Page 1 of 1

Setting up parallel processing

PostPosted: Sat Apr 30, 2016 12:34 pm
by modin
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:
    1. Downloaded PSTools and added it to the windows path
    2. Ran all the executables in PSTools and accepted the license agreement
    3. Created a config file based on the examples in the documentation
    4. Added the default command line options in the .mod file
    5. Get error once the program reaches the MH-stage

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: Select all
conffile='C:\Users\BOB\Downloads\config.txt';
options_.parallel = struct('Local', 1, 'PcName','', 'NumCPU', [0:3], 'user','','passwd','', 'RemoteDrive', '', 'RemoteFolder','', 'MatlabOctavePath', '', 'DynarePath', '');


The error I get once reaching the MH-stage is:
Code: Select all
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) ;
 

Re: Setting up parallel processing

PostPosted: Sat Apr 30, 2016 1:29 pm
by modin
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.

Code: Select all
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: http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4892, but no solution is given there. Any help is appreciated.

//modin
Code: Select all
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:

Re: Setting up parallel processing

PostPosted: Mon May 02, 2016 8:00 am
by rattoma
Please could you try a directory name without spaces?
i.e. change the project directory from

Code: Select all
E:\NEKmaster\Thesis\Thesis\Matlab Code\Simulations

to

Code: Select all
E:\NEKmaster\Thesis\Thesis\Matlab_Code\Simulations

Re: Setting up parallel processing

PostPosted: Mon May 02, 2016 8:01 am
by rattoma
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.

Re: Setting up parallel processing

PostPosted: Mon May 02, 2016 8:10 am
by modin
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

Re: Setting up parallel processing

PostPosted: Mon May 02, 2016 8:37 am
by rattoma
could you please be more explicit about the new error you get?

Re: Setting up parallel processing

PostPosted: Wed May 04, 2016 5:15 am
by modin
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: Select all
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

Re: Setting up parallel processing

PostPosted: Thu May 05, 2016 8:11 am
by rattoma
some questions:
are you getting meaningful prior/posterior plots?
are you managing to run the dynare unit test ls2003 [in git, directory tests\parallel]?