This page documents the parallelization system developped at the Joint Research Centre (Marco Ratto) for Dynare. This work has been funded by FP7 Project MONFISPOL [Grant no.: 225149].

The idea is to provide a general framework in Dynare for parallelizing tasks which require very little inter-process communication.

The implementation is done by running several MATLAB or Octave processes, either on local or on remote machines. Communication between master and slave processes are done through SMB on Windows and SSH on UNIX. Input and output data, and also some short status messages, are exchanged through network filesystems.

Currently the system works only with homogenous grids: only Windows or only Unix machines.

Routines currently parallelized:

1. Requirements

1.1. For a Windows grid

  1. a standard Windows network (SMB) must be in place
  2. PsTools must be installed in the path of the master Windows machine

  3. the Windows user on the master machine has to be user of any other slave machine in the cluster, and that user will be used for the remote computations.

1.2. For a UNIX/Mac grid

  1. SSH must be installed on the master and on the slave machines
  2. SSH keys must be installed so that the SSH connection from the master to the slaves can be done without passwords, or using an SSH agent (see SshKeysHowto)

2. User Interface

2.1. Parallel Computation options

Parallel computation will be triggered by the following options passed to the dynare command:

2.2. Configuration File

To configure a cluster, the user must specify information about every node and cluster to be used in a separate configuration file. A valid configuration file will contain at least one cluster and one node. NB: All options are case-sensitive.

2.2.1. Node Options

Node Options

type

example

default

Meaning

Req. Local Win

Req. Remote Win

Req. Local Unix

Req. Remote Unix

Name

string

n1

(stop processing)

name of the node

*

*

*

*

CPUnbr

int or Matlab array specifying the consecutively-numbered processors to use

1, [2:4]

(stop processing)

The specific CPU's to be used on a node

*

*

*

*

ComputerName

string

localhost, karaba.cepremap.org

(stop processing)

Computer name on the network or IP address

*

*

*

*

UserName

string

houtanb

empty

required for remote login

*

*

Password

string

password

empty

required for remote login (only under Windows)

*

RemoteDrive

string

c

empty

Drive to be used on remote computer

*

RemoteDirectory

string

/home/houtanb

empty

Directory to be used on remote computer

*

*

Port

int

2202

empty

port on ComputerName to connect to

DynarePath

string

/home/houtanb/dynare

empty

path to matlab directory within the Dynare installation directory

MatlabOctavePath

string

matlab

empty

path to MATLAB or Octave executable

SingleCompThread

boolean

true

true

disable MATLAB's native multithreading ?

OperatingSystem (forthcoming in Dynare 4.3)

string

unix

empty

Operating System of Node

2.2.2. Cluster Options

Cluster Options

type

example

default

Meaning

Required

Name

string

c1

empty

name of the node

*

Members

space-separated string

n n2 n3 n4

empty

list of members in this cluster.

*

Members (forthcoming in Dynare 4.3)

space-separated string

n(3) n2(2) n3(1) n4(2)

empty

list of members in this cluster, with their weights. If no weights are specified, node use is distributed evenly.

*

2.2.3. Example

The syntax of the configuration file will take the following form (the order in which the clusters and nodes are listed is not significant):

[cluster]
Name = c1
Members = n1 n2 n3

[cluster]
Name = c2
Members = n2 n3

[node]
Name = n1
ComputerName = localhost
CPUnbr = 1

[node]
Name = n2
ComputerName = karaba.cepremap.org
CPUnbr = 5
UserName = houtanb
RemoteDirectory = /home/houtanb/Remote
DynarePath = /home/houtanb/dynare/matlab
MatlabOctavePath = matlab

[node]
Name = n3
ComputerName = hal.cepremap.ens.fr
CPUnbr = [2:4]
UserName = houtanb
RemoteDirectory = /home/houtanb/Remote
DynarePath = /home/houtanb/dynare/matlab
MatlabOctavePath = matlab

3. Information for Dynare developers

3.1. General architecture of the system

The generic parallelization system is organized around five routines: masterParallel; slaveParallel.m and fParallel; fMessageStatus.m; closeSlaves.

The parallel toolbox also includes a number of utilities:

