diff --git a/doc/manual/source/running-dynare.rst b/doc/manual/source/running-dynare.rst index 793443e7d8fbc47fb5c14f8b8b86966ffbf1c34b..bde52ede77ad97d5725abadd0abae9751c98282a 100644 --- a/doc/manual/source/running-dynare.rst +++ b/doc/manual/source/running-dynare.rst @@ -409,9 +409,11 @@ by the ``dynare`` command. .. option:: fast - Only useful with model option :opt:`use_dll`. Don’t recompile the - MEX files when running again the same model file and the lists - of variables and the equations haven’t changed. We use a 32 + Don’t rewrite the output files otherwise written to the disk by the preprocessor + when re-running the same model file while the lists of variables and the equations + haven’t changed. Note that the whole model still needs to be preprocessed. This option + is most useful with model option :opt:`use_dll`, because + the time-consuming compilation of the MEX files will be skipped. We use a 32 bit checksum, stored in ``<model filename>/checksum``. There is a very small probability that the preprocessor misses a change in the model. In case of doubt, re-run without the fast diff --git a/matlab/dynare.m b/matlab/dynare.m index c22a5f3c7e76dea22adcc71fae3decf4ba3f5818..c23be0d5e51cb2be6db454528ba807472f77f625 100644 --- a/matlab/dynare.m +++ b/matlab/dynare.m @@ -184,6 +184,7 @@ preprocessoroutput = ~ismember('nopreprocessoroutput', varargin) && ... nolog = ismember('nolog', varargin) || ismember('nolog', file_opts); onlymacro = ismember('onlymacro', varargin) || ismember('onlymacro', file_opts); onlyjson = ismember('onlyjson', varargin) || ismember('onlyjson', file_opts); +fast = ismember('fast', varargin) || ismember('fast', file_opts); % Start journal diary off @@ -234,11 +235,13 @@ end % On MATLAB+Windows, the +folder may be locked by MATLAB, preventing its % removal by the preprocessor. % Trying to delete it here will actually fail, but surprisingly this allows -% the preprocessor to actually remove the folder (see ModFile::writeOutputFiles()) +% the preprocessor to actually remove the folder (see ModFile::writeMOutput()) % For an instance of this bug, see: % https://forum.dynare.org/t/issue-with-dynare-preprocessor-4-6-1/15448/1 -if ispc && ~isoctave && exist(['+',fname(1:end-4)],'dir') - [~,~]=rmdir(['+', fname(1:end-4)],'s'); +if ~fast + if ispc && ~isoctave && exist(['+',fname(1:end-4)],'dir') + [~,~]=rmdir(['+', fname(1:end-4)],'s'); + end end % Under Windows, make sure the MEX file is unloaded (in the use_dll case), @@ -254,9 +257,15 @@ else end pTic = tic; -[status, result] = system(command); +if preprocessoroutput + status = system(command); %immediately flush output +else + [status, result] = system(command); %save output for output in case of failure + if status ~= 0 || preprocessoroutput + disp(result) + end +end if status ~= 0 || preprocessoroutput - disp(result) pToc = toc(pTic); dprintf('Preprocessing time: %s.', dynsec2hms(pToc)) if nargout