Ignore:
Timestamp:
12/22/21 10:39:44 (3 years ago)
Author:
Mathieu Morlighem
Message:

merged trunk-jpl and trunk for revision 26742

Location:
issm/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk

  • issm/trunk/src

  • issm/trunk/src/m/classes/clusters/pollux.m

    r21729 r26744  
    77
    88classdef 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          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) % {{{
     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) % {{{
    4040
    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];
    4444
    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) % {{{
     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) % {{{
    4949
    50                          if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
    51                          if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
     50                        if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
     51                        if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
    5252
    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);
     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);
    6969
    70                  end
    71                  %}}}
    72                  function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{
     70                end
     71                %}}}
     72                function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{
    7373
    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)% {{{
     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) % {{{
    8484
    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);
     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);
    9494
    95                  end %}}}
    96                  function Download(cluster,dirname,filelist)% {{{
     95                end %}}}
     96                function Download(cluster,dirname,filelist) % {{{
    9797
    98                          %copy files from cluster to current directory
    99                          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);
    101101
    102                  end %}}}
     102                end %}}}
    103103        end
    104104end
Note: See TracChangeset for help on using the changeset viewer.