Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stéphane Adjemian
dynare
Commits
e86e4b0b
Commit
e86e4b0b
authored
Apr 6, 2011
by
Marco Ratto
Browse files
Options
Downloads
Patches
Plain Diff
Fixes related to the possibility of having octave slaves called by a matlab master.
parent
2d3315f9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/parallel/masterParallel.m
+51
-6
51 additions, 6 deletions
matlab/parallel/masterParallel.m
with
51 additions
and
6 deletions
matlab/parallel/masterParallel.m
+
51
−
6
View file @
e86e4b0b
...
@@ -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
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment