Skip to content
Snippets Groups Projects
Commit ff5ca80b authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Merge branch 'preprocessor_output' into 'master'

By default display preprocessor output line by line instead of only at the end

See merge request Dynare/dynare!2200
parents d95154ff 643face6
Branches
Tags
1 merge request!2200By default display preprocessor output line by line instead of only at the end
Pipeline #9444 passed
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment