Skip to content
Snippets Groups Projects
Commit e86e4b0b authored by Marco Ratto's avatar Marco Ratto
Browse files

Fixes related to the possibility of having octave slaves called by a matlab master.

parent 2d3315f9
Branches
Tags
No related merge requests found
...@@ -163,6 +163,18 @@ end ...@@ -163,6 +163,18 @@ end
[nCPU, totCPU, nBlockPerCPU, totSlaves] = distributeJobs(Parallel, fBlock, nBlock); [nCPU, totCPU, nBlockPerCPU, totSlaves] = distributeJobs(Parallel, fBlock, nBlock);
offset0 = fBlock-1; offset0 = fBlock-1;
% Only for testing!
% fBlock
% nBlock
%
%
% nCPU
% totCPU
% nBlockPerCPU
% totSlaves
% keyboard
% Clean up remnants of previous runs. % Clean up remnants of previous runs.
mydelete(['comp_status_',fname,'*.mat']); mydelete(['comp_status_',fname,'*.mat']);
...@@ -281,8 +293,8 @@ for j=1:totCPU, ...@@ -281,8 +293,8 @@ for j=1:totCPU,
command1=[Parallel(indPC).MatlabOctavePath,' -nosplash -nodesktop -minimize ',compThread,' -r "addpath(''',Parallel(indPC).DynarePath,'''), dynareroot = dynare_config(); fParallel(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',''',fname,''')" &']; command1=[Parallel(indPC).MatlabOctavePath,' -nosplash -nodesktop -minimize ',compThread,' -r "addpath(''',Parallel(indPC).DynarePath,'''), dynareroot = dynare_config(); fParallel(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',''',fname,''')" &'];
end end
else else
if exist('OCTAVE_VERSION') if (exist('OCTAVE_VERSION') || (findstr(Parallel(indPC).MatlabOctavePath, 'octave'))) % exist('OCTAVE_VERSION')
command1=['start /B psexec -W ',DyMo, ' -a ',int2str(Parallel(indPC).CPUnbr(j-nCPU0)),' -low octave --eval "addpath(''',Parallel(indPC).DynarePath,'''), dynareroot = dynare_config(); fParallel(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',''',fname,''')"']; command1=['start /B psexec -W ',DyMo, ' -a ',int2str(Parallel(indPC).CPUnbr(j-nCPU0)),' -low octave --eval "default_save_options(''-v7''); addpath(''',Parallel(indPC).DynarePath,'''), dynareroot = dynare_config(); fParallel(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',''',fname,''')"'];
else else
command1=['start /B psexec -W ',DyMo, ' -a ',int2str(Parallel(indPC).CPUnbr(j-nCPU0)),' -low ',Parallel(indPC).MatlabOctavePath,' -nosplash -nodesktop -minimize ',compThread,' -r "addpath(''',Parallel(indPC).DynarePath,'''), dynareroot = dynare_config(); fParallel(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',''',fname,''')"']; command1=['start /B psexec -W ',DyMo, ' -a ',int2str(Parallel(indPC).CPUnbr(j-nCPU0)),' -low ',Parallel(indPC).MatlabOctavePath,' -nosplash -nodesktop -minimize ',compThread,' -r "addpath(''',Parallel(indPC).DynarePath,'''), dynareroot = dynare_config(); fParallel(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',''',fname,''')"'];
end end
...@@ -301,7 +313,7 @@ for j=1:totCPU, ...@@ -301,7 +313,7 @@ for j=1:totCPU,
end end
else else
if ~strcmp(Parallel(indPC).ComputerName,MasterName), % 0.3 Run on a remote machine! if ~strcmp(Parallel(indPC).ComputerName,MasterName), % 0.3 Run on a remote machine!
if exist('OCTAVE_VERSION'), if (exist('OCTAVE_VERSION') || (findstr(Parallel(indPC).MatlabOctavePath, 'octave'))) % exist('OCTAVE_VERSION'),
command1=['start /B psexec \\',Parallel(indPC).ComputerName,' -e -u ',Parallel(indPC).UserName,' -p ',Parallel(indPC).Password,' -W ',Parallel(indPC).RemoteDrive,':\',Parallel(indPC).RemoteDirectory,'\',PRCDir,'\ -a ',int2str(Parallel(indPC).CPUnbr(j-nCPU0)), ... command1=['start /B psexec \\',Parallel(indPC).ComputerName,' -e -u ',Parallel(indPC).UserName,' -p ',Parallel(indPC).Password,' -W ',Parallel(indPC).RemoteDrive,':\',Parallel(indPC).RemoteDirectory,'\',PRCDir,'\ -a ',int2str(Parallel(indPC).CPUnbr(j-nCPU0)), ...
' -low octave --eval "addpath(''',Parallel(indPC).DynarePath,'''), dynareroot = dynare_config(); fParallel(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',''',fname,''')"']; ' -low octave --eval "addpath(''',Parallel(indPC).DynarePath,'''), dynareroot = dynare_config(); fParallel(',int2str(offset+1),',',int2str(sum(nBlockPerCPU(1:j))),',',int2str(j),',',int2str(indPC),',''',fname,''')"'];
else else
...@@ -389,6 +401,22 @@ while (1) ...@@ -389,6 +401,22 @@ while (1)
end end
end end
% Snapshot of the contents of all the directories involved in parallel
% computing. This is necessary when I want to copy continuously the files produced by
% the slaves ...
% If the compuation is 'Local' it is not necessary to do it ...
% PRCDirSnapshot={};
%
% for indPC=1:totSlaves
%
% if Parallel(indPC).Local==0;
% PRCDirSnapshot{indPC}=dynareParallelListAllFiles(['\\',Parallel(indPC).ComputerName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteDirectory,'\',PRCDir]);
% end
%
% end
% Run the slaves. % Run the slaves.
if ~ispc, %isunix || (~matlab_ver_less_than('7.4') && ismac), if ~ispc, %isunix || (~matlab_ver_less_than('7.4') && ismac),
system('sh ConcurrentCommand1.bat &'); system('sh ConcurrentCommand1.bat &');
...@@ -411,7 +439,6 @@ end ...@@ -411,7 +439,6 @@ end
global options_ global options_
% Create a parallel (local/remote) specialized computational status bars! % Create a parallel (local/remote) specialized computational status bars!
if exist('OCTAVE_VERSION') || (options_.console_mode == 1), if exist('OCTAVE_VERSION') || (options_.console_mode == 1),
...@@ -506,7 +533,6 @@ end ...@@ -506,7 +533,6 @@ end
ForEver=1; ForEver=1;
statusString = ''; statusString = '';
...@@ -573,6 +599,25 @@ while (ForEver) ...@@ -573,6 +599,25 @@ while (ForEver)
end end
end end
% Check if any slave has generated some new files remotely.
% for i ...
% NewFiles=dynareParallelFindNewFiles(...,...)
% if ~isempty(NewFiles)
% if Parallel(indPC).Local==0;
% Se decidiamo di farlo qui e non in dynareParallelFindNewFiles,
% Confronta NewFiles e PRCDirSnapshot{i} per trovare i nuovi files ...
% Copia i nuovi files qui ...
% Metti PRCDirSnapshot{i}=NewFiles
% NewFiles=[];
% else
% continue
% end
% end
% end
if isempty(dynareParallelDir(['P_',fname,'_*End.txt'],PRCDir,Parallel(1:totSlaves))); if isempty(dynareParallelDir(['P_',fname,'_*End.txt'],PRCDir,Parallel(1:totSlaves)));
HoTuttiGliOutput=0; HoTuttiGliOutput=0;
for j=1:totCPU, for j=1:totCPU,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment