Page 1 of 1

parfor with Dynare

PostPosted: Thu Sep 12, 2013 9:27 am
by Dr. En Ami
Is dynare compatible with parfor? That is, can one call dynare within a parfor loop?

Re: parfor with Dynare

PostPosted: Sat Sep 14, 2013 8:02 am
by jpfeifer
Dynare itself features parallelization capabilities. But we have never tried to parallelize around Dynare. My hunch would be that it does not work due to the complexity of the underlying codes. But you might try. Any feedback on your experiences is highly appreciated.

Re: parfor with Dynare

PostPosted: Thu Sep 19, 2013 11:12 pm
by Dr. En Ami
I was able to do it. Within parfor, call a function of the iteration index that (i) cds into a distinct, index dependent directory and (ii) runs dynare. That way, dynare is run in the workspace of a function call and files are not rewritten.

Re: parfor with Dynare

PostPosted: Thu Aug 28, 2014 4:15 pm
by adamg
Has anyone else been able to do this? The problem I am running into is that parfor does not work well with globals, and dynare uses globals. Alternatively, is there a way to run dynare without globals (M_, oo_) so that I can then figure out how to parallelize it?

Adam

Re: parfor with Dynare

PostPosted: Fri Aug 29, 2014 9:23 am
by jpfeifer
Either you follow what Dr. En Ami suggested in doing separate calls to Dynare, which then separates the global variables by using different instances of Dynare.

The second alternative is using Dynare subfunctions directly. Many of them use local instances of the global variables.