Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dynare
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
122
Issues
122
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dynare
dynare
Commits
191de783
Commit
191de783
authored
Dec 17, 2010
by
Marco Ratto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduced console mode monitoring of parallel runs;
Minor changes
parent
916caf2e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
100 additions
and
43 deletions
+100
-43
matlab/parallel/masterParallel.m
matlab/parallel/masterParallel.m
+100
-43
No files found.
matlab/parallel/masterParallel.m
View file @
191de783
...
@@ -4,7 +4,6 @@ function [fOutVar,nBlockPerCPU, totCPU] = masterParallel(Parallel,fBlock,nBlock,
...
@@ -4,7 +4,6 @@ function [fOutVar,nBlockPerCPU, totCPU] = masterParallel(Parallel,fBlock,nBlock,
% computing.
% computing.
% It is the top-level function called on the master computer when parallelizing a task.
% It is the top-level function called on the master computer when parallelizing a task.
% This function have two main computational startegy for manage the matlab worker (slave process).
% This function have two main computational startegy for manage the matlab worker (slave process).
% 0 Simple Close/Open Stategy:
% 0 Simple Close/Open Stategy:
% In this case the new matlab istances (slave process) are open when
% In this case the new matlab istances (slave process) are open when
...
@@ -93,7 +92,7 @@ if nargin>8 && initialize==1
...
@@ -93,7 +92,7 @@ if nargin>8 && initialize==1
evalin
(
'base'
,
'options_.parallel_info.RemoteTmpFolder=PRCDirTmp;'
)
evalin
(
'base'
,
'options_.parallel_info.RemoteTmpFolder=PRCDirTmp;'
)
evalin
(
'base'
,
'clear PRCDirTmp,'
)
evalin
(
'base'
,
'clear PRCDirTmp,'
)
else
else
% Delete the traces (if exist
s) of last local section
computations.
% Delete the traces (if exist
ing) of last local session of
computations.
if
Strategy
==
1
,
if
Strategy
==
1
,
mydelete
([
'slaveParallel_input*.mat'
]);
mydelete
([
'slaveParallel_input*.mat'
]);
end
end
...
@@ -101,19 +100,8 @@ if nargin>8 && initialize==1
...
@@ -101,19 +100,8 @@ if nargin>8 && initialize==1
return
return
end
end
% The default value for the new field MatlabOctavePath now is 'matlab' or
% 'octave'.
for
j
=
1
:
length
(
Parallel
),
if
isempty
(
Parallel
(
j
)
.
MatlabOctavePath
),
Parallel
(
j
)
.
MatlabOctavePath
=
'matlab'
;
end
end
% Only for testing!
% To test AnalyseComputationalEnviroment.m function
% save('Parallel.mat','-struct', 'Parallel');
% Only for testing!
% Only for testing!
% if Strategy==0
% if Strategy==0
...
@@ -130,14 +118,12 @@ end
...
@@ -130,14 +118,12 @@ end
% Determine my hostname and my working directory.
% Determine my hostname and my working directory.
DyMo
=
pwd
;
DyMo
=
pwd
;
fInputVar
.
DyMo
=
DyMo
;
% fInputVar.DyMo=DyMo;
if
isunix
||
(
~
matlab_ver_less_than
(
'7.4'
)
&&
ismac
)
,
if
~
(
isunix
||
(
~
matlab_ver_less_than
(
'7.4'
)
&&
ismac
))
,
[
tempo
,
MasterName
]
=
system
(
'hostname --fqdn'
);
else
[
tempo
,
MasterName
]
=
system
(
'hostname'
);
[
tempo
,
MasterName
]
=
system
(
'hostname'
);
MasterName
=
deblank
(
MasterName
);
end
end
MasterName
=
deblank
(
MasterName
);
% fInputVar.MasterName = MasterName;
fInputVar
.
MasterName
=
MasterName
;
% Save input data for use by the slaves.
% Save input data for use by the slaves.
...
@@ -168,8 +154,8 @@ offset0 = fBlock-1;
...
@@ -168,8 +154,8 @@ offset0 = fBlock-1;
% Clean up remnants of previous runs.
% Clean up remnants of previous runs.
mydelete
([
'comp_status_'
,
fname
,
'*.mat'
])
mydelete
([
'comp_status_'
,
fname
,
'*.mat'
])
;
mydelete
([
'P_'
,
fname
,
'*End.txt'
])
mydelete
([
'P_'
,
fname
,
'*End.txt'
])
;
% Create a shell script containing the commands to launch the required
% Create a shell script containing the commands to launch the required
...
@@ -184,6 +170,7 @@ else
...
@@ -184,6 +170,7 @@ else
dynareParallelMkDir
(
PRCDir
,
Parallel
(
1
:
totSlaves
));
dynareParallelMkDir
(
PRCDir
,
Parallel
(
1
:
totSlaves
));
end
end
for
j
=
1
:
totCPU
,
for
j
=
1
:
totCPU
,
...
@@ -193,6 +180,19 @@ for j=1:totCPU,
...
@@ -193,6 +180,19 @@ for j=1:totCPU,
indPC
=
min
(
find
(
nCPU
>=
j
));
indPC
=
min
(
find
(
nCPU
>=
j
));
% According to the information contained in configuration file, compThread can limit MATLAB
% to a single computational thread. By default, MATLAB makes use of the multithreading
% capabilities of the computer on which it is running. Nevertheless
% exsperimental results show as matlab native
% multithreading limit the performaces when the parallel computing is active.
if
strcmp
(
'true'
,
Parallel
(
indPC
)
.
SingleCompThread
),
compThread
=
'-singleCompThread'
;
else
compThread
=
''
;
end
if
indPC
>
1
if
indPC
>
1
nCPU0
=
nCPU
(
indPC
-
1
);
nCPU0
=
nCPU
(
indPC
-
1
);
else
else
...
@@ -267,13 +267,13 @@ for j=1:totCPU,
...
@@ -267,13 +267,13 @@ for j=1:totCPU,
if
exist
(
'OCTAVE_VERSION'
)
if
exist
(
'OCTAVE_VERSION'
)
command1
=
[
'octave --eval "addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); fParallel('
,
int2str
(
offset
+
1
),
','
,
int2str
(
sum
(
nBlockPerCPU
(
1
:
j
))),
','
,
int2str
(
j
),
','
,
int2str
(
indPC
),
',
''
'
,
fname
,
'
''
)" &'
];
command1
=
[
'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
command1
=
[
Parallel
(
indPC
)
.
MatlabOctavePath
,
' -nosplash -nodesktop -minimize -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'
)
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 "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 -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
end
end
else
% 0.2 Parallel(indPC).Local==0: Run using network on remote machine or also on local machine.
else
% 0.2 Parallel(indPC).Local==0: Run using network on remote machine or also on local machine.
...
@@ -286,7 +286,7 @@ for j=1:totCPU,
...
@@ -286,7 +286,7 @@ for j=1:totCPU,
if
exist
(
'OCTAVE_VERSION'
),
if
exist
(
'OCTAVE_VERSION'
),
command1
=
[
'ssh '
,
Parallel
(
indPC
)
.
UserName
,
'@'
,
Parallel
(
indPC
)
.
ComputerName
,
' "cd '
,
Parallel
(
indPC
)
.
RemoteDirectory
,
'/'
,
PRCDir
,
'; octave --eval \"addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); fParallel('
,
int2str
(
offset
+
1
),
','
,
int2str
(
sum
(
nBlockPerCPU
(
1
:
j
))),
','
,
int2str
(
j
),
','
,
int2str
(
indPC
),
',
''
'
,
fname
,
'
''
);\" " &'
];
command1
=
[
'ssh '
,
Parallel
(
indPC
)
.
UserName
,
'@'
,
Parallel
(
indPC
)
.
ComputerName
,
' "cd '
,
Parallel
(
indPC
)
.
RemoteDirectory
,
'/'
,
PRCDir
,
'; 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
command1
=
[
'ssh '
,
Parallel
(
indPC
)
.
UserName
,
'@'
,
Parallel
(
indPC
)
.
ComputerName
,
' "cd '
,
Parallel
(
indPC
)
.
RemoteDirectory
,
'/'
,
PRCDir
,
'; '
,
Parallel
(
indPC
)
.
MatlabOctavePath
,
' -nosplash -nodesktop -minimize -r \"addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); fParallel('
,
int2str
(
offset
+
1
),
','
,
int2str
(
sum
(
nBlockPerCPU
(
1
:
j
))),
','
,
int2str
(
j
),
','
,
int2str
(
indPC
),
',
''
'
,
fname
,
'
''
);\" " &'
];
command1
=
[
'ssh '
,
Parallel
(
indPC
)
.
UserName
,
'@'
,
Parallel
(
indPC
)
.
ComputerName
,
' "cd '
,
Parallel
(
indPC
)
.
RemoteDirectory
,
'/'
,
PRCDir
,
'; '
,
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
~
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!
...
@@ -295,7 +295,7 @@ for j=1:totCPU,
...
@@ -295,7 +295,7 @@ for j=1:totCPU,
' -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
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 '
,
Parallel
(
indPC
)
.
MatlabOctavePath
,
' -nosplash -nodesktop -minimize -r "addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); fParallel('
,
int2str
(
offset
+
1
),
','
,
int2str
(
sum
(
nBlockPerCPU
(
1
:
j
))),
','
,
int2str
(
j
),
','
,
int2str
(
indPC
),
',
''
'
,
fname
,
'
''
)"'
];
' -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
else
% 0.4 Run on the local machine via the network
else
% 0.4 Run on the local machine via the network
if
exist
(
'OCTAVE_VERSION'
),
if
exist
(
'OCTAVE_VERSION'
),
...
@@ -303,7 +303,7 @@ for j=1:totCPU,
...
@@ -303,7 +303,7 @@ for j=1:totCPU,
' -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
command1
=
[
'start /B psexec \\'
,
Parallel
(
indPC
)
.
ComputerName
,
' -e -W '
,
Parallel
(
indPC
)
.
RemoteDrive
,
':\'
,
Parallel
(
indPC
)
.
RemoteDirectory
,
'\'
,
PRCDir
,
'\ -a '
,
int2str
(
Parallel
(
indPC
)
.
CPUnbr
(
j
-
nCPU0
)),
...
command1
=
[
'start /B psexec \\'
,
Parallel
(
indPC
)
.
ComputerName
,
' -e -W '
,
Parallel
(
indPC
)
.
RemoteDrive
,
':\'
,
Parallel
(
indPC
)
.
RemoteDirectory
,
'\'
,
PRCDir
,
'\ -a '
,
int2str
(
Parallel
(
indPC
)
.
CPUnbr
(
j
-
nCPU0
)),
...
' -low '
,
Parallel
(
indPC
)
.
MatlabOctavePath
,
' -nosplash -nodesktop -minimize -r "addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); fParallel('
,
int2str
(
offset
+
1
),
','
,
int2str
(
sum
(
nBlockPerCPU
(
1
:
j
))),
','
,
int2str
(
j
),
','
,
int2str
(
indPC
),
',
''
'
,
fname
,
'
''
)"'
];
' -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
end
end
end
end
...
@@ -316,13 +316,13 @@ for j=1:totCPU,
...
@@ -316,13 +316,13 @@ for j=1:totCPU,
if
exist
(
'OCTAVE_VERSION'
)
if
exist
(
'OCTAVE_VERSION'
)
command1
=
[
'octave --eval "addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
')" &'
];
command1
=
[
'octave --eval "addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
')" &'
];
else
else
command1
=
[
Parallel
(
indPC
)
.
MatlabOctavePath
,
' -nosplash -nodesktop -minimize -r "addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
')" &'
];
command1
=
[
Parallel
(
indPC
)
.
MatlabOctavePath
,
' -nosplash -nodesktop -minimize
'
,
compThread
,
'
-r "addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
')" &'
];
end
end
else
else
if
exist
(
'OCTAVE_VERSION'
)
if
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(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
')"'
];
command1
=
[
'start /B psexec -W '
,
DyMo
,
' -a '
,
int2str
(
Parallel
(
indPC
)
.
CPUnbr
(
j
-
nCPU0
)),
' -low octave --eval "addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
')"'
];
else
else
command1
=
[
'start /B psexec -W '
,
DyMo
,
' -a '
,
int2str
(
Parallel
(
indPC
)
.
CPUnbr
(
j
-
nCPU0
)),
' -low '
,
Parallel
(
indPC
)
.
MatlabOctavePath
,
' -nosplash -nodesktop -minimize -r "addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
')"'
];
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(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
')"'
];
end
end
end
end
elseif
Parallel
(
indPC
)
.
Local
==
0
,
% 1.2 Run using network on remote machine or also on local machine.
elseif
Parallel
(
indPC
)
.
Local
==
0
,
% 1.2 Run using network on remote machine or also on local machine.
...
@@ -339,7 +339,7 @@ for j=1:totCPU,
...
@@ -339,7 +339,7 @@ for j=1:totCPU,
if
exist
(
'OCTAVE_VERSION'
),
if
exist
(
'OCTAVE_VERSION'
),
command1
=
[
'ssh '
,
Parallel
(
indPC
)
.
UserName
,
'@'
,
Parallel
(
indPC
)
.
ComputerName
,
' "cd '
,
Parallel
(
indPC
)
.
RemoteDirectory
,
'/'
,
PRCDir
'; octave --eval \"addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
');\" " &'
];
command1
=
[
'ssh '
,
Parallel
(
indPC
)
.
UserName
,
'@'
,
Parallel
(
indPC
)
.
ComputerName
,
' "cd '
,
Parallel
(
indPC
)
.
RemoteDirectory
,
'/'
,
PRCDir
'; octave --eval \"addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
');\" " &'
];
else
else
command1
=
[
'ssh '
,
Parallel
(
indPC
)
.
UserName
,
'@'
,
Parallel
(
indPC
)
.
ComputerName
,
' "cd '
,
Parallel
(
indPC
)
.
RemoteDirectory
,
'/'
,
PRCDir
'; '
,
Parallel
(
indPC
)
.
MatlabOctavePath
,
' -nosplash -nodesktop -minimize -r \"addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
');\" " &'
];
command1
=
[
'ssh '
,
Parallel
(
indPC
)
.
UserName
,
'@'
,
Parallel
(
indPC
)
.
ComputerName
,
' "cd '
,
Parallel
(
indPC
)
.
RemoteDirectory
,
'/'
,
PRCDir
'; '
,
Parallel
(
indPC
)
.
MatlabOctavePath
,
' -nosplash -nodesktop -minimize
'
,
compThread
,
'
-r \"addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
');\" " &'
];
end
end
else
else
if
~
strcmp
(
Parallel
(
indPC
)
.
ComputerName
,
MasterName
),
% 1.3 Run on a remote machine.
if
~
strcmp
(
Parallel
(
indPC
)
.
ComputerName
,
MasterName
),
% 1.3 Run on a remote machine.
...
@@ -348,7 +348,7 @@ for j=1:totCPU,
...
@@ -348,7 +348,7 @@ for j=1:totCPU,
' -low octave --eval "addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
')"'
];
' -low octave --eval "addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
')"'
];
else
else
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 '
,
Parallel
(
indPC
)
.
MatlabOctavePath
,
' -nosplash -nodesktop -minimize -r "addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
')"'
];
' -low '
,
Parallel
(
indPC
)
.
MatlabOctavePath
,
' -nosplash -nodesktop -minimize
'
,
compThread
,
'
-r "addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
')"'
];
end
end
else
% 1.4 Run on the local machine via the network.
else
% 1.4 Run on the local machine via the network.
if
exist
(
'OCTAVE_VERSION'
),
if
exist
(
'OCTAVE_VERSION'
),
...
@@ -356,7 +356,7 @@ for j=1:totCPU,
...
@@ -356,7 +356,7 @@ for j=1:totCPU,
' -low octave --eval "addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
')"'
];
' -low octave --eval "addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
')"'
];
else
else
command1
=
[
'start /B psexec \\'
,
Parallel
(
indPC
)
.
ComputerName
,
' -e -W '
,
Parallel
(
indPC
)
.
RemoteDrive
,
':\'
,
Parallel
(
indPC
)
.
RemoteDirectory
,
'\'
,
PRCDir
,
'\ -a '
,
int2str
(
Parallel
(
indPC
)
.
CPUnbr
(
j
-
nCPU0
)),
...
command1
=
[
'start /B psexec \\'
,
Parallel
(
indPC
)
.
ComputerName
,
' -e -W '
,
Parallel
(
indPC
)
.
RemoteDrive
,
':\'
,
Parallel
(
indPC
)
.
RemoteDirectory
,
'\'
,
PRCDir
,
'\ -a '
,
int2str
(
Parallel
(
indPC
)
.
CPUnbr
(
j
-
nCPU0
)),
...
' -low '
,
Parallel
(
indPC
)
.
MatlabOctavePath
,
' -nosplash -nodesktop -minimize -r "addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
')"'
];
' -low '
,
Parallel
(
indPC
)
.
MatlabOctavePath
,
' -nosplash -nodesktop -minimize
'
,
compThread
,
'
-r "addpath(
''
'
,
Parallel
(
indPC
)
.
DynarePath
,
'
''
), dynareroot = dynare_config(); slaveParallel('
,
int2str
(
j
),
','
,
int2str
(
indPC
),
')"'
];
end
end
end
end
end
end
...
@@ -387,11 +387,22 @@ else
...
@@ -387,11 +387,22 @@ else
end
end
% For matlab enviroment with options_.console_mode = 0:
% create a parallel (local/remote) specialized computational status bars!
global
options_
% Create a parallel (local/remote) specialized computational status bars!
% Create a parallel (local/remote) specialized computational status bars!
if
exist
(
'OCTAVE_VERSION'
),
if
exist
(
'OCTAVE_VERSION'
)
||
(
options_
.
console_mode
==
1
)
,
diary
off
;
diary
off
;
printf
(
'\n'
);
if
exist
(
'OCTAVE_VERSION'
)
printf
(
'\n'
);
else
fprintf
(
'\n'
);
end
else
else
hfigstatus
=
figure
(
'name'
,[
'Parallel '
,
fname
],
...
hfigstatus
=
figure
(
'name'
,[
'Parallel '
,
fname
],
...
'DockControls'
,
'off'
,
...
'DockControls'
,
'off'
,
...
...
@@ -436,12 +447,44 @@ delete(['comp_status_',fname,'*.mat']);
...
@@ -436,12 +447,44 @@ delete(['comp_status_',fname,'*.mat']);
% Wait for the slaves to finish their job, and display some progress
% Wait for the slaves to finish their job, and display some progress
% information meanwhile.
% information meanwhile.
% Caption for console mode computing ...
if
(
options_
.
console_mode
==
1
)
fnameTemp
=
fname
;
L
=
length
(
fnameTemp
);
PoCo
=
strfind
(
fnameTemp
,
'_core'
);
for
i
=
PoCo
:
L
if
i
==
PoCo
fnameTemp
(
i
)
=
' '
;
else
fnameTemp
(
i
)
=
'.'
;
end
end
for
i
=
1
:
L
if
fnameTemp
(
i
)
==
'_'
;
fnameTemp
(
i
)
=
' '
;
end
end
fnameTemp
(
L
)
=
''
;
Information
=
[
'Parallel '
fnameTemp
' Computing ...'
];
fprintf
([
Information
,
'\n\n'
]);
end
ForEver
=
1
;
ForEver
=
1
;
statusString
=
''
;
while
(
ForEver
)
while
(
ForEver
)
waitbarString
=
''
;
waitbarString
=
''
;
statusString0
=
repmat
(
'\b'
,
1
,
length
(
sprintf
(
statusString
,
100
.*
pcerdone
)));
statusString
=
''
;
statusString
=
''
;
pause
(
1
)
pause
(
1
)
...
@@ -460,7 +503,7 @@ while (ForEver)
...
@@ -460,7 +503,7 @@ while (ForEver)
end
end
pcerdone
(
j
)
=
prtfrc
;
pcerdone
(
j
)
=
prtfrc
;
idCPU
(
j
)
=
njob
;
idCPU
(
j
)
=
njob
;
if
exist
(
'OCTAVE_VERSION'
),
if
exist
(
'OCTAVE_VERSION'
)
||
(
options_
.
console_mode
==
1
)
,
statusString
=
[
statusString
,
int2str
(
j
),
' %3.f%% done! '
];
statusString
=
[
statusString
,
int2str
(
j
),
' %3.f%% done! '
];
else
else
status_String
{
j
}
=
waitbarString
;
status_String
{
j
}
=
waitbarString
;
...
@@ -468,10 +511,20 @@ while (ForEver)
...
@@ -468,10 +511,20 @@ while (ForEver)
end
end
catch
% ME
catch
% ME
% To define!
% To define!
if
exist
(
'OCTAVE_VERSION'
)
||
(
options_
.
console_mode
==
1
),
statusString
=
[
statusString
,
int2str
(
j
),
' %3.f%% done! '
];
end
end
end
end
end
if
exist
(
'OCTAVE_VERSION'
),
if
exist
(
'OCTAVE_VERSION'
)
||
(
options_
.
console_mode
==
1
),
printf
([
statusString
,
'\r'
],
100
.*
pcerdone
);
if
exist
(
'OCTAVE_VERSION'
)
printf
([
statusString
,
'\r'
],
100
.*
pcerdone
);
else
if
~
isempty
(
statusString
)
fprintf
([
statusString0
,
statusString
],
100
.*
pcerdone
);
end
end
else
else
for
j
=
1
:
totCPU
,
for
j
=
1
:
totCPU
,
try
try
...
@@ -490,14 +543,19 @@ while (ForEver)
...
@@ -490,14 +543,19 @@ while (ForEver)
HoTuttiGliOutput
=
HoTuttiGliOutput
+
1
;
HoTuttiGliOutput
=
HoTuttiGliOutput
+
1
;
end
end
end
end
if
HoTuttiGliOutput
==
totCPU
,
if
HoTuttiGliOutput
==
totCPU
,
mydelete
([
'comp_status_'
,
fname
,
'*.mat'
]);
mydelete
([
'comp_status_'
,
fname
,
'*.mat'
])
if
exist
(
'OCTAVE_VERSION'
)
||
(
options_
.
console_mode
==
1
),
if
~
exist
(
'OCTAVE_VERSION'
),
if
exist
(
'OCTAVE_VERSION'
)
close
(
hfigstatus
),
printf
(
'\n'
);
else
else
printf
(
'\n'
);
fprintf
(
'\n'
);
fprintf
([
'End Parallel Session ....'
,
'\n\n'
]);
end
diary
on
;
diary
on
;
else
close
(
hfigstatus
),
end
end
break
break
...
@@ -521,7 +579,6 @@ for j=1:totCPU,
...
@@ -521,7 +579,6 @@ for j=1:totCPU,
if
isfield
(
fOutputVar
,
'error'
),
if
isfield
(
fOutputVar
,
'error'
),
disp
([
'Job number '
,
int2str
(
j
),
' crashed with error:'
]);
disp
([
'Job number '
,
int2str
(
j
),
' crashed with error:'
]);
iscrash
=
1
;
iscrash
=
1
;
% keyboard;
disp
([
fOutputVar
.
error
.
message
]);
disp
([
fOutputVar
.
error
.
message
]);
for
jstack
=
1
:
length
(
fOutputVar
.
error
.
stack
)
for
jstack
=
1
:
length
(
fOutputVar
.
error
.
stack
)
fOutputVar
.
error
.
stack
(
jstack
),
fOutputVar
.
error
.
stack
(
jstack
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment