Changeset 26744 for issm/trunk/src/m/classes/clusters/pollux.m
- Timestamp:
- 12/22/21 10:39:44 (4 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
-
issm/trunk/src/m/classes/clusters/pollux.m
r21729 r26744 7 7 8 8 classdef pollux 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 end21 methods22 function cluster=pollux(varargin) % {{{23 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);24 end25 %}}}26 function disp(cluster) % {{{27 % display the object28 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 end38 %}}}39 function md = checkconsistency(cluster,md,solution,analyses) % {{{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 available_queues={'shortp','longp'};42 queue_requirements_time=[180 720];43 queue_requirements_np=[128 128];41 available_queues={'shortp','longp'}; 42 queue_requirements_time=[180 720]; 43 queue_requirements_np=[128 128]; 44 44 45 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)46 end47 %}}}48 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{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 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end51 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end50 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 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 end62 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);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 end71 %}}}72 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{70 end 71 %}}} 72 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{ 73 73 74 disp('launching solution sequence on remote cluster');75 if ~isempty(restart)76 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];77 else78 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 end81 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);82 end %}}}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 %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 end90 if cluster.interactive,91 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];92 end93 system(compressstring);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 end %}}}96 function Download(cluster,dirname,filelist)% {{{95 end %}}} 96 function Download(cluster,dirname,filelist) % {{{ 97 97 98 %copy files from cluster to current directory99 directory=[cluster.executionpath '/' dirname '/'];100 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);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 end %}}}102 end %}}} 103 103 end 104 104 end
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/trac/issm/chrome/common/trac_banner.png)