matlab: allow running MPI openEMS on a HPC
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
This commit is contained in:
parent
a607bc6969
commit
8698f7a448
@ -59,7 +59,7 @@ function RunOpenEMS(Sim_Path, Sim_File, opts, Settings)
|
|||||||
% WriteOpenEMS('/tmp/path_to_run_in/myfile.xml', FDTD, CSX)
|
% WriteOpenEMS('/tmp/path_to_run_in/myfile.xml', FDTD, CSX)
|
||||||
% RunOpenEMS('/tmp/path_to_run_in','myfile.xml','-v')
|
% RunOpenEMS('/tmp/path_to_run_in','myfile.xml','-v')
|
||||||
%
|
%
|
||||||
% See also WriteOpenEMS FindFreeSSH InitCSX InitFDTD
|
% See also WriteOpenEMS FindFreeSSH InitCSX InitFDTD RunOpenEMS_MPI
|
||||||
%
|
%
|
||||||
% openEMS matlab interface
|
% openEMS matlab interface
|
||||||
% -----------------------
|
% -----------------------
|
||||||
|
@ -42,6 +42,7 @@ cd(Sim_Path);
|
|||||||
scp_options = '-C -o "PasswordAuthentication no" -o "StrictHostKeyChecking no"';
|
scp_options = '-C -o "PasswordAuthentication no" -o "StrictHostKeyChecking no"';
|
||||||
ssh_options = [scp_options ' -x'];
|
ssh_options = [scp_options ' -x'];
|
||||||
|
|
||||||
|
if isfield(Settings.MPI,'Hosts')
|
||||||
Remote_Nodes = Settings.MPI.Hosts;
|
Remote_Nodes = Settings.MPI.Hosts;
|
||||||
HostList = '';
|
HostList = '';
|
||||||
for n=1:numel(Remote_Nodes)
|
for n=1:numel(Remote_Nodes)
|
||||||
@ -70,6 +71,7 @@ for n=1:numel(Remote_Nodes)
|
|||||||
error('openEMS:RunOpenEMS',['scp to remote ' remote_name ' failed!']);
|
error('openEMS:RunOpenEMS',['scp to remote ' remote_name ' failed!']);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
%run openEMS (with log file if requested)
|
%run openEMS (with log file if requested)
|
||||||
@ -79,21 +81,23 @@ else
|
|||||||
append_unix = [];
|
append_unix = [];
|
||||||
end
|
end
|
||||||
|
|
||||||
disp(['Running remote openEMS_MPI in working dir: ' work_path]);
|
|
||||||
|
|
||||||
if ~isfield(Settings.MPI,'GlobalArgs')
|
if ~isfield(Settings.MPI,'GlobalArgs')
|
||||||
Settings.MPI.GlobalArgs = '';
|
Settings.MPI.GlobalArgs = '';
|
||||||
end
|
end
|
||||||
|
|
||||||
if isfield(Settings.MPI,'Hosts')
|
if isfield(Settings.MPI,'Hosts')
|
||||||
|
disp(['Running remote openEMS_MPI in working dir: ' work_path]);
|
||||||
[status] = system(['mpiexec -host ' HostList ' -n ' int2str(NrProc) ' -wdir ' work_path ' ' Settings.MPI.Binary ' ' Sim_File ' ' opts ' ' append_unix]);
|
[status] = system(['mpiexec -host ' HostList ' -n ' int2str(NrProc) ' -wdir ' work_path ' ' Settings.MPI.Binary ' ' Sim_File ' ' opts ' ' append_unix]);
|
||||||
else
|
else
|
||||||
[status] = system(['mpiexec ' Settings.MPI.GlobalArgs ' -n ' int2str(NrProc) ' -wdir ' work_path ' ' Settings.MPI.Binary ' ' Sim_File ' ' opts ' ' append_unix]);
|
disp('Running local openEMS_MPI');
|
||||||
|
[status] = system(['mpiexec ' Settings.MPI.GlobalArgs ' -n ' int2str(NrProc) ' ' Settings.MPI.Binary ' ' Sim_File ' ' opts ' ' append_unix]);
|
||||||
end
|
end
|
||||||
|
|
||||||
if (status~=0)
|
if (status~=0)
|
||||||
error('openEMS:RunOpenEMS','mpirun openEMS failed!');
|
error('openEMS:RunOpenEMS','mpirun openEMS failed!');
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if isfield(Settings.MPI,'Hosts')
|
||||||
disp( 'Remote simulation done... copying back results and cleaning up...' );
|
disp( 'Remote simulation done... copying back results and cleaning up...' );
|
||||||
|
|
||||||
if (strncmp(work_path,'/tmp/',5)~=1) % savety precaution...
|
if (strncmp(work_path,'/tmp/',5)~=1) % savety precaution...
|
||||||
@ -116,5 +120,6 @@ for n=1:numel(Remote_Nodes)
|
|||||||
warning('openEMS:RunOpenEMS','remote cleanup failed!');
|
warning('openEMS:RunOpenEMS','remote cleanup failed!');
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
cd(savePath);
|
cd(savePath);
|
||||||
|
Loading…
Reference in New Issue
Block a user