Save draws from multiple chains run in parallele

Hi all,

Is there a way for me to run multiple MHRW chains in parallel and save the draws? I suspect that my model has multiple modes and want to plot the recursive averages of each chain to see if the chains are converging to a stationary distribution or are “jumping” from one distribution to another.

Using mh_nblocks allows running multiple chains, whose draws will be saved in the metropolis-subfolder. You can also generate trace_plots for the different chains. The manual documents how to run Dynare in parallel.

I have written a configuration file and am using the smets wouters model. After running dynare usmodel_shock_decomp conffile=myconf my progress bars do not move after several minutes, even if I am only running two chains with 1000 draws.

myconf.m (176 Bytes)
usmodel_shock_decomp.mod (6.6 KB)

That does not look like a full config file. The path to Dynare is missing, for example. The manual has more details.

I have followed the step-by-step instructions for windows and mac. After calling dynare usmodel parallel_test I get the message:

Starting Dynare (version 5.4).
Calling Dynare with arguments: parallel_test
Starting preprocessing of the model file …
Found 40 equation(s).
Evaluating expressions…done
Computing static model derivatives (order 1).
Computing dynamic model derivatives (order 2).
Processing outputs …
done
Preprocessing completed.

Testing computer → localhost ← …

Check on Local Variable … Ok!

Checking Hardware please wait …
Hardware has 8 Cpu/Cores!
User requires 8 Cpu/Cores!
Check on CPUnbr Variable … Ok!

Test for Cluster computation, computer localhost … Passed!

AnalyseComputationalEnvironment returned with Error Code: 0

I set the windows path according to the instructions

and saved the following text as dynare.ini to C:\Users\jthom\AppData

[cluster]
Name = Local
Members = n1

[node]
Name = n1
ComputerName = localhost
CPUnbr = 8
NumberOfThreadsPerJob = 1
MatlabOctavePath = C:\Program Files\MATLAB\R2022b\bin\matlab.exe
DynarePath = C:\dynare\5.4\matlab

I tried changing teh matlab octave path to …\bin\matlab and …\bin but nothing works and I still get "C:\Users\jthom\Downloads\smetswouters43\smetswouters43>psexec -accepteula -d -W “C:\Users\jthom\Downloads\smetswouters43\smetswouters43” -a 0 -low C:\Program Files\MATLAB\R2022b\bin\matlab -nosplash -nodesktop -minimize -r “addpath('C:\dynare\5.4\matlab'), dynareroot = dynare_config(); fParallel(1,1,1,1,‘posterior_sampler_core’)”

PsExec v2.42 - Execute processes remotely
Copyright (C) 2001-2023 Mark Russinovich
Sysinternals - www.sysinternals.com

PsExec could not start C:\Program:
The system cannot find the file specified.

C:\Users\jthom\Downloads\smetswouters43\smetswouters43>psexec -accepteula -d -W “C:\Users\jthom\Downloads\smetswouters43\smetswouters43” -a 1 -low C:\Program Files\MATLAB\R2022b\bin\matlab -nosplash -nodesktop -minimize -r “addpath('C:\dynare\5.4\matlab'), dynareroot = dynare_config(); fParallel(2,2,2,1,‘posterior_sampler_core’)”

PsExec v2.42 - Execute processes remotely
Copyright (C) 2001-2023 Mark Russinovich
Sysinternals - www.sysinternals.com

PsExec could not start C:\Program:
The system cannot find the file specified. "

and the MCMC is stuck at “initializing…”

I’m truly at my wits’ end

You cannot use empty space in path names. Can you try replacing

MatlabOctavePath = C:\Program Files\MATLAB\R2022b\bin\matlab.exe

by

MatlabOctavePath = "C:\Program Files\MATLAB\R2022b\bin\matlab.exe"

If that does not work, try

MatlabOctavePath = C:\Progra~1\MATLAB\R2022b\bin\matlab.exe
1 Like

Neither solution works, I get the same error message

C:\Users\jthom\Downloads\smetswouters43\smetswouters43>psexec -accepteula -d -W “C:\Users\jthom\Downloads\smetswouters43\smetswouters43” -a 6 -low C:\Program Files\MATLAB\R2022b\bin\matlab -nosplash -nodesktop -minimize -r “addpath('C:\dynare\5.4\matlab'), dynareroot = dynare_config(); fParallel(7,7,7,1,‘posterior_sampler_core’)”

PsExec v2.42 - Execute processes remotely
Copyright (C) 2001-2023 Mark Russinovich
Sysinternals - www.sysinternals.com

PsExec could not start C:\Program:
The system cannot find the file specified.

C:\Users\jthom\Downloads\smetswouters43\smetswouters43>psexec -accepteula -d -W “C:\Users\jthom\Downloads\smetswouters43\smetswouters43” -a 7 -low C:\Program Files\MATLAB\R2022b\bin\matlab -nosplash -nodesktop -minimize -r “addpath('C:\dynare\5.4\matlab'), dynareroot = dynare_config(); fParallel(8,8,8,1,‘posterior_sampler_core’)”

PsExec v2.42 - Execute processes remotely
Copyright (C) 2001-2023 Mark Russinovich
Sysinternals - www.sysinternals.com

PsExec could not start C:\Program:
The system cannot find the file specified.

Are you sure the test for the second one, i.e. the manual shortening to 8 characters was correct? Because the displayed file name in your extension is still the full one. And is Matlab not in your %Path%-variable? If it is, you can set the path simply as

MatlabOctavePath = matlab

I believe I have fixed the problem

I had saved a dynare.ini file located at “C:\Users\jthom\AppData” and had modified that, but there was another unmodified dynare.ini file located in C:\Users\jthom\AppData\Roaming that had not been modified correctly

Ok, which version worked?

MatlabOctavePath = C:\Progra~1\MATLAB\R2022b\bin\matlab.exe

Is the first one that worked