diff --git a/matlab/McMCDiagnostics.m b/matlab/McMCDiagnostics.m
index 997422bc7..ebbf80c22 100644
--- a/matlab/McMCDiagnostics.m
+++ b/matlab/McMCDiagnostics.m
@@ -102,7 +102,13 @@ if isnumeric(options_.parallel),
UDIAG = fout.UDIAG;
clear fout
else
- [fout, nBlockPerCPU, totCPU] = masterParallel(options_.parallel, 1, npar,{},'McMCDiagnostics_core', localVars, [], options_.parallel_info);
+ ModelName = M_.fname;
+ if ~isempty(M_.bvar)
+ ModelName = [M_.fname '_bvar'];
+ end
+ NamFileInput={[M_.dname '/metropolis/'],[ModelName '_mh*_blck*.mat']};
+
+ [fout, nBlockPerCPU, totCPU] = masterParallel(options_.parallel, 1, npar,NamFileInput,'McMCDiagnostics_core', localVars, [], options_.parallel_info);
UDIAG = fout(1).UDIAG;
for j=2:totCPU,
UDIAG = cat(3,UDIAG ,fout(j).UDIAG);
@@ -295,7 +301,7 @@ tmp = sortrows(tmp,1);
ligne = 0;
for iter = Origin:StepSize:NumberOfDraws
ligne = ligne+1;
- linea = ceil(0.5*iter);
+ linea = ceil(options_.mh_drop*iter);
n = iter-linea+1;
cinf = round(n*ALPHA/2);
csup = round(n*(1-ALPHA/2));
diff --git a/matlab/PosteriorIRF_core1.m b/matlab/PosteriorIRF_core1.m
index 9d376ae8f..6997ebc98 100644
--- a/matlab/PosteriorIRF_core1.m
+++ b/matlab/PosteriorIRF_core1.m
@@ -240,7 +240,8 @@ end
elseif ~whoiam
waitbar(fpar/npar,h);
end
- if mod(fpar,10)==0 & whoiam,
+ % if mod(fpar,10)==0 & whoiam,
+ if whoiam,
fprintf('Done! \n');
waitbarString = [ 'Subdraw ' int2str(fpar) '/' int2str(npar) ' done.'];
fMessageStatus((fpar-fpar0)/(npar-fpar0),whoiam,waitbarString, waitbarTitle, Parallel(ThisMatlab), MasterName, DyMo)
diff --git a/matlab/closeSlave.m b/matlab/closeSlave.m
index 150127ada..2bd7c9d3b 100644
--- a/matlab/closeSlave.m
+++ b/matlab/closeSlave.m
@@ -19,13 +19,28 @@ function closeSlave(Parallel),
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-delete( 'slaveParallel_input*.mat');
-for indPC=1:length(Parallel),
- if Parallel(indPC).Local==0,
- if isunix || (~matlab_ver_less_than('7.4') && ismac),
- system(['ssh ',Parallel(indPC).user,'@',Parallel(indPC).PcName,' rm -fr ',Parallel(indPC).RemoteFolder,'/slaveParallel_input*.mat']);
- else
- mydelete('slaveParallel_input*.mat',['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder,'\']);
+try
+ delete( 'slaveParallel_input*.mat');
+
+ for indPC=1:length(Parallel),
+ if (Parallel(indPC).Local==0),
+ if isunix || (~matlab_ver_less_than('7.4') && ismac),
+ system(['ssh ',Parallel(indPC).user,'@',Parallel(indPC).PcName,' rm -fr ',Parallel(indPC).RemoteFolder,'/slaveParallel_input*.mat']);
+ system(['ssh ',Parallel(indPC).user,'@',Parallel(indPC).PcName,' rm -fr ',Parallel(indPC).RemoteFolder,'/*']);
+ else
+ mydelete('slaveParallel_input*.mat',['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder,'\']);
+ mydelete('*.*',['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder,'\']);
+ adir=dir(['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder,'\']);
+ for jdir=3:length(adir)
+ STATUS = rmdir(['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder,'\',adir(jdir).name],'s');
+ if STATUS == 0,
+ disp(['Warning!: Directory ',adir(jdir).name,' could not be removed from ',Parallel(indPC).PcName,'.'])
+ end
+ end
+ end
end
end
-end
+catch
+ E1=fopen('Errore1-closeSlave.txt','w+');
+ fclose(E1);
+end
\ No newline at end of file
diff --git a/matlab/masterParallel.m b/matlab/masterParallel.m
index 6343a696c..dbe403134 100644
--- a/matlab/masterParallel.m
+++ b/matlab/masterParallel.m
@@ -169,7 +169,10 @@ for j=1:totCPU,
end
else
copyfile([fname,'_input.mat'], ['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder]);
- for jfil=1:size(NamFileInput,1)
+ for jfil=1:size(NamFileInput,1),
+ if ~isempty(NamFileInput{jfil,1})
+ mkdir(['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder,'\',NamFileInput{jfil,1}]);
+ end
copyfile([NamFileInput{jfil,1},NamFileInput{jfil,2}],['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder,'\',NamFileInput{jfil,1}])
end
end
diff --git a/matlab/masterParallelMan.m b/matlab/masterParallelMan.m
index c543a8925..fca03849f 100644
--- a/matlab/masterParallelMan.m
+++ b/matlab/masterParallelMan.m
@@ -47,36 +47,40 @@ function [fOutVar,nBlockPerCPU, totCPU] = masterParallelMan(Parallel,fBlock,nBlo
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
+
+% Delete the traces (if exists) of last section computations.
persistent initialize
if isempty(initialize),
- mydelete(['P_slave_*End.txt']);
- mydelete(['slaveParallel_input*.mat']);
- initialize = 0;
- pause(1),
+ mydelete(['P_slave_*End.txt']);
+ mydelete(['slaveParallel_input*.mat']);
+ initialize = 0;
+ pause(1),
end
totCPU=0;
% Determine my hostname and my working directory
+
DyMo=pwd;
fInputVar.DyMo=DyMo;
if isunix || (~matlab_ver_less_than('7.4') && ismac) ,
-% [tempo, MasterName]=system(['ifconfig | grep ''inet addr:''| grep -v ''127.0.0.1'' | cut -d: -f2 | awk ''{ print $1}''']);
+ % [tempo, MasterName]=system(['ifconfig | grep ''inet addr:''| grep -v ''127.0.0.1'' | cut -d: -f2 | awk ''{ print $1}''']);
[tempo, MasterName]=system('hostname --fqdn');
-else
+else
[tempo, MasterName]=system('hostname');
end
+
MasterName=deblank(MasterName);
fInputVar.MasterName = MasterName;
% Save input data for use by the slaves
if exist('fGlobalVar'),
- save(['temp_input.mat'],'fInputVar','fGlobalVar')
+ save(['temp_input.mat'],'fInputVar','fGlobalVar')
else
- save(['temp_input.mat'],'fInputVar')
+ save(['temp_input.mat'],'fInputVar')
end
-save(['temp_input.mat'],'Parallel','-append')
+save(['temp_input.mat'],'Parallel','-append')
% Determine the total number of available CPUs, and the number of threads to run on each CPU
for j=1:length(Parallel),
@@ -131,54 +135,54 @@ for j=1:totCPU,
end
pause(1); % wait for possibly local alive CPU to start the new job or close by internal criteria
newInstance = 0;
+
if isempty( dir(['P_slave_',int2str(j),'End.txt'])); % check if j CPU is already alive
fid1=fopen(['P_slave_',int2str(j),'End.txt'],'w+');
fclose(fid1);
newInstance = 1;
- storeGlobalVars( ['slaveParallel_input',int2str(j)]);
- save( ['slaveParallel_input',int2str(j)],'Parallel','-append');
+ storeGlobalVars( ['slaveParallel_input',int2str(j)]);
+ save( ['slaveParallel_input',int2str(j)],'Parallel','-append');
% prepare global vars for Slave
end
if Parallel(indPC).Local == 1 & newInstance, % run on the local machine
if isunix || (~matlab_ver_less_than('7.4') && ismac),
if exist('OCTAVE_VERSION')
-% command1=['octave --eval fParallel\(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',\''',fname,'\''\) &'];
+ % command1=['octave --eval fParallel\(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',\''',fname,'\''\) &'];
command1=['octave --eval slaveParallel\(',int2str(j),',',int2str(indPC),'\) &'];
else
-% command1=['matlab -nosplash -nodesktop -minimize -r fParallel\(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',\''',fname,'\''\) &'];
+ % command1=['matlab -nosplash -nodesktop -minimize -r fParallel\(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',\''',fname,'\''\) &'];
command1=['matlab -nosplash -nodesktop -minimize -r slaveParallel\(',int2str(j),',',int2str(indPC),'\) &'];
end
else
if exist('OCTAVE_VERSION')
-% command1=['start /B psexec -W ',DyMo, ' -a ',int2str(Parallel(indPC).NumCPU(j-nCPU0)),' -low octave --eval fParallel(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',''',fname,''')'];
+ % command1=['start /B psexec -W ',DyMo, ' -a ',int2str(Parallel(indPC).NumCPU(j-nCPU0)),' -low octave --eval fParallel(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',''',fname,''')'];
command1=['start /B psexec -W ',DyMo, ' -a ',int2str(Parallel(indPC).NumCPU(j-nCPU0)),' -low octave --eval slaveParallel(',int2str(j),',',int2str(indPC),')'];
else
-% command1=['start /B psexec -W ',DyMo, ' -a ',int2str(Parallel(indPC).NumCPU(j-nCPU0)),' -low matlab -nosplash -nodesktop -minimize -r fParallel(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',''',fname,''')'];
+ % command1=['start /B psexec -W ',DyMo, ' -a ',int2str(Parallel(indPC).NumCPU(j-nCPU0)),' -low matlab -nosplash -nodesktop -minimize -r fParallel(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',''',fname,''')'];
command1=['start /B psexec -W ',DyMo, ' -a ',int2str(Parallel(indPC).NumCPU(j-nCPU0)),' -low matlab -nosplash -nodesktop -minimize -r slaveParallel(',int2str(j),',',int2str(indPC),')'];
end
end
elseif Parallel(indPC).Local==0,
if isunix || (~matlab_ver_less_than('7.4') && ismac),
-% [tempo, RemoteName]=system(['ssh ',Parallel(indPC).user,'@',Parallel(indPC).PcName,' "ifconfig | grep \''inet addr:\''| grep -v \''127.0.0.1\'' | cut -d: -f2 | awk \''{ print $1}\''"']);
+ % [tempo, RemoteName]=system(['ssh ',Parallel(indPC).user,'@',Parallel(indPC).PcName,' "ifconfig | grep \''inet addr:\''| grep -v \''127.0.0.1\'' | cut -d: -f2 | awk \''{ print $1}\''"']);
[tempo, RemoteName]=system(['ssh ',Parallel(indPC).user,'@',Parallel(indPC).PcName,' "hostname --fqdn"']);
RemoteName=RemoteName(1:end-1);
RemoteFolder = Parallel(indPC).RemoteFolder;
- else
+ else
RemoteName = Parallel(indPC).PcName;
RemoteFolder = [Parallel(indPC).RemoteDrive,':\',Parallel(indPC).RemoteFolder];
end
remoteFlag=1;
-
+
if strcmpi(RemoteName,MasterName),
if ~copyfile(['P_',fname,'_',int2str(j),'End.txt'],RemoteFolder),
remoteFlag=0;
end
end
if remoteFlag,
- if j==nCPU0+1,
- if newInstance, % clean remote folder
+ if (j==nCPU0+1) & newInstance, % clean remote folder
if isunix || (~matlab_ver_less_than('7.4') && ismac),
system(['ssh ',Parallel(indPC).user,'@',Parallel(indPC).PcName,' rm -fr ',Parallel(indPC).RemoteFolder,'/*']);
else
@@ -191,60 +195,62 @@ for j=1:totCPU,
end
end
end
+ end
+
+ if isunix || (~matlab_ver_less_than('7.4') && ismac),
+ % system(['scp ',fname,'_input.mat ',Parallel(indPC).user,'@',Parallel(indPC).PcName,':',Parallel(indPC).RemoteFolder]);
+ for jfil=1:size(NamFileInput,1)
+ if ~isempty(NamFileInput{jfil,1})
+ system(['ssh ',Parallel(indPC).user,'@',Parallel(indPC).PcName,' mkdir -p ',Parallel(indPC).RemoteFolder,'/',NamFileInput{jfil,1}])
+ end
+ system(['scp ',NamFileInput{jfil,1},NamFileInput{jfil,2},' ',Parallel(indPC).user,'@',Parallel(indPC).PcName,':',Parallel(indPC).RemoteFolder,'/',NamFileInput{jfil,1}]);
end
-
- if isunix || (~matlab_ver_less_than('7.4') && ismac),
- system(['scp ',fname,'_input.mat ',Parallel(indPC).user,'@',Parallel(indPC).PcName,':',Parallel(indPC).RemoteFolder]);
- for jfil=1:size(NamFileInput,1)
- if ~isempty(NamFileInput{jfil,1})
- system(['ssh ',Parallel(indPC).user,'@',Parallel(indPC).PcName,' mkdir -p ',Parallel(indPC).RemoteFolder,'/',NamFileInput{jfil,1}])
- end
- system(['scp ',NamFileInput{jfil,1},NamFileInput{jfil,2},' ',Parallel(indPC).user,'@',Parallel(indPC).PcName,':',Parallel(indPC).RemoteFolder,'/',NamFileInput{jfil,1}]);
- end
- system(['scp slaveJob',int2str(j),'.mat ',Parallel(indPC).user,'@',Parallel(indPC).PcName,':',Parallel(indPC).RemoteFolder]);
- if newInstance,
- system(['scp slaveParallel_input',int2str(j),'.mat ',Parallel(indPC).user,'@',Parallel(indPC).PcName,':',Parallel(indPC).RemoteFolder]);
- end
- else
- copyfile([fname,'_input.mat'], ['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder]);
- for jfil=1:size(NamFileInput,1)
- copyfile([NamFileInput{jfil,1},NamFileInput{jfil,2}],['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder,'\',NamFileInput{jfil,1}])
- end
- copyfile(['slaveJob',int2str(j),'.mat'], ['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder]);
- if newInstance,
- copyfile(['slaveParallel_input',int2str(j),'.mat'], ['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder]);
+ system(['scp slaveJob',int2str(j),'.mat ',Parallel(indPC).user,'@',Parallel(indPC).PcName,':',Parallel(indPC).RemoteFolder]);
+ if newInstance,
+ system(['scp slaveParallel_input',int2str(j),'.mat ',Parallel(indPC).user,'@',Parallel(indPC).PcName,':',Parallel(indPC).RemoteFolder]);
+ end
+ else
+ % copyfile([fname,'_input.mat'], ['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder])
+ for jfil=1:size(NamFileInput,1)
+ if ~isempty(NamFileInput{jfil,1})
+ mkdir(['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder,'\',NamFileInput{jfil,1}]);
end
+ copyfile([NamFileInput{jfil,1},NamFileInput{jfil,2}],['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder,'\',NamFileInput{jfil,1}])
+ end
+ copyfile(['slaveJob',int2str(j),'.mat'], ['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder]);
+ if newInstance,
+ copyfile(['slaveParallel_input',int2str(j),'.mat'], ['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder]);
end
end
end
if newInstance,
- if isunix || (~matlab_ver_less_than('7.4') && ismac),
- if exist('OCTAVE_VERSION'),
- command1=['ssh ',Parallel(indPC).user,'@',Parallel(indPC).PcName,' "cd ',Parallel(indPC).RemoteFolder, '; octave --eval fParallel\(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',\''',fname,'\''\);" &'];
+ if isunix || (~matlab_ver_less_than('7.4') && ismac),
+ if exist('OCTAVE_VERSION'),
+ command1=['ssh ',Parallel(indPC).user,'@',Parallel(indPC).PcName,' "cd ',Parallel(indPC).RemoteFolder, '; octave --eval slaveParallel\(',int2str(j),',',int2str(indPC),'\);" &'];
+ else
+ command1=['ssh ',Parallel(indPC).user,'@',Parallel(indPC).PcName,' "cd ',Parallel(indPC).RemoteFolder, '; matlab -nosplash -nodesktop -minimize -r slaveParallel\(',int2str(j),',',int2str(indPC),'\);" &'];
+ end
else
- command1=['ssh ',Parallel(indPC).user,'@',Parallel(indPC).PcName,' "cd ',Parallel(indPC).RemoteFolder, '; matlab -nosplash -nodesktop -minimize -r fParallel\(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',\''',fname,'\''\);" &'];
- end
- else
- if ~strcmp(Parallel(indPC).PcName,MasterName), % run on a remote machine
- if exist('OCTAVE_VERSION'),
- command1=['start /B psexec \\',Parallel(indPC).PcName,' -e -u ',Parallel(indPC).user,' -p ',Parallel(indPC).passwd,' -W ',Parallel(indPC).RemoteDrive,':\',Parallel(indPC).RemoteFolder,'\ -a ',int2str(Parallel(indPC).NumCPU(j-nCPU0)), ...
- ' -low octave --eval fParallel(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',''',fname,''')'];
- else
- command1=['start /B psexec \\',Parallel(indPC).PcName,' -e -u ',Parallel(indPC).user,' -p ',Parallel(indPC).passwd,' -W ',Parallel(indPC).RemoteDrive,':\',Parallel(indPC).RemoteFolder,'\ -a ',int2str(Parallel(indPC).NumCPU(j-nCPU0)), ...
- ' -low matlab -nosplash -nodesktop -minimize -r fParallel(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',''',fname,''')'];
- end
- else % run on the local machine via the network
- if exist('OCTAVE_VERSION'),
- command1=['start /B psexec \\',Parallel(indPC).PcName,' -e -W ',Parallel(indPC).RemoteDrive,':\',Parallel(indPC).RemoteFolder,'\ -a ',int2str(Parallel(indPC).NumCPU(j-nCPU0)), ...
- ' -low octave --eval fParallel(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',''',fname,''')'];
- else
- command1=['start /B psexec \\',Parallel(indPC).PcName,' -e -W ',Parallel(indPC).RemoteDrive,':\',Parallel(indPC).RemoteFolder,'\ -a ',int2str(Parallel(indPC).NumCPU(j-nCPU0)), ...
- ' -low matlab -nosplash -nodesktop -minimize -r fParallel(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',''',fname,''')'];
+ if ~strcmp(Parallel(indPC).PcName,MasterName), % run on a remote machine
+ if exist('OCTAVE_VERSION'),
+ command1=['start /B psexec \\',Parallel(indPC).PcName,' -e -u ',Parallel(indPC).user,' -p ',Parallel(indPC).passwd,' -W ',Parallel(indPC).RemoteDrive,':\',Parallel(indPC).RemoteFolder,'\ -a ',int2str(Parallel(indPC).NumCPU(j-nCPU0)), ...
+ ' -low octave --eval slaveParallel(',int2str(j),',',int2str(indPC),')'];
+ else
+ command1=['start /B psexec \\',Parallel(indPC).PcName,' -e -u ',Parallel(indPC).user,' -p ',Parallel(indPC).passwd,' -W ',Parallel(indPC).RemoteDrive,':\',Parallel(indPC).RemoteFolder,'\ -a ',int2str(Parallel(indPC).NumCPU(j-nCPU0)), ...
+ ' -low matlab -nosplash -nodesktop -minimize -r slaveParallel(',int2str(j),',',int2str(indPC),')'];
+ end
+ else % run on the local machine via the network
+ if exist('OCTAVE_VERSION'),
+ command1=['start /B psexec \\',Parallel(indPC).PcName,' -e -W ',Parallel(indPC).RemoteDrive,':\',Parallel(indPC).RemoteFolder,'\ -a ',int2str(Parallel(indPC).NumCPU(j-nCPU0)), ...
+ ' -low octave --eval slaveParallel(',int2str(j),',',int2str(indPC),')'];
+ else
+ command1=['start /B psexec \\',Parallel(indPC).PcName,' -e -W ',Parallel(indPC).RemoteDrive,':\',Parallel(indPC).RemoteFolder,'\ -a ',int2str(Parallel(indPC).NumCPU(j-nCPU0)), ...
+ ' -low matlab -nosplash -nodesktop -minimize -r slaveParallel(',int2str(j),',',int2str(indPC),')'];
+ end
end
end
end
- end
end
fprintf(fid,'%s\n',command1);
end
@@ -268,25 +274,28 @@ if exist('OCTAVE_VERSION'),
printf('\n');
else
hfigstatus = figure('name',['Parallel ',fname],...
- 'MenuBar', 'none', ...
- 'NumberTitle','off');
+ 'MenuBar', 'none', ...
+ 'NumberTitle','off');
vspace = 0.1;
ncol = ceil(totCPU/10);
hspace = 0.9/ncol;
for j=1:totCPU,
jrow = mod(j-1,10)+1;
- jcol = ceil(j/10);
+ jcol = ceil(j/10);
hstatus(j) = axes('position',[0.05/ncol+(jcol-1)/ncol 0.92-vspace*(jrow-1) 0.9/ncol 0.03], ...
- 'box','on','xtick',[],'ytick',[],'xlim',[0 1],'ylim',[0 1]);
+ 'box','on','xtick',[],'ytick',[],'xlim',[0 1],'ylim',[0 1]);
end
cumBlockPerCPU = cumsum(nBlockPerCPU);
end
pcerdone = NaN(1,totCPU);
while (1)
+
waitbarString = '';
statusString = '';
pause(1)
- stax = dir(['comp_status_',fname,'*.mat']);
+
+ stax = dir(['comp_status_',fname,'*.mat']);
+
for j=1:length(stax),
try
@@ -295,8 +304,8 @@ while (1)
if exist('OCTAVE_VERSION'),
statusString = [statusString, int2str(j), ' %3.f%% done! '];
else
- status_String{j} = waitbarString;
- status_Title{j} = waitbarTitle;
+ status_String{j} = waitbarString;
+ status_Title{j} = waitbarTitle;
idCPU(j) = njob;
end
if prtfrc==1, delete(stax(j).name), end
@@ -307,19 +316,35 @@ while (1)
if exist('OCTAVE_VERSION'),
printf([statusString,'\r'], 100 .* pcerdone);
else
+
figure(hfigstatus),
- for j=1:length(stax),
- axes(hstatus(idCPU(j))),
- hpat = findobj(hstatus(idCPU(j)),'Type','patch');
- if ~isempty(hpat),
- set(hpat,'XData',[0 0 pcerdone(j) pcerdone(j)])
- else
- patch([0 0 pcerdone(j) pcerdone(j)],[0 1 1 0],'r','EdgeColor','r')
+ try
+ for j=1:length(stax)
+
+ axes(hstatus(idCPU(j))),
+ hpat = findobj(hstatus(idCPU(j)),'Type','patch');
+
+
+ if ~isempty(hpat),
+ set(hpat,'XData',[0 0 pcerdone(j) pcerdone(j)])
+ else
+ patch([0 0 pcerdone(j) pcerdone(j)],[0 1 1 0],'r','EdgeColor','r')
+ end
+ title([status_Title{j},' - ',status_String{j}]);
+
end
- title([status_Title{j},' - ',status_String{j}]);
+ catch
+
+ E='ERRORE in while cycle masterParallelMann!'
+ j
+ if j>1
+ j=j-1
+ end
+ j
end
+
end
- if isempty(dir(['P_',fname,'_*End.txt']))
+ if isempty(dir(['P_',fname,'_*End.txt']))
mydelete(['comp_status_',fname,'*.mat'])
if ~exist('OCTAVE_VERSION'),
close(hfigstatus),
diff --git a/matlab/prior_posterior_statistics_core.m b/matlab/prior_posterior_statistics_core.m
index 4feccdcbe..d490559bf 100644
--- a/matlab/prior_posterior_statistics_core.m
+++ b/matlab/prior_posterior_statistics_core.m
@@ -56,15 +56,6 @@ end
MAX_momentsno =myinputs. MAX_momentsno;
ifil=myinputs.ifil;
-
-if strcmpi(typee,'posterior'),
- b=0;
- while b<=B
- b = b + 1;
- [x(b,:), logpost(b,1)] = GetOneDraw(typee);
- end
-end
-
if ~strcmpi(typee,'prior'),
x=myinputs.x;
logpost=myinputs.logpost;
@@ -279,7 +270,8 @@ for b=fpar:B
elseif ~whoiam,
waitbar(b/B,h);
end
- if mod(b,10)==0 & whoiam,
+ % if mod(b,10)==0 & whoiam,
+ if whoiam,
fprintf('Done! \n');
waitbarString = [ 'Subdraw ' int2str(b) '/' int2str(B) ' done.'];
fMessageStatus((b-fpar+1)/(B-fpar+1),whoiam,waitbarString, waitbarTitle, Parallel(ThisMatlab), MasterName, DyMo)
diff --git a/matlab/slaveParallel.m b/matlab/slaveParallel.m
index fe28ad1ad..cc65fe562 100644
--- a/matlab/slaveParallel.m
+++ b/matlab/slaveParallel.m
@@ -68,7 +68,7 @@ while (etime(clock,t0)<1200 && ~isempty(fslave)) || ~isempty(dir(['stayalive',in
% loads values for fblck nblck fname fGlobalVar fInputVar
delete(['slaveJob',int2str(whoiam),'.mat']);
- if exist('fGlobalVar'),
+ if exist('fGlobalVar') && ~isempty (fGlobalVar)
globalVars = fieldnames(fGlobalVar);
% for j=1:length(globalVars),
% eval(['global ',globalVars{j},';'])