I tried to run the files contained in Loop_parfor.zip, however, ran into a few problems. I’m using Matlab R2017a and Dynare 4.5.1 on a Mac.
First, I think in newer Dynare versions I don’t have to change anything in stoch_simul.m and disp_th_moments.m anymore, as they already contain the lines which jpfeifer proposed to change, is that correct?
Then, if I just execute Loop_main.m, I get the following warning and error message
Starting parallel pool (parpool) using the ‘local’ profile …
connected to 2 workers.
Warning: Element(s) of class ‘dates’ do not match the current constructor definition. The element(s) have been converted to structures.In parallel.internal.pool.deserialize (line 9)
In parallel.internal.pool.deserializeFunction (line 12)
In remoteParallelFunction (line 33)
Warning: Element(s) of class ‘dates’ do not match the current constructor definition. The element(s) have been converted to structures.
In parallel.internal.pool.deserialize (line 9)
In parallel.internal.pool.deserializeFunction (line 12)
In remoteParallelFunction (line 33)
Error using wrapper_function (line 10)
Field assignment to a non-structure array object.Error in Loop_main (line 58)
parfor ii = 2:size(X,2)
If I do what hakeru7 proposed, i.e.,
Matlab tells me that it doesn’t know X_in. I tried to define X_in the same way as X_out, i.e.,
X_in=zeros(2,size(X,2));
I get the following error message
Error using wrapper_function (line 6)
Index exceeds matrix dimensions.Error in Loop_main (line 59)
parfor ii = 2:size(X,2)
Maybe there is an easy fix to this problem. I guess I just have to get the dimensions of X_in right? Has anyone worked with the parfor code recently and can help me with this?