Parallelization of Matlab codes under Windows platform for Bayesian estimation: A Dynare application
In the Bayesian estimation of DSGE models with DYNARE (specifically the Matlab Version for Windows), most of the computing time is devoted to the posterior estimation with the Metropolis algorithm. Usually, the Metropolis is run using multiple parallel chains, to allow more careful convergence testing. In this work we describe a way to parallelize the multiple-chain Metropolis algorithm within the Dynare Framework, running parallel chains on different processors to reduce computational time. To do so, we aimed at the easiest and cheapest possible strategy, i.e. the one which requires the lower level of modification in the basic DYNARE routines and does not need any licensed toolbox. Despite the fact that parallelizing the Metropolis-Hasting algorithm is intrinsically easy (the different chains are completely independent each other and do not require communication between them), MatLab software does not allow concurrent programming, or in other terms it does not support multi-threads, without the use of MatLab Distributed Computing Toolbox. The general idea is that when the execution of the Metropolis should start, instead of running it inside the MatLab session, the control of the execution is passed to the operating system that allows for multi-threading and concurrent threads are launched on different processors. When the metropolis computations are concluded the control is given back to the original MatLab session for post-processing Markov Chain results.