Changeset 26330
- Timestamp:
- 06/23/21 13:51:11 (4 years ago)
- Location:
- issm/trunk-jpl/src/m/classes/clusters
- Files:
-
- 15 edited
-
aurora.m (modified) (2 diffs)
-
camhpc.m (modified) (2 diffs)
-
discover.m (modified) (2 diffs)
-
generic.m (modified) (4 diffs)
-
generic.py (modified) (3 diffs)
-
greenplanet.m (modified) (2 diffs)
-
hpc.m (modified) (2 diffs)
-
hpc_simba.m (modified) (2 diffs)
-
lonestar.m (modified) (2 diffs)
-
maui.m (modified) (2 diffs)
-
pfe.m (modified) (10 diffs)
-
pfe.py (modified) (7 diffs)
-
sherlock.m (modified) (2 diffs)
-
tetralith.m (modified) (10 diffs)
-
yellowstone.m (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/clusters/aurora.m
r23624 r26330 1 %AURORA cl ass definition1 %AURORA cluster class definition 2 2 % 3 3 % Usage: … … 7 7 8 8 classdef aurora 9 properties (SetAccess=public) 10 % {{{11 name='aurora.jpl.nasa.gov'12 login='username';13 numnodes = 1;14 cpuspernode = 24;15 modules = {'intel/cluster-toolkit-2013.5.192'};16 port=1070;17 queue='shortq';18 time=3*60;19 codepath='~/issm/trunk/';20 executionpath='~/issm/trunk/execution/';21 mpipath='/opt/intel/impi/4.1.3/intel64/bin/';22 %}}}23 end24 methods25 function cluster=aurora(varargin) % {{{9 properties (SetAccess=public) 10 % {{{ 11 name='aurora.jpl.nasa.gov' 12 login='username'; 13 numnodes = 1; 14 cpuspernode = 24; 15 modules = {'intel/cluster-toolkit-2013.5.192'}; 16 port=1070; 17 queue='shortq'; 18 time=3*60; 19 codepath='~/issm/trunk/'; 20 executionpath='~/issm/trunk/execution/'; 21 mpipath='/opt/intel/impi/4.1.3/intel64/bin/'; 22 %}}} 23 end 24 methods 25 function cluster=aurora(varargin) % {{{ 26 26 27 %initialize cluster using default settings if provided28 if (exist('aurora_settings')==2), aurora_settings; end27 %initialize cluster using default settings if provided 28 if (exist('aurora_settings')==2), aurora_settings; end 29 29 30 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);31 end32 %}}}33 function disp(cluster) % {{{34 % display the object35 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));36 disp(sprintf(' name: %s',cluster.name));37 disp(sprintf(' login: %s',cluster.login));38 disp(sprintf(' numnodes: %i',cluster.numnodes));39 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode));40 disp(sprintf(' port: %i',cluster.port));41 disp(sprintf(' queue: %s',cluster.queue));42 disp(sprintf(' time: %i',cluster.time));43 disp(sprintf(' codepath: %s',cluster.codepath));44 disp(sprintf(' executionpath: %s',cluster.executionpath));45 end46 %}}}47 function numprocs=np(cluster) % {{{48 %compute number of processors49 numprocs=cluster.numnodes*cluster.cpuspernode;50 end51 %}}}52 function md = checkconsistency(cluster,md,solution,analyses) % {{{30 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 31 end 32 %}}} 33 function disp(cluster) % {{{ 34 % display the object 35 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 36 disp(sprintf(' name: %s',cluster.name)); 37 disp(sprintf(' login: %s',cluster.login)); 38 disp(sprintf(' numnodes: %i',cluster.numnodes)); 39 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 40 disp(sprintf(' port: %i',cluster.port)); 41 disp(sprintf(' queue: %s',cluster.queue)); 42 disp(sprintf(' time: %i',cluster.time)); 43 disp(sprintf(' codepath: %s',cluster.codepath)); 44 disp(sprintf(' executionpath: %s',cluster.executionpath)); 45 end 46 %}}} 47 function numprocs=nprocs(cluster) % {{{ 48 %compute number of processors 49 numprocs=cluster.numnodes*cluster.cpuspernode; 50 end 51 %}}} 52 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 53 53 54 available_queues={'debugq','shortq','mediumq','longq','verylongq'};55 queue_requirements_time=[60*1 60*3 60*12 60*48 60*192];56 queue_requirements_np=[16 256 256 128 128];54 available_queues={'debugq','shortq','mediumq','longq','verylongq'}; 55 queue_requirements_time=[60*1 60*3 60*12 60*48 60*192]; 56 queue_requirements_np=[16 256 256 128 128]; 57 57 58 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.numnodes.*cluster.cpuspernode,cluster.time)59 end60 %}}}61 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{58 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.numnodes.*cluster.cpuspernode,cluster.time) 59 end 60 %}}} 61 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 62 62 63 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end64 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end65 executable='issm.exe';66 if isdakota,67 version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));68 if (version>=6),69 executable='issm_dakota.exe';70 end71 end72 if isoceancoupling,73 executable='issm_ocean.exe';74 end63 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 64 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 65 executable='issm.exe'; 66 if isdakota, 67 version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3)); 68 if (version>=6), 69 executable='issm_dakota.exe'; 70 end 71 end 72 if isoceancoupling, 73 executable='issm_ocean.exe'; 74 end 75 75 76 %write queuing script77 fid=fopen([modelname '.queue'],'w');78 fprintf(fid,'#!/bin/bash\n');79 fprintf(fid,'#PBS -l select=%i:ncpus=%i\n',cluster.numnodes,cluster.cpuspernode);80 fprintf(fid,'#PBS -N %s\n',modelname);81 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.82 fprintf(fid,'#PBS -q %s\n',cluster.queue);83 fprintf(fid,'#PBS -o %s.outlog \n',modelname);84 fprintf(fid,'#PBS -e %s.errlog \n',modelname);85 fprintf(fid,'source /usr/share/Modules/init/bash\n');86 for i=1:numel(cluster.modules), fprintf(fid,['module load ' cluster.modules{i} '\n\n']); end87 fprintf(fid,'export PATH="$PATH:."\n\n');88 fprintf(fid,'export MPI_GROUP_MAX=64\n\n');89 fprintf(fid,'export MPI_UNBUFFERED_STDIO=true\n\n');90 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath);91 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');92 fprintf(fid,'export PATH="$PATH:.:%s"\n',cluster.mpipath);93 fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]);94 fprintf(fid,'cd $PBS_O_WORKDIR\n');95 fprintf(fid,'mpirun -n %i %s/%s %s %s %s',cluster.np(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);96 fclose(fid);76 %write queuing script 77 fid=fopen([modelname '.queue'],'w'); 78 fprintf(fid,'#!/bin/bash\n'); 79 fprintf(fid,'#PBS -l select=%i:ncpus=%i\n',cluster.numnodes,cluster.cpuspernode); 80 fprintf(fid,'#PBS -N %s\n',modelname); 81 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds. 82 fprintf(fid,'#PBS -q %s\n',cluster.queue); 83 fprintf(fid,'#PBS -o %s.outlog \n',modelname); 84 fprintf(fid,'#PBS -e %s.errlog \n',modelname); 85 fprintf(fid,'source /usr/share/Modules/init/bash\n'); 86 for i=1:numel(cluster.modules), fprintf(fid,['module load ' cluster.modules{i} '\n\n']); end 87 fprintf(fid,'export PATH="$PATH:."\n\n'); 88 fprintf(fid,'export MPI_GROUP_MAX=64\n\n'); 89 fprintf(fid,'export MPI_UNBUFFERED_STDIO=true\n\n'); 90 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); 91 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); 92 fprintf(fid,'export PATH="$PATH:.:%s"\n',cluster.mpipath); 93 fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]); 94 fprintf(fid,'cd $PBS_O_WORKDIR\n'); 95 fprintf(fid,'mpirun -n %i %s/%s %s %s %s',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname); 96 fclose(fid); 97 97 98 end99 %}}}100 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{98 end 99 %}}} 100 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 101 101 102 %compress the files into one zip.103 compressstring=['tar -zcf ' dirname '.tar.gz '];104 for i=1:numel(filelist),105 compressstring = [compressstring ' ' filelist{i}];106 end107 system(compressstring);102 %compress the files into one zip. 103 compressstring=['tar -zcf ' dirname '.tar.gz ']; 104 for i=1:numel(filelist), 105 compressstring = [compressstring ' ' filelist{i}]; 106 end 107 system(compressstring); 108 108 109 disp('uploading input file and queueing script');110 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});109 disp('uploading input file and queueing script'); 110 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 111 111 112 end %}}}113 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{112 end %}}} 113 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 114 114 115 if ~isempty(restart)116 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];117 else118 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...119 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue '];120 end115 if ~isempty(restart) 116 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue ']; 117 else 118 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 119 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; 120 end 121 121 122 disp('launching solution sequence on remote cluster');123 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);122 disp('launching solution sequence on remote cluster'); 123 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 124 124 125 end %}}}126 function Download(cluster,dirname,filelist)% {{{125 end %}}} 126 function Download(cluster,dirname,filelist) % {{{ 127 127 128 %copy files from cluster to current directory129 directory=[cluster.executionpath '/' dirname '/'];130 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);128 %copy files from cluster to current directory 129 directory=[cluster.executionpath '/' dirname '/']; 130 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 131 131 132 end %}}}132 end %}}} 133 133 end 134 134 end -
issm/trunk-jpl/src/m/classes/clusters/camhpc.m
r22641 r26330 1 % PFEclass definition1 %CAMHPC cluster class definition 2 2 % 3 3 % Usage: … … 7 7 8 8 classdef camhpc 9 properties (SetAccess=public) 10 % {{{11 name = 'camhpc'12 login = '';13 numnodes = 20;14 cpuspernode = 8;15 port = 8000;16 project = '';17 partition = '';18 codepath = '';19 executionpath = '';20 interactive = 0;21 time = 24*60;22 memory = 2;23 end24 %}}}25 methods26 function cluster=camhpc(varargin) % {{{9 properties (SetAccess=public) 10 % {{{ 11 name = 'camhpc' 12 login = ''; 13 numnodes = 20; 14 cpuspernode = 8; 15 port = 8000; 16 project = ''; 17 partition = ''; 18 codepath = ''; 19 executionpath = ''; 20 interactive = 0; 21 time = 24*60; 22 memory = 2; 23 end 24 %}}} 25 methods 26 function cluster=camhpc(varargin) % {{{ 27 27 28 %initialize cluster using default settings if provided29 if (exist('camhpc_settings')==2), camhpc_settings; end28 %initialize cluster using default settings if provided 29 if (exist('camhpc_settings')==2), camhpc_settings; end 30 30 31 %use provided options to change fields32 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);33 end34 %}}}35 function disp(cluster) % {{{36 % display the object37 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));38 disp(sprintf(' name: %s',cluster.name));39 disp(sprintf(' login: %s',cluster.login));40 disp(sprintf(' port: %i',cluster.port));41 disp(sprintf(' numnodes: %i',cluster.numnodes));42 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode));43 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes));44 disp(sprintf(' project: %s',cluster.project));45 disp(sprintf(' partition: %s',cluster.partition));46 disp(sprintf(' codepath: %s',cluster.codepath));47 disp(sprintf(' executionpath: %s',cluster.executionpath));48 disp(sprintf(' interactive: %i',cluster.interactive));49 disp(sprintf(' time: %i',cluster.time));50 disp(sprintf(' memory: %i',cluster.memory));51 end52 %}}}53 function numprocs=np(cluster) % {{{54 %compute number of processors55 numprocs=cluster.numnodes*cluster.cpuspernode;56 end57 %}}}58 function md = checkconsistency(cluster,md,solution,analyses) % {{{31 %use provided options to change fields 32 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 33 end 34 %}}} 35 function disp(cluster) % {{{ 36 % display the object 37 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 38 disp(sprintf(' name: %s',cluster.name)); 39 disp(sprintf(' login: %s',cluster.login)); 40 disp(sprintf(' port: %i',cluster.port)); 41 disp(sprintf(' numnodes: %i',cluster.numnodes)); 42 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 43 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes)); 44 disp(sprintf(' project: %s',cluster.project)); 45 disp(sprintf(' partition: %s',cluster.partition)); 46 disp(sprintf(' codepath: %s',cluster.codepath)); 47 disp(sprintf(' executionpath: %s',cluster.executionpath)); 48 disp(sprintf(' interactive: %i',cluster.interactive)); 49 disp(sprintf(' time: %i',cluster.time)); 50 disp(sprintf(' memory: %i',cluster.memory)); 51 end 52 %}}} 53 function numprocs=nprocs(cluster) % {{{ 54 %compute number of processors 55 numprocs=cluster.numnodes*cluster.cpuspernode; 56 end 57 %}}} 58 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 59 59 60 available_queues={'ARNOLD-SL3-CPU'}; % Updated for csd3 NSA 28/3/1861 queue_requirements_time=[Inf Inf];62 queue_requirements_np=[80 80];60 available_queues={'ARNOLD-SL3-CPU'}; % Updated for csd3 NSA 28/3/18 61 queue_requirements_time=[Inf Inf]; 62 queue_requirements_np=[80 80]; 63 63 64 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.project,cluster.np,1)64 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.project,cluster.np,1) 65 65 66 %Miscelaneous67 if isempty(cluster.login), md = checkmessage(md,'login empty'); end68 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end69 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end66 %Miscelaneous 67 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 68 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end 69 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end 70 70 71 end72 %}}}73 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{71 end 72 %}}} 73 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 74 74 75 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end76 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end75 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 76 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 77 77 78 %write queuing script79 disp(modelname)80 fid=fopen([modelname '.queue'],'w');81 fprintf(fid,'#!/bin/bash\n');82 fprintf(fid,'#SBATCH --job-name=%s\n',modelname);83 fprintf(fid,'#SBATCH -p %s \n',cluster.partition);84 fprintf(fid,'#SBATCH -A %s \n',cluster.project);85 fprintf(fid,'#SBATCH --mail-type=ALL\n');86 fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode);87 fprintf(fid,'#SBATCH --time=%i\n',cluster.time*60) %walltime is in seconds.88 fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);89 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);90 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);91 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME92 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME93 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);94 fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);95 if ~io_gather, %concatenate the output files:96 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);97 end98 fclose(fid);78 %write queuing script 79 disp(modelname) 80 fid=fopen([modelname '.queue'],'w'); 81 fprintf(fid,'#!/bin/bash\n'); 82 fprintf(fid,'#SBATCH --job-name=%s\n',modelname); 83 fprintf(fid,'#SBATCH -p %s \n',cluster.partition); 84 fprintf(fid,'#SBATCH -A %s \n',cluster.project); 85 fprintf(fid,'#SBATCH --mail-type=ALL\n'); 86 fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode); 87 fprintf(fid,'#SBATCH --time=%i\n',cluster.time*60) %walltime is in seconds. 88 fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory); 89 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname); 90 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname); 91 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME 92 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 93 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname); 94 fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 95 if ~io_gather, %concatenate the output files: 96 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 97 end 98 fclose(fid); 99 99 100 %in interactive mode, create a run file, and errlog and outlog file101 if cluster.interactive,102 fid=fopen([modelname '.run'],'w');103 fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);104 if ~io_gather, %concatenate the output files:105 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);106 end107 fclose(fid);108 fid=fopen([modelname '.errlog'],'w');109 fclose(fid);110 fid=fopen([modelname '.outlog'],'w');111 fclose(fid);112 end113 end %}}}114 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{100 %in interactive mode, create a run file, and errlog and outlog file 101 if cluster.interactive, 102 fid=fopen([modelname '.run'],'w'); 103 fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 104 if ~io_gather, %concatenate the output files: 105 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 106 end 107 fclose(fid); 108 fid=fopen([modelname '.errlog'],'w'); 109 fclose(fid); 110 fid=fopen([modelname '.outlog'],'w'); 111 fclose(fid); 112 end 113 end %}}} 114 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 115 115 116 %compress the files into one zip.117 compressstring=['tar -zcf ' dirname '.tar.gz '];118 for i=1:numel(filelist),119 compressstring = [compressstring ' ' filelist{i}];120 end121 if cluster.interactive,122 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];123 end124 system(compressstring);116 %compress the files into one zip. 117 compressstring=['tar -zcf ' dirname '.tar.gz ']; 118 for i=1:numel(filelist), 119 compressstring = [compressstring ' ' filelist{i}]; 120 end 121 if cluster.interactive, 122 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 123 end 124 system(compressstring); 125 125 126 disp('uploading input file and queueing script');127 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});126 disp('uploading input file and queueing script'); 127 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 128 128 129 end %}}}130 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{129 end %}}} 130 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 131 131 132 disp('launching solution sequence on remote cluster');132 disp('launching solution sequence on remote cluster'); 133 133 % 134 134 % qsub replaced by sbatch for csd3 system NSA 28/3/18 135 if ~isempty(restart)136 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue '];137 else138 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...139 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && sbatch ' modelname '.queue '];140 end141 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);142 end %}}}143 function Download(cluster,dirname,filelist)% {{{135 if ~isempty(restart) 136 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue ']; 137 else 138 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 139 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && sbatch ' modelname '.queue ']; 140 end 141 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 142 end %}}} 143 function Download(cluster,dirname,filelist) % {{{ 144 144 145 %copy files from cluster to current directory146 directory=[cluster.executionpath '/' dirname '/'];147 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);145 %copy files from cluster to current directory 146 directory=[cluster.executionpath '/' dirname '/']; 147 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 148 148 149 end %}}}149 end %}}} 150 150 end 151 151 end -
issm/trunk-jpl/src/m/classes/clusters/discover.m
r25018 r26330 1 % PFEclass definition1 %DISCOVER cluster class definition 2 2 % 3 3 % Usage: … … 6 6 % cluster=discover('np',3,'login','username'); 7 7 8 classdef discover 9 properties (SetAccess=public) 10 % {{{11 name=oshostname();12 login='';13 modules = {};14 numnodes=20;15 cpuspernode=8;16 port=0;17 queue='general';18 time=12*60*60;19 processor='west';20 codepath='';21 executionpath='';22 interactive=0;23 bbftp=0;24 numstreams=8;25 hyperthreading=0;26 email='';27 end28 %}}}29 methods30 function cluster=discover(varargin) % {{{31 32 %initialize cluster using default settings if provided33 if (exist('discover_settings')==2), discover_settings; end34 35 %use provided options to change fields36 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);37 end38 %}}}39 function disp(cluster) % {{{40 % display the object41 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));42 disp(sprintf(' name: %s',cluster.name));43 disp(sprintf(' login: %s',cluster.login));44 disp(sprintf(' modules: %s',strjoin(cluster.modules,', ')));45 disp(sprintf(' port: %i',cluster.port));46 disp(sprintf(' numnodes: %i',cluster.numnodes));47 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode));48 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes));49 disp(sprintf(' queue: %s',cluster.queue));50 disp(sprintf(' time: %i',cluster.time));51 disp(sprintf(' processor: %s',cluster.processor));52 disp(sprintf(' codepath: %s',cluster.codepath));53 disp(sprintf(' executionpath: %s',cluster.executionpath));54 disp(sprintf(' interactive: %i',cluster.interactive));55 disp(sprintf(' hyperthreading: %i',cluster.hyperthreading));56 disp(sprintf(' email: %s',cluster.email));57 end58 %}}}59 function numprocs=np(cluster) % {{{60 %compute number of processors61 numprocs=cluster.numnodes*cluster.cpuspernode;62 end63 %}}}64 function md = checkconsistency(cluster,md,solution,analyses) % {{{65 66 available_queues={'long','allnccs','debug'};67 queue_requirements_time=[24*60*60 12*60*60 1*60*60];68 queue_requirements_np=[560 6000 532];69 70 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)71 72 %now, check cluster.cpuspernode according to processor type73 if ( strcmpi(cluster.processor,'sand')),74 if ((cluster.cpuspernode>16 ) | (cluster.cpuspernode<1)),75 md = checkmessage(md,'cpuspernode should be between 1 and 16 for ''sand'' processors');76 end77 elseif strcmpi(cluster.processor,'hasw'),78 if ((cluster.cpuspernode>28 ) | (cluster.cpuspernode<1)),79 md = checkmessage(md,'cpuspernode should be between 1 and 28 for ''hasw'' processors');80 end81 else82 md = checkmessage(md,'unknown processor type, should be ''sand'' or ''hasw'' ');83 end84 85 %Miscelaneous86 if isempty(cluster.login), md = checkmessage(md,'login empty'); end87 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end88 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end89 90 end91 %}}}92 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{93 94 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end95 96 executable='issm.exe';97 if isdakota,98 version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));99 if (version>=6),100 executable='issm_dakota.exe';101 end102 end103 if isoceancoupling,104 executable='issm_ocean.exe';105 end106 107 %write queuing script108 fid=fopen([modelname '.queue'],'w');109 110 fprintf(fid,'#!/bin/bash\n');111 fprintf(fid,'#SBATCH -J %s \n',modelname);112 fprintf(fid,'#SBATCH --qos=%s \n',cluster.queue);113 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);114 fprintf(fid,'#SBATCH -e %s.errlog \n',modelname);115 fprintf(fid,'#SBATCH -n %i \n',cluster.numnodes*cluster.cpuspernode);116 fprintf(fid,'#SBATCH -N %i \n',cluster.numnodes);117 fprintf(fid,'#SBATCH -t %02i:%02i:00 \n',floor(cluster.time/3600),floor(mod(cluster.time,3600)/60));118 fprintf(fid,'#SBATCH -A s1690 \n\n');119 for i=1:numel(cluster.modules),120 fprintf(fid,['module load ' cluster.modules{i} '\n']);121 end122 if length(find(cluster.email=='@'))>0123 fprintf(fid,'#SBATCH --mail-user=%s \n',cluster.email);124 fprintf(fid,'#SBATCH --mail-type=end \n\n');125 end126 fprintf(fid,'. /usr/share/modules/init/bash\n\n');127 fprintf(fid,'module load comp/intel/20.0.0.166\n');128 fprintf(fid,'module load mpi/sgi-mpt/2.17\n');129 fprintf(fid,'module load cmake/3.17.0\n');130 fprintf(fid,'export MPI_GROUP_MAX=64\n\n');131 fprintf(fid,'export MPI_UNBUFFERED_STDIO=true\n\n');132 fprintf(fid,'export PATH="$PATH:."\n\n');133 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME134 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME135 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);136 137 fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);138 if ~io_gather, %concatenate the output files:139 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);140 end141 fclose(fid);142 143 %in interactive mode, create a run file, and errlog and outlog file144 if cluster.interactive,145 fid=fopen([modelname '.run'],'w');146 if ~isvalgrind,147 fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);148 else149 fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);150 end151 if ~io_gather, %concatenate the output files:152 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);153 end154 fclose(fid);155 fid=fopen([modelname '.errlog'],'w');156 fclose(fid);157 fid=fopen([modelname '.outlog'],'w');158 fclose(fid);159 end160 end %}}}161 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{162 163 %compress the files into one zip.164 compressstring=['tar -zcf ' dirname '.tar.gz '];165 for i=1:numel(filelist),166 compressstring = [compressstring ' ' filelist{i}];167 end168 if cluster.interactive,169 compressstring = [compressstring ' ' modelname '.run ' modelname '.errlog ' modelname '.outlog '];170 end171 system(compressstring);172 173 disp('uploading input file and queueing script');174 if cluster.interactive,175 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive)];176 else177 directory=cluster.executionpath;178 end179 180 if ~cluster.bbftp,181 issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']});182 else183 issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']});184 end185 186 end187 %}}}188 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{189 190 if ~cluster.interactive,191 if ~isempty(restart)192 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && sbatch ' modelname '.queue '];193 else194 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...195 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && sbatch ' modelname '.queue '];196 end197 else198 if ~isempty(restart)199 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive)];200 else201 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' dirname '.tar.gz'];202 end203 end204 205 disp('launching solution sequence on remote cluster');206 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);207 end208 %}}}209 function Download(cluster,dirname,filelist)% {{{210 211 %copy files from cluster to current directory212 if ~cluster.interactive,213 directory=[cluster.executionpath '/' dirname '/'];214 else215 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive) '/'];216 end217 218 if ~cluster.bbftp,219 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);220 else221 issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist);222 end223 224 end %}}}8 classdef discover 9 properties (SetAccess=public) 10 % {{{ 11 name=oshostname(); 12 login=''; 13 modules = {}; 14 numnodes=20; 15 cpuspernode=8; 16 port=0; 17 queue='general'; 18 time=12*60*60; 19 processor='west'; 20 codepath=''; 21 executionpath=''; 22 interactive=0; 23 bbftp=0; 24 numstreams=8; 25 hyperthreading=0; 26 email=''; 27 end 28 %}}} 29 methods 30 function cluster=discover(varargin) % {{{ 31 32 %initialize cluster using default settings if provided 33 if (exist('discover_settings')==2), discover_settings; end 34 35 %use provided options to change fields 36 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 37 end 38 %}}} 39 function disp(cluster) % {{{ 40 % display the object 41 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 42 disp(sprintf(' name: %s',cluster.name)); 43 disp(sprintf(' login: %s',cluster.login)); 44 disp(sprintf(' modules: %s',strjoin(cluster.modules,', '))); 45 disp(sprintf(' port: %i',cluster.port)); 46 disp(sprintf(' numnodes: %i',cluster.numnodes)); 47 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 48 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes)); 49 disp(sprintf(' queue: %s',cluster.queue)); 50 disp(sprintf(' time: %i',cluster.time)); 51 disp(sprintf(' processor: %s',cluster.processor)); 52 disp(sprintf(' codepath: %s',cluster.codepath)); 53 disp(sprintf(' executionpath: %s',cluster.executionpath)); 54 disp(sprintf(' interactive: %i',cluster.interactive)); 55 disp(sprintf(' hyperthreading: %i',cluster.hyperthreading)); 56 disp(sprintf(' email: %s',cluster.email)); 57 end 58 %}}} 59 function numprocs=nprocs(cluster) % {{{ 60 %compute number of processors 61 numprocs=cluster.numnodes*cluster.cpuspernode; 62 end 63 %}}} 64 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 65 66 available_queues={'long','allnccs','debug'}; 67 queue_requirements_time=[24*60*60 12*60*60 1*60*60]; 68 queue_requirements_np=[560 6000 532]; 69 70 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time) 71 72 %now, check cluster.cpuspernode according to processor type 73 if ( strcmpi(cluster.processor,'sand')), 74 if ((cluster.cpuspernode>16 ) | (cluster.cpuspernode<1)), 75 md = checkmessage(md,'cpuspernode should be between 1 and 16 for ''sand'' processors'); 76 end 77 elseif strcmpi(cluster.processor,'hasw'), 78 if ((cluster.cpuspernode>28 ) | (cluster.cpuspernode<1)), 79 md = checkmessage(md,'cpuspernode should be between 1 and 28 for ''hasw'' processors'); 80 end 81 else 82 md = checkmessage(md,'unknown processor type, should be ''sand'' or ''hasw'' '); 83 end 84 85 %Miscelaneous 86 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 87 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end 88 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end 89 90 end 91 %}}} 92 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 93 94 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 95 96 executable='issm.exe'; 97 if isdakota, 98 version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3)); 99 if (version>=6), 100 executable='issm_dakota.exe'; 101 end 102 end 103 if isoceancoupling, 104 executable='issm_ocean.exe'; 105 end 106 107 %write queuing script 108 fid=fopen([modelname '.queue'],'w'); 109 110 fprintf(fid,'#!/bin/bash\n'); 111 fprintf(fid,'#SBATCH -J %s \n',modelname); 112 fprintf(fid,'#SBATCH --qos=%s \n',cluster.queue); 113 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname); 114 fprintf(fid,'#SBATCH -e %s.errlog \n',modelname); 115 fprintf(fid,'#SBATCH -n %i \n',cluster.numnodes*cluster.cpuspernode); 116 fprintf(fid,'#SBATCH -N %i \n',cluster.numnodes); 117 fprintf(fid,'#SBATCH -t %02i:%02i:00 \n',floor(cluster.time/3600),floor(mod(cluster.time,3600)/60)); 118 fprintf(fid,'#SBATCH -A s1690 \n\n'); 119 for i=1:numel(cluster.modules), 120 fprintf(fid,['module load ' cluster.modules{i} '\n']); 121 end 122 if length(find(cluster.email=='@'))>0 123 fprintf(fid,'#SBATCH --mail-user=%s \n',cluster.email); 124 fprintf(fid,'#SBATCH --mail-type=end \n\n'); 125 end 126 fprintf(fid,'. /usr/share/modules/init/bash\n\n'); 127 fprintf(fid,'module load comp/intel/20.0.0.166\n'); 128 fprintf(fid,'module load mpi/sgi-mpt/2.17\n'); 129 fprintf(fid,'module load cmake/3.17.0\n'); 130 fprintf(fid,'export MPI_GROUP_MAX=64\n\n'); 131 fprintf(fid,'export MPI_UNBUFFERED_STDIO=true\n\n'); 132 fprintf(fid,'export PATH="$PATH:."\n\n'); 133 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME 134 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 135 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname); 136 137 fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname); 138 if ~io_gather, %concatenate the output files: 139 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 140 end 141 fclose(fid); 142 143 %in interactive mode, create a run file, and errlog and outlog file 144 if cluster.interactive, 145 fid=fopen([modelname '.run'],'w'); 146 if ~isvalgrind, 147 fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname); 148 else 149 fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname); 150 end 151 if ~io_gather, %concatenate the output files: 152 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 153 end 154 fclose(fid); 155 fid=fopen([modelname '.errlog'],'w'); 156 fclose(fid); 157 fid=fopen([modelname '.outlog'],'w'); 158 fclose(fid); 159 end 160 end %}}} 161 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 162 163 %compress the files into one zip. 164 compressstring=['tar -zcf ' dirname '.tar.gz ']; 165 for i=1:numel(filelist), 166 compressstring = [compressstring ' ' filelist{i}]; 167 end 168 if cluster.interactive, 169 compressstring = [compressstring ' ' modelname '.run ' modelname '.errlog ' modelname '.outlog ']; 170 end 171 system(compressstring); 172 173 disp('uploading input file and queueing script'); 174 if cluster.interactive, 175 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive)]; 176 else 177 directory=cluster.executionpath; 178 end 179 180 if ~cluster.bbftp, 181 issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']}); 182 else 183 issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']}); 184 end 185 186 end 187 %}}} 188 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 189 190 if ~cluster.interactive, 191 if ~isempty(restart) 192 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && sbatch ' modelname '.queue ']; 193 else 194 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 195 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && sbatch ' modelname '.queue ']; 196 end 197 else 198 if ~isempty(restart) 199 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive)]; 200 else 201 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' dirname '.tar.gz']; 202 end 203 end 204 205 disp('launching solution sequence on remote cluster'); 206 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 207 end 208 %}}} 209 function Download(cluster,dirname,filelist) % {{{ 210 211 %copy files from cluster to current directory 212 if ~cluster.interactive, 213 directory=[cluster.executionpath '/' dirname '/']; 214 else 215 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive) '/']; 216 end 217 218 if ~cluster.bbftp, 219 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 220 else 221 issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist); 222 end 223 224 end %}}} 225 225 end 226 226 end -
issm/trunk-jpl/src/m/classes/clusters/generic.m
r26168 r26330 286 286 end 287 287 %}}} 288 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{288 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 289 289 290 290 if ~ispc, … … 307 307 end 308 308 end %}}} 309 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{309 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 310 310 311 311 if ~ispc, … … 336 336 337 337 end %}}} 338 function LaunchQueueJobIceOcean(cluster,modelname,dirname,filelist,restart,batch) % {{{338 function LaunchQueueJobIceOcean(cluster,modelname,dirname,filelist,restart,batch) % {{{ 339 339 340 340 if ~ispc, … … 365 365 366 366 end %}}} 367 function Download(cluster,dirname,filelist) % {{{367 function Download(cluster,dirname,filelist) % {{{ 368 368 369 369 if ispc(), -
issm/trunk-jpl/src/m/classes/clusters/generic.py
r26184 r26330 4 4 import numpy as np 5 5 6 from fielddisplay import fielddisplay 6 7 try: 7 8 from generic_settings import generic_settings … … 39 40 self.shell = '/bin/sh' 40 41 41 # use provided options to change fields42 # Use provided options to change fields 42 43 options = pairoptions(*args) 43 44 44 # get name45 # Get name 45 46 self.name = gethostname() 46 47 47 #initialize cluster using user settings if provided 48 48 # Initialize cluster using user settings if provided 49 49 try: 50 50 self = generic_settings(self) 51 51 except NameError: 52 print( "generic_settings.py not found, using default settings")53 54 # OK get other fields52 print('generic_settings.py not found, using default settings') 53 54 # OK get other fields 55 55 self = options.AssignObjectFields(self) 56 56 # }}} … … 59 59 # display the object 60 60 s = "class '%s' object '%s' = \n" % (type(self), 'self') 61 s += " name: %s\n" % self.name62 s += " login: %s\n" % self.login63 s += " np: %i\n" % self.np64 s += " port: %i\n" % self.port65 s += " codepath: %s\n" % self.codepath66 s += " executionpath: %s\n" % self.executionpath67 s += " valgrind: %s\n" % self.valgrind68 s += " valgrindlib: %s\n" % self.valgrindlib69 s += " valgrindsup: %s\n" % self.valgrindsup70 s += " verbose: %s\n" % self.verbose71 s += " shell: %s\n" % self.shell61 s += '{}\n'.format(fielddisplay(self, 'name', '')) 62 s += '{}\n'.format(fielddisplay(self, 'login', '')) 63 s += '{}\n'.format(fielddisplay(self, 'np', '')) 64 s += '{}\n'.format(fielddisplay(self, 'port', '')) 65 s += '{}\n'.format(fielddisplay(self, 'codepath', '')) 66 s += '{}\n'.format(fielddisplay(self, 'executionpath', '')) 67 s += '{}\n'.format(fielddisplay(self, 'valgrind', '')) 68 s += '{}\n'.format(fielddisplay(self, 'valgrindlib', '')) 69 s += '{}\n'.format(fielddisplay(self, 'valgrindsup', '')) 70 s += '{}\n'.format(fielddisplay(self, 'verbose', '')) 71 s += '{}\n'.format(fielddisplay(self, 'shell', '')) 72 72 return s 73 73 # }}} -
issm/trunk-jpl/src/m/classes/clusters/greenplanet.m
r25871 r26330 1 % PFEclass definition1 %GREENPLANET cluster class definition 2 2 % 3 3 % Usage: … … 7 7 8 8 classdef greenplanet 9 properties (SetAccess=public) 10 % {{{11 name = 'greenplanet'12 login = '';13 numnodes = 20;14 cpuspernode = 8;15 port = 8000;16 queue = 'c6145';17 codepath = '';18 executionpath = '';19 interactive = 0;20 time = 24*60;21 memory = 2;22 end23 %}}}24 methods25 function cluster=greenplanet(varargin) % {{{9 properties (SetAccess=public) 10 % {{{ 11 name = 'greenplanet' 12 login = ''; 13 numnodes = 20; 14 cpuspernode = 8; 15 port = 8000; 16 queue = 'c6145'; 17 codepath = ''; 18 executionpath = ''; 19 interactive = 0; 20 time = 24*60; 21 memory = 2; 22 end 23 %}}} 24 methods 25 function cluster=greenplanet(varargin) % {{{ 26 26 27 %initialize cluster using default settings if provided28 if (exist('greenplanet_settings')==2), greenplanet_settings; end27 %initialize cluster using default settings if provided 28 if (exist('greenplanet_settings')==2), greenplanet_settings; end 29 29 30 %use provided options to change fields31 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);32 end33 %}}}34 function disp(cluster) % {{{35 % display the object36 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));37 disp(sprintf(' name: %s',cluster.name));38 disp(sprintf(' login: %s',cluster.login));39 disp(sprintf(' port: %i',cluster.port));40 disp(sprintf(' numnodes: %i',cluster.numnodes));41 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode));42 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes));43 disp(sprintf(' queue: %s',cluster.queue));44 disp(sprintf(' codepath: %s',cluster.codepath));45 disp(sprintf(' executionpath: %s',cluster.executionpath));46 disp(sprintf(' interactive: %i',cluster.interactive));47 disp(sprintf(' time: %i',cluster.time));48 disp(sprintf(' memory: %i',cluster.memory));49 end50 %}}}51 function numprocs=np(cluster) % {{{52 %compute number of processors53 numprocs=cluster.numnodes*cluster.cpuspernode;54 end55 %}}}56 function md = checkconsistency(cluster,md,solution,analyses) % {{{30 %use provided options to change fields 31 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 32 end 33 %}}} 34 function disp(cluster) % {{{ 35 % display the object 36 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 37 disp(sprintf(' name: %s',cluster.name)); 38 disp(sprintf(' login: %s',cluster.login)); 39 disp(sprintf(' port: %i',cluster.port)); 40 disp(sprintf(' numnodes: %i',cluster.numnodes)); 41 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 42 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes)); 43 disp(sprintf(' queue: %s',cluster.queue)); 44 disp(sprintf(' codepath: %s',cluster.codepath)); 45 disp(sprintf(' executionpath: %s',cluster.executionpath)); 46 disp(sprintf(' interactive: %i',cluster.interactive)); 47 disp(sprintf(' time: %i',cluster.time)); 48 disp(sprintf(' memory: %i',cluster.memory)); 49 end 50 %}}} 51 function numprocs=nprocs(cluster) % {{{ 52 %compute number of processors 53 numprocs=cluster.numnodes*cluster.cpuspernode; 54 end 55 %}}} 56 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 57 57 58 available_queues={'brd2.4','has2.5','ilg2.3','m-c1.9','m-c2.2','nes2.8','sib2.9','m2090','default'};59 queue_requirements_time=[Inf Inf Inf Inf Inf Inf Inf Inf Inf];60 queue_requirements_np=[80 80 80 80 80 80 80 80 80];58 available_queues={'brd2.4','has2.5','ilg2.3','m-c1.9','m-c2.2','nes2.8','sib2.9','m2090','default'}; 59 queue_requirements_time=[Inf Inf Inf Inf Inf Inf Inf Inf Inf]; 60 queue_requirements_np=[80 80 80 80 80 80 80 80 80]; 61 61 62 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)62 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1) 63 63 64 %Miscelaneous65 if isempty(cluster.login), md = checkmessage(md,'login empty'); end66 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end67 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end64 %Miscelaneous 65 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 66 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end 67 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end 68 68 69 end70 %}}}71 function BuildKrigingQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{69 end 70 %}}} 71 function BuildKrigingQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 72 72 73 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end74 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end73 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 74 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 75 75 76 %write queuing script77 fid=fopen([modelname '.queue'],'w');78 fprintf(fid,'#!/bin/bash\n');79 fprintf(fid,'#SBATCH --job-name=%s\n',modelname);80 fprintf(fid,'#SBATCH -p %s \n',cluster.queue);81 fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode);82 fprintf(fid,'#SBATCH --time=%i\n',cluster.time*60); %walltime is in seconds.83 fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);84 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);85 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);86 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME87 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME88 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);89 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);90 if ~io_gather, %concatenate the output files:91 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);92 end93 fclose(fid);94 end95 %}}}96 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{76 %write queuing script 77 fid=fopen([modelname '.queue'],'w'); 78 fprintf(fid,'#!/bin/bash\n'); 79 fprintf(fid,'#SBATCH --job-name=%s\n',modelname); 80 fprintf(fid,'#SBATCH -p %s \n',cluster.queue); 81 fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode); 82 fprintf(fid,'#SBATCH --time=%i\n',cluster.time*60); %walltime is in seconds. 83 fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory); 84 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname); 85 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname); 86 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME 87 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 88 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname); 89 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname); 90 if ~io_gather, %concatenate the output files: 91 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 92 end 93 fclose(fid); 94 end 95 %}}} 96 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 97 97 98 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end99 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end98 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 99 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 100 100 101 %write queuing script102 fid=fopen([modelname '.queue'],'w');103 fprintf(fid,'#!/bin/bash\n');104 fprintf(fid,'#SBATCH --job-name=%s\n',modelname);105 fprintf(fid,'#SBATCH --partition=%s',cluster.queue{1});106 for i=2:length(cluster.queue)101 %write queuing script 102 fid=fopen([modelname '.queue'],'w'); 103 fprintf(fid,'#!/bin/bash\n'); 104 fprintf(fid,'#SBATCH --job-name=%s\n',modelname); 105 fprintf(fid,'#SBATCH --partition=%s',cluster.queue{1}); 106 for i=2:length(cluster.queue) 107 107 fprintf(fid,',%s',cluster.queue{i}); 108 end109 fprintf(fid,'\n');110 %fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode);111 %fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);112 fprintf(fid,'#SBATCH --nodes=%i\n',cluster.numnodes); % in general, just 1113 fprintf(fid,'#SBATCH --ntasks=%i\n',cluster.cpuspernode); % in general, just 1114 fprintf(fid,'#SBATCH --cpus-per-task=%i\n',1);115 fprintf(fid,'#SBATCH --mem=%igb\n',cluster.memory); % minimum total node memory required116 fprintf(fid,'#SBATCH --time=%s\n',datestr(cluster.time/24,'HH:MM:SS')); %walltime is in HH:MM:SS format. cluster.time is in hour117 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);118 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);119 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME120 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME121 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);122 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);123 if ~io_gather, %concatenate the output files:124 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);125 end126 fclose(fid);108 end 109 fprintf(fid,'\n'); 110 %fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode); 111 %fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory); 112 fprintf(fid,'#SBATCH --nodes=%i\n',cluster.numnodes); % in general, just 1 113 fprintf(fid,'#SBATCH --ntasks=%i\n',cluster.cpuspernode); % in general, just 1 114 fprintf(fid,'#SBATCH --cpus-per-task=%i\n',1); 115 fprintf(fid,'#SBATCH --mem=%igb\n',cluster.memory); % minimum total node memory required 116 fprintf(fid,'#SBATCH --time=%s\n',datestr(cluster.time/24,'HH:MM:SS')); %walltime is in HH:MM:SS format. cluster.time is in hour 117 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname); 118 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname); 119 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME 120 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 121 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname); 122 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 123 if ~io_gather, %concatenate the output files: 124 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 125 end 126 fclose(fid); 127 127 128 %in interactive mode, create a run file, and errlog and outlog file129 if cluster.interactive,130 fid=fopen([modelname '.run'],'w');131 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);132 if ~io_gather, %concatenate the output files:133 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);134 end135 fclose(fid);136 fid=fopen([modelname '.errlog'],'w');137 fclose(fid);138 fid=fopen([modelname '.outlog'],'w');139 fclose(fid);140 end141 end %}}}142 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{128 %in interactive mode, create a run file, and errlog and outlog file 129 if cluster.interactive, 130 fid=fopen([modelname '.run'],'w'); 131 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 132 if ~io_gather, %concatenate the output files: 133 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 134 end 135 fclose(fid); 136 fid=fopen([modelname '.errlog'],'w'); 137 fclose(fid); 138 fid=fopen([modelname '.outlog'],'w'); 139 fclose(fid); 140 end 141 end %}}} 142 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 143 143 144 %compress the files into one zip.145 compressstring=['tar -zcf ' dirname '.tar.gz '];146 for i=1:numel(filelist),147 compressstring = [compressstring ' ' filelist{i}];148 end149 if cluster.interactive,150 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];151 end152 system(compressstring);144 %compress the files into one zip. 145 compressstring=['tar -zcf ' dirname '.tar.gz ']; 146 for i=1:numel(filelist), 147 compressstring = [compressstring ' ' filelist{i}]; 148 end 149 if cluster.interactive, 150 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 151 end 152 system(compressstring); 153 153 154 disp('uploading input file and queueing script');155 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});154 disp('uploading input file and queueing script'); 155 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 156 156 157 end %}}}158 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{157 end %}}} 158 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 159 159 160 disp('launching solution sequence on remote cluster');161 if ~isempty(restart)162 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue '];163 else164 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...165 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && sbatch ' modelname '.queue '];166 end167 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);168 end %}}}169 function Download(cluster,dirname,filelist)% {{{160 disp('launching solution sequence on remote cluster'); 161 if ~isempty(restart) 162 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue ']; 163 else 164 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 165 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && sbatch ' modelname '.queue ']; 166 end 167 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 168 end %}}} 169 function Download(cluster,dirname,filelist) % {{{ 170 170 171 %copy files from cluster to current directory172 directory=[cluster.executionpath '/' dirname '/'];173 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);171 %copy files from cluster to current directory 172 directory=[cluster.executionpath '/' dirname '/']; 173 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 174 174 175 end %}}}175 end %}}} 176 176 end 177 177 end -
issm/trunk-jpl/src/m/classes/clusters/hpc.m
r23775 r26330 1 %HPC cl ass definition1 %HPC cluster class definition 2 2 % 3 3 % Usage: … … 7 7 8 8 classdef hpc 9 properties (SetAccess=public) 10 % {{{11 name='hpc.oit.uci.edu'12 login='';13 numnodes=1;14 cpuspernode=4;15 port=0;16 queue='pub64';17 codepath='';18 executionpath='';19 interactive=0;20 end21 %}}}22 methods23 function cluster=hpc(varargin) % {{{9 properties (SetAccess=public) 10 % {{{ 11 name='hpc.oit.uci.edu' 12 login=''; 13 numnodes=1; 14 cpuspernode=4; 15 port=0; 16 queue='pub64'; 17 codepath=''; 18 executionpath=''; 19 interactive=0; 20 end 21 %}}} 22 methods 23 function cluster=hpc(varargin) % {{{ 24 24 25 %initialize cluster using default settings if provided26 if (exist('hpc_settings')==2), hpc_settings; end25 %initialize cluster using default settings if provided 26 if (exist('hpc_settings')==2), hpc_settings; end 27 27 28 %use provided options to change fields29 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);30 end31 %}}}32 function disp(cluster) % {{{33 % display the object34 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));35 disp(sprintf(' name: %s',cluster.name));36 disp(sprintf(' login: %s',cluster.login));37 disp(sprintf(' port: %i',cluster.port));38 disp(sprintf(' numnodes: %i',cluster.numnodes));39 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode));40 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes));41 disp(sprintf(' queue: %s',cluster.queue));42 disp(sprintf(' codepath: %s',cluster.codepath));43 disp(sprintf(' executionpath: %s',cluster.executionpath));44 disp(sprintf(' interactive: %i',cluster.interactive));45 end46 %}}}47 function numprocs=np(cluster) % {{{48 %compute number of processors49 numprocs=cluster.numnodes*cluster.cpuspernode;50 end51 %}}}52 function md = checkconsistency(cluster,md,solution,analyses) % {{{28 %use provided options to change fields 29 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 30 end 31 %}}} 32 function disp(cluster) % {{{ 33 % display the object 34 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 35 disp(sprintf(' name: %s',cluster.name)); 36 disp(sprintf(' login: %s',cluster.login)); 37 disp(sprintf(' port: %i',cluster.port)); 38 disp(sprintf(' numnodes: %i',cluster.numnodes)); 39 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 40 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes)); 41 disp(sprintf(' queue: %s',cluster.queue)); 42 disp(sprintf(' codepath: %s',cluster.codepath)); 43 disp(sprintf(' executionpath: %s',cluster.executionpath)); 44 disp(sprintf(' interactive: %i',cluster.interactive)); 45 end 46 %}}} 47 function numprocs=nprocs(cluster) % {{{ 48 %compute number of processors 49 numprocs=cluster.numnodes*cluster.cpuspernode; 50 end 51 %}}} 52 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 53 53 54 available_queues={'pub64','free64','free48','free*,pub64','free*'};55 queue_requirements_time=[Inf Inf Inf Inf Inf];56 queue_requirements_np=[64 64 48 48 48];54 available_queues={'pub64','free64','free48','free*,pub64','free*'}; 55 queue_requirements_time=[Inf Inf Inf Inf Inf]; 56 queue_requirements_np=[64 64 48 48 48]; 57 57 58 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)58 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1) 59 59 60 %Miscelaneous61 if isempty(cluster.login), md = checkmessage(md,'login empty'); end62 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end63 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end60 %Miscelaneous 61 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 62 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end 63 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end 64 64 65 end66 %}}}67 function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{65 end 66 %}}} 67 function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{ 68 68 69 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end70 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end69 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 70 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 71 71 72 %write queuing script73 fid=fopen([modelname '.queue'],'w');74 fprintf(fid,'#!/bin/bash\n');75 fprintf(fid,'#$ -N %s\n',modelname);76 fprintf(fid,'#$ -q %s \n',cluster.queue);77 fprintf(fid,'#$ -pe one-node-mpi 2-64\n');78 fprintf(fid,'#$ -R y\n');79 fprintf(fid,'#$ -m beas\n');80 fprintf(fid,'#$ -o %s.outlog \n',modelname);81 fprintf(fid,'#$ -e %s.errlog \n\n',modelname);82 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME83 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME84 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,modelname);85 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);86 if ~io_gather, %concatenate the output files:87 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);88 end89 fclose(fid);90 end91 %}}}92 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{72 %write queuing script 73 fid=fopen([modelname '.queue'],'w'); 74 fprintf(fid,'#!/bin/bash\n'); 75 fprintf(fid,'#$ -N %s\n',modelname); 76 fprintf(fid,'#$ -q %s \n',cluster.queue); 77 fprintf(fid,'#$ -pe one-node-mpi 2-64\n'); 78 fprintf(fid,'#$ -R y\n'); 79 fprintf(fid,'#$ -m beas\n'); 80 fprintf(fid,'#$ -o %s.outlog \n',modelname); 81 fprintf(fid,'#$ -e %s.errlog \n\n',modelname); 82 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME 83 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 84 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,modelname); 85 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname); 86 if ~io_gather, %concatenate the output files: 87 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 88 end 89 fclose(fid); 90 end 91 %}}} 92 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 93 93 94 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end95 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end94 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 95 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 96 96 97 %write queuing script98 fid=fopen([modelname '.queue'],'w');99 fprintf(fid,'#!/bin/bash\n');100 fprintf(fid,'#$ -N %s\n',modelname);101 fprintf(fid,'#$ -q %s \n',cluster.queue);102 fprintf(fid,'#$ -pe one-node-mpi 2-64\n');103 fprintf(fid,'#$ -R y\n');104 %fprintf(fid,'#$ -m beas\n');105 fprintf(fid,'#$ -o %s.outlog \n',modelname);106 fprintf(fid,'#$ -e %s.errlog \n\n',modelname);107 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME108 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME109 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);110 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);111 if ~io_gather, %concatenate the output files:112 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);113 end114 fclose(fid);97 %write queuing script 98 fid=fopen([modelname '.queue'],'w'); 99 fprintf(fid,'#!/bin/bash\n'); 100 fprintf(fid,'#$ -N %s\n',modelname); 101 fprintf(fid,'#$ -q %s \n',cluster.queue); 102 fprintf(fid,'#$ -pe one-node-mpi 2-64\n'); 103 fprintf(fid,'#$ -R y\n'); 104 %fprintf(fid,'#$ -m beas\n'); 105 fprintf(fid,'#$ -o %s.outlog \n',modelname); 106 fprintf(fid,'#$ -e %s.errlog \n\n',modelname); 107 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME 108 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 109 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname); 110 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 111 if ~io_gather, %concatenate the output files: 112 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 113 end 114 fclose(fid); 115 115 116 %in interactive mode, create a run file, and errlog and outlog file117 if cluster.interactive,118 fid=fopen([modelname '.run'],'w');119 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);120 if ~io_gather, %concatenate the output files:121 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);122 end123 fclose(fid);124 fid=fopen([modelname '.errlog'],'w');125 fclose(fid);126 fid=fopen([modelname '.outlog'],'w');127 fclose(fid);128 end129 end %}}}130 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{116 %in interactive mode, create a run file, and errlog and outlog file 117 if cluster.interactive, 118 fid=fopen([modelname '.run'],'w'); 119 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 120 if ~io_gather, %concatenate the output files: 121 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 122 end 123 fclose(fid); 124 fid=fopen([modelname '.errlog'],'w'); 125 fclose(fid); 126 fid=fopen([modelname '.outlog'],'w'); 127 fclose(fid); 128 end 129 end %}}} 130 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 131 131 132 %compress the files into one zip.133 compressstring=['tar -zcf ' dirname '.tar.gz '];134 for i=1:numel(filelist),135 compressstring = [compressstring ' ' filelist{i}];136 end137 if cluster.interactive,138 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];139 end140 system(compressstring);132 %compress the files into one zip. 133 compressstring=['tar -zcf ' dirname '.tar.gz ']; 134 for i=1:numel(filelist), 135 compressstring = [compressstring ' ' filelist{i}]; 136 end 137 if cluster.interactive, 138 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 139 end 140 system(compressstring); 141 141 142 disp('uploading input file and queueing script');143 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});142 disp('uploading input file and queueing script'); 143 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 144 144 145 end %}}}146 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{145 end %}}} 146 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 147 147 148 disp('launching solution sequence on remote cluster');149 if ~isempty(restart)150 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue '];151 else152 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...153 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && qsub ' modelname '.queue '];154 end155 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);156 end %}}}157 function Download(cluster,dirname,filelist)% {{{148 disp('launching solution sequence on remote cluster'); 149 if ~isempty(restart) 150 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue ']; 151 else 152 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 153 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && qsub ' modelname '.queue ']; 154 end 155 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 156 end %}}} 157 function Download(cluster,dirname,filelist) % {{{ 158 158 159 %copy files from cluster to current directory160 directory=[cluster.executionpath '/' dirname '/'];161 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);159 %copy files from cluster to current directory 160 directory=[cluster.executionpath '/' dirname '/']; 161 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 162 162 163 end %}}}163 end %}}} 164 164 end 165 165 end -
issm/trunk-jpl/src/m/classes/clusters/hpc_simba.m
r25192 r26330 1 %HPC class definition1 %HPC_SIMBA cluster class definition 2 2 % 3 3 % Usage: … … 7 7 8 8 classdef hpc_simba 9 properties (SetAccess=public) 10 % {{{11 name='simba00'12 login='inwoo';13 numnodes=1;14 cpuspernode=36;15 np=4;16 port=7777;17 queue='pub64';18 codepath='/home/DATA/externalpackagesissm/issm/trunk-jpl/bin';19 executionpath='/home/DATA/externalpackages/issm/trunk-jpl/execution/';20 interactive=0;21 end22 %}}}23 methods24 function cluster=hpc_simba(varargin) % {{{9 properties (SetAccess=public) 10 % {{{ 11 name='simba00' 12 login='inwoo'; 13 numnodes=1; 14 cpuspernode=36; 15 np=4; 16 port=7777; 17 queue='pub64'; 18 codepath='/home/DATA/externalpackagesissm/issm/trunk-jpl/bin'; 19 executionpath='/home/DATA/externalpackages/issm/trunk-jpl/execution/'; 20 interactive=0; 21 end 22 %}}} 23 methods 24 function cluster=hpc_simba(varargin) % {{{ 25 25 26 %initialize cluster using default settings if provided27 if (exist('hpc_settings')==2), hpc_settings; end26 %initialize cluster using default settings if provided 27 if (exist('hpc_settings')==2), hpc_settings; end 28 28 29 %use provided options to change fields30 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);31 end32 %}}}33 function disp(cluster) % {{{34 % display the object35 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));36 disp(sprintf(' name: %s',cluster.name));37 disp(sprintf(' login: %s',cluster.login));38 disp(sprintf(' port: %i',cluster.port));39 disp(sprintf(' numnodes: %i',cluster.numnodes));40 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode));41 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes));42 disp(sprintf(' queue: %s',cluster.queue));43 disp(sprintf(' codepath: %s',cluster.codepath));44 disp(sprintf(' executionpath: %s',cluster.executionpath));45 disp(sprintf(' interactive: %i',cluster.interactive));46 end47 %}}}48 %function numprocs=np(cluster) % {{{49 % %compute number of processors50 % numprocs=cluster.numnodes*cluster.cpuspernode;29 %use provided options to change fields 30 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 31 end 32 %}}} 33 function disp(cluster) % {{{ 34 % display the object 35 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 36 disp(sprintf(' name: %s',cluster.name)); 37 disp(sprintf(' login: %s',cluster.login)); 38 disp(sprintf(' port: %i',cluster.port)); 39 disp(sprintf(' numnodes: %i',cluster.numnodes)); 40 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 41 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes)); 42 disp(sprintf(' queue: %s',cluster.queue)); 43 disp(sprintf(' codepath: %s',cluster.codepath)); 44 disp(sprintf(' executionpath: %s',cluster.executionpath)); 45 disp(sprintf(' interactive: %i',cluster.interactive)); 46 end 47 %}}} 48 %function numprocs=nprocs(cluster) % {{{ 49 % %compute number of processors 50 % numprocs=cluster.numnodes*cluster.cpuspernode; 51 51 % end 52 %}}}53 function md = checkconsistency(cluster,md,solution,analyses) % {{{52 %}}} 53 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 54 54 55 available_queues={'pub64','free64','free48','free*,pub64','free*'};56 queue_requirements_time=[Inf Inf Inf Inf Inf];57 queue_requirements_np=[64 64 48 48 48];55 available_queues={'pub64','free64','free48','free*,pub64','free*'}; 56 queue_requirements_time=[Inf Inf Inf Inf Inf]; 57 queue_requirements_np=[64 64 48 48 48]; 58 58 59 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)59 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1) 60 60 61 %Miscelaneous62 if isempty(cluster.login), md = checkmessage(md,'login empty'); end63 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end64 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end61 %Miscelaneous 62 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 63 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end 64 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end 65 65 66 end67 %}}}68 function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{66 end 67 %}}} 68 function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{ 69 69 70 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end71 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end70 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 71 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 72 72 73 %write queuing script74 fid=fopen([modelname '.queue'],'w');75 fprintf(fid,'#!/bin/bash\n');76 fprintf(fid,'#$ -N %s\n',modelname);77 fprintf(fid,'#$ -q %s \n',cluster.queue);78 fprintf(fid,'#$ -pe one-node-mpi 2-64\n');79 fprintf(fid,'#$ -R y\n');80 fprintf(fid,'#$ -m beas\n');81 fprintf(fid,'#$ -o %s.outlog \n',modelname);82 fprintf(fid,'#$ -e %s.errlog \n\n',modelname);83 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME84 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME85 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,modelname);86 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);87 if ~io_gather, %concatenate the output files:88 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);89 end90 fclose(fid);91 end92 %}}}93 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{73 %write queuing script 74 fid=fopen([modelname '.queue'],'w'); 75 fprintf(fid,'#!/bin/bash\n'); 76 fprintf(fid,'#$ -N %s\n',modelname); 77 fprintf(fid,'#$ -q %s \n',cluster.queue); 78 fprintf(fid,'#$ -pe one-node-mpi 2-64\n'); 79 fprintf(fid,'#$ -R y\n'); 80 fprintf(fid,'#$ -m beas\n'); 81 fprintf(fid,'#$ -o %s.outlog \n',modelname); 82 fprintf(fid,'#$ -e %s.errlog \n\n',modelname); 83 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME 84 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 85 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,modelname); 86 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname); 87 if ~io_gather, %concatenate the output files: 88 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 89 end 90 fclose(fid); 91 end 92 %}}} 93 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 94 94 95 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end96 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end95 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 96 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 97 97 98 %write queuing script99 fid=fopen([modelname '.queue'],'w');100 if 0101 fprintf(fid,'#!/bin/bash\n');102 fprintf(fid,'#$ -N %s\n',modelname);103 fprintf(fid,'#$ -q %s \n',cluster.queue);104 fprintf(fid,'#$ -pe one-node-mpi 2-64\n');105 fprintf(fid,'#$ -R y\n');106 %fprintf(fid,'#$ -m beas\n');107 fprintf(fid,'#$ -o %s.outlog \n',modelname);108 fprintf(fid,'#$ -e %s.errlog \n\n',modelname);109 else % FIXME : This script for SIMBA-Kopri110 fprintf(fid,'#!/bin/bash\n');111 %fprintf(fid,'#PBS -q workq\n');112 fprintf(fid,'#PBS -N %s\n',modelname);113 %fprintf(fid,'#PBS -l nodes=simba01:ppn=%d\n',...114 % ceil(cluster.np/cluster.cpuspernode), cluster.np);115 fprintf(fid,'#PBS -l nodes=simba01:ppn=%d\n',...98 %write queuing script 99 fid=fopen([modelname '.queue'],'w'); 100 if 0 101 fprintf(fid,'#!/bin/bash\n'); 102 fprintf(fid,'#$ -N %s\n',modelname); 103 fprintf(fid,'#$ -q %s \n',cluster.queue); 104 fprintf(fid,'#$ -pe one-node-mpi 2-64\n'); 105 fprintf(fid,'#$ -R y\n'); 106 %fprintf(fid,'#$ -m beas\n'); 107 fprintf(fid,'#$ -o %s.outlog \n',modelname); 108 fprintf(fid,'#$ -e %s.errlog \n\n',modelname); 109 else % FIXME : This script for SIMBA-Kopri 110 fprintf(fid,'#!/bin/bash\n'); 111 %fprintf(fid,'#PBS -q workq\n'); 112 fprintf(fid,'#PBS -N %s\n',modelname); 113 %fprintf(fid,'#PBS -l nodes=simba01:ppn=%d\n',... 114 % ceil(cluster.np/cluster.cpuspernode), cluster.np); 115 fprintf(fid,'#PBS -l nodes=simba01:ppn=%d\n',... 116 116 cluster.np); 117 fprintf(fid,'#PBS -o %s.outlog \n',modelname);118 fprintf(fid,'#PBS -e %s.errlog \n\n',modelname);119 fprintf(fid,'\n');120 end121 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME122 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME123 fprintf(fid,'\n');124 fprintf(fid,'module load intel18/impi-18\n');125 fprintf(fid,'\n');126 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);127 fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);128 if ~io_gather, %concatenate the output files:129 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);130 end131 fclose(fid);117 fprintf(fid,'#PBS -o %s.outlog \n',modelname); 118 fprintf(fid,'#PBS -e %s.errlog \n\n',modelname); 119 fprintf(fid,'\n'); 120 end 121 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME 122 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 123 fprintf(fid,'\n'); 124 fprintf(fid,'module load intel18/impi-18\n'); 125 fprintf(fid,'\n'); 126 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname); 127 fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 128 if ~io_gather, %concatenate the output files: 129 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 130 end 131 fclose(fid); 132 132 133 %in interactive mode, create a run file, and errlog and outlog file134 if cluster.interactive,135 fid=fopen([modelname '.run'],'w');136 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);137 if ~io_gather, %concatenate the output files:138 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);139 end140 fclose(fid);141 fid=fopen([modelname '.errlog'],'w');142 fclose(fid);143 fid=fopen([modelname '.outlog'],'w');144 fclose(fid);145 end146 end %}}}147 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{133 %in interactive mode, create a run file, and errlog and outlog file 134 if cluster.interactive, 135 fid=fopen([modelname '.run'],'w'); 136 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 137 if ~io_gather, %concatenate the output files: 138 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 139 end 140 fclose(fid); 141 fid=fopen([modelname '.errlog'],'w'); 142 fclose(fid); 143 fid=fopen([modelname '.outlog'],'w'); 144 fclose(fid); 145 end 146 end %}}} 147 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 148 148 149 %compress the files into one zip.150 compressstring=['tar -zcf ' dirname '.tar.gz '];151 for i=1:numel(filelist),152 compressstring = [compressstring ' ' filelist{i}];153 end154 if cluster.interactive,155 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];156 end157 system(compressstring);149 %compress the files into one zip. 150 compressstring=['tar -zcf ' dirname '.tar.gz ']; 151 for i=1:numel(filelist), 152 compressstring = [compressstring ' ' filelist{i}]; 153 end 154 if cluster.interactive, 155 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 156 end 157 system(compressstring); 158 158 159 disp('uploading input file and queueing script');160 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});159 disp('uploading input file and queueing script'); 160 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 161 161 162 end %}}}163 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{162 end %}}} 163 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 164 164 165 disp('launching solution sequence on remote cluster');166 if ~isempty(restart)167 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue '];168 else169 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...170 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && qsub ' modelname '.queue '];171 end172 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);173 end %}}}174 function Download(cluster,dirname,filelist)% {{{165 disp('launching solution sequence on remote cluster'); 166 if ~isempty(restart) 167 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue ']; 168 else 169 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 170 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && qsub ' modelname '.queue ']; 171 end 172 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 173 end %}}} 174 function Download(cluster,dirname,filelist) % {{{ 175 175 176 %copy files from cluster to current directory177 directory=[cluster.executionpath '/' dirname '/'];178 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);176 %copy files from cluster to current directory 177 directory=[cluster.executionpath '/' dirname '/']; 178 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 179 179 180 end %}}}180 end %}}} 181 181 end 182 182 end -
issm/trunk-jpl/src/m/classes/clusters/lonestar.m
r26291 r26330 1 %LONESTAR cl ass definition1 %LONESTAR cluster class definition 2 2 % 3 3 % Usage: … … 7 7 8 8 classdef lonestar 9 properties (SetAccess=public) 10 % {{{11 name = 'ls5.tacc.utexas.edu'12 login = '';13 modules = {'intel/18.0.2' 'gsl'};14 numnodes = 1;15 cpuspernode = 24;16 port = 1099;17 queue = 'normal';18 codepath = '';19 executionpath = '';20 interactive = 0;21 time = 48*60*60;22 email = '';23 end24 %}}}25 methods26 function cluster=lonestar(varargin) % {{{27 28 %initialize cluster using default settings if provided29 if (exist('lonestar_settings')==2), lonestar_settings; end30 31 %use provided options to change fields32 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);33 34 end35 %}}}36 function disp(cluster) % {{{37 % display the object38 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));39 disp(sprintf(' name: %s',cluster.name));40 disp(sprintf(' login: %s',cluster.login));41 disp(sprintf(' modules: %s',strjoin(cluster.modules,', ')));42 disp(sprintf(' port: %i',cluster.port));43 disp(sprintf(' numnodes: %i',cluster.numnodes));44 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode));45 disp(sprintf(' np: %i',cluster.np));46 disp(sprintf(' queue: %s',cluster.queue));47 disp(sprintf(' codepath: %s',cluster.codepath));48 disp(sprintf(' executionpath: %s',cluster.executionpath));49 disp(sprintf(' interactive: %i',cluster.interactive));50 disp(sprintf(' time: %i',cluster.time));51 disp(sprintf(' email: %s',cluster.email));52 end53 %}}}54 function numprocs=np(cluster) % {{{55 %compute number of processors56 numprocs=cluster.numnodes*cluster.cpuspernode;57 end58 %}}}59 function md = checkconsistency(cluster,md,solution,analyses) % {{{60 61 available_queues={'normal','development'};62 queue_requirements_time=[48*60*60 2*60*60];63 queue_requirements_np=[4104 264];64 65 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)66 67 %Miscelaneous68 if isempty(cluster.login), md = checkmessage(md,'login empty'); end69 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end70 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end71 end72 %}}}73 function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{74 75 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end76 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end77 78 %write queuing script79 fid=fopen([modelname '.queue'],'w');80 fprintf(fid,'#!/bin/bash\n');81 fprintf(fid,'#$ -N %s\n',modelname);82 fprintf(fid,'#$ -q %s \n',cluster.queue);83 fprintf(fid,'#$ -pe one-node-mpi 2-64\n');84 fprintf(fid,'#$ -R y\n');85 fprintf(fid,'#$ -m beas\n');86 fprintf(fid,'#$ -o %s.outlog \n',modelname);87 fprintf(fid,'#$ -e %s.errlog \n\n',modelname);88 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME89 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME90 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,modelname);91 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);92 if ~io_gather, %concatenate the output files:93 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);94 end95 fclose(fid);96 end97 %}}}98 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{99 100 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end101 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end102 103 executable='issm.exe';104 if isdakota,105 version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));106 if (version>=6),107 executable='issm_dakota.exe';108 end109 end110 if isoceancoupling,111 executable='issm_ocean.exe';112 end113 114 %write queuing script115 fid=fopen([modelname '.queue'],'w');116 117 fprintf(fid,'#!/bin/bash\n');118 fprintf(fid,'#SBATCH -J %s \n',modelname);119 fprintf(fid,'#SBATCH -p %s \n',cluster.queue);120 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);121 fprintf(fid,'#SBATCH -e %s.errlog \n',modelname);122 fprintf(fid,'#SBATCH -n %i \n',cluster.numnodes*max(cluster.np/cluster.numnodes,24));123 fprintf(fid,'#SBATCH -N %i \n',cluster.numnodes);124 fprintf(fid,'#SBATCH -t %02i:%02i:00 \n\n',floor(cluster.time/3600),floor(mod(cluster.time,3600)/60));125 for i=1:numel(cluster.modules),126 fprintf(fid,['module load ' cluster.modules{i} '\n']);127 end128 129 if isdakota,130 fprintf(fid,'export KMP_AFFINITY="granularity=fine,compact,verbose" \n\n');131 end132 133 if length(find(cluster.email=='@'))>0134 fprintf(fid,'#SBATCH --mail-user=%s \n',cluster.email);135 fprintf(fid,'#SBATCH --mail-type=end \n\n');136 137 %fprintf(fid,'ssh login1 "mail -s ''SLURM Jobid=${SLURM_JOBID} Name=${SLURM_JOB_NAME} Began on Lonestar 5.'' %s <<< ''Job Started'' " \n\n',cluster.email);138 end139 140 fprintf(fid,'export PATH="$PATH:."\n\n');141 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME142 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME143 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);144 fprintf(fid,'ibrun -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);145 if ~io_gather, %concatenate the output files:146 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);147 end148 149 fclose(fid);150 151 %in interactive mode, create a run file, and errlog and outlog file152 if cluster.interactive,153 fid=fopen([modelname '.run'],'w');154 fprintf(fid,'ibrun -np %i %s/%s %s %s %s\n',cluster.np,executable,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);155 if ~io_gather, %concatenate the output files:156 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);157 end158 fclose(fid);159 fid=fopen([modelname '.errlog'],'w');160 fclose(fid);161 fid=fopen([modelname '.outlog'],'w');162 fclose(fid);163 end164 end %}}}165 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{166 167 %compress the files into one zip.168 compressstring=['tar -zcf ' dirname '.tar.gz '];169 for i=1:numel(filelist),170 compressstring = [compressstring ' ' filelist{i}];171 end172 if cluster.interactive,173 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];174 end175 system(compressstring);176 177 disp('uploading input file and queueing script');178 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});179 180 end %}}}181 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{182 183 disp('launching solution sequence on remote cluster');184 if ~isempty(restart)185 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue '];186 else187 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...188 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && sbatch ' modelname '.queue '];189 end190 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);191 end %}}}192 function Download(cluster,dirname,filelist)% {{{193 194 %copy files from cluster to current directory195 directory=[cluster.executionpath '/' dirname '/'];196 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);197 198 end %}}}9 properties (SetAccess=public) 10 % {{{ 11 name = 'ls5.tacc.utexas.edu' 12 login = ''; 13 modules = {'intel/18.0.2' 'gsl'}; 14 numnodes = 1; 15 cpuspernode = 24; 16 port = 1099; 17 queue = 'normal'; 18 codepath = ''; 19 executionpath = ''; 20 interactive = 0; 21 time = 48*60*60; 22 email = ''; 23 end 24 %}}} 25 methods 26 function cluster=lonestar(varargin) % {{{ 27 28 %initialize cluster using default settings if provided 29 if (exist('lonestar_settings')==2), lonestar_settings; end 30 31 %use provided options to change fields 32 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 33 34 end 35 %}}} 36 function disp(cluster) % {{{ 37 % display the object 38 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 39 disp(sprintf(' name: %s',cluster.name)); 40 disp(sprintf(' login: %s',cluster.login)); 41 disp(sprintf(' modules: %s',strjoin(cluster.modules,', '))); 42 disp(sprintf(' port: %i',cluster.port)); 43 disp(sprintf(' numnodes: %i',cluster.numnodes)); 44 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 45 disp(sprintf(' np: %i',cluster.np)); 46 disp(sprintf(' queue: %s',cluster.queue)); 47 disp(sprintf(' codepath: %s',cluster.codepath)); 48 disp(sprintf(' executionpath: %s',cluster.executionpath)); 49 disp(sprintf(' interactive: %i',cluster.interactive)); 50 disp(sprintf(' time: %i',cluster.time)); 51 disp(sprintf(' email: %s',cluster.email)); 52 end 53 %}}} 54 function numprocs=nprocs(cluster) % {{{ 55 %compute number of processors 56 numprocs=cluster.numnodes*cluster.cpuspernode; 57 end 58 %}}} 59 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 60 61 available_queues={'normal','development'}; 62 queue_requirements_time=[48*60*60 2*60*60]; 63 queue_requirements_np=[4104 264]; 64 65 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time) 66 67 %Miscelaneous 68 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 69 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end 70 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end 71 end 72 %}}} 73 function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{ 74 75 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 76 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 77 78 %write queuing script 79 fid=fopen([modelname '.queue'],'w'); 80 fprintf(fid,'#!/bin/bash\n'); 81 fprintf(fid,'#$ -N %s\n',modelname); 82 fprintf(fid,'#$ -q %s \n',cluster.queue); 83 fprintf(fid,'#$ -pe one-node-mpi 2-64\n'); 84 fprintf(fid,'#$ -R y\n'); 85 fprintf(fid,'#$ -m beas\n'); 86 fprintf(fid,'#$ -o %s.outlog \n',modelname); 87 fprintf(fid,'#$ -e %s.errlog \n\n',modelname); 88 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME 89 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 90 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,modelname); 91 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname); 92 if ~io_gather, %concatenate the output files: 93 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 94 end 95 fclose(fid); 96 end 97 %}}} 98 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 99 100 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 101 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 102 103 executable='issm.exe'; 104 if isdakota, 105 version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3)); 106 if (version>=6), 107 executable='issm_dakota.exe'; 108 end 109 end 110 if isoceancoupling, 111 executable='issm_ocean.exe'; 112 end 113 114 %write queuing script 115 fid=fopen([modelname '.queue'],'w'); 116 117 fprintf(fid,'#!/bin/bash\n'); 118 fprintf(fid,'#SBATCH -J %s \n',modelname); 119 fprintf(fid,'#SBATCH -p %s \n',cluster.queue); 120 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname); 121 fprintf(fid,'#SBATCH -e %s.errlog \n',modelname); 122 fprintf(fid,'#SBATCH -n %i \n',cluster.numnodes*max(cluster.np/cluster.numnodes,24)); 123 fprintf(fid,'#SBATCH -N %i \n',cluster.numnodes); 124 fprintf(fid,'#SBATCH -t %02i:%02i:00 \n\n',floor(cluster.time/3600),floor(mod(cluster.time,3600)/60)); 125 for i=1:numel(cluster.modules), 126 fprintf(fid,['module load ' cluster.modules{i} '\n']); 127 end 128 129 if isdakota, 130 fprintf(fid,'export KMP_AFFINITY="granularity=fine,compact,verbose" \n\n'); 131 end 132 133 if length(find(cluster.email=='@'))>0 134 fprintf(fid,'#SBATCH --mail-user=%s \n',cluster.email); 135 fprintf(fid,'#SBATCH --mail-type=end \n\n'); 136 137 %fprintf(fid,'ssh login1 "mail -s ''SLURM Jobid=${SLURM_JOBID} Name=${SLURM_JOB_NAME} Began on Lonestar 5.'' %s <<< ''Job Started'' " \n\n',cluster.email); 138 end 139 140 fprintf(fid,'export PATH="$PATH:."\n\n'); 141 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME 142 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 143 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname); 144 fprintf(fid,'ibrun -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname); 145 if ~io_gather, %concatenate the output files: 146 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 147 end 148 149 fclose(fid); 150 151 %in interactive mode, create a run file, and errlog and outlog file 152 if cluster.interactive, 153 fid=fopen([modelname '.run'],'w'); 154 fprintf(fid,'ibrun -np %i %s/%s %s %s %s\n',cluster.np,executable,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 155 if ~io_gather, %concatenate the output files: 156 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 157 end 158 fclose(fid); 159 fid=fopen([modelname '.errlog'],'w'); 160 fclose(fid); 161 fid=fopen([modelname '.outlog'],'w'); 162 fclose(fid); 163 end 164 end %}}} 165 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 166 167 %compress the files into one zip. 168 compressstring=['tar -zcf ' dirname '.tar.gz ']; 169 for i=1:numel(filelist), 170 compressstring = [compressstring ' ' filelist{i}]; 171 end 172 if cluster.interactive, 173 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 174 end 175 system(compressstring); 176 177 disp('uploading input file and queueing script'); 178 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 179 180 end %}}} 181 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 182 183 disp('launching solution sequence on remote cluster'); 184 if ~isempty(restart) 185 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue ']; 186 else 187 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 188 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && sbatch ' modelname '.queue ']; 189 end 190 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 191 end %}}} 192 function Download(cluster,dirname,filelist) % {{{ 193 194 %copy files from cluster to current directory 195 directory=[cluster.executionpath '/' dirname '/']; 196 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 197 198 end %}}} 199 199 end 200 200 end -
issm/trunk-jpl/src/m/classes/clusters/maui.m
r25395 r26330 1 %MAUI cl ass definition1 %MAUI cluster class definition 2 2 % 3 3 % Usage: … … 7 7 8 8 classdef maui 9 properties (SetAccess=public) 10 % {{{11 name = 'maui'12 login = '';13 numnodes = 1;14 cpuspernode = 8;15 port = 0;16 projectaccount = '';17 partition = 'nesi_research';18 codepath = '';19 executionpath = '';20 interactive = 0;21 time = 24*60;22 memory = 2;23 end24 %}}}25 methods26 function cluster=maui(varargin) % {{{9 properties (SetAccess=public) 10 % {{{ 11 name = 'maui' 12 login = ''; 13 numnodes = 1; 14 cpuspernode = 8; 15 port = 0; 16 projectaccount = ''; 17 partition = 'nesi_research'; 18 codepath = ''; 19 executionpath = ''; 20 interactive = 0; 21 time = 24*60; 22 memory = 2; 23 end 24 %}}} 25 methods 26 function cluster=maui(varargin) % {{{ 27 27 28 %initialize cluster using default settings if provided29 if (exist('maui_settings')==2), maui_settings; end28 %initialize cluster using default settings if provided 29 if (exist('maui_settings')==2), maui_settings; end 30 30 31 %use provided options to change fields32 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);33 end34 %}}}35 function disp(cluster) % {{{36 % display the object37 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));38 disp(sprintf(' name: %s',cluster.name));39 disp(sprintf(' login: %s',cluster.login));40 disp(sprintf(' port: %i',cluster.port));41 disp(sprintf(' numnodes: %i',cluster.numnodes));42 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode));43 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes));44 disp(sprintf(' projectaccount: %s',cluster.projectaccount));45 disp(sprintf(' partition: %s',cluster.partition));46 disp(sprintf(' codepath: %s',cluster.codepath));47 disp(sprintf(' executionpath: %s',cluster.executionpath));48 disp(sprintf(' interactive: %i',cluster.interactive));49 disp(sprintf(' time: %i',cluster.time));50 disp(sprintf(' memory: %i',cluster.memory));51 end52 %}}}53 function numprocs=np(cluster) % {{{54 %compute number of processors55 numprocs=cluster.numnodes*cluster.cpuspernode;56 end57 %}}}58 function md = checkconsistency(cluster,md,solution,analyses) % {{{31 %use provided options to change fields 32 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 33 end 34 %}}} 35 function disp(cluster) % {{{ 36 % display the object 37 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 38 disp(sprintf(' name: %s',cluster.name)); 39 disp(sprintf(' login: %s',cluster.login)); 40 disp(sprintf(' port: %i',cluster.port)); 41 disp(sprintf(' numnodes: %i',cluster.numnodes)); 42 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 43 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes)); 44 disp(sprintf(' projectaccount: %s',cluster.projectaccount)); 45 disp(sprintf(' partition: %s',cluster.partition)); 46 disp(sprintf(' codepath: %s',cluster.codepath)); 47 disp(sprintf(' executionpath: %s',cluster.executionpath)); 48 disp(sprintf(' interactive: %i',cluster.interactive)); 49 disp(sprintf(' time: %i',cluster.time)); 50 disp(sprintf(' memory: %i',cluster.memory)); 51 end 52 %}}} 53 function numprocs=nprocs(cluster) % {{{ 54 %compute number of processors 55 numprocs=cluster.numnodes*cluster.cpuspernode; 56 end 57 %}}} 58 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 59 59 60 available_partitions={'nesi_research'}61 partition_requirements_time=[24*60];62 partition_requirements_np=[80];60 available_partitions={'nesi_research'} 61 partition_requirements_time=[24*60]; 62 partition_requirements_np=[80]; 63 63 64 QueueRequirements(available_partitions,partition_requirements_time,partition_requirements_np,cluster.partition,cluster.np,1)64 QueueRequirements(available_partitions,partition_requirements_time,partition_requirements_np,cluster.partition,cluster.np,1) 65 65 66 %Miscelaneous67 if isempty(cluster.login), md = checkmessage(md,'login empty'); end68 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end69 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end70 end71 %}}}72 function BuildKrigingQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{73 error('not implemented yet');74 end75 %}}}76 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{66 %Miscelaneous 67 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 68 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end 69 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end 70 end 71 %}}} 72 function BuildKrigingQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 73 error('not implemented yet'); 74 end 75 %}}} 76 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 77 77 78 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end79 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end78 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 79 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 80 80 81 %write queuing script82 fid=fopen([modelname '.queue'],'w');83 fprintf(fid,'#!/bin/bash\n');84 fprintf(fid,'#SBATCH --job-name=%s\n',modelname);85 fprintf(fid,'#SBATCH --account=%s \n',cluster.projectaccount);86 fprintf(fid,'#SBATCH --partition=%s \n',cluster.partition);87 fprintf(fid,'#SBATCH --ntasks=%i \n',cluster.numnodes);88 fprintf(fid,'#SBATCH --cpus-per-task=%i\n',cluster.cpuspernode);89 fprintf(fid,'#SBATCH --time=%i\n',cluster.time); %walltime is in minutes90 fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);91 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);92 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);93 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME94 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME95 fprintf(fid,'module swap PrgEnv-cray PrgEnv-intel\n');96 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);97 fprintf(fid,'srun -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);98 if ~io_gather, %concatenate the output files:99 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);100 end101 fclose(fid);81 %write queuing script 82 fid=fopen([modelname '.queue'],'w'); 83 fprintf(fid,'#!/bin/bash\n'); 84 fprintf(fid,'#SBATCH --job-name=%s\n',modelname); 85 fprintf(fid,'#SBATCH --account=%s \n',cluster.projectaccount); 86 fprintf(fid,'#SBATCH --partition=%s \n',cluster.partition); 87 fprintf(fid,'#SBATCH --ntasks=%i \n',cluster.numnodes); 88 fprintf(fid,'#SBATCH --cpus-per-task=%i\n',cluster.cpuspernode); 89 fprintf(fid,'#SBATCH --time=%i\n',cluster.time); %walltime is in minutes 90 fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory); 91 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname); 92 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname); 93 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME 94 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 95 fprintf(fid,'module swap PrgEnv-cray PrgEnv-intel\n'); 96 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname); 97 fprintf(fid,'srun -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 98 if ~io_gather, %concatenate the output files: 99 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 100 end 101 fclose(fid); 102 102 103 %in interactive mode, create a run file, and errlog and outlog file104 if cluster.interactive,105 fid=fopen([modelname '.run'],'w');106 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);107 if ~io_gather, %concatenate the output files:108 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);109 end110 fclose(fid);111 fid=fopen([modelname '.errlog'],'w');112 fclose(fid);113 fid=fopen([modelname '.outlog'],'w');114 fclose(fid);115 end116 end %}}}117 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{103 %in interactive mode, create a run file, and errlog and outlog file 104 if cluster.interactive, 105 fid=fopen([modelname '.run'],'w'); 106 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 107 if ~io_gather, %concatenate the output files: 108 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 109 end 110 fclose(fid); 111 fid=fopen([modelname '.errlog'],'w'); 112 fclose(fid); 113 fid=fopen([modelname '.outlog'],'w'); 114 fclose(fid); 115 end 116 end %}}} 117 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 118 118 119 %compress the files into one zip.120 compressstring=['tar -zcf ' dirname '.tar.gz '];121 for i=1:numel(filelist),122 compressstring = [compressstring ' ' filelist{i}];123 end124 if cluster.interactive,125 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];126 end127 system(compressstring);119 %compress the files into one zip. 120 compressstring=['tar -zcf ' dirname '.tar.gz ']; 121 for i=1:numel(filelist), 122 compressstring = [compressstring ' ' filelist{i}]; 123 end 124 if cluster.interactive, 125 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 126 end 127 system(compressstring); 128 128 129 disp('uploading input file and queueing script');130 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});129 disp('uploading input file and queueing script'); 130 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 131 131 132 end %}}}133 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{132 end %}}} 133 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 134 134 135 disp('launching solution sequence on remote cluster');136 if ~isempty(restart)137 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue '];138 else139 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...140 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && sbatch ' modelname '.queue '];141 end142 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);143 end %}}}144 function Download(cluster,dirname,filelist)% {{{135 disp('launching solution sequence on remote cluster'); 136 if ~isempty(restart) 137 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue ']; 138 else 139 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 140 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && sbatch ' modelname '.queue ']; 141 end 142 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 143 end %}}} 144 function Download(cluster,dirname,filelist) % {{{ 145 145 146 %copy files from cluster to current directory147 directory=[cluster.executionpath '/' dirname '/'];148 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);146 %copy files from cluster to current directory 147 directory=[cluster.executionpath '/' dirname '/']; 148 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 149 149 150 end %}}}150 end %}}} 151 151 end 152 152 end -
issm/trunk-jpl/src/m/classes/clusters/pfe.m
r26034 r26330 1 %PFE cl ass definition1 %PFE cluster class definition 2 2 % 3 3 % Usage: … … 7 7 8 8 classdef pfe 9 properties (SetAccess=public) 9 properties (SetAccess=public) 10 10 % {{{ 11 11 name = 'pfe' … … 39 39 %}}} 40 40 function disp(cluster) % {{{ 41 % display the object 41 % TODO: 42 % - Correct formatting of modules and cluster.np 43 % 44 45 % display the object 42 46 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 43 disp(sprintf(' name: %s',cluster.name)); 44 disp(sprintf(' login: %s',cluster.login)); 45 modules=''; for i=1:length(cluster.modules), modules=[modules cluster.modules{i} ',']; end; modules=modules(1:end-1); 46 disp(sprintf(' modules: %s',modules)); 47 disp(sprintf(' port: %i',cluster.port)); 48 disp(sprintf(' numnodes: %i',cluster.numnodes)); 49 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 50 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes)); 51 disp(sprintf(' queue: %s',cluster.queue)); 52 disp(sprintf(' time: %i',cluster.time)); 53 disp(sprintf(' processor: %s',cluster.processor)); 54 disp(sprintf(' srcpath: %s ($ISSM_DIR on pfe)',cluster.srcpath)); 55 disp(sprintf(' codepath: %s ($ISSM_DIR/bin on pfe)',cluster.codepath)); 56 disp(sprintf(' executionpath: %s (directory containing issm.exe on pfe)',cluster.executionpath)); 57 disp(sprintf(' grouplist: %s',cluster.grouplist)); 58 disp(sprintf(' interactive: %i',cluster.interactive)); 59 disp(sprintf(' hyperthreading: %i',cluster.hyperthreading)); 47 fielddisplay(cluster,'name','name of the cluster'); 48 fielddisplay(cluster,'login','login'); 49 modules=''; for i=1:length(cluster.modules), modules=[modules cluster.modules{i} ',']; end; modules=modules(1:end-1); 50 disp(sprintf(' modules : %s',modules)); 51 fielddisplay(cluster,'port','machine access port'); 52 fielddisplay(cluster,'numnodes','number of nodes'); 53 fielddisplay(cluster,'cpuspernode','number of CPUs per node'); 54 disp(sprintf(' np: : %i -- %s',cluster.np(),'number of CPUs')); 55 fielddisplay(cluster,'queue','name of the queue'); 56 fielddisplay(cluster,'time','walltime requested'); 57 fielddisplay(cluster,'processor','type of processor'); 58 fielddisplay(cluster,'srcpath','$ISSM_DIR on pfe'); 59 fielddisplay(cluster,'codepath','$ISSM_DIR/bin on pfe'); 60 fielddisplay(cluster,'executionpath','directory containing issm.exe on pfe'); 61 fielddisplay(cluster,'grouplist','grouplist'); 62 fielddisplay(cluster,'interactive',''); 63 fielddisplay(cluster,'bbftp',''); 64 fielddisplay(cluster,'numstreams',''); 65 fielddisplay(cluster,'hyperthreading',''); 60 66 end 61 67 %}}} … … 128 134 129 135 else 130 md = checkmessage(md,'unknown processor type, should be ''bro'' or ''has'' or ''ivy'' or ''san''or ''cas_ait''');136 md = checkmessage(md,'unknown processor type, should be ''bro'', ''has'', ''ivy'', ''san'', or ''cas_ait'''); 131 137 end 132 138 … … 137 143 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end 138 144 if isempty(cluster.grouplist), md = checkmessage(md,'grouplist empty'); end 145 if ~isempty(cluster.interactive), md = checkmessage(md,'interactive mode not implemented'); end 139 146 140 147 end … … 164 171 fprintf(fid,'#PBS -W group_list=%s\n',cluster.grouplist); 165 172 fprintf(fid,'#PBS -m e\n'); 166 fprintf(fid,'#PBS -o %s .outlog \n',[cluster.executionpath '/' dirname '/' modelname]);167 fprintf(fid,'#PBS -e %s .errlog \n\n',[cluster.executionpath '/' dirname '/' modelname]);173 fprintf(fid,'#PBS -o %s/%s/%s.outlog \n',cluster.executionpath,dirname,modelname); 174 fprintf(fid,'#PBS -e %s/%s/%s.errlog \n\n',cluster.executionpath,dirname,modelname); 168 175 fprintf(fid,'. /usr/share/modules/init/bash\n\n'); 169 176 for i=1:numel(cluster.modules), fprintf(fid,['module load ' cluster.modules{i} '\n']); end … … 176 183 fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,dirname); 177 184 if ~isvalgrind, 178 fprintf(fid,'/u/scicon/tools/bin/several_tries mpiexec -np %i /u/scicon/tools/bin/mbind.x -cs -n%i %s/%s %s %s %s\n',cluster.np,cluster.cpuspernode,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);185 fprintf(fid,'/u/scicon/tools/bin/several_tries mpiexec -np %i /u/scicon/tools/bin/mbind.x -cs -n%i %s/%s %s %s/%s %s\n',cluster.np,cluster.cpuspernode,cluster.codepath,executable,solution,cluster.executionpath,dirname,modelname); 179 186 else 180 187 fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname); … … 382 389 383 390 end %}}} 384 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{391 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 385 392 386 393 %compress the files into one zip. 387 compressstring=['tar -zcf ' dirname '.tar.gz '];394 compressstring=['tar -zcf ' dirname '.tar.gz']; 388 395 for i=1:numel(filelist), 389 396 compressstring = [compressstring ' ' filelist{i}]; … … 411 418 end 412 419 %}}} 413 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{420 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 414 421 415 422 %lauch command, to be executed via ssh … … 437 444 end 438 445 %}}} 439 function Download(cluster,dirname,filelist) % {{{446 function Download(cluster,dirname,filelist) % {{{ 440 447 441 448 %copy files from cluster to current directory -
issm/trunk-jpl/src/m/classes/clusters/pfe.py
r25453 r26330 1 1 import subprocess 2 2 3 from fielddisplay import fielddisplay 3 from pairoptions import pairoptions 4 from issmssh import issmssh 4 from IssmConfig import IssmConfig 5 5 from issmscpin import issmscpin 6 6 from issmscpout import issmscpout 7 from QueueRequirements import QueueRequirements8 from IssmConfig import IssmConfig7 from issmssh import issmssh 8 from pairoptions import pairoptions 9 9 try: 10 10 from pfe_settings import pfe_settings 11 11 except ImportError: 12 12 print('You need pfe_settings.py to proceed, check presence and sys.path') 13 13 from QueueRequirements import QueueRequirements 14 14 15 15 class pfe(object): 16 """PFE cluster class definition 17 18 Usage: 19 cluster = pfe() 20 cluster = pfe('np', 3) 21 cluster = pfe('np', 3, 'login', 'username') 16 22 """ 17 PFE cluster class definition 18 19 Usage: 20 cluster = pfe() 21 cluster = pfe('np', 3) 22 cluster = pfe('np', 3, 'login', 'username') 23 """ 24 25 def __init__(self, *args): # {{{ 23 24 def __init__(self, *args): # {{{ 26 25 self.name = 'pfe' 27 26 self.login = '' 27 self.modules = ['comp-intel/2016.2.181', 'mpi-sgi/mpt'] 28 28 self.numnodes = 20 29 29 self.cpuspernode = 8 … … 31 31 self.queue = 'long' 32 32 self.time = 12 * 60 33 self.processor = ' bro'33 self.processor = 'ivy' 34 34 self.srcpath = '' 35 35 self.codepath = '' 36 36 self.executionpath = '' 37 self.grouplist = 's1 010'37 self.grouplist = 's1690' 38 38 self.interactive = 0 39 39 self.bbftp = 0 … … 41 41 self.hyperthreading = 0 42 42 43 # use provided options to change fields43 # Use provided options to change fields 44 44 options = pairoptions(*args) 45 45 46 #initialize cluster using user settings if provided 47 self = pfe_settings(self) 48 self.np = self.nprocs() 46 # Initialize cluster using user settings if provided 47 try: 48 self = pfe_settings(self) 49 except NameError: 50 print('pfe_settings.py not found, using default settings') 49 51 50 52 #OK get other fields 51 53 self = options.AssignObjectFields(self) 52 53 # }}} 54 55 def __repr__(self): # {{{ 56 # display the object 57 s = "class pfe object:" 58 s = "%s\n%s" % (s, fielddisplay(self, 'name', 'name of the cluster')) 59 s = "%s\n%s" % (s, fielddisplay(self, 'login', 'login')) 60 s = "%s\n%s" % (s, fielddisplay(self, 'numnodes', 'number of nodes')) 61 s = "%s\n%s" % (s, fielddisplay(self, 'cpuspernode', 'number of nodes per CPUs')) 62 s = "%s\n%s" % (s, fielddisplay(self, 'np', 'number of CPUs')) 63 s = "%s\n%s" % (s, fielddisplay(self, 'port', 'machine access port')) 64 s = "%s\n%s" % (s, fielddisplay(self, 'queue', 'name of the queue')) 65 s = "%s\n%s" % (s, fielddisplay(self, 'time', 'walltime requested')) 66 s = "%s\n%s" % (s, fielddisplay(self, 'processor', 'type of processor')) 67 s = "%s\n%s" % (s, fielddisplay(self, 'codepath', '$ISSM_DIR on pfe')) 68 s = "%s\n%s" % (s, fielddisplay(self, 'executionpath', 'directory containing issm.exe on pfe')) 69 s = "%s\n%s" % (s, fielddisplay(self, 'grouplist', 'name of the group')) 70 s = "%s\n%s" % (s, fielddisplay(self, 'interactive', '')) 71 s = "%s\n%s" % (s, fielddisplay(self, 'bbftp', '')) 72 s = "%s\n%s" % (s, fielddisplay(self, 'numstreams', '')) 73 s = "%s\n%s" % (s, fielddisplay(self, 'hyperthreading', '')) 54 # }}} 55 56 def __repr__(self): # {{{ 57 # TODO: 58 # - Correct formatting of modules and cluster.np 59 # 60 61 # Display the object 62 s = 'class pfe object\n' 63 s += '{}\n'.format(fielddisplay(self, 'name', 'name of the cluster')) 64 s += '{}\n'.format(fielddisplay(self, 'login', 'login')) 65 modules = '' 66 for i in range(len(self.modules)): 67 modules += self.modules[i] + ',' 68 modules = modules[:-1] 69 s += ' modules : {}\n'.format(modules) 70 s += '{}\n'.format(fielddisplay(self, 'port', 'machine access port')) 71 s += '{}\n'.format(fielddisplay(self, 'numnodes', 'number of nodes')) 72 s += '{}\n'.format(fielddisplay(self, 'cpuspernode', 'number of CPUs per node')) 73 s += ' np: : {} -- {}\n'.format(self.nprocs(), 'number of CPUs') 74 s += '{}\n'.format(fielddisplay(self, 'queue', 'name of the queue')) 75 s += '{}\n'.format(fielddisplay(self, 'time', 'walltime requested')) 76 s += '{}\n'.format(fielddisplay(self, 'processor', 'type of processor')) 77 s += '{}\n'.format(fielddisplay(self, 'srcpath', '$ISSM_DIR on pfe')) 78 s += '{}\n'.format(fielddisplay(self, 'codepath', '$ISSM_DIR/bin on pfe')) 79 s += '{}\n'.format(fielddisplay(self, 'executionpath', 'directory containing issm.exe on pfe')) 80 s += '{}\n'.format(fielddisplay(self, 'grouplist', 'grouplist')) 81 s += '{}\n'.format(fielddisplay(self, 'interactive', '')) 82 s += '{}\n'.format(fielddisplay(self, 'bbftp', '')) 83 s += '{}\n'.format(fielddisplay(self, 'numstreams', '')) 84 s += '{}\n'.format(fielddisplay(self, 'hyperthreading', '')) 74 85 return s 75 86 # }}} 76 87 77 def nprocs(self): # {{{ 78 self.np = self.numnodes * self.cpuspernode 79 return self.np 80 # }}} 81 82 def checkconsistency(self, md, solution, analyses): # {{{ 88 def nprocs(self): # {{{ 89 return self.numnodes * self.cpuspernode 90 # }}} 91 92 def checkconsistency(self, md, solution, analyses): # {{{ 83 93 queuedict = {'long': [5 * 24 * 60, 2048], 84 94 'normal': [8 * 60, 2048], … … 87 97 QueueRequirements(queuedict, self.queue, self.nprocs(), self.time) 88 98 89 # now, check cluster.cpuspernode according to processor type90 if self.processor == ' har' or self.processor == 'neh':99 # Now, check cluster.cpuspernode according to processor type 100 if self.processor == 'ivy': 91 101 if self.hyperthreading: 92 if not 0 < self.cpuspernode < 17: 102 if self.cpuspernode > 40 or self.cpuspernode < 1: 103 md = md.checkmessage('cpuspernode should be between 1 and 40 for ''ivy'' processors in hyperthreading mode') 104 else: 105 if self.cpuspernode > 20 or self.cpuspernode < 1: 106 md = md.checkmessage('cpuspernode should be between 1 and 20 for ''ivy'' processors') 107 elif self.processor == 'bro': 108 if self.hyperthreading: 109 if self.cpuspernode > 56 or self.cpuspernode < 1: 110 md = md.checkmessage('cpuspernode should be between 1 and 56 for ''bro'' processors in hyperthreading mode') 111 else: 112 if self.cpuspernode > 28 or self.cpuspernode < 1: 113 md = md.checkmessage('cpuspernode should be between 1 and 28 for ''bro'' processors') 114 elif self.processor == 'har' or self.processor == 'neh': 115 if self.hyperthreading: 116 if self.cpuspernode > 16 or self.cpuspernode < 1: 93 117 md = md.checkmessage('cpuspernode should be between 1 and 16 for ''neh'' and ''har'' processors in hyperthreading mode') 94 118 else: 95 if not 0 < self.cpuspernode < 9:119 if self.cpuspernode > 8 or self.cpuspernode < 1: 96 120 md = md.checkmessage('cpuspernode should be between 1 and 8 for ''neh'' and ''har'' processors') 97 98 elif self.processor == 'bro':99 if self.hyperthreading:100 if not 0 < self.cpuspernode < 57:101 md = md.checkmessage('cpuspernode should be between 1 and 56 for ''bro'' processors in hyperthreading mode')102 else:103 if not 0 < self.cpuspernode < 29:104 md = md.checkmessage('cpuspernode should be between 1 and 28 for ''bro'' processors')105 106 elif self.processor == 'ivy':107 if self.hyperthreading:108 if not 0 < self.cpuspernode < 41:109 md = md.checkmessage('cpuspernode should be between 1 and 40 for ''ivy'' processors in hyperthreading mode')110 else:111 if not 0 < self.cpuspernode < 21:112 md = md.checkmessage('cpuspernode should be between 1 and 20 for ''ivy'' processors')113 121 else: 114 md = md.checkmessage('unknown processor type, should be ''neh'', ''bro'' or ''har'' or ''ivy''')115 116 # Miscellaneous122 md = md.checkmessage('unknown processor type, should be \'ivy\', \'bro\', \'har\', or \'neh\'') 123 124 # Miscellaneous 117 125 if not self.login: 118 126 md = md.checkmessage('login empty') … … 131 139 # }}} 132 140 133 def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling): # {{{ 141 def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling): # {{{ 142 if isgprof: 143 print('gprof not supported by cluster, ignoring...') 144 134 145 executable = 'issm.exe' 135 146 if isdakota: … … 141 152 executable = 'issm_ocean.exe' 142 153 143 #write queuing script154 # Write queuing script 144 155 fid = open(modelname + '.queue', 'w') 145 fid.write('#PBS -S / bin /bash\n')146 fid.write('#PBS -l select= %i:ncpus=%i:model=%s\n' %(self.numnodes, self.cpuspernode, self.processor))147 fid.write('#PBS -l walltime= %i\n' % (self.time * 60))148 fid.write('#PBS -q %s \n' % self.queue)149 fid.write('#PBS -W group_list= %s\n' % self.grouplist)156 fid.write('#PBS -S /bin/bash\n') 157 fid.write('#PBS -l select={}:ncpus={}:model={}\n'.format(self.numnodes, self.cpuspernode, self.processor)) 158 fid.write('#PBS -l walltime={}\n'.format(self.time * 60)) # walltime is in seconds 159 fid.write('#PBS -q {} \n'.format(self.queue)) 160 fid.write('#PBS -W group_list={}\n'.format(self.grouplist)) 150 161 fid.write('#PBS -m e\n') 151 fid.write('#PBS -o %s/%s/%s.outlog \n' %(self.executionpath, dirname, modelname))152 fid.write('#PBS -e %s/%s/%s.errlog \n\n' %(self.executionpath, dirname, modelname))153 fid.write('. /usr/share/modules/init/bash\n\n')154 f id.write('module load comp-intel/2015.0.090\n')155 fid.write('module load mpi-sgi/mpt.2.11r13\n')162 fid.write('#PBS -o {}/{}/{}.outlog \n'.format(self.executionpath, dirname, modelname)) 163 fid.write('#PBS -e {}/{}/{}.errlog \n\n'.format(self.executionpath, dirname, modelname)) 164 fid.write('. /usr/share/modules/init/bash\n\n') 165 for i in range(len(self.modules)): 166 fid.write('module load {}\n'.format(self.modules[i])) 156 167 fid.write('export PATH="$PATH:."\n\n') 168 fid.write('export MPI_LAUNCH_TIMEOUT=520\n') 157 169 fid.write('export MPI_GROUP_MAX=64\n\n') 158 fid.write('export ISSM_DIR=" %s"\n' % self.srcpath)159 fid.write('source $ISSM_DIR/etc/environment.sh\n') 170 fid.write('export ISSM_DIR="{}"\n'.format(self.srcpath)) # FIXME 171 fid.write('source $ISSM_DIR/etc/environment.sh\n') # FIXME 160 172 fid.write('export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ISSM_DIR/externalpackages/petsc/install/lib"\n') 161 fid.write('cd %s/%s/ \n\n' %(self.executionpath, dirname))162 fid.write('mpiexec - np %i %s/%s %s %s/%s %s\n' % (self.nprocs(), self.codepath, executable, str(solution), self.executionpath, dirname, modelname))173 fid.write('cd %s/%s/\n\n'.format(self.executionpath, dirname)) 174 fid.write('mpiexec -np {} {}/{} {} {}/{} {}\n'.format(self.nprocs(), self.cpuspernode, self.codepath, executable, solution, self.executionpath, dirname, modelname)) 163 175 164 176 fid.close() … … 166 178 # }}} 167 179 168 def UploadQueueJob(self, modelname, dirname, filelist): # {{{169 # compress the files into one zip.170 compressstring = 'tar -zcf %s.tar.gz ' % dirname180 def UploadQueueJob(self, modelname, dirname, filelist): # {{{ 181 # Compress the files into one zip 182 compressstring = 'tar -zcf {}.tar.gz'.format(dirname) 171 183 for file in filelist: 172 compressstring += ' %s' %file184 compressstring += file 173 185 subprocess.call(compressstring, shell=True) 174 186 175 187 print('uploading input file and queueing script') 176 issmscpout(self.name, self.executionpath, self.login, self.port, [dirname + '.tar.gz']) 177 178 # }}} 179 def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ 188 directory = self.executionpath 189 issmscpout(self.name, directory, self.login, self.port, [dirname + '.tar.gz']) 190 191 # }}} 192 def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ 193 if restart: 194 launchcommand = 'cd {} && cd {} && qsub {}.queue'.format(self.executionpath, dirname, modelname) 195 else: 196 launchcommand = 'cd {} && rm -rf ./{} && mkdir {} && cd {} && mv ../{}.tar.gz ./ && tar -zxf {}.tar.gz && qsub {}.queue'.format(self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname) 197 180 198 print('launching solution sequence on remote cluster') 181 if restart:182 launchcommand = 'cd %s && cd %s && qsub %s.queue' % (self.executionpath, dirname, modelname)183 else:184 launchcommand = 'cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz && qsub %s.queue' % (self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname)185 199 issmssh(self.name, self.login, self.port, launchcommand) 186 200 187 201 # }}} 188 def Download(self, dirname, filelist): # {{{189 # copy files from cluster to current directory190 directory = ' %s/%s/' %(self.executionpath, dirname)202 def Download(self, dirname, filelist): # {{{ 203 # Copy files from cluster to current directory 204 directory = '{}/{}/'.format(self.executionpath, dirname) 191 205 issmscpin(self.name, self.login, self.port, directory, filelist) 192 206 # }}} -
issm/trunk-jpl/src/m/classes/clusters/sherlock.m
r24160 r26330 1 % PFEclass definition1 %SHERLOCK cluster class definition 2 2 % 3 3 % Usage: … … 7 7 8 8 classdef sherlock 9 properties (SetAccess=public) 10 % {{{11 name = 'sherlock'12 login = '';13 numnodes = 1;14 cpuspernode = 24;15 port = 0;16 codepath = '';17 executionpath = '';18 interactive = 0;19 time = 30;20 memory = 2;21 end22 %}}}23 methods24 function cluster=sherlock(varargin) % {{{9 properties (SetAccess=public) 10 % {{{ 11 name = 'sherlock' 12 login = ''; 13 numnodes = 1; 14 cpuspernode = 24; 15 port = 0; 16 codepath = ''; 17 executionpath = ''; 18 interactive = 0; 19 time = 30; 20 memory = 2; 21 end 22 %}}} 23 methods 24 function cluster=sherlock(varargin) % {{{ 25 25 26 %initialize cluster using default settings if provided27 if (exist('sherlock_settings')==2), sherlock_settings; end26 %initialize cluster using default settings if provided 27 if (exist('sherlock_settings')==2), sherlock_settings; end 28 28 29 %use provided options to change fields30 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);31 end32 %}}}33 function disp(cluster) % {{{34 % display the object35 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));36 disp(sprintf(' name: %s',cluster.name));37 disp(sprintf(' login: %s',cluster.login));38 disp(sprintf(' port: %i',cluster.port));39 disp(sprintf(' numnodes: %i',cluster.numnodes));40 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode));41 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes));42 disp(sprintf(' codepath: %s',cluster.codepath));43 disp(sprintf(' executionpath: %s',cluster.executionpath));44 disp(sprintf(' interactive: %i',cluster.interactive));45 disp(sprintf(' time: %i',cluster.time));46 disp(sprintf(' memory: %i',cluster.memory));47 end48 %}}}49 function numprocs=np(cluster) % {{{50 %compute number of processors51 numprocs=cluster.numnodes*cluster.cpuspernode;52 end53 %}}}54 function md = checkconsistency(cluster,md,solution,analyses) % {{{29 %use provided options to change fields 30 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 31 end 32 %}}} 33 function disp(cluster) % {{{ 34 % display the object 35 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 36 disp(sprintf(' name: %s',cluster.name)); 37 disp(sprintf(' login: %s',cluster.login)); 38 disp(sprintf(' port: %i',cluster.port)); 39 disp(sprintf(' numnodes: %i',cluster.numnodes)); 40 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 41 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes)); 42 disp(sprintf(' codepath: %s',cluster.codepath)); 43 disp(sprintf(' executionpath: %s',cluster.executionpath)); 44 disp(sprintf(' interactive: %i',cluster.interactive)); 45 disp(sprintf(' time: %i',cluster.time)); 46 disp(sprintf(' memory: %i',cluster.memory)); 47 end 48 %}}} 49 function numprocs=nprocs(cluster) % {{{ 50 %compute number of processors 51 numprocs=cluster.numnodes*cluster.cpuspernode; 52 end 53 %}}} 54 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 55 55 56 %Miscelaneous57 if isempty(cluster.login), md = checkmessage(md,'login empty'); end58 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end59 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end56 %Miscelaneous 57 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 58 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end 59 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end 60 60 61 end62 %}}}63 function BuildKrigingQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{61 end 62 %}}} 63 function BuildKrigingQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 64 64 65 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end66 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end65 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 66 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 67 67 68 %write queuing script69 fid=fopen([modelname '.queue'],'w');70 fprintf(fid,'#!/bin/bash\n');71 fprintf(fid,'#SBATCH --job-name=%s\n',mdelname);72 fprintf(fid,'#SBATCH -p %s \n',cluster.queue);73 fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode);74 fprintf(fid,'#SBATCH --time=%i\n',cluster.time*60); %walltime is in seconds.75 fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);76 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);77 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);78 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME79 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME80 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);81 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);82 if ~io_gather, %concatenate the output files:83 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);84 end85 fclose(fid);86 end87 %}}}88 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{68 %write queuing script 69 fid=fopen([modelname '.queue'],'w'); 70 fprintf(fid,'#!/bin/bash\n'); 71 fprintf(fid,'#SBATCH --job-name=%s\n',mdelname); 72 fprintf(fid,'#SBATCH -p %s \n',cluster.queue); 73 fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode); 74 fprintf(fid,'#SBATCH --time=%i\n',cluster.time*60); %walltime is in seconds. 75 fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory); 76 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname); 77 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname); 78 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME 79 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 80 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname); 81 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname); 82 if ~io_gather, %concatenate the output files: 83 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 84 end 85 fclose(fid); 86 end 87 %}}} 88 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 89 89 90 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end91 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end90 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 91 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 92 92 93 %write queuing script94 fid=fopen([modelname '.queue'],'w');95 fprintf(fid,'#!/bin/bash\n');96 fprintf(fid,'#SBATCH --job-name=%s\n',modelname);97 fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode);98 fprintf(fid,'#SBATCH --time=%i\n',cluster.time*60); %walltime is in seconds.99 fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);100 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);101 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);102 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME103 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME104 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);105 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);106 if ~io_gather, %concatenate the output files:107 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);108 end109 fclose(fid);93 %write queuing script 94 fid=fopen([modelname '.queue'],'w'); 95 fprintf(fid,'#!/bin/bash\n'); 96 fprintf(fid,'#SBATCH --job-name=%s\n',modelname); 97 fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode); 98 fprintf(fid,'#SBATCH --time=%i\n',cluster.time*60); %walltime is in seconds. 99 fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory); 100 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname); 101 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname); 102 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME 103 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 104 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname); 105 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 106 if ~io_gather, %concatenate the output files: 107 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 108 end 109 fclose(fid); 110 110 111 %in interactive mode, create a run file, and errlog and outlog file112 if cluster.interactive,113 fid=fopen([modelname '.run'],'w');114 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);115 if ~io_gather, %concatenate the output files:116 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);117 end118 fclose(fid);119 fid=fopen([modelname '.errlog'],'w');120 fclose(fid);121 fid=fopen([modelname '.outlog'],'w');122 fclose(fid);123 end124 end %}}}125 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{111 %in interactive mode, create a run file, and errlog and outlog file 112 if cluster.interactive, 113 fid=fopen([modelname '.run'],'w'); 114 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 115 if ~io_gather, %concatenate the output files: 116 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 117 end 118 fclose(fid); 119 fid=fopen([modelname '.errlog'],'w'); 120 fclose(fid); 121 fid=fopen([modelname '.outlog'],'w'); 122 fclose(fid); 123 end 124 end %}}} 125 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 126 126 127 %compress the files into one zip.128 compressstring=['tar -zcf ' dirname '.tar.gz '];129 for i=1:numel(filelist),130 compressstring = [compressstring ' ' filelist{i}];131 end132 if cluster.interactive,133 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];134 end135 system(compressstring);127 %compress the files into one zip. 128 compressstring=['tar -zcf ' dirname '.tar.gz ']; 129 for i=1:numel(filelist), 130 compressstring = [compressstring ' ' filelist{i}]; 131 end 132 if cluster.interactive, 133 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 134 end 135 system(compressstring); 136 136 137 disp('uploading input file and queueing script');138 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});137 disp('uploading input file and queueing script'); 138 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 139 139 140 end %}}}141 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{140 end %}}} 141 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 142 142 143 disp('launching solution sequence on remote cluster');144 if ~isempty(restart)145 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue '];146 else147 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...148 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && sbatch ' modelname '.queue '];149 end150 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);151 end %}}}152 function Download(cluster,dirname,filelist)% {{{143 disp('launching solution sequence on remote cluster'); 144 if ~isempty(restart) 145 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue ']; 146 else 147 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 148 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && sbatch ' modelname '.queue ']; 149 end 150 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 151 end %}}} 152 function Download(cluster,dirname,filelist) % {{{ 153 153 154 %copy files from cluster to current directory155 directory=[cluster.executionpath '/' dirname '/'];156 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);154 %copy files from cluster to current directory 155 directory=[cluster.executionpath '/' dirname '/']; 156 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 157 157 158 end %}}}158 end %}}} 159 159 end 160 160 end -
issm/trunk-jpl/src/m/classes/clusters/tetralith.m
r23265 r26330 1 % teralithclass definition1 %TERALITH cluster class definition 2 2 % 3 3 % Usage: … … 7 7 8 8 classdef tetralith 9 properties (SetAccess=public) 9 properties (SetAccess=public) 10 10 % {{{ 11 11 name = 'tetralith'; … … 66 66 end 67 67 %}}} 68 function numprocs=np (self) % {{{68 function numprocs=nprocs(self) % {{{ 69 69 %compute number of processors 70 70 numprocs=self.numnodes*self.cpuspernode; … … 78 78 %compute number of processors 79 79 % cluster.np=cluster.numnodes*cluster.cpuspernode; 80 np (cluster);%=cluster.numnodes*cluster.cpuspernode;80 nprocs(cluster);%=cluster.numnodes*cluster.cpuspernode; 81 81 82 82 %write queuing script … … 106 106 % fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname); 107 107 % fprintf(fid,'mpiexec_mpt -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname); 108 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);108 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 109 109 % fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 110 if ~io_gather, %concatenate the output files:111 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);112 end113 fclose(fid);110 if ~io_gather, %concatenate the output files: 111 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 112 end 113 fclose(fid); 114 114 end 115 115 %}}} … … 132 132 %compute number of processors 133 133 % cluster.np=cluster.numnodes*cluster.cpuspernode; 134 np (cluster);%=cluster.numnodes*cluster.cpuspernode;134 nprocs(cluster);%=cluster.numnodes*cluster.cpuspernode; 135 135 % shortname = substring(modelname,1,min(12,length(modelname))); 136 136 … … 160 160 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname); 161 161 % fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname); 162 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);162 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 163 163 % fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 164 164 % fprintf(fid,'mpiexec_mpt -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname); … … 183 183 end 184 184 end %}}} 185 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{185 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 186 186 187 187 %compress the files into one zip. … … 198 198 end 199 199 %}}} 200 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{200 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 201 201 202 202 disp('launching solution sequence on remote cluster'); … … 206 206 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 207 207 end %}}} 208 function Download(cluster,dirname,filelist) % {{{208 function Download(cluster,dirname,filelist) % {{{ 209 209 210 210 %copy files from cluster to current directory -
issm/trunk-jpl/src/m/classes/clusters/yellowstone.m
r21699 r26330 1 %YELLOWSTONE cl ass definition1 %YELLOWSTONE cluster class definition 2 2 % 3 3 % Usage: … … 7 7 8 8 classdef yellowstone 9 properties (SetAccess=public) 10 % {{{11 name = 'yellowstone.ucar.edu'12 login = '';13 modules = {'ncarenv/1.0' 'ncarbinlibs/1.1' 'perlmods/5.0' 'gmake/4.1' 'python/2.7.7' 'all-python-libs' 'git/2.3.0' 'intel/15.0.3' 'mkl/11.1.2' 'esmf' 'esmf-6.3.0rp1-defio-mpi-O' 'netcdf-mpi/4.3.3.1' 'pnetcdf/1.6.1' 'ncarcompilers/1.0' 'cmake/3.0.2' 'matlab/R2015b' 'issm'};14 numnodes = 1;15 cpuspernode = 8;16 port = 0;17 queue = 'premium';18 time = 12*60;19 processor = 'sandy';20 codepath = '';21 executionpath = '';22 grouplist = 'P93300301';23 end24 %}}}25 methods26 function cluster=yellowstone(varargin) % {{{9 properties (SetAccess=public) 10 % {{{ 11 name = 'yellowstone.ucar.edu' 12 login = ''; 13 modules = {'ncarenv/1.0' 'ncarbinlibs/1.1' 'perlmods/5.0' 'gmake/4.1' 'python/2.7.7' 'all-python-libs' 'git/2.3.0' 'intel/15.0.3' 'mkl/11.1.2' 'esmf' 'esmf-6.3.0rp1-defio-mpi-O' 'netcdf-mpi/4.3.3.1' 'pnetcdf/1.6.1' 'ncarcompilers/1.0' 'cmake/3.0.2' 'matlab/R2015b' 'issm'}; 14 numnodes = 1; 15 cpuspernode = 8; 16 port = 0; 17 queue = 'premium'; 18 time = 12*60; 19 processor = 'sandy'; 20 codepath = ''; 21 executionpath = ''; 22 grouplist = 'P93300301'; 23 end 24 %}}} 25 methods 26 function cluster=yellowstone(varargin) % {{{ 27 27 28 %initialize cluster using default settings if provided29 if (exist('yellowstone_settings')==2), yellowstone_settings; end28 %initialize cluster using default settings if provided 29 if (exist('yellowstone_settings')==2), yellowstone_settings; end 30 30 31 %use provided options to change fields32 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);33 end34 %}}}35 function disp(cluster) % {{{36 % display the object37 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));38 disp(sprintf(' name: %s',cluster.name));39 disp(sprintf(' login: %s',cluster.login));40 modules=''; for i=1:length(cluster.modules), modules=[modules cluster.modules{i} ',']; end; modules=modules(1:end-1);41 disp(sprintf(' modules: %s',modules));42 disp(sprintf(' port: %i',cluster.port));43 disp(sprintf(' numnodes: %i',cluster.numnodes));44 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode));45 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes));46 disp(sprintf(' queue: %s',cluster.queue));47 disp(sprintf(' time: %i',cluster.time));48 disp(sprintf(' processor: %s',cluster.processor));49 disp(sprintf(' codepath: %s',cluster.codepath));50 disp(sprintf(' executionpath: %s',cluster.executionpath));51 disp(sprintf(' grouplist: %s',cluster.grouplist));52 end53 %}}}54 function numprocs=np(cluster) % {{{55 %compute number of processors56 numprocs=cluster.numnodes*cluster.cpuspernode;57 end58 %}}}59 function md = checkconsistency(cluster,md,solution,analyses) % {{{31 %use provided options to change fields 32 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 33 end 34 %}}} 35 function disp(cluster) % {{{ 36 % display the object 37 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 38 disp(sprintf(' name: %s',cluster.name)); 39 disp(sprintf(' login: %s',cluster.login)); 40 modules=''; for i=1:length(cluster.modules), modules=[modules cluster.modules{i} ',']; end; modules=modules(1:end-1); 41 disp(sprintf(' modules: %s',modules)); 42 disp(sprintf(' port: %i',cluster.port)); 43 disp(sprintf(' numnodes: %i',cluster.numnodes)); 44 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 45 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes)); 46 disp(sprintf(' queue: %s',cluster.queue)); 47 disp(sprintf(' time: %i',cluster.time)); 48 disp(sprintf(' processor: %s',cluster.processor)); 49 disp(sprintf(' codepath: %s',cluster.codepath)); 50 disp(sprintf(' executionpath: %s',cluster.executionpath)); 51 disp(sprintf(' grouplist: %s',cluster.grouplist)); 52 end 53 %}}} 54 function numprocs=nprocs(cluster) % {{{ 55 %compute number of processors 56 numprocs=cluster.numnodes*cluster.cpuspernode; 57 end 58 %}}} 59 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 60 60 61 available_queues={'premium','regular'};62 queue_requirements_time=[12*60 12*650];63 queue_requirements_np=[16384 16384];61 available_queues={'premium','regular'}; 62 queue_requirements_time=[12*60 12*650]; 63 queue_requirements_np=[16384 16384]; 64 64 65 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)65 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time) 66 66 67 %Miscelaneous68 if isempty(cluster.login), md = checkmessage(md,'login empty'); end69 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end70 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end71 if isempty(cluster.grouplist), md = checkmessage(md,'grouplist empty'); end67 %Miscelaneous 68 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 69 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end 70 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end 71 if isempty(cluster.grouplist), md = checkmessage(md,'grouplist empty'); end 72 72 73 end74 %}}}75 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{73 end 74 %}}} 75 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 76 76 77 executable='issm.exe';78 if isdakota,79 version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));80 if (version>=6),81 executable='issm_dakota.exe';82 end83 end84 if isoceancoupling,85 executable='issm_ocean.exe';86 end77 executable='issm.exe'; 78 if isdakota, 79 version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3)); 80 if (version>=6), 81 executable='issm_dakota.exe'; 82 end 83 end 84 if isoceancoupling, 85 executable='issm_ocean.exe'; 86 end 87 87 88 88 89 %write queuing script90 fid=fopen([modelname '.queue'],'w');91 fprintf(fid,'#!/bin/tcsh\n');92 fprintf(fid,'#BSUB -P %s\n',cluster.grouplist);93 fprintf(fid,'#BSUB -W %i:%i\n',floor(cluster.time/60),cluster.time-floor(cluster.time/60)*60);94 fprintf(fid,'#BSUB -n %i\n',cluster.np);95 fprintf(fid,'#BSUB -J %s\n',modelname);96 fprintf(fid,'#BSUB -o %s.outlog \n',[cluster.executionpath '/' dirname '/' modelname]);97 fprintf(fid,'#BSUB -e %s.errlog \n',[cluster.executionpath '/' dirname '/' modelname]);98 fprintf(fid,'#BSUB -q %s\n',cluster.queue);89 %write queuing script 90 fid=fopen([modelname '.queue'],'w'); 91 fprintf(fid,'#!/bin/tcsh\n'); 92 fprintf(fid,'#BSUB -P %s\n',cluster.grouplist); 93 fprintf(fid,'#BSUB -W %i:%i\n',floor(cluster.time/60),cluster.time-floor(cluster.time/60)*60); 94 fprintf(fid,'#BSUB -n %i\n',cluster.np); 95 fprintf(fid,'#BSUB -J %s\n',modelname); 96 fprintf(fid,'#BSUB -o %s.outlog \n',[cluster.executionpath '/' dirname '/' modelname]); 97 fprintf(fid,'#BSUB -e %s.errlog \n',[cluster.executionpath '/' dirname '/' modelname]); 98 fprintf(fid,'#BSUB -q %s\n',cluster.queue); 99 99 100 fprintf(fid,'module purge\n');101 for i=1:length(cluster.modules),102 fprintf(fid,'module load %s\n',cluster.modules{i});103 end100 fprintf(fid,'module purge\n'); 101 for i=1:length(cluster.modules), 102 fprintf(fid,'module load %s\n',cluster.modules{i}); 103 end 104 104 105 fprintf(fid,'setenv OMP_STACKSIZE 256M\n');106 fprintf(fid,'setenv MP_LABELIO yes\n');107 fprintf(fid,'setenv MP_INFOLEVEL 2\n');108 fprintf(fid,'setenv MP_SHARED_MEMORY yes\n');109 fprintf(fid,'setenv MP_EUILIB us\n');110 fprintf(fid,'setenv MP_STDOUTMODE unordered\n');111 fprintf(fid,'setenv MP_RC_USE_LMC yes\n');112 fprintf(fid,'setenv MP_MPILIB mpich2\n');113 fprintf(fid,'setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/opt/ibmhpc/pecurrent/mpich2/intel/lib64/\n');114 fprintf(fid,'setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/ncar/opt/intel/psxe-2015_update3/impi/5.0.3.048/lib64/\n');105 fprintf(fid,'setenv OMP_STACKSIZE 256M\n'); 106 fprintf(fid,'setenv MP_LABELIO yes\n'); 107 fprintf(fid,'setenv MP_INFOLEVEL 2\n'); 108 fprintf(fid,'setenv MP_SHARED_MEMORY yes\n'); 109 fprintf(fid,'setenv MP_EUILIB us\n'); 110 fprintf(fid,'setenv MP_STDOUTMODE unordered\n'); 111 fprintf(fid,'setenv MP_RC_USE_LMC yes\n'); 112 fprintf(fid,'setenv MP_MPILIB mpich2\n'); 113 fprintf(fid,'setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/opt/ibmhpc/pecurrent/mpich2/intel/lib64/\n'); 114 fprintf(fid,'setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/ncar/opt/intel/psxe-2015_update3/impi/5.0.3.048/lib64/\n'); 115 115 116 fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,dirname);116 fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,dirname); 117 117 118 fprintf(fid,'mpirun.lsf %s/%s %s %s %s\n',cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);119 fclose(fid);118 fprintf(fid,'mpirun.lsf %s/%s %s %s %s\n',cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname); 119 fclose(fid); 120 120 121 end %}}}122 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{121 end %}}} 122 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 123 123 124 %compress the files into one zip.125 compressstring=['tar -zcf ' dirname '.tar.gz '];126 for i=1:numel(filelist),127 compressstring = [compressstring ' ' filelist{i}];128 end129 system(compressstring);124 %compress the files into one zip. 125 compressstring=['tar -zcf ' dirname '.tar.gz ']; 126 for i=1:numel(filelist), 127 compressstring = [compressstring ' ' filelist{i}]; 128 end 129 system(compressstring); 130 130 131 disp('uploading input file and queueing script');132 directory=cluster.executionpath;131 disp('uploading input file and queueing script'); 132 directory=cluster.executionpath; 133 133 134 issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']});134 issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']}); 135 135 136 end137 %}}}138 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{136 end 137 %}}} 138 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 139 139 140 %lauch command, to be executed via ssh141 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...142 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && bsub < ' modelname '.queue '];140 %lauch command, to be executed via ssh 141 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 142 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && bsub < ' modelname '.queue ']; 143 143 144 disp('launching solution sequence on remote cluster');145 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);146 end147 %}}}148 function Download(cluster,dirname,filelist)% {{{144 disp('launching solution sequence on remote cluster'); 145 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 146 end 147 %}}} 148 function Download(cluster,dirname,filelist) % {{{ 149 149 150 %copy files from cluster to current directory151 directory=[cluster.executionpath '/' dirname '/'];152 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);150 %copy files from cluster to current directory 151 directory=[cluster.executionpath '/' dirname '/']; 152 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 153 153 154 end %}}}154 end %}}} 155 155 end 156 156 end
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/trac/issm/chrome/common/trac_banner.png)