Merge branch 'parallel' of git.dynare.org:JohannesPfeifer/dynare

Ref. !2240
covariance-quadratic-approximation
Sébastien Villemot 2023-12-19 18:32:24 +01:00
commit 52b92ce64d
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
2 changed files with 6 additions and 27 deletions

View File

@ -6,7 +6,7 @@ function closeSlave(Parallel,TmpFolder,partial)
%
% INPUTS
% o Parallel [struct vector] copy of options_.parallel.
% o TmpFolder string if islocal==0, is the name of didectory devoted to remote computation.
% o TmpFolder string if islocal==0, is the name of directory devoted to remote computation.
% This directory is named using current date
% and is used only one time and then deleted.
% If islocal==1, TmpFolder=''.
@ -45,32 +45,19 @@ if partial==1
dynareParallelSendFiles('slaveParallel_break.mat',TmpFolder,Parallel(indPC));
end
end
% delete('slaveParallel_break')
return
end
if partial==-1
delete('slaveParallel_break.mat')
for indPC=1:length(Parallel)
if (Parallel(indPC).Local==0)
dynareParallelDelete( 'slaveParallel_break.mat',TmpFolder,Parallel(indPC));
end
end
% delete('slaveParallel_break')
s=warning('on');
return
end
for indPC=1:length(Parallel)
if (Parallel(indPC).Local==0)
dynareParallelDelete( 'slaveParallel_input*.mat',TmpFolder,Parallel(indPC));
dynareParallelDelete(' slaveParallel_input*.mat',TmpFolder,Parallel(indPC));
end
delete( 'slaveParallel_input*.mat');
delete( 'slaveJob*.mat');
pause(1)
delete('slaveParallel_*.log');
delete ConcurrentCommand1.bat;
end
while(1)

View File

@ -48,7 +48,7 @@ dynareroot = dynare_config();
load( ['slaveParallel_input',int2str(whoiam)]);
%Loads fGlobalVar Parallel.
if exist('fGlobalVar')
if exist('fGlobalVar','var')
globalVars = fieldnames(fGlobalVar);
for j=1:length(globalVars)
eval(['global ',globalVars{j},';']);
@ -70,7 +70,7 @@ while (etime(clock,t0)<1200 && ~isempty(fslave)) || ~isempty(dir(['stayalive',in
t0=clock;
delete(['stayalive',int2str(whoiam),'.txt']);
end
% I wait for 20 min or while mater asks to exit (i.e. it cancels fslave file)
% I wait for 20 min or while master asks to exit (i.e. it cancels fslave file)
pause(1)
fjob = dir(['slaveJob',int2str(whoiam),'.mat']);
@ -79,8 +79,6 @@ while (etime(clock,t0)<1200 && ~isempty(fslave)) || ~isempty(dir(['stayalive',in
clear fGlobalVar fInputVar fblck nblck fname
while(1)
Go=0;
Go=fopen(['slaveJob',int2str(whoiam),'.mat']);
if Go>0
@ -104,7 +102,7 @@ while (etime(clock,t0)<1200 && ~isempty(fslave)) || ~isempty(dir(['stayalive',in
funcName=fname; % Update global job name.
if exist('fGlobalVar') && ~isempty (fGlobalVar)
if exist('fGlobalVar','var') && ~isempty (fGlobalVar)
globalVars = fieldnames(fGlobalVar);
for j=1:length(globalVars)
info_whos = whos(globalVars{j});
@ -126,11 +124,6 @@ while (etime(clock,t0)<1200 && ~isempty(fslave)) || ~isempty(dir(['stayalive',in
tic
fOutputVar = feval(fname, fInputVar ,fblck, nblck, whoiam, ThisMatlab);
toc
if isfield(fOutputVar,'OutputFileName')
OutputFileName = fOutputVar.OutputFileName;
else
OutputFileName = '';
end
if(whoiam)
@ -183,5 +176,4 @@ diary off;
delete(['P_slave_',int2str(whoiam),'End.txt']);
exit;