Setting up parallel processing

Dear all

I’m trying to set up parallel processing running on my local quad core machine. I’ve tried to follow the steps on the dynare wiki and the reference documentation but I’m not sure I follow exatly what I need to do in order to make the MH-algorithm run in parallel mode. I should mention that I don’t have any experience with multi-core processing previously so any help is appreciated. I’m currently using Matlab R2014a, dynare 4.4.3 and Windows 10. I’ve attached the config file. I should maybe mention that the .mod file runs without issues if I don’t invoke the parallel commands.

What I’ve done so far is:
[ul]1. Downloaded PSTools and added it to the windows path[/ul]
[ul]2. Ran all the executables in PSTools and accepted the license agreement[/ul]
[ul]3. Created a config file based on the examples in the documentation[/ul]
[ul]4. Added the default command line options in the .mod file[/ul]
[ul]5. Get error once the program reaches the MH-stage [/ul]

First of all I’m wondering if I’m missing some important step in the configuration procedure and also what could be causing this error. I also wasn’t sure whether to include the options as well as the path to the config file or just one or the other, so I tested both and get the same error. The options I used in the mod file are the following:

[code]conffile=‘C:\Users\BOB\Downloads\config.txt’;
options_.parallel = struct(‘Local’, 1, ‘PcName’,’’, ‘NumCPU’, [0:3], ‘user’,’’,‘passwd’,’’, ‘RemoteDrive’, ‘’, ‘RemoteFolder’,’’, ‘MatlabOctavePath’, ‘’, ‘DynarePath’, ‘’);

[/code]
The error I get once reaching the MH-stage is:

[code]Reference to non-existent field ‘CPUnbr’.

Error in distributeJobs (line 52)
nCPU(j)=length(Parallel(j).CPUnbr);

Error in masterParallel (line 177)
[nCPU, totCPU, nBlockPerCPU, totSlaves] = distributeJobs(Parallel, fBlock, nBlock);

Error in random_walk_metropolis_hastings (line 138)
[fout, nBlockPerCPU, totCPU] = masterParallel(options_.parallel, fblck,
nblck,NamFileInput,‘random_walk_metropolis_hastings_core’, localVars, globalVars,
options_.parallel_info);

Error in dynare_estimation_1 (line 782)
feval(options_.posterior_sampling_method,objective_function,options_.proposal_distribution,xparam1,invhess,bounds,dataset_,options_,M_,estim_params_,bayestopt_,oo_);

Error in dynare_estimation (line 89)
dynare_estimation_1(var_list,dname);

Error in testy (line 401)
dynare_estimation(var_list_);

Error in dynare (line 180)
evalin(‘base’,fname) ;
[/code]
config.txt (93 Bytes)

Seemingly I was wrong in adding the options to the .mod file? As I understand it now they should be added to the command line instead? e.g.

dynare testy parallel conffile='C:\Users\BOB\Downloads\config.txt'

I now run this, omitting he options in the .mod file and run into the error below. It seem to be very similar to the error found in this thread: [Parallel computing problem), but no solution is given there. Any help is appreciated.

//modin

[code]Warning: File ‘\localhost$\slaveParallel_break.mat’ not found.

In dynareParallelDelete at 51
In masterParallel at 191
In random_walk_metropolis_hastings at 138
In dynare_estimation_1 at 782
In dynare_estimation at 89
In testy at 402
In dynare at 180

E:\NEKmaster\Thesis\Thesis\Matlab Code\Simulations>psexec -d -W E:\NEKmaster\Thesis\Thesis\Matlab Code\Simulations -a 0 -low matlab -nosplash -nodesktop -minimize -singleCompThread -r “addpath('E:\Dynare\4.4.3\matlab'), dynareroot = dynare_config(); fParallel(1,1,1,1,‘random_walk_metropolis_hastings_core’)”

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

Katalognamnet är felaktigt.

PsExec could not start Code\Simulations:

E:\NEKmaster\Thesis\Thesis\Matlab Code\Simulations>psexec -d -W E:\NEKmaster\Thesis\Thesis\Matlab Code\Simulations -a 1 -low matlab -nosplash -nodesktop -minimize -singleCompThread -r “addpath('E:\Dynare\4.4.3\matlab'), dynareroot = dynare_config(); fParallel(2,2,2,1,‘random_walk_metropolis_hastings_core’)”

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

Katalognamnet är felaktigt.

PsExec could not start Code\Simulations:

E:\NEKmaster\Thesis\Thesis\Matlab Code\Simulations>psexec -d -W E:\NEKmaster\Thesis\Thesis\Matlab Code\Simulations -a 2 -low matlab -nosplash -nodesktop -minimize -singleCompThread -r “addpath('E:\Dynare\4.4.3\matlab'), dynareroot = dynare_config(); fParallel(3,3,3,1,‘random_walk_metropolis_hastings_core’)”

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

Katalognamnet är felaktigt.

PsExec could not start Code\Simulations:

E:\NEKmaster\Thesis\Thesis\Matlab Code\Simulations>psexec -d -W E:\NEKmaster\Thesis\Thesis\Matlab Code\Simulations -a 3 -low matlab -nosplash -nodesktop -minimize -singleCompThread -r “addpath('E:\Dynare\4.4.3\matlab'), dynareroot = dynare_config(); fParallel(4,4,4,1,‘random_walk_metropolis_hastings_core’)”

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

Katalognamnet är felaktigt.

PsExec could not start Code\Simulations: [/code]

Please could you try a directory name without spaces?
i.e. change the project directory from

to

Concerning options_, indeed you should not set them manually in the .mod file, rather let the dynare pre-processor perform the job starting from your configuration file.

Thank you for your answer!

I managed to get the MH-algorithm to run in Parallel now by changing the folder names. However, I get a warning similar to the one in the post and no Bayesian IRFs show up in the end even though they are properly estimated.

My guess it’s related to the fact that I’ve replaced the “PosteriorIRF_core2.m” file with one provided by Pfeifer in a previous thread for the Bayesian HPDs to work properly. I haven’t tried using the unstable version yet but last time I tried my model didn’t work at all using mode_compute=6. I’m not home unfortunately and can’t give the exact warning but like I said, no Bayesian IRFs “pop up” at the end when the estimation is finished.

//modin

could you please be more explicit about the new error you get?

So, the parallel computing seem to work but I get no IRF plots at the end of MH-runs. Any idea what could be causing this? Also, is there a dynare command to plot the IRFs after estimation is completed?

//modin

The warning message I get is:

[code]Warning: File ‘\localhost$\slaveParallel_break.mat’ not found.

In dynareParallelDelete at 51
In masterParallel at 191
In PosteriorIRF at 461
In dynare_estimation_1 at 815
In dynare_estimation at 89
In Frictionless at 401
In dynare at 180 [/code]

some questions:
are you getting meaningful prior/posterior plots?
are you managing to run the dynare unit test ls2003 [in git, directory tests\parallel]?