Changeset 26744 for issm/trunk/src/m/classes/clusters/maui.m
- Timestamp:
- 12/22/21 10:39:44 (3 years ago)
- Location:
- issm/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk ¶
- Property svn:mergeinfo changed
/issm/trunk-jpl merged: 25837-25866,25868-25993,25995-26330,26332-26733,26736-26739,26741
- Property svn:mergeinfo changed
-
issm/trunk/src ¶
- Property svn:mergeinfo changed
-
TabularUnified issm/trunk/src/m/classes/clusters/maui.m ¶
r25836 r26744 1 %MAUI cl ass definition1 %MAUI cluster class definition 2 2 % 3 3 % Usage: … … 7 7 8 8 classdef maui 9 properties (SetAccess=public) 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 9 properties (SetAccess=public) 10 % {{{ 11 name = 'maui' 12 login = ''; 13 numnodes = 1; 14 cpuspernode = 8; 15 port = 0; 16 projectaccount = ''; 17 partition = 'nesi_research'; 18 codepath = ''; 19 executionpath = ''; 20 interactive = 0; 21 time = 24*60; 22 memory = 2; 23 end 24 %}}} 25 methods 26 function cluster=maui(varargin) % {{{ 27 27 28 29 28 %initialize cluster using default settings if provided 29 if (exist('maui_settings')==2), maui_settings; end 30 30 31 32 33 34 35 36 37 38 39 40 disp(sprintf(' port: %i',cluster.port));41 disp(sprintf(' numnodes: %i',cluster.numnodes));42 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode));43 disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes));44 45 46 47 48 49 50 51 52 53 function numprocs=np(cluster) % {{{54 55 56 57 58 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(' numnodes: %i',cluster.numnodes)); 41 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode)); 42 disp(sprintf(' np: %i',cluster.nprocs())); 43 disp(sprintf(' port: %i',cluster.port)); 44 disp(sprintf(' projectaccount: %s',cluster.projectaccount)); 45 disp(sprintf(' partition: %s',cluster.partition)); 46 disp(sprintf(' codepath: %s',cluster.codepath)); 47 disp(sprintf(' executionpath: %s',cluster.executionpath)); 48 disp(sprintf(' interactive: %i',cluster.interactive)); 49 disp(sprintf(' time: %i',cluster.time)); 50 disp(sprintf(' memory: %i',cluster.memory)); 51 end 52 %}}} 53 function numprocs=nprocs(cluster) % {{{ 54 %compute number of processors 55 numprocs=cluster.numnodes*cluster.cpuspernode; 56 end 57 %}}} 58 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 59 59 60 61 62 60 available_partitions={'nesi_research'} 61 partition_requirements_time=[24*60]; 62 partition_requirements_np=[80]; 63 63 64 QueueRequirements(available_partitions,partition_requirements_time,partition_requirements_np,cluster.partition,cluster.np,1)64 QueueRequirements(available_partitions,partition_requirements_time,partition_requirements_np,cluster.partition,cluster.nprocs(),1) 65 65 66 %Miscelaneous67 68 69 70 71 72 73 74 75 76 66 %Miscellaneous 67 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 68 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end 69 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end 70 end 71 %}}} 72 function BuildKrigingQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 73 error('not implemented yet'); 74 end 75 %}}} 76 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{ 77 77 78 79 78 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 79 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 80 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 fprintf(fid,'srun -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);98 99 100 101 81 %write queuing script 82 fid=fopen([modelname '.queue'],'w'); 83 fprintf(fid,'#!/bin/bash\n'); 84 fprintf(fid,'#SBATCH --job-name=%s\n',modelname); 85 fprintf(fid,'#SBATCH --account=%s \n',cluster.projectaccount); 86 fprintf(fid,'#SBATCH --partition=%s \n',cluster.partition); 87 fprintf(fid,'#SBATCH --ntasks=%i \n',cluster.numnodes); 88 fprintf(fid,'#SBATCH --cpus-per-task=%i\n',cluster.cpuspernode); 89 fprintf(fid,'#SBATCH --time=%i\n',cluster.time); %walltime is in minutes 90 fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory); 91 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname); 92 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname); 93 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME 94 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME 95 fprintf(fid,'module swap PrgEnv-cray PrgEnv-intel\n'); 96 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname); 97 fprintf(fid,'srun -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 98 if ~io_gather, %concatenate the output files: 99 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 100 end 101 fclose(fid); 102 102 103 104 105 106 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);107 108 109 110 111 112 113 114 115 116 117 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{103 %in interactive mode, create a run file, and errlog and outlog file 104 if cluster.interactive, 105 fid=fopen([modelname '.run'],'w'); 106 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname); 107 if ~io_gather, %concatenate the output files: 108 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 109 end 110 fclose(fid); 111 fid=fopen([modelname '.errlog'],'w'); 112 fclose(fid); 113 fid=fopen([modelname '.outlog'],'w'); 114 fclose(fid); 115 end 116 end %}}} 117 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ 118 118 119 120 121 122 123 124 125 126 127 119 %compress the files into one zip. 120 compressstring=['tar -zcf ' dirname '.tar.gz ']; 121 for i=1:numel(filelist), 122 compressstring = [compressstring ' ' filelist{i}]; 123 end 124 if cluster.interactive, 125 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 126 end 127 system(compressstring); 128 128 129 130 129 disp('uploading input file and queueing script'); 130 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 131 131 132 133 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{132 end %}}} 133 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ 134 134 135 136 137 138 139 140 141 142 143 144 function Download(cluster,dirname,filelist)% {{{135 disp('launching solution sequence on remote cluster'); 136 if ~isempty(restart) 137 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue ']; 138 else 139 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 140 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && sbatch ' modelname '.queue ']; 141 end 142 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 143 end %}}} 144 function Download(cluster,dirname,filelist) % {{{ 145 145 146 147 148 146 %copy files from cluster to current directory 147 directory=[cluster.executionpath '/' dirname '/']; 148 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 149 149 150 150 end %}}} 151 151 end 152 152 end
Note:
See TracChangeset
for help on using the changeset viewer.