source: issm/oecreview/Archive/26740-27031/ISSM-26994-26995.diff@ 27032

Last change on this file since 27032 was 27032, checked in by Mathieu Morlighem, 3 years ago

CHG: added 26740-27031

File size: 3.5 KB
RevLine 
[27032]1Index: ../trunk-jpl/src/m/classes/clusters/discovery.m
2===================================================================
3--- ../trunk-jpl/src/m/classes/clusters/discovery.m (revision 26994)
4+++ ../trunk-jpl/src/m/classes/clusters/discovery.m (revision 26995)
5@@ -35,16 +35,17 @@
6 function disp(cluster) % {{{
7 % display the object
8 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
9- disp(sprintf(' name: %s',cluster.name));
10+ disp(sprintf(' name: %s',cluster.name));
11 disp(sprintf(' login: %s',cluster.login));
12- disp(sprintf(' numnodes: %i',cluster.numnodes));
13+ disp(sprintf(' numnodes: %i',cluster.numnodes));
14 disp(sprintf(' cpuspernode: %i',cluster.cpuspernode));
15+ disp(sprintf(' time: %i hours',cluster.time));
16+ disp(sprintf(' memory: %i Gb',cluster.memory));
17+ disp(sprintf(' email: %s (notifications: BEGIN,END,FAIL)',cluster.email));
18 disp(sprintf(' port: %i',cluster.port));
19- disp(sprintf(' codepath: %s',cluster.codepath));
20+ disp(sprintf(' codepath: %s',cluster.codepath));
21 disp(sprintf(' executionpath: %s',cluster.executionpath));
22 disp(sprintf(' interactive: %i',cluster.interactive));
23- disp(sprintf(' time: %i hours',cluster.time));
24- disp(sprintf(' memory: %i Gb',cluster.memory));
25 end
26 %}}}
27 function numprocs=nprocs(cluster) % {{{
28@@ -90,7 +91,46 @@
29 end
30 %}}}
31 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
32- error('not implemented yet');
33+
34+ if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
35+ if(isgprof), disp('gprof not supported by cluster, ignoring...'); end
36+
37+ %write queuing script
38+ fid=fopen([modelname '.queue'],'w');
39+ fprintf(fid,'#!/bin/bash\n');
40+ fprintf(fid,'#SBATCH --job-name=%s\n',modelname);
41+ fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
42+ fprintf(fid,'#SBATCH -e %s.errlog \n',modelname);
43+ fprintf(fid,'#SBATCH --nodes=%i\n',cluster.numnodes);
44+ fprintf(fid,'#SBATCH --ntasks-per-node=%i\n',cluster.cpuspernode);
45+ fprintf(fid,'#SBATCH --time=%s\n',datestr(cluster.time/24,'HH:MM:SS')); %walltime is in HH:MM:SS format. cluster.time is in hour
46+ fprintf(fid,'#SBATCH --mem=%iG\n',cluster.memory);
47+ if ~isempty(cluster.email)
48+ fprintf(fid,'#SBATCH --mail-type=%s\n',cluster.email);
49+ end
50+ fprintf(fid,'\n');
51+ fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath);
52+ fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');
53+ fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
54+ fprintf(fid,'mpirun -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(), cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
55+ if ~io_gather, %concatenate the output files:
56+ fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
57+ end
58+ fclose(fid);
59+
60+ %in interactive mode, create a run file, and errlog and outlog file
61+ if cluster.interactive,
62+ fid=fopen([modelname '.run'],'w');
63+ fprintf(fid,'mpirun -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(), cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
64+ if ~io_gather, %concatenate the output files:
65+ fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
66+ end
67+ fclose(fid);
68+ fid=fopen([modelname '.errlog'],'w');
69+ fclose(fid);
70+ fid=fopen([modelname '.outlog'],'w');
71+ fclose(fid);
72+ end
73 end %}}}
74 function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
75
Note: See TracBrowser for help on using the repository browser.