Changeset 26332
- Timestamp:
- 06/28/21 14:12:20 (4 years ago)
- Location:
- issm/trunk-jpl/src/m
- Files:
-
- 1 added
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/clusters/acenet.m
r21576 r26332 7 7 8 8 classdef acenet 9 properties (SetAccess=public) 10 11 12 13 14 15 16 17 18 19 20 21 22 23 executionpath='/net/glacdyn-data/glacdyn/1/klemorza/issm.dir';24 25 26 27 28 29 30 31 9 properties (SetAccess=public) 10 % {{{ 11 %name='glacdyn.ace-net.ca' 12 name='placentia.ace-net.ca' 13 %name='brasdor.ace-net.ca' 14 login='klemorza'; 15 np=10; 16 port=0; 17 queue='longq'; 18 time=10; 19 % codepath='/usr/local/issm-r11321/bin'; % this one is for issm on acenet global 20 codepath='/home/klemorza/issm/trunk-jpl/bin'; % this one is for issm on my acenet directory 21 %executionpath='/home/klemorza/issm/trunk-jpl/execution'; 22 %executionpath='/home/klemorza/scratch/issmres.dir'; 23 executionpath='/net/glacdyn-data/glacdyn/1/klemorza/issm.dir'; 24 %}}} 25 end 26 methods 27 function cluster=acenet(varargin) % {{{ 28 %use provided options to change fields 29 options=pairoptions(varargin{:}); 30 %initialize cluster using user settings if provided 31 if (exist([cluster.name '_settings'])==2), eval([cluster.name '_settings']); end 32 32 33 34 35 36 37 38 %display the object39 40 41 42 43 44 45 46 47 48 49 50 33 %OK get other fields 34 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 35 end 36 %}}} 37 function disp(cluster) % {{{ 38 % display the object 39 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 40 disp(sprintf(' name: %s',cluster.name)); 41 disp(sprintf(' login: %s',cluster.login)); 42 disp(sprintf(' np: %i',cluster.np)); 43 disp(sprintf(' port: %i',cluster.port)); 44 disp(sprintf(' queue: %s',cluster.queue)); 45 disp(sprintf(' time: %i',cluster.time)); 46 disp(sprintf(' codepath: %s',cluster.codepath)); 47 disp(sprintf(' executionpath: %s',cluster.executionpath)); 48 end 49 %}}} 50 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 51 51 52 53 54 55 56 57 58 52 available_queues={'debug','shortq','longq'}; 53 queue_requirements_time=[48*1 48*7 48*15]; 54 queue_requirements_np=[32 128 256]; 55 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time) 56 end 57 %}}} 58 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 59 59 60 61 60 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 61 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 62 62 63 64 65 66 63 %write queuing script 64 fid=fopen([modelname '.queue'],'w'); 65 fprintf(fid,'#!/bin/bash\n'); 66 fprintf(fid,'#$ -cwd\n'); 67 67 68 69 70 71 72 73 74 75 76 77 68 fprintf(fid,'#$ -N issm\n'); 69 % fprintf(fid,'#$ -l h_rt=00:15:00\n'); 70 % fprintf(fid,'#$ -l h_rt=5:00:0\n'); 71 % fprintf(fid,'#$ -l h_rt=25:00:0\n'); 72 % fprintf(fid,'#$ -l h_rt=47:59:00\n'); 73 % fprintf(fid,'#$ -l h_rt=72:00:0\n'); 74 % fprintf(fid,'#$ -l h_rt=96:00:0\n'); 75 % fprintf(fid,'#$ -l h_rt=336:00:0\n'); 76 tstr = sprintf('#$ -l h_rt=%i:00:00\n',cluster.time); 77 fprintf(fid,tstr); 78 78 79 79 fprintf(fid,'#$ -l h_vmem=2G\n'); 80 80 81 if strcmp(cluster.executionpath,'/home/klemorza/scratch/issmres.dir') 82 % ---- Which acent queue to use ---- 83 fprintf(fid,'#$ -q short.q@*,medium.q@*\n'); 84 %fprintf(fid,'#$ -q medium.q@*,long.q@*\n'); 85 %fprintf(fid,'#$ -q medium.q@*\n'); 86 %fprintf(fid,'#$ -q short.q@*\n'); 87 % Acenet nodes with 16cpus and more than 60G mem 88 % fprintf(fid,'#$ -l h=cl001|cl002|cl003|cl004|cl005|cl006|cl007|cl008|cl009|cl010|cl011|cl012|cl021|cl022|cl023|cl024 \n'); 89 % ---- cpus on different nodes ---- 90 if cluster.np==4 91 % -------- All cpus in the same node -------- 92 fprintf(fid,'#$ -pe openmp %i\n',cluster.np); 93 else 94 fprintf(fid,'#$ -pe ompi %i\n',cluster.np); % To avoid green acenet that does not have InfiniBand 95 end 96 97 elseif strcmp(cluster.executionpath,'/net/glacdyn-data/glacdyn/1/klemorza/issm.dir') 98 % ---- Which node for Lev's queue are selected ---- 99 fprintf(fid,'#$ -q tarasov.q\n'); 100 fprintf(fid,'#$ -l h=cl27*|cl28*|cl29*|cl30*|cl31*|cl320|cl267|cl268|cl269|cl338 \n'); 101 %fprintf(fid,'#$ -l h=cl27*|cl28*|cl29*|cl30*|cl31*|cl320|cl267|cl268|cl269 \n'); 102 %fprintf(fid,'#$ -l h=cl0* \n'); 103 % fprintf(fid,'#$ -l h=cl338 \n'); 104 105 if cluster.np==4 106 % -------- All cpus in the same node -------- 107 fprintf(fid,'#$ -pe openmp %i\n',cluster.np); 108 else 109 fprintf(fid,'#$ -pe ompi* %i\n',cluster.np); 110 %fprintf(fid,'#$ -pe 4per %i\n',cluster.np); 111 %fprintf(fid,'#$ -pe 8per %i\n',cluster.np); 112 end 113 end 114 115 % ---- misc ---- 116 fprintf(fid,'#$ -j y\n'); 117 118 fprintf(fid,'module purge\n'); 119 %fprintf(fid,'module load gcc openmpi/gcc\n'); 120 %fprintf(fid,'module unload openmpi\n'); 121 fprintf(fid,'module load intel/12.1.7.367\n'); 122 fprintf(fid,'module load openmpi/intel/1.2.9\n'); 81 if strcmp(cluster.executionpath,'/home/klemorza/scratch/issmres.dir') 82 % ---- Which acent queue to use ---- 83 fprintf(fid,'#$ -q short.q@*,medium.q@*\n'); 84 %fprintf(fid,'#$ -q medium.q@*,long.q@*\n'); 85 %fprintf(fid,'#$ -q medium.q@*\n'); 86 %fprintf(fid,'#$ -q short.q@*\n'); 87 % Acenet nodes with 16cpus and more than 60G mem 88 % fprintf(fid,'#$ -l h=cl001|cl002|cl003|cl004|cl005|cl006|cl007|cl008|cl009|cl010|cl011|cl012|cl021|cl022|cl023|cl024 \n'); 89 % ---- cpus on different nodes ---- 90 if cluster.np==4 91 % -------- All cpus in the same node -------- 92 fprintf(fid,'#$ -pe openmp %i\n',cluster.np); 93 else 94 fprintf(fid,'#$ -pe ompi %i\n',cluster.np); % To avoid green acenet that does not have InfiniBand 95 end 123 96 124 fprintf(fid,'module load gsl\n'); 125 %fprintf(fid,'module load issm\n'); 126 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME 127 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 128 fprintf(fid,'\n'); 129 fprintf(fid,'mpiexec %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog\n',... 130 cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname,modelname,modelname); 131 %fprintf(fid,'echo $HOSTNAME >>%s.outlog',modelname); 132 fclose(fid); 97 elseif strcmp(cluster.executionpath,'/net/glacdyn-data/glacdyn/1/klemorza/issm.dir') 98 % ---- Which node for Lev's queue are selected ---- 99 fprintf(fid,'#$ -q tarasov.q\n'); 100 fprintf(fid,'#$ -l h=cl27*|cl28*|cl29*|cl30*|cl31*|cl320|cl267|cl268|cl269|cl338 \n'); 101 %fprintf(fid,'#$ -l h=cl27*|cl28*|cl29*|cl30*|cl31*|cl320|cl267|cl268|cl269 \n'); 102 %fprintf(fid,'#$ -l h=cl0* \n'); 103 % fprintf(fid,'#$ -l h=cl338 \n'); 104 105 if cluster.np==4 106 % -------- All cpus in the same node -------- 107 fprintf(fid,'#$ -pe openmp %i\n',cluster.np); 108 else 109 fprintf(fid,'#$ -pe ompi* %i\n',cluster.np); 110 %fprintf(fid,'#$ -pe 4per %i\n',cluster.np); 111 %fprintf(fid,'#$ -pe 8per %i\n',cluster.np); 112 end 113 end 114 115 % ---- misc ---- 116 fprintf(fid,'#$ -j y\n'); 117 118 fprintf(fid,'module purge\n'); 119 %fprintf(fid,'module load gcc openmpi/gcc\n'); 120 %fprintf(fid,'module unload openmpi\n'); 121 fprintf(fid,'module load intel/12.1.7.367\n'); 122 fprintf(fid,'module load openmpi/intel/1.2.9\n'); 133 123 134 end 135 %}}} 136 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{ 124 fprintf(fid,'module load gsl\n'); 125 %fprintf(fid,'module load issm\n'); 126 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME 127 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 128 fprintf(fid,'\n'); 129 fprintf(fid,'mpiexec %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog\n',... 130 cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname,modelname,modelname); 131 %fprintf(fid,'echo $HOSTNAME >>%s.outlog',modelname); 132 fclose(fid); 137 133 138 %compress the files into one zip. 139 compressstring=['tar -zcf ' dirname '.tar.gz ']; 140 for i=1:numel(filelist), 141 compressstring = [compressstring ' ' filelist{i}]; 142 end 143 system(compressstring); 134 end 135 %}}} 136 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 144 137 145 disp('uploading input file and queueing script'); 146 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 138 %compress the files into one zip. 139 compressstring=['tar -zcf ' dirname '.tar.gz ']; 140 for i=1:numel(filelist), 141 compressstring = [compressstring ' ' filelist{i}]; 142 end 143 system(compressstring); 147 144 148 end %}}} 145 disp('uploading input file and queueing script'); 146 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 149 147 150 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{148 end %}}} 151 149 152 disp('launching solution sequence on remote cluster'); 153 if ~isempty(restart) 154 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue ']; 155 else 156 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 157 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; 158 end 159 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 160 end %}}} 150 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{ 161 151 162 function Download(cluster,dirname,filelist)% {{{ 152 disp('launching solution sequence on remote cluster'); 153 if ~isempty(restart) 154 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue ']; 155 else 156 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 157 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; 158 end 159 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 160 end %}}} 163 161 164 %copy files from cluster to current directory 165 directory=[cluster.executionpath '/' dirname '/']; 166 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 162 function Download(cluster,dirname,filelist) % {{{ 167 163 168 end %}}} 164 %copy files from cluster to current directory 165 directory=[cluster.executionpath '/' dirname '/']; 166 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 167 168 end %}}} 169 169 end 170 170 end -
issm/trunk-jpl/src/m/classes/clusters/aci.m
r21818 r26332 53 53 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.ppn*cluster.nodes,1) 54 54 55 %Miscel aneous55 %Miscellaneous 56 56 if cluster.ppn>20, md = checkmessage(md,'cannot request more that 20 cores per node'); end 57 57 if isempty(cluster.login), md = checkmessage(md,'login empty'); end -
issm/trunk-jpl/src/m/classes/clusters/aurora.m
r26330 r26332 38 38 disp(sprintf(' numnodes: %i',cluster.numnodes)); 39 39 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 40 disp(sprintf(' np: %i',cluster.nprocs())); 41 disp(sprintf(' modules: %s',strjoin(cluster.modules,', '))); 40 42 disp(sprintf(' port: %i',cluster.port)); 41 43 disp(sprintf(' queue: %s',cluster.queue)); … … 43 45 disp(sprintf(' codepath: %s',cluster.codepath)); 44 46 disp(sprintf(' executionpath: %s',cluster.executionpath)); 47 disp(sprintf(' mpipath: %s',cluster.mpipath)); 45 48 end 46 49 %}}} -
issm/trunk-jpl/src/m/classes/clusters/camhpc.m
r26330 r26332 38 38 disp(sprintf(' name: %s',cluster.name)); 39 39 disp(sprintf(' login: %s',cluster.login)); 40 disp(sprintf(' port: %i',cluster.port));41 40 disp(sprintf(' numnodes: %i',cluster.numnodes)); 42 41 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 43 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes)); 42 disp(sprintf(' np: %i',cluster.nprocs())); 43 disp(sprintf(' port: %i',cluster.port)); 44 44 disp(sprintf(' project: %s',cluster.project)); 45 45 disp(sprintf(' partition: %s',cluster.partition)); … … 62 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.nprocs(),1) 65 65 66 %Miscel aneous66 %Miscellaneous 67 67 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 68 68 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end … … 92 92 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 93 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);94 fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 95 95 if ~io_gather, %concatenate the output files: 96 96 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); … … 101 101 if cluster.interactive, 102 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);103 fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 104 104 if ~io_gather, %concatenate the output files: 105 105 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); -
issm/trunk-jpl/src/m/classes/clusters/castor.m
r21576 r26332 7 7 8 8 classdef castor 9 properties (SetAccess=public) 10 11 12 13 np=128;14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 9 properties (SetAccess=public) 10 % {{{ 11 name='castor' 12 login='username'; 13 np=128; 14 port=0; 15 queue='shortc'; 16 time=180; 17 codepath='/workp/edw/issm-2.0/bin' 18 executionpath='/workp/edw/Testing/Execution' 19 %}}} 20 end 21 methods 22 function cluster=castor(varargin) % {{{ 23 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 24 end 25 %}}} 26 function disp(cluster) % {{{ 27 % display the object 28 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 29 disp(sprintf(' name: %s',cluster.name)); 30 disp(sprintf(' login: %s',cluster.login)); 31 disp(sprintf(' np: %i',cluster.np)); 32 disp(sprintf(' port: %i',cluster.port)); 33 disp(sprintf(' queue: %s',cluster.queue)); 34 disp(sprintf(' time: %i',cluster.time)); 35 disp(sprintf(' codepath: %s',cluster.codepath)); 36 disp(sprintf(' executionpath: %s',cluster.executionpath)); 37 end 38 %}}} 39 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 40 40 41 42 43 41 available_queues={'shortc','longc'}; 42 queue_requirements_time=[180 720]; 43 queue_requirements_np=[128 128]; 44 44 45 46 47 48 45 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time) 46 end 47 %}}} 48 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 49 49 50 51 50 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 51 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 52 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 53 %write queuing script 54 fid=fopen([modelname '.queue'],'w'); 55 fprintf(fid,'#!/bin/sh\n'); 56 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds. 57 fprintf(fid,'#PBS -N %s\n',modelname); 58 fprintf(fid,'#PBS -l ncpus=%i\n',cluster.np); 59 if ~isempty(queue), 60 fprintf(fid,'#PBS -q %s\n',cluster.queue); 61 end 62 fprintf(fid,'#PBS -o %s.outlog \n',modelname); 63 fprintf(fid,'#PBS -e %s.errlog \n',modelname); 64 fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]); 65 fprintf(fid,'cd $PBS_O_WORKDIR\n'); 66 fprintf(fid,'export OMP_NUM_THREADS=1\n'); 67 fprintf(fid,'dplace -s1 -c0-%i mpiexec -np %i %s/issm.exe %s %s %s',cluster.np-1,cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 68 fclose(fid); 69 69 70 71 72 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{70 end 71 %}}} 72 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 73 73 74 75 76 77 78 79 80 81 82 74 %compress the files into one zip. 75 compressstring=['tar -zcf ' dirname '.tar.gz ']; 76 for i=1:numel(filelist), 77 compressstring = [compressstring ' ' filelist{i}]; 78 end 79 if cluster.interactive, 80 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 81 end 82 system(compressstring); 83 83 84 85 84 disp('uploading input file and queueing script'); 85 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 86 86 87 88 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{87 end %}}} 88 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{ 89 89 90 91 92 93 94 95 96 97 98 99 function Download(cluster,dirname,filelist)% {{{90 disp('launching solution sequence on remote cluster'); 91 if ~isempty(restart) 92 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue ']; 93 else 94 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 95 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; 96 end 97 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 98 end %}}} 99 function Download(cluster,dirname,filelist) % {{{ 100 100 101 102 103 101 %copy files from cluster to current directory 102 directory=[cluster.executionpath '/' dirname '/']; 103 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 104 104 105 105 end %}}} 106 106 end 107 107 end -
issm/trunk-jpl/src/m/classes/clusters/cloud.m
r21576 r26332 6 6 7 7 classdef cloud 8 properties (SetAccess=public) 8 properties (SetAccess=public) 9 9 % {{{ 10 10 name=''; … … 64 64 end 65 65 %}}} 66 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{66 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 67 67 68 68 %compress the files into one zip. … … 80 80 81 81 end %}}} 82 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{82 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{ 83 83 84 84 if cluster.interactive, … … 101 101 issmstssh(cluster.name,cluster.login,launchcommand); 102 102 end %}}} 103 function Download(cluster,dirname,filelist) % {{{103 function Download(cluster,dirname,filelist) % {{{ 104 104 105 105 %copy files from cluster to current directory -
issm/trunk-jpl/src/m/classes/clusters/cosmos.m
r21576 r26332 7 7 8 8 classdef cosmos 9 properties (SetAccess=public) 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 9 properties (SetAccess=public) 10 % {{{ 11 name='cosmos' 12 login='username'; 13 np=128; 14 port=0; 15 queue='shortq'; 16 time=3*60; 17 codepath='/work00/edw/issm-2.0/bin'; 18 executionpath='/work00/edw/Execution'; 19 %}}} 20 end 21 methods 22 function cluster=cosmos(varargin) % {{{ 23 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 24 end 25 %}}} 26 function disp(cluster) % {{{ 27 % display the object 28 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 29 disp(sprintf(' name: %s',cluster.name)); 30 disp(sprintf(' login: %s',cluster.login)); 31 disp(sprintf(' np: %i',cluster.np)); 32 disp(sprintf(' port: %i',cluster.port)); 33 disp(sprintf(' queue: %s',cluster.queue)); 34 disp(sprintf(' time: %i',cluster.time)); 35 disp(sprintf(' codepath: %s',cluster.codepath)); 36 disp(sprintf(' executionpath: %s',cluster.executionpath)); 37 end 38 %}}} 39 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 40 40 41 42 43 41 available_queues={'debug','shortq','longq'}; 42 queue_requirements_time=[60*1 60*3 60*17]; 43 queue_requirements_np=[32 128 256]; 44 44 45 46 47 48 45 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time) 46 end 47 %}}} 48 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 49 49 50 51 50 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 51 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 52 52 53 %write queuing script54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 53 %write queuing script 54 fid=fopen([modelname '.queue'],'w'); 55 fprintf(fid,'#!/bin/bash\n'); 56 fprintf(fid,'#PBS -l select=%i:ncpus=1\n',cluster.np); 57 fprintf(fid,'#PBS -N %s\n',modelname); 58 fprintf(fid,'#PBS -l walltime=%i\n',time*60); %walltime is in seconds. 59 fprintf(fid,'#PBS -q %s\n',queue); 60 fprintf(fid,'#PBS -o %s.outlog \n',modelname); 61 fprintf(fid,'#PBS -e %s.errlog \n',modelname); 62 fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]); 63 fprintf(fid,'cd $PBS_O_WORKDIR\n'); 64 fprintf(fid,'export OMP_NUM_THREADS=1\n'); 65 fprintf(fid,'ulimit -s unlimited\n'); 66 fprintf(fid,'ulimit -c 0\n'); 67 fprintf(fid,'/opt/mpich/gm/intel10.1/bin/mpiexec -np %i %s/issm.exe %s %s %s',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 68 fclose(fid); 69 69 70 71 72 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{70 end 71 %}}} 72 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 73 73 74 75 76 77 78 79 80 81 82 74 %compress the files into one zip. 75 compressstring=['tar -zcf ' dirname '.tar.gz ']; 76 for i=1:numel(filelist), 77 compressstring = [compressstring ' ' filelist{i}]; 78 end 79 if cluster.interactive, 80 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 81 end 82 system(compressstring); 83 83 84 85 84 disp('uploading input file and queueing script'); 85 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 86 86 87 88 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{87 end %}}} 88 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{ 89 89 90 91 92 93 94 95 96 97 98 99 function Download(cluster,dirname,filelist)% {{{90 disp('launching solution sequence on remote cluster'); 91 if ~isempty(restart) 92 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue ']; 93 else 94 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 95 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; 96 end 97 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 98 end %}}} 99 function Download(cluster,dirname,filelist) % {{{ 100 100 101 102 103 101 %copy files from cluster to current directory 102 directory=[cluster.executionpath '/' dirname '/']; 103 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 104 104 105 105 end %}}} 106 106 end 107 107 end -
issm/trunk-jpl/src/m/classes/clusters/cyclone.py
r24269 r26332 12 12 13 13 class cyclone(object): 14 """ 15 Be aware that this is not a cluster as we usually know them. There is no scheduling and ressources are pretty low. 16 The Computer have 20 cpus and 512Gb of memory used by a number of person so be respectful with your usage. 17 I putted some restrictive upper limits to avoid over - use. (Basile) 14 """CYCLONE cluster class definition 18 15 19 Usage: 20 cluster = cyclone() 16 Be aware that this is not a cluster as we usually know them. There is no scheduling and resources are pretty low. 17 The computer has 20 CPUs and 512GB of memory used by a number of persons, so be respectful with your usage. 18 I have put some restrictive upper limits in place to avoid overuse. (Basile) 19 20 Usage: 21 cluster = cyclone() 21 22 """ 22 23 23 def __init__(self, *args): 24 def __init__(self, *args): # {{{ 24 25 self.name = 'cyclone' 25 26 self.login = '' … … 31 32 self.interactive = 0 32 33 33 #use provided options to change fields34 # Use provided options to change fields 34 35 options = pairoptions(*args) 35 36 36 #initialize cluster using user settings if provided37 # Initialize cluster using user settings if provided 37 38 self = cyclone_settings(self) 38 #OK get other fields39 # OK get other fields 39 40 self = options.AssignObjectFields(self) 40 41 41 # }}} 42 42 43 def __repr__(self): 44 # display the object43 def __repr__(self): # {{{ 44 # Display the object 45 45 s = "class cyclone object:" 46 46 s = "%s\n%s" % (s, fielddisplay(self, 'name', 'name of the cluster')) … … 53 53 # }}} 54 54 55 def checkconsistency(self, md, solution, analyses): 56 # Miscelaneous55 def checkconsistency(self, md, solution, analyses): # {{{ 56 # Miscellaneous 57 57 if not self.login: 58 58 md = md.checkmessage('login empty') … … 69 69 # }}} 70 70 71 def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling): 71 def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling): # {{{ 72 72 executable = 'issm.exe' 73 # write queuing script73 # Write queuing script 74 74 fid = open(modelname + '.queue', 'w') 75 75 fid.write('export ISSM_DIR="%s/../ "\n' % self.codepath) … … 83 83 fid.write('mpiexec -np %i %s/%s %s %s %s>%s.outlog 2>%s.errlog\n' % (self.np, self.codepath, executable, str(solution), rundir, modelname, runfile, runfile)) 84 84 fid.close() 85 86 85 # }}} 87 def UploadQueueJob(self, modelname, dirname, filelist): 86 def UploadQueueJob(self, modelname, dirname, filelist): # {{{ 88 87 #compress the files into one zip. 89 88 compressstring = 'tar -zcf %s.tar.gz ' % dirname 90 89 for file in filelist: 91 compressstring += ' %s' % file90 compressstring += ' {}'.format(file) 92 91 subprocess.call(compressstring, shell=True) 93 92 94 93 print('uploading input file and queueing script') 95 94 issmscpout(self.name, self.executionpath, self.login, self.port, [dirname + '.tar.gz']) 96 97 95 # }}} 98 def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): 96 def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ 99 97 print('launching solution sequence on remote cluster') 100 98 if restart: … … 103 101 launchcommand = 'cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz && chmod +x ./%s.queue && ./%s.queue' % (self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname, modelname) 104 102 issmssh(self.name, self.login, self.port, launchcommand) 105 106 103 # }}} 107 def Download(self, dirname, filelist): 108 # copy files from cluster to current directory104 def Download(self, dirname, filelist): # {{{ 105 # Copy files from cluster to current directory 109 106 directory = '%s/%s/' % (self.executionpath, dirname) 110 107 issmscpin(self.name, self.login, self.port, directory, filelist) -
issm/trunk-jpl/src/m/classes/clusters/discover.m
r26330 r26332 11 11 name=oshostname(); 12 12 login=''; 13 modules = {};13 modules={'comp/intel/20.0.0.166' 'mpi/sgi-mpt/2.17' 'cmake/3.17.0'}; 14 14 numnodes=20; 15 cpuspernode=8; 15 cpuspernode=8; 16 16 port=0; 17 17 queue='general'; … … 20 20 codepath=''; 21 21 executionpath=''; 22 grouplist=''; 22 23 interactive=0; 23 24 bbftp=0; … … 43 44 disp(sprintf(' login: %s',cluster.login)); 44 45 disp(sprintf(' modules: %s',strjoin(cluster.modules,', '))); 45 disp(sprintf(' port: %i',cluster.port));46 46 disp(sprintf(' numnodes: %i',cluster.numnodes)); 47 47 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 48 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes)); 48 disp(sprintf(' np: %i',cluster.nprocs())); 49 disp(sprintf(' port: %i',cluster.port)); 49 50 disp(sprintf(' queue: %s',cluster.queue)); 50 51 disp(sprintf(' time: %i',cluster.time)); 51 52 disp(sprintf(' processor: %s',cluster.processor)); 53 disp(sprintf(' srcpath: %s',cluster.srcpath)); 52 54 disp(sprintf(' codepath: %s',cluster.codepath)); 53 55 disp(sprintf(' executionpath: %s',cluster.executionpath)); 56 disp(sprintf(' grouplist: %s',cluster.grouplist)); 54 57 disp(sprintf(' interactive: %i',cluster.interactive)); 58 disp(sprintf(' bbftp: %s',cluster.bbftp)); 59 disp(sprintf(' numstreams: %s',cluster.numstreams)); 55 60 disp(sprintf(' hyperthreading: %i',cluster.hyperthreading)); 56 61 disp(sprintf(' email: %s',cluster.email)); … … 68 73 queue_requirements_np=[560 6000 532]; 69 74 70 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np ,cluster.time)75 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),cluster.time) 71 76 72 77 %now, check cluster.cpuspernode according to processor type … … 83 88 end 84 89 85 %Miscel aneous90 %Miscellaneous 86 91 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 87 92 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end … … 113 118 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname); 114 119 fprintf(fid,'#SBATCH -e %s.errlog \n',modelname); 115 fprintf(fid,'#SBATCH -n %i \n',cluster.n umnodes*cluster.cpuspernode);120 fprintf(fid,'#SBATCH -n %i \n',cluster.nprocs()); 116 121 fprintf(fid,'#SBATCH -N %i \n',cluster.numnodes); 117 122 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 123 fprintf(fid,'#SBATCH -A %s \n\n',cluster.grouplist); 122 124 if length(find(cluster.email=='@'))>0 123 125 fprintf(fid,'#SBATCH --mail-user=%s \n',cluster.email); … … 125 127 end 126 128 fprintf(fid,'. /usr/share/modules/init/bash\n\n'); 127 f printf(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');129 for i=1:numel(cluster.modules), 130 fprintf(fid,['module load ' cluster.modules{i} '\n']); 131 end 130 132 fprintf(fid,'export MPI_GROUP_MAX=64\n\n'); 131 133 fprintf(fid,'export MPI_UNBUFFERED_STDIO=true\n\n'); … … 135 137 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname); 136 138 137 fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);139 fprintf(fid,'mpiexec -np %i %s/%s %s %s/%s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,cluster.executionpath,dirname,modelname); 138 140 if ~io_gather, %concatenate the output files: 139 141 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); … … 145 147 fid=fopen([modelname '.run'],'w'); 146 148 if ~isvalgrind, 147 fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);149 fprintf(fid,'mpiexec -np %i %s/%s %s %s/%s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,cluster.executionpath,dirname,modelname); 148 150 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);151 fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s/%s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,cluster.executionpath,dirname,modelname); 150 152 end 151 153 if ~io_gather, %concatenate the output files: … … 153 155 end 154 156 fclose(fid); 155 fid=fopen([modelname '.errlog'],'w'); 157 fid=fopen([modelname '.errlog'],'w'); % TODO: Change this to system call (touch <file>)? 156 158 fclose(fid); 157 fid=fopen([modelname '.outlog'],'w'); 159 fid=fopen([modelname '.outlog'],'w'); % TODO: Change this to system call (touch <file>)? 158 160 fclose(fid); 159 161 end … … 162 164 163 165 %compress the files into one zip. 164 compressstring=['tar -zcf ' dirname '.tar.gz 166 compressstring=['tar -zcf ' dirname '.tar.gz']; 165 167 for i=1:numel(filelist), 166 168 compressstring = [compressstring ' ' filelist{i}]; … … 178 180 end 179 181 180 if ~cluster.bbftp, 182 if cluster.bbftp, 183 issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']}); 184 else 181 185 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 186 end 185 187 … … 188 190 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 189 191 190 if ~cluster.interactive, 192 if cluster.interactive, 193 if ~isempty(restart) 194 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive)]; 195 else 196 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' dirname '.tar.gz']; 197 end 198 else 191 199 if ~isempty(restart) 192 200 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && sbatch ' modelname '.queue ']; … … 195 203 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && sbatch ' modelname '.queue ']; 196 204 end 197 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 205 end 204 206 … … 210 212 211 213 %copy files from cluster to current directory 212 if ~cluster.interactive, 214 if cluster.interactive, 215 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive) '/']; 216 else 213 217 directory=[cluster.executionpath '/' dirname '/']; 214 e lse215 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive) '/']; 216 end217 218 if ~cluster.bbftp,218 end 219 220 if cluster.bbftp, 221 issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist); 222 else 219 223 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 220 else221 issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist);222 224 end 223 225 -
issm/trunk-jpl/src/m/classes/clusters/fram.py
r24213 r26332 15 15 16 16 class fram(object): 17 """ 18 Fram cluster class definition 17 """FRAM cluster class definition 18 19 19 This is a SLURM queue 20 20 The priorities are based on a point system, reservation when reaching 20000 and earning 1 point per min. 21 22 23 21 - Devel queue starts at 19990 22 - Normal starts at 19940 23 - Normal unpri atarts at 19400 24 24 25 25 Jobs can be: 26 27 26 - normal (4 to 30 nodes, more if asked, 48h max walltime, 60Gb per nodes) 27 - bigmem for big memory nodes (8 512Gb nodes and 2 6Tb nodes, shared nodes, 14days max walltime 28 28 29 30 cluster = stallo()29 Usage: 30 cluster = fram() 31 31 """ 32 32 33 def __init__(self, *args): 33 def __init__(self, *args): # {{{ 34 34 self.name = 'fram' 35 35 self.login = '' … … 45 45 self.accountname = '' 46 46 self.profiling = 0 47 #use provided options to change fields47 # Use provided options to change fields 48 48 options = pairoptions(*args) 49 49 50 #initialize cluster using user settings if provided50 # Initialize cluster using user settings if provided 51 51 self = fram_settings(self) 52 #OK get other fields 52 53 # OK get other fields 53 54 self = options.AssignObjectFields(self) 54 55 self.np = self.numnodes * self.cpuspernode 55 56 # }}} 56 57 57 def __repr__(self): 58 # display the object59 s = "class viljeobject:"58 def __repr__(self): # {{{ 59 # Display the object 60 s = "class fram object:" 60 61 s = "%s\n%s" % (s, fielddisplay(self, 'name', 'name of the cluster')) 61 62 s = "%s\n%s" % (s, fielddisplay(self, 'login', 'login')) … … 74 75 75 76 def checkconsistency(self, md, solution, analyses): # {{{ 76 # Queue dictionarry gives queue name as key and max walltime and cpus as var77 # Queue dictionary gives queue name as key and max walltime and CPUs as var 77 78 queuedict = {'normal': [2 * 24 * 60, 2048], 78 79 'devel': [4 * 60, 2048]} 79 80 QueueRequirements(queuedict, self.queue, self.np, self.time) 80 81 81 #Miscelaneous82 # Miscellaneous 82 83 if not self.login: 83 84 md = md.checkmessage('login empty') … … 91 92 # }}} 92 93 93 def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling): 94 def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling): # {{{ 94 95 executable = 'issm.exe' 95 96 if isdakota: … … 100 101 if isoceancoupling: 101 102 executable = 'issm_ocean.exe' 102 #write queuing script103 # Write queuing script 103 104 shortname = modelname[0:min(12, len(modelname))] 104 105 fid = open(modelname + '.queue', 'w') … … 125 126 fid.write('module load ParMETIS/4.0.3-intel-2017a\n') 126 127 fid.write('cd %s/%s/ \n\n' % (self.executionpath, dirname)) 127 if self.profiling == 1:128 if self.profiling: 128 129 fid.write('module load perf-report\n') 129 130 fid.write('perf-report mpirun -np %i %s/%s %s %s/%s %s\n' % (self.np, self.codepath, executable, str(solution), self.executionpath, dirname, modelname)) … … 131 132 fid.write('mpirun -np %i %s/%s %s %s/%s %s\n' % (self.np, self.codepath, executable, str(solution), self.executionpath, dirname, modelname)) 132 133 fid.close() 133 134 134 # }}} 135 135 136 def UploadQueueJob(self, modelname, dirname, filelist): 137 # compress the files into one zip.136 def UploadQueueJob(self, modelname, dirname, filelist): # {{{ 137 # Compress the files into one zip 138 138 compressstring = 'tar -zcf %s.tar.gz ' % dirname 139 139 for file in filelist: 140 compressstring += ' %s' % file140 compressstring += ' {}'.format(file) 141 141 subprocess.call(compressstring, shell=True) 142 142 … … 145 145 146 146 # }}} 147 def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): 147 def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ 148 148 print('launching solution sequence on remote cluster') 149 149 if restart: … … 152 152 launchcommand = 'cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz && sbatch %s.queue' % (self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname) 153 153 issmssh(self.name, self.login, self.port, launchcommand) 154 155 154 # }}} 156 def Download(self, dirname, filelist): 157 # copy files from cluster to current directory155 def Download(self, dirname, filelist): # {{{ 156 # Copy files from cluster to current directory 158 157 directory = '%s/%s/' % (self.executionpath, dirname) 159 158 issmscpin(self.name, self.login, self.port, directory, filelist) -
issm/trunk-jpl/src/m/classes/clusters/gemini.m
r21576 r26332 7 7 8 8 classdef gemini 9 properties (SetAccess=public) 9 properties (SetAccess=public) 10 10 % {{{ 11 11 name='gemini' … … 18 18 executionpath='/workg/edw/Testing/Execution' 19 19 %}}} 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 20 end 21 methods 22 function cluster=gemini(varargin) % {{{ 23 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 24 end 25 %}}} 26 function disp(cluster) % {{{ 27 % display the object 28 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 29 disp(sprintf(' name: %s',cluster.name)); 30 disp(sprintf(' login: %s',cluster.login)); 31 disp(sprintf(' np: %i',cluster.np)); 32 disp(sprintf(' port: %i',cluster.port)); 33 disp(sprintf(' queue: %s',cluster.queue)); 34 disp(sprintf(' time: %i',cluster.time)); 35 disp(sprintf(' codepath: %s',cluster.codepath)); 36 disp(sprintf(' executionpath: %s',cluster.executionpath)); 37 end 38 %}}} 39 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 40 40 41 42 43 41 available_queues={'debug','shortg','longg'}; 42 queue_requirements_time=[60 180 720]; 43 queue_requirements_np=[50 50 50]; 44 44 45 46 47 48 45 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time) 46 end 47 %}}} 48 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 49 49 50 51 50 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 51 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 52 52 53 54 55 56 57 58 59 60 61 62 63 53 %write queuing script 54 fid=fopen([modelname '.queue'],'w'); 55 fprintf(fid,'#!/bin/sh\n'); 56 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds. 57 fprintf(fid,'#PBS -N %s\n',modelname); 58 fprintf(fid,'#PBS -l ncpus=%i\n',cluster.np); 59 if ~isempty(queue), 60 fprintf(fid,'#PBS -q %s\n',cluster.queue); 61 end 62 fprintf(fid,'#PBS -o %s.outlog \n',modelname); 63 fprintf(fid,'#PBS -e %s.errlog \n',modelname); 64 64 65 66 67 68 69 65 fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]); 66 fprintf(fid,'cd $PBS_O_WORKDIR\n'); 67 fprintf(fid,'export OMP_NUM_THREADS=1\n'); 68 fprintf(fid,'dplace -s1 -c0-%i mpiexec -np %i %s/issm.exe %s %s %s',cluster.np-1,cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 69 fclose(fid); 70 70 71 72 73 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{71 end 72 %}}} 73 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 74 74 75 76 77 78 79 80 81 82 83 75 %compress the files into one zip. 76 compressstring=['tar -zcf ' dirname '.tar.gz ']; 77 for i=1:numel(filelist), 78 compressstring = [compressstring ' ' filelist{i}]; 79 end 80 if cluster.interactive, 81 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 82 end 83 system(compressstring); 84 84 85 86 85 disp('uploading input file and queueing script'); 86 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 87 87 88 89 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{88 end %}}} 89 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{ 90 90 91 92 93 94 95 96 97 98 99 100 function Download(cluster,dirname,filelist)% {{{91 disp('launching solution sequence on remote cluster'); 92 if ~isempty(restart) 93 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue ']; 94 else 95 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 96 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; 97 end 98 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 99 end %}}} 100 function Download(cluster,dirname,filelist) % {{{ 101 101 102 103 104 102 %copy files from cluster to current directory 103 directory=[cluster.executionpath '/' dirname '/']; 104 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 105 105 106 106 end %}}} 107 107 end 108 108 end -
issm/trunk-jpl/src/m/classes/clusters/generic.py
r26330 r26332 1 from socket import gethostname2 1 from subprocess import call 3 2 … … 9 8 except ImportError: 10 9 print('Warning generic_settings.py not found, default will be used') 11 from MatlabFuncs import ispc10 from MatlabFuncs import * 12 11 from IssmConfig import IssmConfig 13 12 from issmdir import issmdir … … 44 43 45 44 # Get name 46 self.name = gethostname()45 self.name = oshostname() 47 46 48 47 # Initialize cluster using user settings if provided … … 58 57 def __repr__(self): # {{{ 59 58 # display the object 60 s = "class '%s' object '%s' = \n" %(type(self), 'self')61 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', ''))59 s = 'class \'{}\' object \'{}\' = \n'.format(type(self), 'self') 60 s += ' name: {}\n'.format(self.name) 61 s += ' login: {}\n'.format(self.login) 62 s += ' np: {}\n'.format(self.np) 63 s += ' port: {}\n'.format(self.port) 64 s += ' codepath: {}\n'.format(self.codepath) 65 s += ' executionpath: {}\n'.format(self.executionpath) 66 s += ' valgrind: {}\n'.format(self.valgrind) 67 s += ' valgrindlib: {}\n'.format(self.valgrindlib) 68 s += ' valgrindsup: {}\n'.format(self.valgrindsup) 69 s += ' verbose: {}\n'.format(self.verbose) 70 s += ' shell: {}\n'.format(self.shell) 72 71 return s 73 72 # }}} -
issm/trunk-jpl/src/m/classes/clusters/generic_static.m
r24593 r26332 36 36 disp(sprintf(' np: %i',cluster.np)); 37 37 disp(sprintf(' codepath: %s',cluster.codepath)); 38 disp(sprintf(' executionpath: %s',cluster.executionpath)); 39 disp(sprintf(' interactive: %s',cluster.interactive)); 38 40 disp(sprintf(' shell: %s',cluster.shell)); 39 41 end … … 84 86 end 85 87 %}}} 86 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{88 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 87 89 % Do nothing 88 90 return; 89 91 end %}}} 90 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{92 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 91 93 if ~ispc, 92 94 % Figure out which file extension to use … … 104 106 end 105 107 end %}}} 106 function Download(cluster,dirname,filelist) % {{{108 function Download(cluster,dirname,filelist) % {{{ 107 109 % Do nothing 108 110 return; -
issm/trunk-jpl/src/m/classes/clusters/generic_static.py
r25684 r26332 1 1 import math 2 2 import os 3 import socket4 3 import subprocess 5 6 4 import numpy as np 7 8 5 from IssmConfig import IssmConfig 9 6 from issmdir import issmdir … … 11 8 from issmscpin import issmscpin 12 9 from issmscpout import issmscpout 13 import MatlabFuncs as m 10 from MatlabFuncs import * 14 11 from pairoptions import pairoptions 15 12 16 13 17 14 class generic_static(object): 18 """ 19 GENERIC cluster class definition 15 """GENERIC cluster class definition 20 16 21 22 17 Usage: 18 cluster = generic_static('name', 'astrid', 'np', 3) 23 19 """ 24 20 … … 38 34 39 35 #get name 40 self.name = socket.gethostname()36 self.name = oshostname() 41 37 42 38 #initialize cluster using user settings if provided -
issm/trunk-jpl/src/m/classes/clusters/greenplanet.m
r26330 r26332 37 37 disp(sprintf(' name: %s',cluster.name)); 38 38 disp(sprintf(' login: %s',cluster.login)); 39 disp(sprintf(' port: %i',cluster.port));40 39 disp(sprintf(' numnodes: %i',cluster.numnodes)); 41 40 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 42 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes)); 41 disp(sprintf(' np: %i',cluster.nprocs())); 42 disp(sprintf(' port: %i',cluster.port)); 43 43 disp(sprintf(' queue: %s',cluster.queue)); 44 44 disp(sprintf(' codepath: %s',cluster.codepath)); … … 60 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.nprocs(),1) 63 63 64 %Miscel aneous64 %Miscellaneous 65 65 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 66 66 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end … … 87 87 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 88 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);89 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname); 90 90 if ~io_gather, %concatenate the output files: 91 91 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); … … 120 120 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 121 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);122 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 123 123 if ~io_gather, %concatenate the output files: 124 124 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); … … 129 129 if cluster.interactive, 130 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);131 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 132 132 if ~io_gather, %concatenate the output files: 133 133 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); -
issm/trunk-jpl/src/m/classes/clusters/hpc.m
r26330 r26332 35 35 disp(sprintf(' name: %s',cluster.name)); 36 36 disp(sprintf(' login: %s',cluster.login)); 37 disp(sprintf(' port: %i',cluster.port));38 37 disp(sprintf(' numnodes: %i',cluster.numnodes)); 39 38 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 40 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes)); 39 disp(sprintf(' np: %i',cluster.nprocs())); 40 disp(sprintf(' port: %i',cluster.port)); 41 41 disp(sprintf(' queue: %s',cluster.queue)); 42 42 disp(sprintf(' codepath: %s',cluster.codepath)); … … 56 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.nprocs(),1) 59 59 60 %Miscel aneous60 %Miscellaneous 61 61 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 62 62 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end … … 83 83 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 84 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);85 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname); 86 86 if ~io_gather, %concatenate the output files: 87 87 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); … … 108 108 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 109 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);110 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 111 111 if ~io_gather, %concatenate the output files: 112 112 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); … … 117 117 if cluster.interactive, 118 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);119 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 120 120 if ~io_gather, %concatenate the output files: 121 121 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); -
issm/trunk-jpl/src/m/classes/clusters/hpc_simba.m
r26330 r26332 36 36 disp(sprintf(' name: %s',cluster.name)); 37 37 disp(sprintf(' login: %s',cluster.login)); 38 disp(sprintf(' port: %i',cluster.port));39 38 disp(sprintf(' numnodes: %i',cluster.numnodes)); 40 39 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 41 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes)); 40 disp(sprintf(' np: %i',cluster.np)); 41 disp(sprintf(' port: %i',cluster.port)); 42 42 disp(sprintf(' queue: %s',cluster.queue)); 43 43 disp(sprintf(' codepath: %s',cluster.codepath)); … … 45 45 disp(sprintf(' interactive: %i',cluster.interactive)); 46 46 end 47 %}}}48 %function numprocs=nprocs(cluster) % {{{49 % %compute number of processors50 % numprocs=cluster.numnodes*cluster.cpuspernode;51 % end52 47 %}}} 53 48 function md = checkconsistency(cluster,md,solution,analyses) % {{{ … … 59 54 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1) 60 55 61 %Miscel aneous56 %Miscellaneous 62 57 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 63 58 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end -
issm/trunk-jpl/src/m/classes/clusters/local.m
r25627 r26332 36 36 disp(sprintf(' np: %i',cluster.np)); 37 37 disp(sprintf(' codepath: %s',cluster.codepath)); 38 disp(sprintf(' etcpath: %s',cluster.etcpath)); 38 39 disp(sprintf(' executionpath: %s',cluster.executionpath)); 39 disp(sprintf(' etcpath: %s',cluster.etcpath));40 40 disp(sprintf(' verbose: %s',cluster.verbose)); 41 41 disp(sprintf(' shell: %s',cluster.shell)); -
issm/trunk-jpl/src/m/classes/clusters/localpfe.m
r26034 r26332 1 % localpfecluster class definition1 %LOCALPFE cluster class definition 2 2 % 3 3 % Usage: … … 53 53 disp(sprintf(' login: %s',cluster.login)); 54 54 disp(sprintf(' np: %i',cluster.np)); 55 disp(sprintf(' npocean: %i',cluster.npocean)); 55 56 disp(sprintf(' port: %i',cluster.port)); 57 disp(sprintf(' interactive: %i',cluster.interactive)); 56 58 disp(sprintf(' codepath: %s',cluster.codepath)); 59 disp(sprintf(' etcpath: %s',cluster.etcpath)); 57 60 disp(sprintf(' executionpath: %s',cluster.executionpath)); 58 disp(sprintf(' etcpath: %s',cluster.etcpath));59 61 disp(sprintf(' valgrind: %s',cluster.valgrind)); 60 62 disp(sprintf(' valgrindlib: %s',cluster.valgrindlib)); -
issm/trunk-jpl/src/m/classes/clusters/lonestar.m
r26330 r26332 43 43 disp(sprintf(' numnodes: %i',cluster.numnodes)); 44 44 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 45 disp(sprintf(' np: %i',cluster.np)); 45 disp(sprintf(' np: %i',cluster.nprocs())); 46 disp(sprintf(' port: %i',cluster.port)); 46 47 disp(sprintf(' queue: %s',cluster.queue)); 47 48 disp(sprintf(' codepath: %s',cluster.codepath)); … … 63 64 queue_requirements_np=[4104 264]; 64 65 65 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np ,cluster.time)66 67 %Miscel aneous66 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),cluster.time) 67 68 %Miscellaneous 68 69 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 69 70 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end … … 89 90 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 90 91 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 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname); 92 93 if ~io_gather, %concatenate the output files: 93 94 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); … … 120 121 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname); 121 122 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*max(cluster.nprocs()/cluster.numnodes,24)); 123 124 fprintf(fid,'#SBATCH -N %i \n',cluster.numnodes); 124 125 fprintf(fid,'#SBATCH -t %02i:%02i:00 \n\n',floor(cluster.time/3600),floor(mod(cluster.time,3600)/60)); … … 142 143 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 143 144 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 fprintf(fid,'ibrun -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname); 145 146 if ~io_gather, %concatenate the output files: 146 147 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); … … 152 153 if cluster.interactive, 153 154 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 fprintf(fid,'ibrun -np %i %s/%s %s %s %s\n',cluster.nprocs(),executable,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 155 156 if ~io_gather, %concatenate the output files: 156 157 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); -
issm/trunk-jpl/src/m/classes/clusters/maui.m
r26330 r26332 38 38 disp(sprintf(' name: %s',cluster.name)); 39 39 disp(sprintf(' login: %s',cluster.login)); 40 disp(sprintf(' port: %i',cluster.port));41 40 disp(sprintf(' numnodes: %i',cluster.numnodes)); 42 41 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 43 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes)); 42 disp(sprintf(' np: %i',cluster.nprocs())); 43 disp(sprintf(' port: %i',cluster.port)); 44 44 disp(sprintf(' projectaccount: %s',cluster.projectaccount)); 45 45 disp(sprintf(' partition: %s',cluster.partition)); … … 62 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.nprocs(),1) 65 65 66 %Miscel aneous66 %Miscellaneous 67 67 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 68 68 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end … … 95 95 fprintf(fid,'module swap PrgEnv-cray PrgEnv-intel\n'); 96 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);97 fprintf(fid,'srun -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 98 98 if ~io_gather, %concatenate the output files: 99 99 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); … … 104 104 if cluster.interactive, 105 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);106 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 107 107 if ~io_gather, %concatenate the output files: 108 108 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); -
issm/trunk-jpl/src/m/classes/clusters/pfe.m
r26330 r26332 21 21 codepath = ''; 22 22 executionpath = ''; 23 grouplist = 's1690';23 grouplist = ''; 24 24 interactive = 0; 25 25 bbftp = 0; … … 39 39 %}}} 40 40 function disp(cluster) % {{{ 41 % TODO:42 % - Correct formatting of modules and cluster.np43 %44 45 41 % display the object 46 42 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 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',''); 66 end 67 %}}} 68 function numprocs=np(cluster) % {{{ 43 disp(sprintf(' name: %s',cluster.name)); 44 disp(sprintf(' login: %s',cluster.login)); 45 disp(sprintf(' modules: %s',strjoin(cluster.modules,', '))); 46 disp(sprintf(' numnodes: %s',cluster.numnodes)); 47 disp(sprintf(' cpuspernode: %s',cluster.cpuspernode)); 48 disp(sprintf(' np: %i',cluster.nprocs())); 49 disp(sprintf(' port: %i',cluster.port)); 50 disp(sprintf(' queue: %i',cluster.queue)); 51 disp(sprintf(' time: %i',cluster.time)); 52 disp(sprintf(' processor: %i',cluster.processor)); 53 disp(sprintf(' srcpath: %s',cluster.srcpath)); 54 disp(sprintf(' codepath: %s',cluster.codepath)); 55 disp(sprintf(' executionpath: %s',cluster.executionpath)); 56 disp(sprintf(' grouplist: %s',cluster.grouplist)); 57 disp(sprintf(' interactive: %s',cluster.interactive)); 58 disp(sprintf(' bbftp: %s',cluster.bbftp)); 59 disp(sprintf(' numstreams: %s',cluster.numstreams)); 60 disp(sprintf(' hyperthreading: %s',cluster.hyperthreading)); 61 end 62 %}}} 63 function numprocs=nprocs(cluster) % {{{ 69 64 %compute number of processors 70 65 numprocs=cluster.numnodes*cluster.cpuspernode; … … 77 72 queue_requirements_np=[2048 2048 150 150 2048]; 78 73 79 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np ,cluster.time)74 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),cluster.time) 80 75 81 76 %now, check cluster.cpuspernode according to processor type … … 183 178 fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,dirname); 184 179 if ~isvalgrind, 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);186 else 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);180 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.nprocs(),cluster.cpuspernode,cluster.codepath,executable,solution,cluster.executionpath,dirname,modelname); 181 else 182 fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname); 188 183 end 189 184 if ~io_gather, %concatenate the output files: … … 197 192 if cluster.interactive==10, 198 193 fprintf(fid,'module unload mpi-mvapich2/1.4.1/gcc\n'); 199 fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np ,cluster.codepath,executable,solution,[pwd() '/run'],modelname);194 fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[pwd() '/run'],modelname); 200 195 else 201 196 if ~isvalgrind, 202 fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np ,cluster.codepath,executable,solution,[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname);197 fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname); 203 198 else 204 fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.np ,cluster.codepath,executable,solution,[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname);199 fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname); 205 200 end 206 201 end … … 325 320 fprintf(fid,'export MPI_GROUP_MAX=64\n\n'); 326 321 fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,modelname); 327 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np ,cluster.codepath,[cluster.executionpath '/' modelname],modelname); %FIXME322 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname); %FIXME 328 323 if ~io_gather, %concatenate the output files: 329 324 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); … … 335 330 fid=fopen([modelname '.run'],'w'); 336 331 if ~isvalgrind, 337 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np ,cluster.codepath,[cluster.executionpath '/' modelname],modelname);338 else 339 fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/kriging.exe %s %s\n',cluster.np ,cluster.codepath,[cluster.executionpath '/' modelname],modelname);332 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname); 333 else 334 fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname); 340 335 end 341 336 if ~io_gather, %concatenate the output files: … … 410 405 end 411 406 412 if ~cluster.bbftp, 407 if cluster.bbftp, 408 issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']}); 409 else 413 410 issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']}); 414 else415 issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']});416 411 end 417 412 … … 420 415 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 421 416 422 %lauch command, to be executed via ssh 423 if ~cluster.interactive, 424 if ~isempty(restart) 425 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue ']; 426 else 427 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 428 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; 429 end 430 else 417 %launch command, to be executed via ssh 418 if cluster.interactive, 431 419 if ~isempty(restart) 432 420 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive)]; … … 437 425 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' dirname '.tar.gz']; 438 426 end 427 end 428 else 429 if ~isempty(restart) 430 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue ']; 431 else 432 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 433 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; 439 434 end 440 435 end … … 455 450 end 456 451 457 if ~cluster.bbftp, 452 if cluster.bbftp, 453 issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist); 454 else 458 455 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 459 else460 issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist);461 456 end 462 457 -
issm/trunk-jpl/src/m/classes/clusters/pfe.py
r26330 r26332 6 6 from issmscpout import issmscpout 7 7 from issmssh import issmssh 8 from MatlabFuncs import * 8 9 from pairoptions import pairoptions 9 10 try: … … 35 36 self.codepath = '' 36 37 self.executionpath = '' 37 self.grouplist = ' s1690'38 self.grouplist = '' 38 39 self.interactive = 0 39 40 self.bbftp = 0 … … 50 51 print('pfe_settings.py not found, using default settings') 51 52 52 # OK get other fields53 # OK get other fields 53 54 self = options.AssignObjectFields(self) 54 55 # }}} 55 56 56 57 def __repr__(self): # {{{ 57 # TODO:58 # - Correct formatting of modules and cluster.np59 #60 61 58 # Display the object 62 59 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', '')) 60 s += ' name: {}\n'.format(self.name) 61 s += ' login: {}\n'.format(self.login) 62 s += ' modules: {}\n'.format(strjoin(self.modules, ', ')) 63 s += ' numnodes: {}\n'.format(self.numnodes) 64 s += ' cpuspernode: {}\n'.format(self.cpuspernode) 65 s += ' np: {}\n'.format(self.nprocs()) 66 s += ' port: {}\n'.format(self.port) 67 s += ' queue: {}\n'.format(self.queue) 68 s += ' time: {}\n'.format(self.time) 69 s += ' processor: {}\n'.format(self.processor) 70 s += ' srcpath: {}\n'.format(self.srcpath) 71 s += ' codepath: {}\n'.format(self.codepath) 72 s += ' executionpath: {}\n'.format(self.executionpath) 73 s += ' grouplist: {}\n'.format(self.grouplist) 74 s += ' interactive: {}\n'.format(self.interactive) 75 s += ' bbftp: {}\n'.format(self.bbftp) 76 s += ' numstreams: {}\n'.format(self.numstreams) 77 s += ' hyperthreading: {}\n'.format(self.hyperthreading) 85 78 return s 86 79 # }}} … … 101 94 if self.hyperthreading: 102 95 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')96 md = md.checkmessage('cpuspernode should be between 1 and 40 for \'ivy\' processors in hyperthreading mode') 104 97 else: 105 98 if self.cpuspernode > 20 or self.cpuspernode < 1: 106 md = md.checkmessage('cpuspernode should be between 1 and 20 for ''ivy'' processors')99 md = md.checkmessage('cpuspernode should be between 1 and 20 for \'ivy\' processors') 107 100 elif self.processor == 'bro': 108 101 if self.hyperthreading: 109 102 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')103 md = md.checkmessage('cpuspernode should be between 1 and 56 for \'bro\' processors in hyperthreading mode') 111 104 else: 112 105 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: 106 md = md.checkmessage('cpuspernode should be between 1 and 28 for \'bro\' processors') 107 elif self.processor == 'has': 108 if self.hyperthreading: 109 if self.cpuspernode > 48 or self.cpuspernode < 1: 110 md = md.checkmessage('cpuspernode should be between 1 and 48 for \'has\' processors in hyperthreading mode') 111 else: 112 if self.cpuspernode > 24 or self.cpuspernode < 1: 113 md = md.checkmessage('cpuspernode should be between 1 and 24 for \'has\' processors') 114 elif self.processor == 'san': 115 if self.hyperthreading: 116 if self.cpuspernode > 32 or self.cpuspernode < 1: 117 md = md.checkmessage('cpuspernode should be between 1 and 32 for \'san\' processors in hyperthreading mode') 118 else: 116 119 if self.cpuspernode > 16 or self.cpuspernode < 1: 117 md = md.checkmessage('cpuspernode should be between 1 and 16 for ''neh'' and ''har'' processors in hyperthreading mode') 118 else: 119 if self.cpuspernode > 8 or self.cpuspernode < 1: 120 md = md.checkmessage('cpuspernode should be between 1 and 8 for ''neh'' and ''har'' processors') 120 md = md.checkmessage('cpuspernode should be between 1 and 16 for \'san\' processors') 121 elif self.processor == 'cas_ait': 122 if self.hyperthreading: 123 if self.cpuspernode > 80 or self.cpuspernode < 1: 124 md = md.checkmessage('cpuspernode should be between 1 and 80 for \'cas_ait\' processors in hyperthreading mode') 125 else: 126 if self.cpuspernode > 40 or self.cpuspernode < 1: 127 md = md.checkmessage('cpuspernode should be between 1 and 40 for \'cas_ait\' processors') 121 128 else: 122 md = md.checkmessage('unknown processor type, should be \' ivy\', \'bro\', \'har\', or \'neh\'')129 md = md.checkmessage('unknown processor type, should be \'bro\', \'has\', \'ivy\', \'san\', or \'cas_ait\'') 123 130 124 131 # Miscellaneous … … 182 189 compressstring = 'tar -zcf {}.tar.gz'.format(dirname) 183 190 for file in filelist: 184 compressstring += file191 compressstring += ' {}'.format(file) 185 192 subprocess.call(compressstring, shell=True) 186 193 … … 191 198 # }}} 192 199 def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ 193 if restart: 194 launchcommand = 'cd {} && cd {} && qsub {}.queue'.format(self.executionpath, dirname, modelname) 200 # Launch command, to be executed via ssh 201 if self.interactive: 202 if restart: 203 launchcommand = 'cd {} /Interactive{}'.format(self.executionpath, self.interactive) 204 else: 205 if self.interactive == 10: 206 launchcommand = 'cd {}/run && tar -zxf {}.tar.gz'.format(pwd(), dirname) 207 else: 208 launchcommand = 'cd {} /Interactive{} && tar -zxf {}.tar.gz'.format(self.executionpath, self.interactive, dirname) 195 209 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) 210 if restart: 211 launchcommand = 'cd {} && cd {} && qsub {}.queue'.format(self.executionpath, dirname, modelname) 212 else: 213 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 214 198 215 print('launching solution sequence on remote cluster') -
issm/trunk-jpl/src/m/classes/clusters/pollux.m
r21576 r26332 7 7 8 8 classdef pollux 9 properties (SetAccess=public) 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 9 properties (SetAccess=public) 10 % {{{ 11 name='pollux' 12 login='username'; 13 np=128; 14 port=0; 15 queue='shortp'; 16 time=180; 17 codepath='/workc/edw/issm-2.0/bin' 18 executionpath='/workc/edw/Testing/Execution' 19 %}}} 20 end 21 methods 22 function cluster=pollux(varargin) % {{{ 23 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 24 end 25 %}}} 26 function disp(cluster) % {{{ 27 % display the object 28 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); 29 disp(sprintf(' name: %s',cluster.name)); 30 disp(sprintf(' login: %s',cluster.login)); 31 disp(sprintf(' port: %i',cluster.port)); 32 disp(sprintf(' np: %i',cluster.np)); 33 disp(sprintf(' queue: %s',cluster.queue)); 34 disp(sprintf(' time: %i',cluster.time)); 35 disp(sprintf(' codepath: %s',cluster.codepath)); 36 disp(sprintf(' executionpath: %s',cluster.executionpath)); 37 end 38 %}}} 39 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 40 40 41 42 43 41 available_queues={'shortp','longp'}; 42 queue_requirements_time=[180 720]; 43 queue_requirements_np=[128 128]; 44 44 45 46 47 48 45 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time) 46 end 47 %}}} 48 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 49 49 50 51 50 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 51 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 52 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 53 %write queuing script 54 fid=fopen([modelname '.queue'],'w'); 55 fprintf(fid,'#!/bin/sh\n'); 56 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds. 57 fprintf(fid,'#PBS -N %s\n',modelname); 58 fprintf(fid,'#PBS -l ncpus=%i\n',cluster.np); 59 if ~isempty(queue), 60 fprintf(fid,'#PBS -q %s\n',cluster.queue); 61 end 62 fprintf(fid,'#PBS -o %s.outlog \n',modelname); 63 fprintf(fid,'#PBS -e %s.errlog \n',modelname); 64 fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]); 65 fprintf(fid,'cd $PBS_O_WORKDIR\n'); 66 fprintf(fid,'export OMP_NUM_THREADS=1\n'); 67 fprintf(fid,'dplace -s1 -c0-%i mpiexec -np %i %s/issm.exe %s %s %s',cluster.np-1,cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 68 fclose(fid); 69 69 70 71 72 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{70 end 71 %}}} 72 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{ 73 73 74 75 76 77 78 79 80 81 82 83 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{74 disp('launching solution sequence on remote cluster'); 75 if ~isempty(restart) 76 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue ']; 77 else 78 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 79 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; 80 end 81 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 82 end %}}} 83 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 84 84 85 86 87 88 89 90 91 92 93 85 %compress the files into one zip. 86 compressstring=['tar -zcf ' dirname '.tar.gz ']; 87 for i=1:numel(filelist), 88 compressstring = [compressstring ' ' filelist{i}]; 89 end 90 if cluster.interactive, 91 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 92 end 93 system(compressstring); 94 94 95 96 function Download(cluster,dirname,filelist)% {{{95 end %}}} 96 function Download(cluster,dirname,filelist) % {{{ 97 97 98 99 100 98 %copy files from cluster to current directory 99 directory=[cluster.executionpath '/' dirname '/']; 100 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 101 101 102 102 end %}}} 103 103 end 104 104 end -
issm/trunk-jpl/src/m/classes/clusters/raijin.m
r21576 r26332 7 7 8 8 classdef raijin 9 properties (SetAccess=public) 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 9 properties (SetAccess=public) 10 % {{{ 11 name=''; 12 login=''; 13 np=0; 14 mem=0; 15 time=0; 16 project=''; 17 email=''; 18 port=0; 19 queue=''; 20 codepath=''; 21 executionpath=''; 22 modules={}; 23 end 24 %}}} 25 methods 26 function cluster=raijin(varargin) % {{{ 27 27 28 29 28 %initialize cluster using default settings if provided 29 if (exist('raijin_settings')==2), raijin_settings; end 30 30 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(' mem: %i',cluster.mem)); 42 disp(sprintf(' time: %i',cluster.time)); 43 disp(sprintf(' np: %i',cluster.np)); 44 disp(sprintf(' queue: %s',cluster.queue)); 45 disp(sprintf(' project: %s',cluster.project)); 46 disp(sprintf(' codepath: %s',cluster.codepath)); 47 disp(sprintf(' executionpath: %s',cluster.executionpath)); 48 end 49 %}}} 50 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(' np: %i',cluster.np)); 41 disp(sprintf(' mem: %i',cluster.mem)); 42 disp(sprintf(' time: %i',cluster.time)); 43 disp(sprintf(' project: %s',cluster.project)); 44 disp(sprintf(' email: %s',cluster.email)); 45 disp(sprintf(' port: %i',cluster.port)); 46 disp(sprintf(' queue: %s',cluster.queue)); 47 disp(sprintf(' codepath: %s',cluster.codepath)); 48 disp(sprintf(' executionpath: %s',cluster.executionpath)); 49 disp(sprintf(' modules: %s',strjoin(cluster.modules,', '))); 50 end 51 %}}} 52 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 51 53 52 53 54 54 available_queues={'express', 'normal'}; 55 queue_requirements_time=[5*60 40*60]; 56 queue_requirements_np=[256 1024]; 55 57 56 58 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1) 57 59 58 %Miscelaneous59 60 61 60 %Miscellaneous 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 62 64 63 end 64 %}}} 65 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 66 67 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 68 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 65 end 66 %}}} 67 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 69 68 70 %write queuing script 71 fid=fopen([modelname '.queue'],'w'); 72 fprintf(fid,'#PBS -S /bin/bash\n'); 73 fprintf(fid,'#PBS -P %s\n', cluster.project); 74 fprintf(fid,'#PBS -q %s\n',cluster.queue); 75 fprintf(fid,'#PBS -l ncpus=%i\n',cluster.np); 76 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); % walltime is in seconds 77 fprintf(fid,'#PBS -l mem=%igb\n', cluster.mem); 78 fprintf(fid,'#PBS -M %s\n', cluster.email); 79 fprintf(fid,'#PBS -o %s.outlog\n',(modelname)); 80 fprintf(fid,'#PBS -e %s.errlog\n',(modelname)); 81 fprintf(fid,'#PBS -l wd\n\n'); 82 fprintf(fid,'source ~/.bashrc\n'); 83 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); 84 for i=1:numel(cluster.modules) 85 fprintf(fid,'module load %s\n', cluster.modules{i}); 86 end 87 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 88 if ~io_gather, %concatenate the output files: 89 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 90 end 91 fclose(fid); 92 end %}}} 93 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{ 69 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 70 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 94 71 95 %compress the files into one zip. 96 compressstring=['tar -zcf ' dirname '.tar.gz ']; 97 for i=1:numel(filelist), 98 compressstring = [compressstring ' ' filelist{i}]; 99 end 100 system(compressstring); 72 %write queuing script 73 fid=fopen([modelname '.queue'],'w'); 74 fprintf(fid,'#PBS -S /bin/bash\n'); 75 fprintf(fid,'#PBS -P %s\n', cluster.project); 76 fprintf(fid,'#PBS -q %s\n',cluster.queue); 77 fprintf(fid,'#PBS -l ncpus=%i\n',cluster.np); 78 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); % walltime is in seconds 79 fprintf(fid,'#PBS -l mem=%igb\n', cluster.mem); 80 fprintf(fid,'#PBS -M %s\n', cluster.email); 81 fprintf(fid,'#PBS -o %s.outlog\n',(modelname)); 82 fprintf(fid,'#PBS -e %s.errlog\n',(modelname)); 83 fprintf(fid,'#PBS -l wd\n\n'); 84 fprintf(fid,'source ~/.bashrc\n'); 85 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); 86 for i=1:numel(cluster.modules) 87 fprintf(fid,'module load %s\n', cluster.modules{i}); 88 end 89 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],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 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 101 96 102 disp('uploading input file and queueing script'); 103 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 97 %compress the files into one zip. 98 compressstring=['tar -zcf ' dirname '.tar.gz ']; 99 for i=1:numel(filelist), 100 compressstring = [compressstring ' ' filelist{i}]; 101 end 102 system(compressstring); 104 103 105 end %}}} 106 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{ 107 108 disp('launching solution sequence on remote cluster'); 109 if ~isempty(restart) 110 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue ']; 111 else 112 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 113 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && qsub ' modelname '.queue ']; 114 end 115 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 116 end %}}} 117 function Download(cluster,dirname,filelist)% {{{ 104 disp('uploading input file and queueing script'); 105 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 118 106 119 %copy files from cluster to current directory 120 directory=[cluster.executionpath '/' dirname '/']; 121 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 107 end %}}} 108 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 109 110 disp('launching solution sequence on remote cluster'); 111 if ~isempty(restart) 112 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue ']; 113 else 114 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 115 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && qsub ' modelname '.queue ']; 116 end 117 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 118 end %}}} 119 function Download(cluster,dirname,filelist) % {{{ 122 120 123 end %}}} 121 %copy files from cluster to current directory 122 directory=[cluster.executionpath '/' dirname '/']; 123 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 124 125 end %}}} 124 126 end 125 127 end -
issm/trunk-jpl/src/m/classes/clusters/saga.py
r25818 r26332 15 15 16 16 class saga(object): 17 """ 18 Saga cluster class definition 17 """SAGA cluster class definition 18 19 19 This is a SLURM queue 20 20 21 22 21 Usage: 22 cluster = saga() 23 23 """ 24 24 … … 44 44 self.valgrind = '/cluster/software/Valgrind/3.16.1-gompi-2019b/bin/valgrind' 45 45 46 #use provided options to change fields46 # Use provided options to change fields 47 47 options = pairoptions(*args) 48 #initialize cluster using user settings if provided48 # Initialize cluster using user settings if provided 49 49 self = saga_settings(self) 50 #OK get other fields50 # OK get other fields 51 51 self = options.AssignObjectFields(self) 52 52 self.np = self.numnodes * self.cpuspernode … … 54 54 55 55 def __repr__(self): # {{{ 56 # display the object56 # Display the object 57 57 s = "class vilje object:" 58 58 s = "%s\n%s" % (s, fielddisplay(self, 'name', 'name of the cluster')) … … 72 72 73 73 def checkconsistency(self, md, solution, analyses): # {{{ 74 # Queue dictionarry gives queue name as key and max walltime, cpusand memory (GB) as var74 # Queue dictionarry gives queue name as key and max walltime, CPUs, and memory (GB) as var 75 75 queuedict = {'normal': [7 * 24 * 60, 256, 8], 76 76 'bigmem': [14 * 24 * 60, 256, 10], … … 78 78 QueueRequirements(queuedict, self.queue, self.np, self.time) 79 79 80 #Miscelaneous80 # Miscellaneous 81 81 if not self.login: 82 82 md = md.checkmessage('login empty') … … 91 91 92 92 def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling): # {{{ 93 94 93 executable = 'issm.exe' 95 94 if isdakota: … … 100 99 if isoceancoupling: 101 100 executable = 'issm_ocean.exe' 102 #write queuing script101 # Write queuing script 103 102 shortname = modelname[0:min(12, len(modelname))] 104 103 timeobj = datetime.timedelta(minutes=self.time) … … 146 145 # }}} 147 146 def UploadQueueJob(self, modelname, dirname, filelist): # {{{ 148 # compress the files into one zip.147 # Compress the files into one zip 149 148 compressstring = 'tar -zcf %s.tar.gz ' % dirname 150 149 for file in filelist: 151 compressstring += ' %s' % file150 compressstring += ' {}'.format(file) 152 151 subprocess.call(compressstring, shell=True) 153 152 154 153 print('uploading input file and queueing script') 155 154 issmscpout(self.name, self.executionpath, self.login, self.port, [dirname + '.tar.gz']) 156 157 155 # }}} 158 156 159 157 def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ 160 161 158 print('launching solution sequence on remote cluster') 162 159 if restart: … … 165 162 launchcommand = 'cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz && sbatch %s.queue' % (self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname) 166 163 issmssh(self.name, self.login, self.port, launchcommand) 167 168 164 # }}} 169 165 170 166 def Download(self, dirname, filelist): # {{{ 171 # copy files from cluster to current directory167 # Copy files from cluster to current directory 172 168 directory = '%s/%s/' % (self.executionpath, dirname) 173 169 issmscpin(self.name, self.login, self.port, directory, filelist) -
issm/trunk-jpl/src/m/classes/clusters/sherlock.m
r26330 r26332 36 36 disp(sprintf(' name: %s',cluster.name)); 37 37 disp(sprintf(' login: %s',cluster.login)); 38 disp(sprintf(' port: %i',cluster.port));39 38 disp(sprintf(' numnodes: %i',cluster.numnodes)); 40 39 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 41 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes)); 40 disp(sprintf(' np: %i',cluster.nprocs())); 41 disp(sprintf(' port: %i',cluster.port)); 42 42 disp(sprintf(' codepath: %s',cluster.codepath)); 43 43 disp(sprintf(' executionpath: %s',cluster.executionpath)); … … 54 54 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 55 55 56 %Miscel aneous56 %Miscellaneous 57 57 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 58 58 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end … … 79 79 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 80 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);81 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname); 82 82 if ~io_gather, %concatenate the output files: 83 83 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); … … 103 103 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 104 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);105 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 106 106 if ~io_gather, %concatenate the output files: 107 107 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); … … 112 112 if cluster.interactive, 113 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);114 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 115 115 if ~io_gather, %concatenate the output files: 116 116 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); -
issm/trunk-jpl/src/m/classes/clusters/tetralith.m
r26330 r26332 38 38 disp(sprintf(' name: %s',cluster.name)); 39 39 disp(sprintf(' login: %s',cluster.login)); 40 disp(sprintf(' accountname: %s',cluster.accountname));41 40 disp(sprintf(' numnodes: %i',cluster.numnodes)); 42 41 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 43 disp(sprintf(' np: %i', cluster.cpuspernode*cluster.numnodes)); 42 disp(sprintf(' np: %i',cluster.nprocs())); 43 disp(sprintf(' memory: %i',cluster.mem)); 44 44 disp(sprintf(' queue: %s',cluster.queue)); 45 disp(sprintf(' time: %i',cluster.time)); 45 46 disp(sprintf(' codepath: %s',cluster.codepath)); 46 47 disp(sprintf(' executionpath: %s',cluster.executionpath)); 47 48 disp(sprintf(' interactive: %i',cluster.interactive)); 48 disp(sprintf(' time: %i',cluster.time));49 disp(sprintf(' memory: %i',cluster.mem));49 disp(sprintf(' port: %s',cluster.port)); 50 disp(sprintf(' accountname: %s',cluster.accountname)); 50 51 end 51 52 %}}} … … 56 57 queue_requirements_np=[1024 2*32]; 57 58 58 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np ,1)59 60 %Miscel aneous59 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),1) 60 61 %Miscellaneous 61 62 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 62 63 if isempty(cluster.accountname), md = checkmessage(md,'accountname empty'); end … … 78 79 %compute number of processors 79 80 % cluster.np=cluster.numnodes*cluster.cpuspernode; 80 nprocs(cluster);%=cluster.numnodes*cluster.cpuspernode;81 % nprocs(cluster);%=cluster.numnodes*cluster.cpuspernode; 81 82 82 83 %write queuing script … … 104 105 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 105 106 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname); 106 % fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np ,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);107 % fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname); 107 108 % 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);109 % fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np ,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);109 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 110 % fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 110 111 if ~io_gather, %concatenate the output files: 111 112 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); … … 159 160 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 160 161 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname); 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);163 % fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np ,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);164 % fprintf(fid,'mpiexec_mpt -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/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname); 163 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 164 % fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 165 % fprintf(fid,'mpiexec_mpt -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname); 165 166 166 167 if ~io_gather, %concatenate the output files: … … 172 173 if cluster.interactive, 173 174 fid=fopen([modelname '.run'],'w'); 174 fprintf(fid,'mpiexec_mpt -np %i %s/issm.exe %s %s %s\n',cluster.np ,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);175 fprintf(fid,'mpiexec_mpt -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 175 176 if ~io_gather, %concatenate the output files: 176 177 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); -
issm/trunk-jpl/src/m/classes/clusters/yellowstone.m
r26330 r26332 38 38 disp(sprintf(' name: %s',cluster.name)); 39 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)); 40 disp(sprintf(' modules: %s',strjoin(cluster.modules,', '))); 43 41 disp(sprintf(' numnodes: %i',cluster.numnodes)); 44 42 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 45 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes)); 43 disp(sprintf(' np: %i',cluster.nprocs())); 44 disp(sprintf(' port: %i',cluster.port)); 46 45 disp(sprintf(' queue: %s',cluster.queue)); 47 46 disp(sprintf(' time: %i',cluster.time)); … … 63 62 queue_requirements_np=[16384 16384]; 64 63 65 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np ,cluster.time)64 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),cluster.time) 66 65 67 %Miscel aneous66 %Miscellaneous 68 67 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 69 68 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end … … 92 91 fprintf(fid,'#BSUB -P %s\n',cluster.grouplist); 93 92 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 );93 fprintf(fid,'#BSUB -n %i\n',cluster.nprocs()); 95 94 fprintf(fid,'#BSUB -J %s\n',modelname); 96 95 fprintf(fid,'#BSUB -o %s.outlog \n',[cluster.executionpath '/' dirname '/' modelname]); … … 138 137 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 139 138 140 %lau ch command, to be executed via ssh139 %launch command, to be executed via ssh 141 140 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 142 141 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && bsub < ' modelname '.queue ']; -
issm/trunk-jpl/src/m/dev/ISSM.py
r24213 r26332 4 4 import scipy.io as spio 5 5 from model import * 6 from socket import gethostname7 6 from triangle import * 8 7 from setmask import * … … 10 9 from setflowequation import * 11 10 from solve import * 12 from IssmConfing import * 11 from IssmConfig import * 12 from MatlabFuncs import * 13 13 14 14 #Secondary imports -
issm/trunk-jpl/src/m/miscellaneous/MatlabFuncs.py
r26301 r26332 1 """ 2 A collection of functions that replicate the behavior of MATLAB built-in 3 functions of the same, respective name. 4 5 Where possible, users are encouraged to use native and/or the most efficient 6 methods in Python, but we provide these functions as a way to make translations 7 from the MATLAB to the Python ISSM API more seamless. 8 """ 9 1 10 def acosd(X): #{{{ 2 11 """ function acosd - Inverse cosine in degrees … … 55 64 #}}} 56 65 66 def find(*args): #{{{ 67 nargs = len(args) 68 if nargs >= 1 or nargs <= 2: 69 X = args[0] 70 n = len(args[0]) 71 if nargs == 2: 72 n = args[1] 73 indices=[] 74 for i in range(n): 75 if X[i] != 0: 76 indices.push(i) 77 return indices 78 else: 79 raise Exception('find: must have 1 or 2 arguments') 80 #}}} 81 57 82 def heaviside(x): #{{{ 58 83 import numpy as np … … 105 130 #}}} 106 131 132 def mod(a, m): #{{{ 133 return a % m 134 #}}} 135 107 136 def oshostname(): #{{{ 108 137 import socket … … 141 170 #}}} 142 171 172 def strjoin(*args): #{{{ 173 nargs = len(args) 174 if nargs >= 1 or nargs <= 2: 175 sep = ' ' 176 if nargs == 2: 177 sep = args[1] 178 return sep.join(args[0]) 179 else: 180 raise Exception('strjoin: must have 1 or 2 arguments') 181 #}}} 182 143 183 def strncmp(s1, s2, n): #{{{ 144 184 if s1[0:n] == s2[0:n]: -
issm/trunk-jpl/src/m/os/issmscpin.py
r24252 r26332 1 from socket import gethostname2 import subprocess3 1 import os 4 2 import shutil 5 import MatlabFuncs as m 3 import subprocess 4 from MatlabFuncs import * 6 5 7 6 8 7 def issmscpin(host, login, port, path, packages): 9 """ 10 ISSMSCPIN get packages from host, using scp on unix, and pscp on windows 11 usage: issmscpin(host, packages, path) 8 """ISSMSCPIN get packages from host, using scp on unix, and pscp on windows 9 10 Usage: 11 issmscpin(host, packages, path) 12 12 """ 13 13 14 14 #first get hostname 15 hostname = gethostname()15 hostname = oshostname() 16 16 #first be sure packages are not in the current directory, this could conflict with pscp on windows. 17 17 #remove warnings in case the files do not exist … … 29 29 pass 30 30 else: 31 if m.ispc():31 if ispc(): 32 32 #use the putty project pscp.exe: it should be in the path. 33 33 #get ISSM_DIR variable -
issm/trunk-jpl/src/m/os/issmscpout.m
r26034 r26332 9 9 hostname=oshostname(); 10 10 11 %are we dis -allowing symbolic links?11 %are we disallowing symbolic links? 12 12 if nargin==6, 13 13 no_symlinks=1; -
issm/trunk-jpl/src/m/os/issmscpout.py
r25817 r26332 1 import os 1 2 from socket import gethostname 2 3 import subprocess 3 import os 4 import MatlabFuncs as m 4 from MatlabFuncs import * 5 5 6 6 7 7 def issmscpout(host, path, login, port, packages): 8 """ 9 ISSMSCPOUT send packages to a host, using scp on unix, and pscp on windows 8 """ISSMSCPOUT send packages to a host, using scp on unix, and pscp on windows 10 9 11 usage: issmscpout(host, path, packages) 10 Usage: 11 issmscpout(host, path, packages) 12 12 """ 13 13 14 14 #get hostname 15 hostname = gethostname()15 hostname = oshostname() 16 16 17 17 #if hostname and host are the same, do a simple copy … … 28 28 os.chdir(here) 29 29 else: 30 if m.ispc():30 if ispc(): 31 31 #use the putty project pscp.exe: it should be in the path. 32 32 #get ISSM_DIR variable -
issm/trunk-jpl/src/m/os/issmssh.py
r24252 r26332 1 from socket import gethostname 1 import os 2 import subprocess 2 3 from sys import platform as _platform 3 import subprocess 4 import os 5 import MatlabFuncs as m 4 from MatlabFuncs import * 6 5 7 6 8 7 def issmssh(host, login, port, command): 9 """ 10 ISSMSSH - wrapper for OS independent ssh command. 8 """ISSMSSH - wrapper for OS independent ssh command. 11 9 12 usage:13 10 Usage: 11 issmssh(host, command) 14 12 """ 15 13 16 14 #first get hostname 17 hostname = gethostname()15 hostname = oshostname() 18 16 19 17 #if same as host, just run the command. 20 if m.strcmpi(host, hostname):18 if strcmpi(host, hostname): 21 19 subprocess.call(command, shell=True) 22 20 else: 23 if m.ispc():21 if ispc(): 24 22 #use the putty project plink.exe: it should be in the path. 25 23 #get ISSM_DIR variable -
issm/trunk-jpl/src/m/solve/loadresultsfromcluster.py
r26178 r26332 1 1 import os 2 import socket3 2 from helpers import * 4 3 from loadresultsfromdisk import loadresultsfromdisk 5 from MatlabFuncs import ispc4 from MatlabFuncs import * 6 5 from pairoptions import pairoptions 7 6 … … 63 62 64 63 # Erase input file if run was carried out on same platform 65 hostname = socket.gethostname()64 hostname = oshostname() 66 65 if hostname == cluster.name: 67 66 remove(md.miscellaneous.name + '.bin') -
issm/trunk-jpl/src/m/solve/waitonlock.py
r24213 r26332 1 1 import os 2 from socket import gethostname3 2 import time 4 import MatlabFuncs as m 5 3 from MatlabFuncs import * 6 4 7 5 def waitonlock(md): 8 """ 9 WAITONLOCK - wait for a file 6 """WAITONLOCK - wait for a file 10 7 11 12 8 This routine will return when a file named 'filename' is written to disk. 9 If the time limit given in input is exceeded, return 0 13 10 14 15 11 Usage: 12 flag = waitonlock(md) 16 13 """ 17 14 … … 23 20 24 21 #waitonlock will work if the lock is on the same machine only: 25 if not m.strcmpi(gethostname(), cluster):22 if not strcmpi(oshostname(), cluster): 26 23 27 24 print('solution launched on remote cluster. log in to detect job completion.') 28 25 choice = eval(input('Is the job successfully completed? (y / n) ')) 29 if not m.strcmp(choice, 'y'):26 if not strcmp(choice, 'y'): 30 27 print('Results not loaded... exiting') 31 28 flag = 0 … … 35 32 #job is running on the same machine 36 33 else: 37 38 34 if 'interactive' in vars(md.cluster) and md.cluster.interactive: 39 35 #We are in interactive mode, no need to check for job completion
Note:
See TracChangeset
for help on using the changeset viewer.