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
  • ../trunk-jpl/src/m/classes/clusters/discovery.m

     
    3535                function disp(cluster) % {{{
    3636                        %  display the object
    3737                        disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
    38                         disp(sprintf('    name: %s',cluster.name));
     38                        disp(sprintf('    name:  %s',cluster.name));
    3939                        disp(sprintf('    login: %s',cluster.login));
    40                         disp(sprintf('    numnodes: %i',cluster.numnodes));
     40                        disp(sprintf('    numnodes:    %i',cluster.numnodes));
    4141                        disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
     42                        disp(sprintf('    time: %i hours',cluster.time));
     43                        disp(sprintf('    memory: %i Gb',cluster.memory));
     44                        disp(sprintf('    email: %s (notifications: BEGIN,END,FAIL)',cluster.email));
    4245                        disp(sprintf('    port: %i',cluster.port));
    43                         disp(sprintf('    codepath: %s',cluster.codepath));
     46                        disp(sprintf('    codepath:      %s',cluster.codepath));
    4447                        disp(sprintf('    executionpath: %s',cluster.executionpath));
    4548                        disp(sprintf('    interactive: %i',cluster.interactive));
    46                         disp(sprintf('    time: %i hours',cluster.time));
    47                         disp(sprintf('    memory: %i Gb',cluster.memory));
    4849                end
    4950                %}}}
    5051                function numprocs=nprocs(cluster) % {{{
     
    9091                end
    9192                %}}}
    9293                function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
    93                         error('not implemented yet');
     94
     95                        if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
     96                        if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
     97
     98                        %write queuing script
     99                        fid=fopen([modelname '.queue'],'w');
     100                        fprintf(fid,'#!/bin/bash\n');
     101                        fprintf(fid,'#SBATCH --job-name=%s\n',modelname);
     102                        fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
     103                        fprintf(fid,'#SBATCH -e %s.errlog \n',modelname);
     104                        fprintf(fid,'#SBATCH --nodes=%i\n',cluster.numnodes);
     105                        fprintf(fid,'#SBATCH --ntasks-per-node=%i\n',cluster.cpuspernode);
     106                        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
     107                        fprintf(fid,'#SBATCH --mem=%iG\n',cluster.memory);
     108                        if ~isempty(cluster.email)
     109                                fprintf(fid,'#SBATCH --mail-type=%s\n',cluster.email);
     110                        end
     111                        fprintf(fid,'\n');
     112                        fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath);
     113                        fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');
     114                        fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
     115                        fprintf(fid,'mpirun -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(), cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     116                        if ~io_gather, %concatenate the output files:
     117                                fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
     118                        end
     119                        fclose(fid);
     120
     121                        %in interactive mode, create a run file, and errlog and outlog file
     122                        if cluster.interactive,
     123                                fid=fopen([modelname '.run'],'w');
     124                                fprintf(fid,'mpirun -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(), cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     125                                if ~io_gather, %concatenate the output files:
     126                                        fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
     127                                end
     128                                fclose(fid);
     129                                fid=fopen([modelname '.errlog'],'w');
     130                                fclose(fid);
     131                                fid=fopen([modelname '.outlog'],'w');
     132                                fclose(fid);
     133                        end
    94134                end %}}}
    95135                function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
    96136
Note: See TracBrowser for help on using the repository browser.