Page 1 of 1

about mex documents and dynare_simul_

PostPosted: Tue Aug 30, 2016 12:09 pm
by kingtobe
In the directory C:\dynare\4.4.3\mex\matlab, there are many mex files. what are they?

Here is a line of codes, and I do not know whether it relates to mex file dynare_simul_. What does dynare_simul_.mexw64 mean ? Can somebody tell me ? Thank you!

[err, y_] = dynare_simul_(3,M_.nstatic,M_.npred,M_.nboth,M_.nfwrd,exo_nbr, ...
y_(dr.order_var,1),ex_',M_.Sigma_e,options_.DynareRandomStreams.seed,dr.ys(dr.order_var),dr.g_0, ...
dr.g_1,dr.g_2,dr.g_3);

Re: about mex documents and dynare_simul_

PostPosted: Tue Aug 30, 2016 2:31 pm
by jpfeifer
mex-files are precompiled files that Matlab (a non-compiled language) can use to speed up computationally intensive tasks. If you want to learn more about those, see http://de.mathworks.com/help/matlab/matlab_external/introducing-mex-files.html

Re: about mex documents and dynare_simul_

PostPosted: Wed Aug 31, 2016 12:22 am
by rhein
On the same topic, I am experiencing errors regarding the dynare_simul.m after running model via dynare++

Code: Select all
t=840;
nsimul=100;
shocks = zeros (2,t)./0;
sim_results=zeros(20,t,nsimul);
for i=1:nsimul
    sim_results(:,:,i)=dynare_simul('model.mat', shocks);
end

Invalid MEX-file 'E:\dynare\4.4.3\mex\matlab\win64-7.3-7.4\dynare_simul_.mexw64': The specified procedure
could not be found.


Just to clarify, I did add path with the routines via:
Code: Select all
addpath(genpath('E:\dynare\4.4.3\dynare++'))
addpath(genpath('E:\dynare\4.4.3\matlab'))


Do you maybe know what the reason might be?
Thanks in advance!

Re: about mex documents and dynare_simul_

PostPosted: Wed Aug 31, 2016 6:07 am
by jpfeifer
You are missing
Code: Select all
addpath('E:\dynare\4.4.3\mex\your system path belongs here')

Re: about mex documents and dynare_simul_

PostPosted: Wed Aug 31, 2016 3:21 pm
by rhein
Thank you very much for your comment. However I am still obtaining the same error, even though I did add the mex folder and subfolders to the matlab paths.
Do you maybe know what may be causing a problem?

My conjecture is that there might be an issue with discrepancies between the versions of compiler used to generate mex files and the one I have installed on my lapot (I have SDK 7.1 (C) ).Do you maybe know which version was used to create the dynare .mex files?

Second question: I am also using the dynare at the university PC lab, which does not have any mex compiler installed. Do you know if there is any way to avoid calling .mex files with dynare_simul() function?

Re: about mex documents and dynare_simul_

PostPosted: Wed Aug 31, 2016 4:30 pm
by jpfeifer
As long as the mex-files match your Windows system, you should be fine. You don't need a compiler on Windows.
However, I just recognized that it is a bad idea to use
Code: Select all
addpath(genpath('E:\dynare\4.4.3\mex'))

because this will add a path to all mex-files, i.e. for Octave and all Windows and Matlab versions. Thereby, you will have no control over which one is actually on top of the path. Please identify your system (32 bit vs, 64 bit) and your Matlab version (ver command in Matlab) and set a path to only the subfolder corresponding to your system.

Re: about mex documents and dynare_simul_

PostPosted: Wed Aug 31, 2016 5:00 pm
by rhein
I did what you suggested and now it works !
Thank you very much for your help.

Re: about mex documents and dynare_simul_

PostPosted: Thu Sep 01, 2016 9:41 am
by kingtobe
Thank you for your reply.

jpfeifer wrote:mex-files are precompiled files that Matlab (a non-compiled language) can use to speed up computationally intensive tasks. If you want to learn more about those, see http://de.mathworks.com/help/matlab/matlab_external/introducing-mex-files.html