Parallel version of 4.0.2 for 4-8 cores

Hi everyone,

Here is the fork of Dynare 4.0.2 that I’ve been using for a parallelised version of Dynare 4.0.2 running on an 8-core Xeon machine. I don’t have any hard figures but it seems to deliver a speedup of roughly 6ish for Bayesian estimation.

You install this by dumping these files in your dynare\4.0.2\matlab folder. (You may want to make sure that you’ve got the original Dynare files saved somewhere safe first…)

The code uses Matlab’s Parallel Computing Toolbox; for running two chains at once, it uses the Multicore package by Markus Buehren. You’ll need to install that yourself.

Here’s what’s new in the attached zip file:
[ol]
] The numerical gradient and hessian routines are parallelised in a pretty obvious way./:m]
] The newrat optimiser (mode_compute=5) now uses four different Hessian updates each time, and picks the best one. That’s an idea suggested by Phua et al./:m]
] For the MCMC part, I implemented Ingvar Strid’s prefetching mechanism. I’ve hard-coded an optimal prefetching routine on the assumption that there are 4 cores per MCMC chain, and that the acceptation ratio is less than 0.6ish. That means that each chain runs about 2.25 – 2.5 times faster than normal./:m]
] The rest of the changes involve ugly workarounds for Matlab’s reluctance to use global variables in a parallel context. /:m][/ol]

Just thought I’d post it in case anyone else was interested in this sort of thing. Comments / questions / suggestions would be very welcome.

All the best,
Jamie
parallel_dynare_4_0_2.zip (37 KB)

Dear JamieHall,

It sounds really interesting what you are doing. Unfortunately, I could not have made it run on a R2009a Matlab with the example code of Frank Schorfheide’s model made by Michel Juillard found on dynare’s webpage. The code has met the global options_ variable in dynare_solve.m and crashed. Could you please post a code that runs parallel with your code? I might find it really useful for learning about your code.

Thank you: Peter