A more complete developer documentation is in parallel.pdf.

3.2. Internal representation

The parallelization mechanism is triggered by the use of options_.parallel. By default, this option is equal to zero, no parallelization is used.

To trigger the parallelization, this option must be filled with a vector of structures. Each structure represents a slave machine (possibly using several CPU cores on the machine).

The fields are:

There is currently no interface in the preprocessor to construct this option structure vector; this has to be done by hand by the user in the MOD file.

3.2.1. Example syntax for win and unix, for local parallel runs (assuming quad-core)

All empty fields, except Local and NumCPU

options_.parallel = struct('Local', 1, 'PcName','', 'NumCPU', [0:3], 'user','','passwd','',
'RemoteDrive', '', 'RemoteFolder','', 'MatlabOctavePath', '', 'DynarePath', '');

3.2.2. Example Windows syntax for remote runs

options_.parallel = struct('Local', 0, 'PcName','RemotePCName','NumCPU', [4:6], 'user',
'DEPT\JohnSmith','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote', 'MatlabOctavePath', 'matlab', 'DynarePath', 'd:\dynare\matlab');

3.2.2.1. Example to use several remote PC's to build a grid

A vector of parallel structures has to be built:

options_.parallel = struct('Local', 0, 'PcName','RemotePCName1','NumCPU', [0:3], 
'user', 'DEPT\JohnSmith', 'passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote', 'MatlabOctavePath', 'matlab', 'DynarePath', 'c:\dynare\matlab');

options_.parallel(2) = struct('Local', 0, 'PcName','RemotePCName2','NumCPU', [0:3], 
'user', 'DEPT\JohnSmith','passwd','****', 'RemoteDrive', 'D', 'RemoteFolder','dynare_calcs\Remote', 'MatlabOctavePath', 'matlab', 'DynarePath', 'c:\dynare\matlab');

options_.parallel(3) = struct('Local', 0, 'PcName','RemotePCName3','NumCPU', [0:1], 
'user','DEPT\JohnSmith','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote', 'MatlabOctavePath', 'matlab', 'DynarePath', 'c:\dynare\matlab');

options_.parallel(4) = struct('Local', 0, 'PcName','RemotePCName4','NumCPU', [0:3], 
'user','DEPT\JohnSmith','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote', 'MatlabOctavePath', 'matlab', 'DynarePath', 'c:\dynare\matlab');

3.2.2.2. Example of combining local and remote runs

options_.parallel=struct('Local', 1, 'PcName','','NumCPU', [0:3],
 'user','','passwd','','RemoteDrive', '', 'RemoteFolder','','MatlabOctavePath', '', 'DynarePath', '');

options_.parallel(2)=struct('Local', 0, 'PcName','RemotePCName','NumCPU', [0:1], 
'user','DEPT\JohnSmith','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote', 'MatlabOctavePath', 'matlab', 'DynarePath', 'c:\dynare\matlab');

3.2.3. Example Unix/Mac syntax for remote runs

3.2.3.1. Example with only one remote slave

options_.parallel=struct('Local', 0, 'PcName','name.domain.org','NumCPU', [0:3], 
'user','JohnSmith','passwd','', 'RemoteDrive', '', 'RemoteFolder','/home/rattoma/Remote','MatlabOctavePath', 'matlab', 'DynarePath', '/home/rattoma/dynare/matlab');

3.2.3.2. Example of combining local and remote runs (on unix):

options_.parallel=struct('Local', 1, 'PcName','','NumCPU', [0:3], 
'user','','passwd','','RemoteDrive', '', 'RemoteFolder','','MatlabOctavePath', '', 'DynarePath', '');

options_.parallel(2)=struct('Local', 0, 'PcName','name.domain.org','NumCPU', [0:3], 'user','JohnSmith','passwd','', 'RemoteDrive', '', 'RemoteFolder','/home/rattoma/Remote','MatlabOctavePath', 'matlab', 'DynarePath', '/home/rattoma/dynare/matlab');

3.3. Improvements to be made (by decreasing order of importance)

DynareWiki: ParallelDynare (last edited 2012-05-09 10:05:10 by HoutanBastani)