Changeset 26332


Ignore:
Timestamp:
06/28/21 14:12:20 (4 years ago)
Author:
jdquinn
Message:

CHG: Translation of discover.m -> py; additional MATLAB builtin function translations; cleanup

Location:
issm/trunk-jpl/src/m
Files:
1 added
37 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/clusters/acenet.m

    r21576 r26332  
    77
    88classdef acenet
    9     properties (SetAccess=public)
    10                  % {{{
    11                  %name='glacdyn.ace-net.ca'
    12                  name='placentia.ace-net.ca'
    13                  %name='brasdor.ace-net.ca'
    14                  login='klemorza';
    15                  np=10;
    16                  port=0;
    17                  queue='longq';
    18                  time=10;
    19                  % codepath='/usr/local/issm-r11321/bin'; % this one is for issm on acenet global
    20                  codepath='/home/klemorza/issm/trunk-jpl/bin'; % this one is for issm on my acenet directory
    21                  %executionpath='/home/klemorza/issm/trunk-jpl/execution';
    22                  %executionpath='/home/klemorza/scratch/issmres.dir';
    23                  executionpath='/net/glacdyn-data/glacdyn/1/klemorza/issm.dir';                 
    24                  %}}}
    25          end
    26          methods
    27                  function cluster=acenet(varargin) % {{{
    28                          %use provided options to change fields
    29                          options=pairoptions(varargin{:});
    30                          %initialize cluster using user settings if provided
    31                          if (exist([cluster.name '_settings'])==2), eval([cluster.name '_settings']); end
     9        properties (SetAccess=public)
     10                % {{{
     11                %name='glacdyn.ace-net.ca'
     12                name='placentia.ace-net.ca'
     13                %name='brasdor.ace-net.ca'
     14                login='klemorza';
     15                np=10;
     16                port=0;
     17                queue='longq';
     18                time=10;
     19                % codepath='/usr/local/issm-r11321/bin'; % this one is for issm on acenet global
     20                codepath='/home/klemorza/issm/trunk-jpl/bin'; % this one is for issm on my acenet directory
     21                %executionpath='/home/klemorza/issm/trunk-jpl/execution';
     22                %executionpath='/home/klemorza/scratch/issmres.dir';
     23                executionpath='/net/glacdyn-data/glacdyn/1/klemorza/issm.dir';
     24                %}}}
     25        end
     26        methods
     27                function cluster=acenet(varargin) % {{{
     28                        %use provided options to change fields
     29                        options=pairoptions(varargin{:});
     30                        %initialize cluster using user settings if provided
     31                        if (exist([cluster.name '_settings'])==2), eval([cluster.name '_settings']); end
    3232
    33                          %OK get other fields
    34                          cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
    35                  end
    36                  %}}}
    37                  function disp(cluster) % {{{
    38                          % display the object
    39                          disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
    40                          disp(sprintf('    name: %s',cluster.name));
    41                          disp(sprintf('    login: %s',cluster.login));
    42                          disp(sprintf('    np: %i',cluster.np));
    43                          disp(sprintf('    port: %i',cluster.port));
    44                          disp(sprintf('    queue: %s',cluster.queue));
    45                          disp(sprintf('    time: %i',cluster.time));
    46                          disp(sprintf('    codepath: %s',cluster.codepath));
    47                          disp(sprintf('    executionpath: %s',cluster.executionpath));
    48                  end
    49                  %}}}
    50                  function md = checkconsistency(cluster,md,solution,analyses) % {{{
     33                        %OK get other fields
     34                        cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
     35                end
     36                %}}}
     37                function disp(cluster) % {{{
     38                        % display the object
     39                        disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
     40                        disp(sprintf('    name: %s',cluster.name));
     41                        disp(sprintf('    login: %s',cluster.login));
     42                        disp(sprintf('    np: %i',cluster.np));
     43                        disp(sprintf('    port: %i',cluster.port));
     44                        disp(sprintf('    queue: %s',cluster.queue));
     45                        disp(sprintf('    time: %i',cluster.time));
     46                        disp(sprintf('    codepath: %s',cluster.codepath));
     47                        disp(sprintf('    executionpath: %s',cluster.executionpath));
     48                end
     49                %}}}
     50                function md = checkconsistency(cluster,md,solution,analyses) % {{{
    5151
    52                          available_queues={'debug','shortq','longq'};
    53                          queue_requirements_time=[48*1 48*7 48*15];
    54                          queue_requirements_np=[32 128 256];
    55                          QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
    56                  end
    57                  %}}}
    58                  function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
     52                        available_queues={'debug','shortq','longq'};
     53                        queue_requirements_time=[48*1 48*7 48*15];
     54                        queue_requirements_np=[32 128 256];
     55                        QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
     56                end
     57                %}}}
     58                function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
    5959
    60                          if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
    61                          if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
     60                        if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
     61                        if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
    6262
    63                          %write queuing script
    64                          fid=fopen([modelname '.queue'],'w');
    65                          fprintf(fid,'#!/bin/bash\n');
    66                          fprintf(fid,'#$ -cwd\n');
     63                        %write queuing script
     64                        fid=fopen([modelname '.queue'],'w');
     65                        fprintf(fid,'#!/bin/bash\n');
     66                        fprintf(fid,'#$ -cwd\n');
    6767
    68                          fprintf(fid,'#$ -N issm\n');
    69                          % fprintf(fid,'#$ -l h_rt=00:15:00\n');
    70                          % fprintf(fid,'#$ -l h_rt=5:00:0\n');
    71                          % fprintf(fid,'#$ -l h_rt=25:00:0\n');
    72                          % fprintf(fid,'#$ -l h_rt=47:59:00\n');
    73                          % fprintf(fid,'#$ -l h_rt=72:00:0\n');
    74                          % fprintf(fid,'#$ -l h_rt=96:00:0\n');
    75                          % fprintf(fid,'#$ -l h_rt=336:00:0\n');
    76                          tstr = sprintf('#$ -l h_rt=%i:00:00\n',cluster.time);
    77                          fprintf(fid,tstr);
     68                        fprintf(fid,'#$ -N issm\n');
     69                        % fprintf(fid,'#$ -l h_rt=00:15:00\n');
     70                        % fprintf(fid,'#$ -l h_rt=5:00:0\n');
     71                        % fprintf(fid,'#$ -l h_rt=25:00:0\n');
     72                        % fprintf(fid,'#$ -l h_rt=47:59:00\n');
     73                        % fprintf(fid,'#$ -l h_rt=72:00:0\n');
     74                        % fprintf(fid,'#$ -l h_rt=96:00:0\n');
     75                        % fprintf(fid,'#$ -l h_rt=336:00:0\n');
     76                        tstr = sprintf('#$ -l h_rt=%i:00:00\n',cluster.time);
     77                        fprintf(fid,tstr);
    7878
    79                          fprintf(fid,'#$ -l h_vmem=2G\n');
     79                        fprintf(fid,'#$ -l h_vmem=2G\n');
    8080
    81                          if strcmp(cluster.executionpath,'/home/klemorza/scratch/issmres.dir')
    82                              % ---- Which acent queue to use ----
    83                              fprintf(fid,'#$ -q short.q@*,medium.q@*\n');
    84                              %fprintf(fid,'#$ -q medium.q@*,long.q@*\n');
    85                              %fprintf(fid,'#$ -q medium.q@*\n');
    86                              %fprintf(fid,'#$ -q short.q@*\n');
    87                              % Acenet nodes with 16cpus and more than 60G mem
    88                              % fprintf(fid,'#$ -l h=cl001|cl002|cl003|cl004|cl005|cl006|cl007|cl008|cl009|cl010|cl011|cl012|cl021|cl022|cl023|cl024 \n');
    89                              % ---- cpus on different nodes ----
    90                              if cluster.np==4
    91                                  % -------- All cpus in the same node --------         
    92                                  fprintf(fid,'#$ -pe openmp %i\n',cluster.np);
    93                              else
    94                                  fprintf(fid,'#$ -pe ompi %i\n',cluster.np); % To avoid green acenet that does not have InfiniBand
    95                              end
    96                          
    97                          elseif strcmp(cluster.executionpath,'/net/glacdyn-data/glacdyn/1/klemorza/issm.dir')
    98                              % ---- Which node for Lev's queue are selected ----
    99                              fprintf(fid,'#$ -q tarasov.q\n');
    100                              fprintf(fid,'#$ -l h=cl27*|cl28*|cl29*|cl30*|cl31*|cl320|cl267|cl268|cl269|cl338 \n');
    101                              %fprintf(fid,'#$ -l h=cl27*|cl28*|cl29*|cl30*|cl31*|cl320|cl267|cl268|cl269 \n');
    102                              %fprintf(fid,'#$ -l h=cl0* \n');
    103                              % fprintf(fid,'#$ -l h=cl338 \n');
    104                              
    105                              if cluster.np==4
    106                                  % -------- All cpus in the same node --------         
    107                                  fprintf(fid,'#$ -pe openmp %i\n',cluster.np);
    108                              else
    109                                  fprintf(fid,'#$ -pe ompi* %i\n',cluster.np);
    110                                  %fprintf(fid,'#$ -pe 4per %i\n',cluster.np);
    111                                  %fprintf(fid,'#$ -pe 8per %i\n',cluster.np);
    112                              end
    113                          end
    114                                                  
    115                          % ---- misc ----
    116                          fprintf(fid,'#$ -j y\n');
    117                          
    118                          fprintf(fid,'module purge\n');
    119                          %fprintf(fid,'module load gcc openmpi/gcc\n');
    120                          %fprintf(fid,'module unload openmpi\n');
    121                          fprintf(fid,'module load intel/12.1.7.367\n');
    122                          fprintf(fid,'module load openmpi/intel/1.2.9\n');
     81                        if strcmp(cluster.executionpath,'/home/klemorza/scratch/issmres.dir')
     82                                % ---- Which acent queue to use ----
     83                                fprintf(fid,'#$ -q short.q@*,medium.q@*\n');
     84                                %fprintf(fid,'#$ -q medium.q@*,long.q@*\n');
     85                                %fprintf(fid,'#$ -q medium.q@*\n');
     86                                %fprintf(fid,'#$ -q short.q@*\n');
     87                                % Acenet nodes with 16cpus and more than 60G mem
     88                                % fprintf(fid,'#$ -l h=cl001|cl002|cl003|cl004|cl005|cl006|cl007|cl008|cl009|cl010|cl011|cl012|cl021|cl022|cl023|cl024 \n');
     89                                % ---- cpus on different nodes ----
     90                                if cluster.np==4
     91                                        % -------- All cpus in the same node --------         
     92                                        fprintf(fid,'#$ -pe openmp %i\n',cluster.np);
     93                                else
     94                                        fprintf(fid,'#$ -pe ompi %i\n',cluster.np); % To avoid green acenet that does not have InfiniBand
     95                                end
    12396
    124                          fprintf(fid,'module load gsl\n');
    125                          %fprintf(fid,'module load issm\n');
    126                          fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
    127                          fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
    128                          fprintf(fid,'\n');
    129                          fprintf(fid,'mpiexec %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog\n',...
    130                                  cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname,modelname,modelname);
    131                          %fprintf(fid,'echo $HOSTNAME >>%s.outlog',modelname);
    132                          fclose(fid);
     97                        elseif strcmp(cluster.executionpath,'/net/glacdyn-data/glacdyn/1/klemorza/issm.dir')
     98                                % ---- Which node for Lev's queue are selected ----
     99                                fprintf(fid,'#$ -q tarasov.q\n');
     100                                fprintf(fid,'#$ -l h=cl27*|cl28*|cl29*|cl30*|cl31*|cl320|cl267|cl268|cl269|cl338 \n');
     101                                %fprintf(fid,'#$ -l h=cl27*|cl28*|cl29*|cl30*|cl31*|cl320|cl267|cl268|cl269 \n');
     102                                %fprintf(fid,'#$ -l h=cl0* \n');
     103                                % fprintf(fid,'#$ -l h=cl338 \n');
     104                               
     105                                if cluster.np==4
     106                                        % -------- All cpus in the same node --------         
     107                                        fprintf(fid,'#$ -pe openmp %i\n',cluster.np);
     108                                else
     109                                        fprintf(fid,'#$ -pe ompi* %i\n',cluster.np);
     110                                        %fprintf(fid,'#$ -pe 4per %i\n',cluster.np);
     111                                        %fprintf(fid,'#$ -pe 8per %i\n',cluster.np);
     112                                end
     113                        end
     114                                               
     115                        % ---- misc ----
     116                        fprintf(fid,'#$ -j y\n');
     117                       
     118                        fprintf(fid,'module purge\n');
     119                        %fprintf(fid,'module load gcc openmpi/gcc\n');
     120                        %fprintf(fid,'module unload openmpi\n');
     121                        fprintf(fid,'module load intel/12.1.7.367\n');
     122                        fprintf(fid,'module load openmpi/intel/1.2.9\n');
    133123
    134                  end
    135                  %}}}
    136                  function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
     124                        fprintf(fid,'module load gsl\n');
     125                        %fprintf(fid,'module load issm\n');
     126                        fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
     127                        fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
     128                        fprintf(fid,'\n');
     129                        fprintf(fid,'mpiexec %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog\n',...
     130                                        cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname,modelname,modelname);
     131                        %fprintf(fid,'echo $HOSTNAME >>%s.outlog',modelname);
     132                        fclose(fid);
    137133
    138                          %compress the files into one zip.
    139                          compressstring=['tar -zcf ' dirname '.tar.gz '];
    140                          for i=1:numel(filelist),
    141                                  compressstring = [compressstring ' ' filelist{i}];
    142                          end
    143                          system(compressstring);
     134                end
     135                %}}}
     136                function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
    144137
    145                          disp('uploading input file and queueing script');
    146                          issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
     138                        %compress the files into one zip.
     139                        compressstring=['tar -zcf ' dirname '.tar.gz '];
     140                        for i=1:numel(filelist),
     141                                compressstring = [compressstring ' ' filelist{i}];
     142                        end
     143                        system(compressstring);
    147144
    148                  end %}}}
     145                        disp('uploading input file and queueing script');
     146                        issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
    149147
    150                  function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{
     148                end %}}}
    151149
    152                          disp('launching solution sequence on remote cluster');
    153                          if ~isempty(restart)
    154                                  launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
    155                          else
    156                                  launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
    157                                          ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue '];
    158                          end
    159                          issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
    160                  end %}}}
     150                function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{
    161151
    162                  function Download(cluster,dirname,filelist)% {{{
     152                        disp('launching solution sequence on remote cluster');
     153                        if ~isempty(restart)
     154                                launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
     155                        else
     156                                launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
     157                                        ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue '];
     158                        end
     159                        issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
     160                end %}}}
    163161
    164                          %copy files from cluster to current directory
    165                          directory=[cluster.executionpath '/' dirname '/'];
    166                          issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
     162                function Download(cluster,dirname,filelist) % {{{
    167163
    168                  end %}}}
     164                        %copy files from cluster to current directory
     165                        directory=[cluster.executionpath '/' dirname '/'];
     166                        issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
     167
     168                end %}}}
    169169        end
    170170end
  • issm/trunk-jpl/src/m/classes/clusters/aci.m

    r21818 r26332  
    5353                        QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.ppn*cluster.nodes,1)
    5454
    55                         %Miscelaneous
     55                        %Miscellaneous
    5656                        if cluster.ppn>20, md = checkmessage(md,'cannot request more that 20 cores per node'); end
    5757                        if isempty(cluster.login), md = checkmessage(md,'login empty'); end
  • issm/trunk-jpl/src/m/classes/clusters/aurora.m

    r26330 r26332  
    3838                        disp(sprintf('    numnodes: %i',cluster.numnodes));
    3939                        disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
     40                        disp(sprintf('    np: %i',cluster.nprocs()));
     41                        disp(sprintf('    modules: %s',strjoin(cluster.modules,', ')));
    4042                        disp(sprintf('    port: %i',cluster.port));
    4143                        disp(sprintf('    queue: %s',cluster.queue));
     
    4345                        disp(sprintf('    codepath: %s',cluster.codepath));
    4446                        disp(sprintf('    executionpath: %s',cluster.executionpath));
     47                        disp(sprintf('    mpipath: %s',cluster.mpipath));
    4548                end
    4649                %}}}
  • issm/trunk-jpl/src/m/classes/clusters/camhpc.m

    r26330 r26332  
    3838                        disp(sprintf('    name: %s',cluster.name));
    3939                        disp(sprintf('    login: %s',cluster.login));
    40                         disp(sprintf('    port: %i',cluster.port));
    4140                        disp(sprintf('    numnodes: %i',cluster.numnodes));
    4241                        disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
    43                         disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
     42                        disp(sprintf('    np: %i',cluster.nprocs()));
     43                        disp(sprintf('    port: %i',cluster.port));
    4444                        disp(sprintf('    project: %s',cluster.project));
    4545                        disp(sprintf('    partition: %s',cluster.partition));
     
    6262                        queue_requirements_np=[80 80];
    6363
    64                         QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.project,cluster.np,1)
     64                        QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.project,cluster.nprocs(),1)
    6565
    66                         %Miscelaneous
     66                        %Miscellaneous
    6767                        if isempty(cluster.login), md = checkmessage(md,'login empty'); end
    6868                        if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
     
    9292                        fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
    9393                        fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
    94                         fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     94                        fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
    9595                        if ~io_gather, %concatenate the output files:
    9696                                fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
     
    101101                        if cluster.interactive,
    102102                                fid=fopen([modelname '.run'],'w');
    103                                 fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     103                                fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
    104104                                if ~io_gather, %concatenate the output files:
    105105                                        fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
  • issm/trunk-jpl/src/m/classes/clusters/castor.m

    r21576 r26332  
    77
    88classdef castor
    9     properties (SetAccess=public)
    10                  % {{{
    11                  name='castor'
    12                  login='username';
    13                  np   =128;
    14                  port=0;
    15                  queue='shortc';
    16                  time=180;
    17                  codepath='/workp/edw/issm-2.0/bin'
    18                  executionpath='/workp/edw/Testing/Execution'
    19                  %}}}
    20          end
    21          methods
    22                  function cluster=castor(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('    np: %i',cluster.np));
    32                          disp(sprintf('    port: %i',cluster.port));
    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='castor'
     12                login='username';
     13                np=128;
     14                port=0;
     15                queue='shortc';
     16                time=180;
     17                codepath='/workp/edw/issm-2.0/bin'
     18                executionpath='/workp/edw/Testing/Execution'
     19                %}}}
     20        end
     21        methods
     22                function cluster=castor(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('    np: %i',cluster.np));
     32                        disp(sprintf('    port: %i',cluster.port));
     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={'shortc','longc'};
    42                          queue_requirements_time=[180 720];
    43                          queue_requirements_np=[128 128];
     41                        available_queues={'shortc','longc'};
     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 UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
     70                end
     71                %}}}
     72                function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
    7373
    74                          %compress the files into one zip.
    75                          compressstring=['tar -zcf ' dirname '.tar.gz '];
    76                          for i=1:numel(filelist),
    77                                  compressstring = [compressstring ' ' filelist{i}];
    78                          end
    79                          if cluster.interactive,
    80                                  compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
    81                          end
    82                          system(compressstring);
     74                        %compress the files into one zip.
     75                        compressstring=['tar -zcf ' dirname '.tar.gz '];
     76                        for i=1:numel(filelist),
     77                                compressstring = [compressstring ' ' filelist{i}];
     78                        end
     79                        if cluster.interactive,
     80                                compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
     81                        end
     82                        system(compressstring);
    8383
    84                          disp('uploading input file and queueing script');
    85                          issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
     84                        disp('uploading input file and queueing script');
     85                        issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
    8686
    87                  end %}}}
    88                  function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{
     87                end %}}}
     88                function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{
    8989
    90                          disp('launching solution sequence on remote cluster');
    91                          if ~isempty(restart)
    92                                  launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
    93                          else
    94                                  launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
    95                                          ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
    96                          end
    97                          issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
    98                  end %}}}
    99                  function Download(cluster,dirname,filelist)% {{{
     90                        disp('launching solution sequence on remote cluster');
     91                        if ~isempty(restart)
     92                                launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
     93                        else
     94                                launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
     95                                        ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
     96                        end
     97                        issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
     98                end %}}}
     99                function Download(cluster,dirname,filelist) % {{{
    100100
    101                          %copy files from cluster to current directory
    102                          directory=[cluster.executionpath '/' dirname '/'];
    103                          issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
     101                        %copy files from cluster to current directory
     102                        directory=[cluster.executionpath '/' dirname '/'];
     103                        issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
    104104
    105                  end %}}}
     105                end %}}}
    106106        end
    107107end
  • issm/trunk-jpl/src/m/classes/clusters/cloud.m

    r21576 r26332  
    66
    77classdef cloud
    8         properties (SetAccess=public) 
     8        properties (SetAccess=public)
    99                % {{{
    1010                name='';
     
    6464                end
    6565                %}}}
    66                 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
     66                function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
    6767
    6868                        %compress the files into one zip.
     
    8080
    8181                end %}}}
    82                 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{
     82                function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{
    8383
    8484                        if cluster.interactive,
     
    101101                        issmstssh(cluster.name,cluster.login,launchcommand);
    102102                end %}}}
    103                 function Download(cluster,dirname,filelist)% {{{
     103                function Download(cluster,dirname,filelist) % {{{
    104104
    105105                        %copy files from cluster to current directory
  • issm/trunk-jpl/src/m/classes/clusters/cosmos.m

    r21576 r26332  
    77
    88classdef cosmos
    9     properties (SetAccess=public)
    10                  % {{{
    11                  name='cosmos'
    12                  login='username';
    13                  np=128;
    14                  port=0;
    15                  queue='shortq';
    16                  time=3*60;
    17                  codepath='/work00/edw/issm-2.0/bin';
    18                  executionpath='/work00/edw/Execution';
    19                  %}}}
    20          end
    21          methods
    22                  function cluster=cosmos(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('    np: %i',cluster.np));
    32                          disp(sprintf('    port: %i',cluster.port));
    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='cosmos'
     12                login='username';
     13                np=128;
     14                port=0;
     15                queue='shortq';
     16                time=3*60;
     17                codepath='/work00/edw/issm-2.0/bin';
     18                executionpath='/work00/edw/Execution';
     19                %}}}
     20        end
     21        methods
     22                function cluster=cosmos(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('    np: %i',cluster.np));
     32                        disp(sprintf('    port: %i',cluster.port));
     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={'debug','shortq','longq'};
    42                          queue_requirements_time=[60*1 60*3 60*17];
    43                          queue_requirements_np=[32 128 256];
     41                        available_queues={'debug','shortq','longq'};
     42                        queue_requirements_time=[60*1 60*3 60*17];
     43                        queue_requirements_np=[32 128 256];
    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/bash\n');
    56                          fprintf(fid,'#PBS -l select=%i:ncpus=1\n',cluster.np);
    57                          fprintf(fid,'#PBS -N %s\n',modelname);
    58                          fprintf(fid,'#PBS -l walltime=%i\n',time*60); %walltime is in seconds.
    59                          fprintf(fid,'#PBS -q %s\n',queue);
    60                          fprintf(fid,'#PBS -o %s.outlog \n',modelname);
    61                          fprintf(fid,'#PBS -e %s.errlog \n',modelname);
    62                          fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]);
    63                          fprintf(fid,'cd $PBS_O_WORKDIR\n');
    64                          fprintf(fid,'export OMP_NUM_THREADS=1\n');
    65                          fprintf(fid,'ulimit -s unlimited\n');
    66                          fprintf(fid,'ulimit -c 0\n');
    67                          fprintf(fid,'/opt/mpich/gm/intel10.1/bin/mpiexec -np %i %s/issm.exe %s %s %s',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/bash\n');
     56                        fprintf(fid,'#PBS -l select=%i:ncpus=1\n',cluster.np);
     57                        fprintf(fid,'#PBS -N %s\n',modelname);
     58                        fprintf(fid,'#PBS -l walltime=%i\n',time*60); %walltime is in seconds.
     59                        fprintf(fid,'#PBS -q %s\n',queue);
     60                        fprintf(fid,'#PBS -o %s.outlog \n',modelname);
     61                        fprintf(fid,'#PBS -e %s.errlog \n',modelname);
     62                        fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]);
     63                        fprintf(fid,'cd $PBS_O_WORKDIR\n');
     64                        fprintf(fid,'export OMP_NUM_THREADS=1\n');
     65                        fprintf(fid,'ulimit -s unlimited\n');
     66                        fprintf(fid,'ulimit -c 0\n');
     67                        fprintf(fid,'/opt/mpich/gm/intel10.1/bin/mpiexec -np %i %s/issm.exe %s %s %s',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     68                        fclose(fid);
    6969
    70                  end
    71                  %}}}
    72                  function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
     70                end
     71                %}}}
     72                function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
    7373
    74                          %compress the files into one zip.
    75                          compressstring=['tar -zcf ' dirname '.tar.gz '];
    76                          for i=1:numel(filelist),
    77                                  compressstring = [compressstring ' ' filelist{i}];
    78                          end
    79                          if cluster.interactive,
    80                                  compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
    81                          end
    82                          system(compressstring);
     74                        %compress the files into one zip.
     75                        compressstring=['tar -zcf ' dirname '.tar.gz '];
     76                        for i=1:numel(filelist),
     77                                compressstring = [compressstring ' ' filelist{i}];
     78                        end
     79                        if cluster.interactive,
     80                                compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
     81                        end
     82                        system(compressstring);
    8383
    84                          disp('uploading input file and queueing script');
    85                          issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
     84                        disp('uploading input file and queueing script');
     85                        issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
    8686
    87                  end %}}}
    88                  function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{
     87                end %}}}
     88                function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{
    8989
    90                          disp('launching solution sequence on remote cluster');
    91                          if ~isempty(restart)
    92                                  launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
    93                          else
    94                                  launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
    95                                          ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
    96                          end
    97                          issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
    98                  end %}}}
    99                  function Download(cluster,dirname,filelist)% {{{
     90                        disp('launching solution sequence on remote cluster');
     91                        if ~isempty(restart)
     92                                launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
     93                        else
     94                                launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
     95                                        ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
     96                        end
     97                        issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
     98                end %}}}
     99                function Download(cluster,dirname,filelist) % {{{
    100100
    101                          %copy files from cluster to current directory
    102                          directory=[cluster.executionpath '/' dirname '/'];
    103                          issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
     101                        %copy files from cluster to current directory
     102                        directory=[cluster.executionpath '/' dirname '/'];
     103                        issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
    104104
    105                  end %}}}
     105                end %}}}
    106106        end
    107107end
  • issm/trunk-jpl/src/m/classes/clusters/cyclone.py

    r24269 r26332  
    1212
    1313class cyclone(object):
    14     """
    15     Be aware that this is not a cluster as we usually know them. There is no scheduling and ressources are pretty low.
    16     The Computer have 20 cpus and 512Gb of memory used by a number of person so be respectful with your usage.
    17     I putted some restrictive upper limits to avoid over - use. (Basile)
     14    """CYCLONE cluster class definition
    1815
    19        Usage:
    20           cluster = cyclone()
     16    Be aware that this is not a cluster as we usually know them. There is no scheduling and resources are pretty low.
     17    The computer has 20 CPUs and 512GB of memory used by a number of persons, so be respectful with your usage.
     18    I have put some restrictive upper limits in place to avoid overuse. (Basile)
     19
     20    Usage:
     21        cluster = cyclone()
    2122    """
    2223
    23     def __init__(self, *args):    # {{{
     24    def __init__(self, *args):  # {{{
    2425        self.name = 'cyclone'
    2526        self.login = ''
     
    3132        self.interactive = 0
    3233
    33     #use provided options to change fields
     34        # Use provided options to change fields
    3435        options = pairoptions(*args)
    3536
    36     #initialize cluster using user settings if provided
     37        # Initialize cluster using user settings if provided
    3738        self = cyclone_settings(self)
    38     #OK get other fields
     39        # OK get other fields
    3940        self = options.AssignObjectFields(self)
    40 
    4141    # }}}
    4242
    43     def __repr__(self):    # {{{
    44         #  display the object
     43    def __repr__(self):  # {{{
     44        # Display the object
    4545        s = "class cyclone object:"
    4646        s = "%s\n%s" % (s, fielddisplay(self, 'name', 'name of the cluster'))
     
    5353    # }}}
    5454
    55     def checkconsistency(self, md, solution, analyses):    # {{{
    56         #Miscelaneous
     55    def checkconsistency(self, md, solution, analyses):  # {{{
     56        # Miscellaneous
    5757        if not self.login:
    5858            md = md.checkmessage('login empty')
     
    6969    # }}}
    7070
    71     def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):    # {{{
     71    def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):  # {{{
    7272        executable = 'issm.exe'
    73         #write queuing script
     73        # Write queuing script
    7474        fid = open(modelname + '.queue', 'w')
    7575        fid.write('export ISSM_DIR="%s/../ "\n' % self.codepath)
     
    8383        fid.write('mpiexec -np %i %s/%s %s %s %s>%s.outlog 2>%s.errlog\n' % (self.np, self.codepath, executable, str(solution), rundir, modelname, runfile, runfile))
    8484        fid.close()
    85 
    8685    # }}}
    87     def UploadQueueJob(self, modelname, dirname, filelist):    # {{{
     86    def UploadQueueJob(self, modelname, dirname, filelist):  # {{{
    8887        #compress the files into one zip.
    8988        compressstring = 'tar -zcf %s.tar.gz ' % dirname
    9089        for file in filelist:
    91             compressstring += ' %s' % file
     90            compressstring += ' {}'.format(file)
    9291        subprocess.call(compressstring, shell=True)
    9392
    9493        print('uploading input file and queueing script')
    9594        issmscpout(self.name, self.executionpath, self.login, self.port, [dirname + '.tar.gz'])
    96 
    9795    # }}}
    98     def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):    # {{{
     96    def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):  # {{{
    9997        print('launching solution sequence on remote cluster')
    10098        if restart:
     
    103101            launchcommand = 'cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz  && chmod +x ./%s.queue && ./%s.queue' % (self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname, modelname)
    104102        issmssh(self.name, self.login, self.port, launchcommand)
    105 
    106103    # }}}
    107     def Download(self, dirname, filelist):    # {{{
    108         #copy files from cluster to current directory
     104    def Download(self, dirname, filelist):  # {{{
     105        # Copy files from cluster to current directory
    109106        directory = '%s/%s/' % (self.executionpath, dirname)
    110107        issmscpin(self.name, self.login, self.port, directory, filelist)
  • issm/trunk-jpl/src/m/classes/clusters/discover.m

    r26330 r26332  
    1111                name=oshostname();
    1212                login='';
    13                 modules        = {};
     13                modules={'comp/intel/20.0.0.166' 'mpi/sgi-mpt/2.17' 'cmake/3.17.0'};
    1414                numnodes=20;
    15                 cpuspernode=8; 
     15                cpuspernode=8;
    1616                port=0;
    1717                queue='general';
     
    2020                codepath='';
    2121                executionpath='';
     22                grouplist='';
    2223                interactive=0;
    2324                bbftp=0;
     
    4344                        disp(sprintf('    login: %s',cluster.login));
    4445                        disp(sprintf('    modules: %s',strjoin(cluster.modules,', ')));
    45                         disp(sprintf('    port: %i',cluster.port));
    4646                        disp(sprintf('    numnodes: %i',cluster.numnodes));
    4747                        disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
    48                         disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
     48                        disp(sprintf('    np: %i',cluster.nprocs()));
     49                        disp(sprintf('    port: %i',cluster.port));
    4950                        disp(sprintf('    queue: %s',cluster.queue));
    5051                        disp(sprintf('    time: %i',cluster.time));
    5152                        disp(sprintf('    processor: %s',cluster.processor));
     53                        disp(sprintf('    srcpath: %s',cluster.srcpath));
    5254                        disp(sprintf('    codepath: %s',cluster.codepath));
    5355                        disp(sprintf('    executionpath: %s',cluster.executionpath));
     56                        disp(sprintf('    grouplist: %s',cluster.grouplist));
    5457                        disp(sprintf('    interactive: %i',cluster.interactive));
     58                        disp(sprintf('    bbftp: %s',cluster.bbftp));
     59                        disp(sprintf('    numstreams: %s',cluster.numstreams));
    5560                        disp(sprintf('    hyperthreading: %i',cluster.hyperthreading));
    5661                        disp(sprintf('    email: %s',cluster.email));
     
    6873                        queue_requirements_np=[560 6000 532];
    6974
    70                         QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
     75                        QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),cluster.time)
    7176
    7277                        %now, check cluster.cpuspernode according to processor type
     
    8388                        end
    8489
    85                         %Miscelaneous
     90                        %Miscellaneous
    8691                        if isempty(cluster.login), md = checkmessage(md,'login empty'); end
    8792                        if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
     
    113118                        fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
    114119                        fprintf(fid,'#SBATCH -e %s.errlog \n',modelname);
    115                         fprintf(fid,'#SBATCH -n %i \n',cluster.numnodes*cluster.cpuspernode);
     120                        fprintf(fid,'#SBATCH -n %i \n',cluster.nprocs());
    116121                        fprintf(fid,'#SBATCH -N %i \n',cluster.numnodes);
    117122                        fprintf(fid,'#SBATCH -t %02i:%02i:00 \n',floor(cluster.time/3600),floor(mod(cluster.time,3600)/60));
    118                         fprintf(fid,'#SBATCH -A s1690 \n\n');
    119                         for i=1:numel(cluster.modules),
    120                                 fprintf(fid,['module load ' cluster.modules{i} '\n']);
    121                         end
     123                        fprintf(fid,'#SBATCH -A %s \n\n',cluster.grouplist);
    122124                        if length(find(cluster.email=='@'))>0
    123125                                fprintf(fid,'#SBATCH --mail-user=%s \n',cluster.email);
     
    125127                        end
    126128                        fprintf(fid,'. /usr/share/modules/init/bash\n\n');
    127                         fprintf(fid,'module load comp/intel/20.0.0.166\n');
    128                         fprintf(fid,'module load mpi/sgi-mpt/2.17\n');
    129                         fprintf(fid,'module load cmake/3.17.0\n');
     129                        for i=1:numel(cluster.modules),
     130                                fprintf(fid,['module load ' cluster.modules{i} '\n']);
     131                        end
    130132                        fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
    131133                        fprintf(fid,'export MPI_UNBUFFERED_STDIO=true\n\n');
     
    135137                        fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
    136138
    137                         fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
     139                        fprintf(fid,'mpiexec -np %i %s/%s %s %s/%s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,cluster.executionpath,dirname,modelname);
    138140                        if ~io_gather, %concatenate the output files:
    139141                                fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
     
    145147                                fid=fopen([modelname '.run'],'w');
    146148                                if ~isvalgrind,
    147                                         fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
     149                                        fprintf(fid,'mpiexec -np %i %s/%s %s %s/%s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,cluster.executionpath,dirname,modelname);
    148150                                else
    149                                         fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
     151                                        fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s/%s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,cluster.executionpath,dirname,modelname);
    150152                                end
    151153                                if ~io_gather, %concatenate the output files:
     
    153155                                end
    154156                                fclose(fid);
    155                                 fid=fopen([modelname '.errlog'],'w');
     157                                fid=fopen([modelname '.errlog'],'w'); % TODO: Change this to system call (touch <file>)?
    156158                                fclose(fid);
    157                                 fid=fopen([modelname '.outlog'],'w');
     159                                fid=fopen([modelname '.outlog'],'w'); % TODO: Change this to system call (touch <file>)?
    158160                                fclose(fid);
    159161                        end
     
    162164
    163165                        %compress the files into one zip.
    164                         compressstring=['tar -zcf ' dirname '.tar.gz '];
     166                        compressstring=['tar -zcf ' dirname '.tar.gz'];
    165167                        for i=1:numel(filelist),
    166168                                compressstring = [compressstring ' ' filelist{i}];
     
    178180                        end
    179181
    180                         if ~cluster.bbftp,
     182                        if cluster.bbftp,
     183                                issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']});
     184                        else
    181185                                issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']});
    182                         else
    183                                 issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']});
    184186                        end
    185187
     
    188190                function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
    189191
    190                         if ~cluster.interactive,
     192                        if cluster.interactive,
     193                                if ~isempty(restart)
     194                                        launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive)];
     195                                else
     196                                        launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' dirname '.tar.gz'];
     197                                end
     198                        else
    191199                                if ~isempty(restart)
    192200                                        launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && sbatch ' modelname '.queue '];
     
    195203                                                ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && sbatch ' modelname '.queue '];
    196204                                end
    197                         else
    198                                 if ~isempty(restart)
    199                                         launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive)];
    200                                 else
    201                                         launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' dirname '.tar.gz'];
    202                                 end
    203205                        end
    204206
     
    210212
    211213                        %copy files from cluster to current directory
    212                         if ~cluster.interactive,
     214                        if cluster.interactive,
     215                                directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive) '/'];
     216                        else
    213217                                directory=[cluster.executionpath '/' dirname '/'];
    214                         else
    215                                 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive) '/'];
    216                         end
    217 
    218                         if ~cluster.bbftp,
     218                        end
     219
     220                        if cluster.bbftp,
     221                                issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist);
     222                        else
    219223                                issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
    220                         else
    221                                 issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist);
    222224                        end
    223225
  • issm/trunk-jpl/src/m/classes/clusters/fram.py

    r24213 r26332  
    1515
    1616class fram(object):
    17     """
    18     Fram cluster class definition
     17    """FRAM cluster class definition
     18
    1919    This is a SLURM queue
    2020    The priorities are based on a point system, reservation when reaching 20000 and earning 1 point per min.
    21      - Devel queue starts at 19990
    22      - Normal starts at 19940
    23      - Normal unpri atarts at 19400
     21    - Devel queue starts at 19990
     22    - Normal starts at 19940
     23    - Normal unpri atarts at 19400
    2424
    2525    Jobs can be:
    26      - normal (4 to 30 nodes, more if asked, 48h max walltime, 60Gb per nodes)
    27      - bigmem for big memory nodes (8 512Gb nodes and 2 6Tb nodes, shared nodes, 14days max walltime
     26    - normal (4 to 30 nodes, more if asked, 48h max walltime, 60Gb per nodes)
     27    - bigmem for big memory nodes (8 512Gb nodes and 2 6Tb nodes, shared nodes, 14days max walltime
    2828
    29        Usage:
    30           cluster = stallo()
     29    Usage:
     30        cluster = fram()
    3131    """
    3232
    33     def __init__(self, *args):    # {{{
     33    def __init__(self, *args):  # {{{
    3434        self.name = 'fram'
    3535        self.login = ''
     
    4545        self.accountname = ''
    4646        self.profiling = 0
    47     #use provided options to change fields
     47        # Use provided options to change fields
    4848        options = pairoptions(*args)
    4949
    50     #initialize cluster using user settings if provided
     50        # Initialize cluster using user settings if provided
    5151        self = fram_settings(self)
    52     #OK get other fields
     52
     53        # OK get other fields
    5354        self = options.AssignObjectFields(self)
    5455        self.np = self.numnodes * self.cpuspernode
    5556    # }}}
    5657
    57     def __repr__(self):    # {{{
    58         #  display the object
    59         s = "class vilje object:"
     58    def __repr__(self):  # {{{
     59        # Display the object
     60        s = "class fram object:"
    6061        s = "%s\n%s" % (s, fielddisplay(self, 'name', 'name of the cluster'))
    6162        s = "%s\n%s" % (s, fielddisplay(self, 'login', 'login'))
     
    7475
    7576    def checkconsistency(self, md, solution, analyses):  # {{{
    76         #Queue dictionarry  gives queue name as key and max walltime and cpus as var
     77        # Queue dictionary gives queue name as key and max walltime and CPUs as var
    7778        queuedict = {'normal': [2 * 24 * 60, 2048],
    7879                     'devel': [4 * 60, 2048]}
    7980        QueueRequirements(queuedict, self.queue, self.np, self.time)
    8081
    81     #Miscelaneous
     82        # Miscellaneous
    8283        if not self.login:
    8384            md = md.checkmessage('login empty')
     
    9192    # }}}
    9293
    93     def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):    # {{{
     94    def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):  # {{{
    9495        executable = 'issm.exe'
    9596        if isdakota:
     
    100101        if isoceancoupling:
    101102            executable = 'issm_ocean.exe'
    102     #write queuing script
     103        # Write queuing script
    103104        shortname = modelname[0:min(12, len(modelname))]
    104105        fid = open(modelname + '.queue', 'w')
     
    125126        fid.write('module load ParMETIS/4.0.3-intel-2017a\n')
    126127        fid.write('cd %s/%s/ \n\n' % (self.executionpath, dirname))
    127         if self.profiling == 1:
     128        if self.profiling:
    128129            fid.write('module load perf-report\n')
    129130            fid.write('perf-report mpirun -np %i %s/%s %s %s/%s %s\n' % (self.np, self.codepath, executable, str(solution), self.executionpath, dirname, modelname))
     
    131132            fid.write('mpirun -np %i %s/%s %s %s/%s %s\n' % (self.np, self.codepath, executable, str(solution), self.executionpath, dirname, modelname))
    132133        fid.close()
    133 
    134134    # }}}
    135135
    136     def UploadQueueJob(self, modelname, dirname, filelist):    # {{{
    137         #compress the files into one zip.
     136    def UploadQueueJob(self, modelname, dirname, filelist):  # {{{
     137        # Compress the files into one zip
    138138        compressstring = 'tar -zcf %s.tar.gz ' % dirname
    139139        for file in filelist:
    140             compressstring += ' %s' % file
     140            compressstring += ' {}'.format(file)
    141141        subprocess.call(compressstring, shell=True)
    142142
     
    145145
    146146    # }}}
    147     def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):    # {{{
     147    def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):  # {{{
    148148        print('launching solution sequence on remote cluster')
    149149        if restart:
     
    152152            launchcommand = 'cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz  && sbatch %s.queue' % (self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname)
    153153        issmssh(self.name, self.login, self.port, launchcommand)
    154 
    155154    # }}}
    156     def Download(self, dirname, filelist):    # {{{
    157         #copy files from cluster to current directory
     155    def Download(self, dirname, filelist):  # {{{
     156        # Copy files from cluster to current directory
    158157        directory = '%s/%s/' % (self.executionpath, dirname)
    159158        issmscpin(self.name, self.login, self.port, directory, filelist)
  • issm/trunk-jpl/src/m/classes/clusters/gemini.m

    r21576 r26332  
    77
    88classdef gemini
    9     properties (SetAccess=public)
     9        properties (SetAccess=public)
    1010        % {{{
    1111                name='gemini'
     
    1818                executionpath='/workg/edw/Testing/Execution'
    1919        %}}}
    20     end
    21     methods
    22                  function cluster=gemini(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('    np: %i',cluster.np));
    32                          disp(sprintf('    port: %i',cluster.port));
    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) % {{{
     20        end
     21        methods
     22                function cluster=gemini(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('    np: %i',cluster.np));
     32                        disp(sprintf('    port: %i',cluster.port));
     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={'debug','shortg','longg'};
    42                          queue_requirements_time=[60 180 720];
    43                          queue_requirements_np=[50 50 50];
     41                        available_queues={'debug','shortg','longg'};
     42                        queue_requirements_time=[60 180 720];
     43                        queue_requirements_np=[50 50 50];
    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);
     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);
    6464
    65                          fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]);
    66                          fprintf(fid,'cd $PBS_O_WORKDIR\n');
    67                          fprintf(fid,'export OMP_NUM_THREADS=1\n');
    68                          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);
    69                          fclose(fid);
     65                        fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]);
     66                        fprintf(fid,'cd $PBS_O_WORKDIR\n');
     67                        fprintf(fid,'export OMP_NUM_THREADS=1\n');
     68                        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);
     69                        fclose(fid);
    7070
    71                  end
    72                  %}}}
    73                  function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
     71                end
     72                %}}}
     73                function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
    7474
    75                          %compress the files into one zip.
    76                          compressstring=['tar -zcf ' dirname '.tar.gz '];
    77                          for i=1:numel(filelist),
    78                                  compressstring = [compressstring ' ' filelist{i}];
    79                          end
    80                          if cluster.interactive,
    81                                  compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
    82                          end
    83                          system(compressstring);
     75                        %compress the files into one zip.
     76                        compressstring=['tar -zcf ' dirname '.tar.gz '];
     77                        for i=1:numel(filelist),
     78                                compressstring = [compressstring ' ' filelist{i}];
     79                        end
     80                        if cluster.interactive,
     81                                compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
     82                        end
     83                        system(compressstring);
    8484
    85                          disp('uploading input file and queueing script');
    86                          issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
     85                        disp('uploading input file and queueing script');
     86                        issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
    8787
    88                  end %}}}
    89                  function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{
     88                end %}}}
     89                function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{
    9090
    91                          disp('launching solution sequence on remote cluster');
    92                          if ~isempty(restart)
    93                                  launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
    94                          else
    95                                  launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
    96                                          ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
    97                          end
    98                          issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
    99                  end %}}}
    100                  function Download(cluster,dirname,filelist)% {{{
     91                        disp('launching solution sequence on remote cluster');
     92                        if ~isempty(restart)
     93                                launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
     94                        else
     95                                launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
     96                                        ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
     97                        end
     98                        issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
     99                end %}}}
     100                function Download(cluster,dirname,filelist) % {{{
    101101
    102                          %copy files from cluster to current directory
    103                          directory=[cluster.executionpath '/' dirname '/'];
    104                          issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
     102                        %copy files from cluster to current directory
     103                        directory=[cluster.executionpath '/' dirname '/'];
     104                        issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
    105105
    106                  end %}}}
     106                end %}}}
    107107        end
    108108end
  • issm/trunk-jpl/src/m/classes/clusters/generic.py

    r26330 r26332  
    1 from socket import gethostname
    21from subprocess import call
    32
     
    98except ImportError:
    109    print('Warning generic_settings.py not found, default will be used')
    11 from MatlabFuncs import ispc
     10from MatlabFuncs import *
    1211from IssmConfig import IssmConfig
    1312from issmdir import issmdir
     
    4443
    4544        # Get name
    46         self.name = gethostname()
     45        self.name = oshostname()
    4746
    4847        # Initialize cluster using user settings if provided
     
    5857    def __repr__(self):  # {{{
    5958        #  display the object
    60         s = "class '%s' object '%s' = \n" % (type(self), 'self')
    61         s += '{}\n'.format(fielddisplay(self, 'name', ''))
    62         s += '{}\n'.format(fielddisplay(self, 'login', ''))
    63         s += '{}\n'.format(fielddisplay(self, 'np', ''))
    64         s += '{}\n'.format(fielddisplay(self, 'port', ''))
    65         s += '{}\n'.format(fielddisplay(self, 'codepath', ''))
    66         s += '{}\n'.format(fielddisplay(self, 'executionpath', ''))
    67         s += '{}\n'.format(fielddisplay(self, 'valgrind', ''))
    68         s += '{}\n'.format(fielddisplay(self, 'valgrindlib', ''))
    69         s += '{}\n'.format(fielddisplay(self, 'valgrindsup', ''))
    70         s += '{}\n'.format(fielddisplay(self, 'verbose', ''))
    71         s += '{}\n'.format(fielddisplay(self, 'shell', ''))
     59        s = 'class \'{}\' object \'{}\' = \n'.format(type(self), 'self')
     60        s += '    name: {}\n'.format(self.name)
     61        s += '    login: {}\n'.format(self.login)
     62        s += '    np: {}\n'.format(self.np)
     63        s += '    port: {}\n'.format(self.port)
     64        s += '    codepath: {}\n'.format(self.codepath)
     65        s += '    executionpath: {}\n'.format(self.executionpath)
     66        s += '    valgrind: {}\n'.format(self.valgrind)
     67        s += '    valgrindlib: {}\n'.format(self.valgrindlib)
     68        s += '    valgrindsup: {}\n'.format(self.valgrindsup)
     69        s += '    verbose: {}\n'.format(self.verbose)
     70        s += '    shell: {}\n'.format(self.shell)
    7271        return s
    7372    # }}}
  • issm/trunk-jpl/src/m/classes/clusters/generic_static.m

    r24593 r26332  
    3636                        disp(sprintf('    np: %i',cluster.np));
    3737                        disp(sprintf('    codepath: %s',cluster.codepath));
     38                        disp(sprintf('    executionpath: %s',cluster.executionpath));
     39                        disp(sprintf('    interactive: %s',cluster.interactive));
    3840                        disp(sprintf('    shell: %s',cluster.shell));
    3941                end
     
    8486                end
    8587                %}}}
    86                 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
     88                function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
    8789                        % Do nothing
    8890                        return;
    8991                end %}}}
    90                 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
     92                function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
    9193                        if ~ispc,
    9294                                % Figure out which file extension to use
     
    104106                        end
    105107                end %}}}
    106                 function Download(cluster,dirname,filelist)% {{{
     108                function Download(cluster,dirname,filelist) % {{{
    107109                        % Do nothing
    108110                        return;
  • issm/trunk-jpl/src/m/classes/clusters/generic_static.py

    r25684 r26332  
    11import math
    22import os
    3 import socket
    43import subprocess
    5 
    64import numpy as np
    7 
    85from IssmConfig import IssmConfig
    96from issmdir import issmdir
     
    118from issmscpin import issmscpin
    129from issmscpout import issmscpout
    13 import MatlabFuncs as m
     10from MatlabFuncs import *
    1411from pairoptions import pairoptions
    1512
    1613
    1714class generic_static(object):
    18     """
    19     GENERIC cluster class definition
     15    """GENERIC cluster class definition
    2016
    21        Usage:
    22           cluster = generic_static('name', 'astrid', 'np', 3)
     17    Usage:
     18        cluster = generic_static('name', 'astrid', 'np', 3)
    2319    """
    2420
     
    3834
    3935        #get name
    40         self.name = socket.gethostname()
     36        self.name = oshostname()
    4137
    4238        #initialize cluster using user settings if provided
  • issm/trunk-jpl/src/m/classes/clusters/greenplanet.m

    r26330 r26332  
    3737                        disp(sprintf('    name: %s',cluster.name));
    3838                        disp(sprintf('    login: %s',cluster.login));
    39                         disp(sprintf('    port: %i',cluster.port));
    4039                        disp(sprintf('    numnodes: %i',cluster.numnodes));
    4140                        disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
    42                         disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
     41                        disp(sprintf('    np: %i',cluster.nprocs()));
     42                        disp(sprintf('    port: %i',cluster.port));
    4343                        disp(sprintf('    queue: %s',cluster.queue));
    4444                        disp(sprintf('    codepath: %s',cluster.codepath));
     
    6060                        queue_requirements_np=[80 80 80 80 80 80 80 80 80];
    6161
    62                         QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)
     62                        QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),1)
    6363
    64                         %Miscelaneous
     64                        %Miscellaneous
    6565                        if isempty(cluster.login), md = checkmessage(md,'login empty'); end
    6666                        if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
     
    8787                        fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
    8888                        fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
    89                         fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
     89                        fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname);
    9090                        if ~io_gather, %concatenate the output files:
    9191                                fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
     
    120120                        fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
    121121                        fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
    122                         fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     122                        fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
    123123                        if ~io_gather, %concatenate the output files:
    124124                                fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
     
    129129                        if cluster.interactive,
    130130                                fid=fopen([modelname '.run'],'w');
    131                                 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     131                                fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
    132132                                if ~io_gather, %concatenate the output files:
    133133                                        fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
  • issm/trunk-jpl/src/m/classes/clusters/hpc.m

    r26330 r26332  
    3535                        disp(sprintf('    name: %s',cluster.name));
    3636                        disp(sprintf('    login: %s',cluster.login));
    37                         disp(sprintf('    port: %i',cluster.port));
    3837                        disp(sprintf('    numnodes: %i',cluster.numnodes));
    3938                        disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
    40                         disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
     39                        disp(sprintf('    np: %i',cluster.nprocs()));
     40                        disp(sprintf('    port: %i',cluster.port));
    4141                        disp(sprintf('    queue: %s',cluster.queue));
    4242                        disp(sprintf('    codepath: %s',cluster.codepath));
     
    5656                        queue_requirements_np=[64 64 48 48 48];
    5757
    58                         QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)
     58                        QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),1)
    5959
    60                         %Miscelaneous
     60                        %Miscellaneous
    6161                        if isempty(cluster.login), md = checkmessage(md,'login empty'); end
    6262                        if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
     
    8383                        fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
    8484                        fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,modelname);
    85                         fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
     85                        fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname);
    8686                        if ~io_gather, %concatenate the output files:
    8787                                fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
     
    108108                        fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
    109109                        fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
    110                         fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     110                        fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
    111111                        if ~io_gather, %concatenate the output files:
    112112                                fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
     
    117117                        if cluster.interactive,
    118118                                fid=fopen([modelname '.run'],'w');
    119                                 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     119                                fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
    120120                                if ~io_gather, %concatenate the output files:
    121121                                        fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
  • issm/trunk-jpl/src/m/classes/clusters/hpc_simba.m

    r26330 r26332  
    3636                        disp(sprintf('    name: %s',cluster.name));
    3737                        disp(sprintf('    login: %s',cluster.login));
    38                         disp(sprintf('    port: %i',cluster.port));
    3938                        disp(sprintf('    numnodes: %i',cluster.numnodes));
    4039                        disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
    41                         disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
     40                        disp(sprintf('    np: %i',cluster.np));
     41                        disp(sprintf('    port: %i',cluster.port));
    4242                        disp(sprintf('    queue: %s',cluster.queue));
    4343                        disp(sprintf('    codepath: %s',cluster.codepath));
     
    4545                        disp(sprintf('    interactive: %i',cluster.interactive));
    4646                end
    47                 %}}}
    48                 %function numprocs=nprocs(cluster) % {{{
    49                 %       %compute number of processors
    50                 %       numprocs=cluster.numnodes*cluster.cpuspernode;
    51                 % end
    5247                %}}}
    5348                function md = checkconsistency(cluster,md,solution,analyses) % {{{
     
    5954                        QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)
    6055
    61                         %Miscelaneous
     56                        %Miscellaneous
    6257                        if isempty(cluster.login), md = checkmessage(md,'login empty'); end
    6358                        if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
  • issm/trunk-jpl/src/m/classes/clusters/local.m

    r25627 r26332  
    3636                        disp(sprintf('    np: %i',cluster.np));
    3737                        disp(sprintf('    codepath: %s',cluster.codepath));
     38                        disp(sprintf('    etcpath: %s',cluster.etcpath));
    3839                        disp(sprintf('    executionpath: %s',cluster.executionpath));
    39                         disp(sprintf('    etcpath: %s',cluster.etcpath));
    4040                        disp(sprintf('    verbose: %s',cluster.verbose));
    4141                        disp(sprintf('    shell: %s',cluster.shell));
  • issm/trunk-jpl/src/m/classes/clusters/localpfe.m

    r26034 r26332  
    1 %localpfe cluster class definition
     1%LOCALPFE cluster class definition
    22%
    33%   Usage:
     
    5353                        disp(sprintf('    login: %s',cluster.login));
    5454                        disp(sprintf('    np: %i',cluster.np));
     55                        disp(sprintf('    npocean: %i',cluster.npocean));
    5556                        disp(sprintf('    port: %i',cluster.port));
     57                        disp(sprintf('    interactive: %i',cluster.interactive));
    5658                        disp(sprintf('    codepath: %s',cluster.codepath));
     59                        disp(sprintf('    etcpath: %s',cluster.etcpath));
    5760                        disp(sprintf('    executionpath: %s',cluster.executionpath));
    58                         disp(sprintf('    etcpath: %s',cluster.etcpath));
    5961                        disp(sprintf('    valgrind: %s',cluster.valgrind));
    6062                        disp(sprintf('    valgrindlib: %s',cluster.valgrindlib));
  • issm/trunk-jpl/src/m/classes/clusters/lonestar.m

    r26330 r26332  
    4343                        disp(sprintf('    numnodes: %i',cluster.numnodes));
    4444                        disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
    45                         disp(sprintf('    np: %i',cluster.np));
     45                        disp(sprintf('    np: %i',cluster.nprocs()));
     46                        disp(sprintf('    port: %i',cluster.port));
    4647                        disp(sprintf('    queue: %s',cluster.queue));
    4748                        disp(sprintf('    codepath: %s',cluster.codepath));
     
    6364                        queue_requirements_np=[4104 264];
    6465
    65                         QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
    66 
    67                         %Miscelaneous
     66                        QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),cluster.time)
     67
     68                        %Miscellaneous
    6869                        if isempty(cluster.login), md = checkmessage(md,'login empty'); end
    6970                        if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
     
    8990                        fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
    9091                        fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,modelname);
    91                         fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
     92                        fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname);
    9293                        if ~io_gather, %concatenate the output files:
    9394                                fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
     
    120121                        fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
    121122                        fprintf(fid,'#SBATCH -e %s.errlog \n',modelname);
    122                         fprintf(fid,'#SBATCH -n %i \n',cluster.numnodes*max(cluster.np/cluster.numnodes,24));
     123                        fprintf(fid,'#SBATCH -n %i \n',cluster.numnodes*max(cluster.nprocs()/cluster.numnodes,24));
    123124                        fprintf(fid,'#SBATCH -N %i \n',cluster.numnodes);
    124125                        fprintf(fid,'#SBATCH -t %02i:%02i:00 \n\n',floor(cluster.time/3600),floor(mod(cluster.time,3600)/60));
     
    142143                        fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
    143144                        fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
    144                         fprintf(fid,'ibrun -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
     145                        fprintf(fid,'ibrun -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
    145146                        if ~io_gather, %concatenate the output files:
    146147                                fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
     
    152153                        if cluster.interactive,
    153154                                fid=fopen([modelname '.run'],'w');
    154                                 fprintf(fid,'ibrun -np %i %s/%s %s %s %s\n',cluster.np,executable,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     155                                fprintf(fid,'ibrun -np %i %s/%s %s %s %s\n',cluster.nprocs(),executable,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
    155156                                if ~io_gather, %concatenate the output files:
    156157                                        fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
  • issm/trunk-jpl/src/m/classes/clusters/maui.m

    r26330 r26332  
    3838                        disp(sprintf('    name: %s',cluster.name));
    3939                        disp(sprintf('    login: %s',cluster.login));
    40                         disp(sprintf('    port: %i',cluster.port));
    4140                        disp(sprintf('    numnodes: %i',cluster.numnodes));
    4241                        disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
    43                         disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
     42                        disp(sprintf('    np: %i',cluster.nprocs()));
     43                        disp(sprintf('    port: %i',cluster.port));
    4444                        disp(sprintf('    projectaccount: %s',cluster.projectaccount));
    4545                        disp(sprintf('    partition: %s',cluster.partition));
     
    6262                        partition_requirements_np=[80];
    6363
    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)
    6565
    66                         %Miscelaneous
     66                        %Miscellaneous
    6767                        if isempty(cluster.login), md = checkmessage(md,'login empty'); end
    6868                        if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
     
    9595                        fprintf(fid,'module swap PrgEnv-cray PrgEnv-intel\n');
    9696                        fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
    97                         fprintf(fid,'srun -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     97                        fprintf(fid,'srun -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
    9898                        if ~io_gather, %concatenate the output files:
    9999                                fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
     
    104104                        if cluster.interactive,
    105105                                fid=fopen([modelname '.run'],'w');
    106                                 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     106                                fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
    107107                                if ~io_gather, %concatenate the output files:
    108108                                        fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
  • issm/trunk-jpl/src/m/classes/clusters/pfe.m

    r26330 r26332  
    2121                codepath       = '';
    2222                executionpath  = '';
    23                 grouplist     = 's1690';
     23                grouplist      = '';
    2424                interactive    = 0;
    2525                bbftp          = 0;
     
    3939                %}}}
    4040                function disp(cluster) % {{{
    41                         % TODO:
    42                         % - Correct formatting of modules and cluster.np
    43                         %
    44 
    4541                        % display the object
    4642                        disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
    47                         fielddisplay(cluster,'name','name of the cluster');
    48                         fielddisplay(cluster,'login','login');
    49                         modules=''; for i=1:length(cluster.modules), modules=[modules cluster.modules{i} ',']; end; modules=modules(1:end-1);
    50                         disp(sprintf('         modules                : %s',modules));
    51                         fielddisplay(cluster,'port','machine access port');
    52                         fielddisplay(cluster,'numnodes','number of nodes');
    53                         fielddisplay(cluster,'cpuspernode','number of CPUs per node');
    54                         disp(sprintf('         np:                    : %i             -- %s',cluster.np(),'number of CPUs'));
    55                         fielddisplay(cluster,'queue','name of the queue');
    56                         fielddisplay(cluster,'time','walltime requested');
    57                         fielddisplay(cluster,'processor','type of processor');
    58                         fielddisplay(cluster,'srcpath','$ISSM_DIR on pfe');
    59                         fielddisplay(cluster,'codepath','$ISSM_DIR/bin on pfe');
    60                         fielddisplay(cluster,'executionpath','directory containing issm.exe on pfe');
    61                         fielddisplay(cluster,'grouplist','grouplist');
    62                         fielddisplay(cluster,'interactive','');
    63                         fielddisplay(cluster,'bbftp','');
    64                         fielddisplay(cluster,'numstreams','');
    65                         fielddisplay(cluster,'hyperthreading','');
    66                 end
    67                 %}}}
    68                 function numprocs=np(cluster) % {{{
     43                        disp(sprintf('    name: %s',cluster.name));
     44                        disp(sprintf('    login: %s',cluster.login));
     45                        disp(sprintf('    modules: %s',strjoin(cluster.modules,', ')));
     46                        disp(sprintf('    numnodes: %s',cluster.numnodes));
     47                        disp(sprintf('    cpuspernode: %s',cluster.cpuspernode));
     48                        disp(sprintf('    np: %i',cluster.nprocs()));
     49                        disp(sprintf('    port: %i',cluster.port));
     50                        disp(sprintf('    queue: %i',cluster.queue));
     51                        disp(sprintf('    time: %i',cluster.time));
     52                        disp(sprintf('    processor: %i',cluster.processor));
     53                        disp(sprintf('    srcpath: %s',cluster.srcpath));
     54                        disp(sprintf('    codepath: %s',cluster.codepath));
     55                        disp(sprintf('    executionpath: %s',cluster.executionpath));
     56                        disp(sprintf('    grouplist: %s',cluster.grouplist));
     57                        disp(sprintf('    interactive: %s',cluster.interactive));
     58                        disp(sprintf('    bbftp: %s',cluster.bbftp));
     59                        disp(sprintf('    numstreams: %s',cluster.numstreams));
     60                        disp(sprintf('    hyperthreading: %s',cluster.hyperthreading));
     61                end
     62                %}}}
     63                function numprocs=nprocs(cluster) % {{{
    6964                        %compute number of processors
    7065                        numprocs=cluster.numnodes*cluster.cpuspernode;
     
    7772                        queue_requirements_np=[2048 2048 150 150 2048];
    7873
    79                         QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
     74                        QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),cluster.time)
    8075
    8176                        %now, check cluster.cpuspernode according to processor type
     
    183178                        fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,dirname);
    184179                        if ~isvalgrind,
    185                                 fprintf(fid,'/u/scicon/tools/bin/several_tries mpiexec -np %i /u/scicon/tools/bin/mbind.x -cs -n%i %s/%s %s %s/%s %s\n',cluster.np,cluster.cpuspernode,cluster.codepath,executable,solution,cluster.executionpath,dirname,modelname);
    186                         else
    187                                 fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
     180                                fprintf(fid,'/u/scicon/tools/bin/several_tries mpiexec -np %i /u/scicon/tools/bin/mbind.x -cs -n%i %s/%s %s %s/%s %s\n',cluster.nprocs(),cluster.cpuspernode,cluster.codepath,executable,solution,cluster.executionpath,dirname,modelname);
     181                        else
     182                                fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
    188183                        end
    189184                        if ~io_gather, %concatenate the output files:
     
    197192                                if cluster.interactive==10,
    198193                                                fprintf(fid,'module unload mpi-mvapich2/1.4.1/gcc\n');
    199                                                 fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[pwd() '/run'],modelname);
     194                                                fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[pwd() '/run'],modelname);
    200195                                else
    201196                                        if ~isvalgrind,
    202                                                 fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname);
     197                                                fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname);
    203198                                        else
    204                                                 fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname);
     199                                                fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname);
    205200                                        end
    206201                                end
     
    325320                        fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
    326321                        fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,modelname);
    327                         fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname); %FIXME
     322                        fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname); %FIXME
    328323                        if ~io_gather, %concatenate the output files:
    329324                                fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
     
    335330                                fid=fopen([modelname '.run'],'w');
    336331                                if ~isvalgrind,
    337                                         fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
    338                                 else
    339                                         fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
     332                                        fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname);
     333                                else
     334                                        fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname);
    340335                                end
    341336                                if ~io_gather, %concatenate the output files:
     
    410405                        end
    411406
    412                         if ~cluster.bbftp,
     407                        if cluster.bbftp,
     408                                issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']});
     409                        else
    413410                                issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']});
    414                         else
    415                                 issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']});
    416411                        end
    417412
     
    420415                function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
    421416
    422                         %lauch command, to be executed via ssh
    423                         if ~cluster.interactive,
    424                                 if ~isempty(restart)
    425                                         launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
    426                                 else
    427                                         launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
    428                                                 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
    429                                 end
    430                         else
     417                        %launch command, to be executed via ssh
     418                        if cluster.interactive,
    431419                                if ~isempty(restart)
    432420                                        launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive)];
     
    437425                                                launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' dirname '.tar.gz'];
    438426                                        end
     427                                end
     428                        else
     429                                if ~isempty(restart)
     430                                        launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
     431                                else
     432                                        launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
     433                                                ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
    439434                                end
    440435                        end
     
    455450                        end
    456451
    457                         if ~cluster.bbftp,
     452                        if cluster.bbftp,
     453                                issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist);
     454                        else
    458455                                issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
    459                         else
    460                                 issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist);
    461456                        end
    462457
  • issm/trunk-jpl/src/m/classes/clusters/pfe.py

    r26330 r26332  
    66from issmscpout import issmscpout
    77from issmssh import issmssh
     8from MatlabFuncs import *
    89from pairoptions import pairoptions
    910try:
     
    3536        self.codepath = ''
    3637        self.executionpath = ''
    37         self.grouplist = 's1690'
     38        self.grouplist = ''
    3839        self.interactive = 0
    3940        self.bbftp = 0
     
    5051            print('pfe_settings.py not found, using default settings')
    5152
    52         #OK get other fields
     53        # OK get other fields
    5354        self = options.AssignObjectFields(self)
    5455    # }}}
    5556
    5657    def __repr__(self):  # {{{
    57         # TODO:
    58         # - Correct formatting of modules and cluster.np
    59         #
    60 
    6158        # Display the object
    6259        s = 'class pfe object\n'
    63         s += '{}\n'.format(fielddisplay(self, 'name', 'name of the cluster'))
    64         s += '{}\n'.format(fielddisplay(self, 'login', 'login'))
    65         modules = ''
    66         for i in range(len(self.modules)):
    67             modules += self.modules[i] + ','
    68         modules = modules[:-1]
    69         s += '         modules                : {}\n'.format(modules)
    70         s += '{}\n'.format(fielddisplay(self, 'port', 'machine access port'))
    71         s += '{}\n'.format(fielddisplay(self, 'numnodes', 'number of nodes'))
    72         s += '{}\n'.format(fielddisplay(self, 'cpuspernode', 'number of CPUs per node'))
    73         s += '         np:                    : {}             -- {}\n'.format(self.nprocs(), 'number of CPUs')
    74         s += '{}\n'.format(fielddisplay(self, 'queue', 'name of the queue'))
    75         s += '{}\n'.format(fielddisplay(self, 'time', 'walltime requested'))
    76         s += '{}\n'.format(fielddisplay(self, 'processor', 'type of processor'))
    77         s += '{}\n'.format(fielddisplay(self, 'srcpath', '$ISSM_DIR on pfe'))
    78         s += '{}\n'.format(fielddisplay(self, 'codepath', '$ISSM_DIR/bin on pfe'))
    79         s += '{}\n'.format(fielddisplay(self, 'executionpath', 'directory containing issm.exe on pfe'))
    80         s += '{}\n'.format(fielddisplay(self, 'grouplist', 'grouplist'))
    81         s += '{}\n'.format(fielddisplay(self, 'interactive', ''))
    82         s += '{}\n'.format(fielddisplay(self, 'bbftp', ''))
    83         s += '{}\n'.format(fielddisplay(self, 'numstreams', ''))
    84         s += '{}\n'.format(fielddisplay(self, 'hyperthreading', ''))
     60        s += '    name: {}\n'.format(self.name)
     61        s += '    login: {}\n'.format(self.login)
     62        s += '    modules: {}\n'.format(strjoin(self.modules, ', '))
     63        s += '    numnodes: {}\n'.format(self.numnodes)
     64        s += '    cpuspernode: {}\n'.format(self.cpuspernode)
     65        s += '    np: {}\n'.format(self.nprocs())
     66        s += '    port: {}\n'.format(self.port)
     67        s += '    queue: {}\n'.format(self.queue)
     68        s += '    time: {}\n'.format(self.time)
     69        s += '    processor: {}\n'.format(self.processor)
     70        s += '    srcpath: {}\n'.format(self.srcpath)
     71        s += '    codepath: {}\n'.format(self.codepath)
     72        s += '    executionpath: {}\n'.format(self.executionpath)
     73        s += '    grouplist: {}\n'.format(self.grouplist)
     74        s += '    interactive: {}\n'.format(self.interactive)
     75        s += '    bbftp: {}\n'.format(self.bbftp)
     76        s += '    numstreams: {}\n'.format(self.numstreams)
     77        s += '    hyperthreading: {}\n'.format(self.hyperthreading)
    8578        return s
    8679    # }}}
     
    10194            if self.hyperthreading:
    10295                if self.cpuspernode > 40 or self.cpuspernode < 1:
    103                     md = md.checkmessage('cpuspernode should be between 1 and 40 for ''ivy'' processors in hyperthreading mode')
     96                    md = md.checkmessage('cpuspernode should be between 1 and 40 for \'ivy\' processors in hyperthreading mode')
    10497            else:
    10598                if self.cpuspernode > 20 or self.cpuspernode < 1:
    106                     md = md.checkmessage('cpuspernode should be between 1 and 20 for ''ivy'' processors')
     99                    md = md.checkmessage('cpuspernode should be between 1 and 20 for \'ivy\' processors')
    107100        elif self.processor == 'bro':
    108101            if self.hyperthreading:
    109102                if self.cpuspernode > 56 or self.cpuspernode < 1:
    110                     md = md.checkmessage('cpuspernode should be between 1 and 56 for ''bro'' processors in hyperthreading mode')
     103                    md = md.checkmessage('cpuspernode should be between 1 and 56 for \'bro\' processors in hyperthreading mode')
    111104            else:
    112105                if self.cpuspernode > 28 or self.cpuspernode < 1:
    113                     md = md.checkmessage('cpuspernode should be between 1 and 28 for ''bro'' processors')
    114         elif self.processor == 'har' or self.processor == 'neh':
    115             if self.hyperthreading:
     106                    md = md.checkmessage('cpuspernode should be between 1 and 28 for \'bro\' processors')
     107        elif self.processor == 'has':
     108            if self.hyperthreading:
     109                if self.cpuspernode > 48 or self.cpuspernode < 1:
     110                    md = md.checkmessage('cpuspernode should be between 1 and 48 for \'has\' processors in hyperthreading mode')
     111            else:
     112                if self.cpuspernode > 24 or self.cpuspernode < 1:
     113                    md = md.checkmessage('cpuspernode should be between 1 and 24 for \'has\' processors')
     114        elif self.processor == 'san':
     115            if self.hyperthreading:
     116                if self.cpuspernode > 32 or self.cpuspernode < 1:
     117                    md = md.checkmessage('cpuspernode should be between 1 and 32 for \'san\' processors in hyperthreading mode')
     118            else:
    116119                if self.cpuspernode > 16 or self.cpuspernode < 1:
    117                     md = md.checkmessage('cpuspernode should be between 1 and 16 for ''neh'' and ''har'' processors in hyperthreading mode')
    118             else:
    119                 if self.cpuspernode > 8 or self.cpuspernode < 1:
    120                     md = md.checkmessage('cpuspernode should be between 1 and 8 for ''neh'' and ''har'' processors')
     120                    md = md.checkmessage('cpuspernode should be between 1 and 16 for \'san\' processors')
     121        elif self.processor == 'cas_ait':
     122            if self.hyperthreading:
     123                if self.cpuspernode > 80 or self.cpuspernode < 1:
     124                    md = md.checkmessage('cpuspernode should be between 1 and 80 for \'cas_ait\' processors in hyperthreading mode')
     125            else:
     126                if self.cpuspernode > 40 or self.cpuspernode < 1:
     127                    md = md.checkmessage('cpuspernode should be between 1 and 40 for \'cas_ait\' processors')
    121128        else:
    122             md = md.checkmessage('unknown processor type, should be \'ivy\', \'bro\', \'har\', or \'neh\'')
     129            md = md.checkmessage('unknown processor type, should be \'bro\', \'has\', \'ivy\', \'san\', or \'cas_ait\'')
    123130
    124131        # Miscellaneous
     
    182189        compressstring = 'tar -zcf {}.tar.gz'.format(dirname)
    183190        for file in filelist:
    184             compressstring += file
     191            compressstring += ' {}'.format(file)
    185192        subprocess.call(compressstring, shell=True)
    186193
     
    191198    # }}}
    192199    def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):  # {{{
    193         if restart:
    194             launchcommand = 'cd {} && cd {} && qsub {}.queue'.format(self.executionpath, dirname, modelname)
     200        # Launch command, to be executed via ssh
     201        if self.interactive:
     202            if restart:
     203                launchcommand = 'cd {} /Interactive{}'.format(self.executionpath, self.interactive)
     204            else:
     205                if self.interactive == 10:
     206                    launchcommand = 'cd {}/run && tar -zxf {}.tar.gz'.format(pwd(), dirname)
     207                else:
     208                    launchcommand = 'cd {} /Interactive{} && tar -zxf {}.tar.gz'.format(self.executionpath, self.interactive, dirname)
    195209        else:
    196             launchcommand = 'cd {} && rm -rf ./{} && mkdir {} && cd {} && mv ../{}.tar.gz ./ && tar -zxf {}.tar.gz  && qsub {}.queue'.format(self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname)
     210            if restart:
     211                launchcommand = 'cd {} && cd {} && qsub {}.queue'.format(self.executionpath, dirname, modelname)
     212            else:
     213                launchcommand = 'cd {} && rm -rf ./{} && mkdir {} && cd {} && mv ../{}.tar.gz ./ && tar -zxf {}.tar.gz  && qsub {}.queue'.format(self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname)
    197214
    198215        print('launching solution sequence on remote cluster')
  • issm/trunk-jpl/src/m/classes/clusters/pollux.m

    r21576 r26332  
    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
  • issm/trunk-jpl/src/m/classes/clusters/raijin.m

    r21576 r26332  
    77
    88classdef raijin
    9     properties (SetAccess=public) 
    10                  % {{{
    11                  name='';
    12                  login='';
    13                  np=0;
    14                  mem=0;
    15                  time=0;
    16                  project='';
    17                  email='';
    18                  port=0;
    19                  queue='';
    20                  codepath='';
    21                  executionpath='';
    22                  modules={};
    23          end
    24          %}}}
    25          methods
    26                  function cluster=raijin(varargin) % {{{
     9        properties (SetAccess=public)
     10                % {{{
     11                name='';
     12                login='';
     13                np=0;
     14                mem=0;
     15                time=0;
     16                project='';
     17                email='';
     18                port=0;
     19                queue='';
     20                codepath='';
     21                executionpath='';
     22                modules={};
     23        end
     24        %}}}
     25        methods
     26                function cluster=raijin(varargin) % {{{
    2727
    28                          %initialize cluster using default settings if provided
    29                          if (exist('raijin_settings')==2), raijin_settings; end
     28                        %initialize cluster using default settings if provided
     29                        if (exist('raijin_settings')==2), raijin_settings; end
    3030
    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('    port: %i',cluster.port));
    41                          disp(sprintf('    mem: %i',cluster.mem));
    42                          disp(sprintf('    time: %i',cluster.time));
    43                          disp(sprintf('    np: %i',cluster.np));
    44                          disp(sprintf('    queue: %s',cluster.queue));
    45                          disp(sprintf('    project: %s',cluster.project));
    46                          disp(sprintf('    codepath: %s',cluster.codepath));
    47                          disp(sprintf('    executionpath: %s',cluster.executionpath));
    48                  end
    49                  %}}}
    50                  function md = checkconsistency(cluster,md,solution,analyses) % {{{
     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('    np: %i',cluster.np));
     41                        disp(sprintf('    mem: %i',cluster.mem));
     42                        disp(sprintf('    time: %i',cluster.time));
     43                        disp(sprintf('    project: %s',cluster.project));
     44                        disp(sprintf('    email: %s',cluster.email));
     45                        disp(sprintf('    port: %i',cluster.port));
     46                        disp(sprintf('    queue: %s',cluster.queue));
     47                        disp(sprintf('    codepath: %s',cluster.codepath));
     48                        disp(sprintf('    executionpath: %s',cluster.executionpath));
     49                        disp(sprintf('    modules: %s',strjoin(cluster.modules,', ')));
     50                end
     51                %}}}
     52                function md = checkconsistency(cluster,md,solution,analyses) % {{{
    5153
    52                          available_queues={'express', 'normal'};
    53                          queue_requirements_time=[5*60 40*60];
    54                          queue_requirements_np=[256 1024];
     54                        available_queues={'express', 'normal'};
     55                        queue_requirements_time=[5*60 40*60];
     56                        queue_requirements_np=[256 1024];
    5557
    56                          QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)
     58                        QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)
    5759
    58                          %Miscelaneous
    59                          if isempty(cluster.login), md = checkmessage(md,'login empty'); end
    60                          if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
    61                          if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
     60                        %Miscellaneous
     61                        if isempty(cluster.login), md = checkmessage(md,'login empty'); end
     62                        if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
     63                        if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
    6264
    63                  end
    64                  %}}}
    65                  function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
    66                      
    67                          if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
    68                          if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
     65                end
     66                %}}}
     67                function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
    6968
    70                          %write queuing script
    71                          fid=fopen([modelname '.queue'],'w');
    72                          fprintf(fid,'#PBS -S /bin/bash\n');
    73                          fprintf(fid,'#PBS -P %s\n', cluster.project);
    74                          fprintf(fid,'#PBS -q %s\n',cluster.queue);
    75                          fprintf(fid,'#PBS -l ncpus=%i\n',cluster.np);
    76                          fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); % walltime is in seconds
    77                          fprintf(fid,'#PBS -l mem=%igb\n', cluster.mem);
    78                          fprintf(fid,'#PBS -M %s\n', cluster.email);
    79                          fprintf(fid,'#PBS -o %s.outlog\n',(modelname));
    80                          fprintf(fid,'#PBS -e %s.errlog\n',(modelname));
    81                          fprintf(fid,'#PBS -l wd\n\n');
    82                          fprintf(fid,'source ~/.bashrc\n');
    83                          fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');
    84                          for i=1:numel(cluster.modules)
    85                              fprintf(fid,'module load %s\n', cluster.modules{i});
    86                          end
    87                          fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
    88                          if ~io_gather, %concatenate the output files:
    89                                  fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
    90                          end
    91                          fclose(fid);
    92                  end %}}}
    93                  function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
     69                        if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
     70                        if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
    9471
    95                          %compress the files into one zip.
    96                          compressstring=['tar -zcf ' dirname '.tar.gz '];
    97                          for i=1:numel(filelist),
    98                                  compressstring = [compressstring ' ' filelist{i}];
    99                          end
    100                          system(compressstring);
     72                        %write queuing script
     73                        fid=fopen([modelname '.queue'],'w');
     74                        fprintf(fid,'#PBS -S /bin/bash\n');
     75                        fprintf(fid,'#PBS -P %s\n', cluster.project);
     76                        fprintf(fid,'#PBS -q %s\n',cluster.queue);
     77                        fprintf(fid,'#PBS -l ncpus=%i\n',cluster.np);
     78                        fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); % walltime is in seconds
     79                        fprintf(fid,'#PBS -l mem=%igb\n', cluster.mem);
     80                        fprintf(fid,'#PBS -M %s\n', cluster.email);
     81                        fprintf(fid,'#PBS -o %s.outlog\n',(modelname));
     82                        fprintf(fid,'#PBS -e %s.errlog\n',(modelname));
     83                        fprintf(fid,'#PBS -l wd\n\n');
     84                        fprintf(fid,'source ~/.bashrc\n');
     85                        fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');
     86                        for i=1:numel(cluster.modules)
     87                                fprintf(fid,'module load %s\n', cluster.modules{i});
     88                        end
     89                        fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     90                        if ~io_gather, %concatenate the output files:
     91                                fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
     92                        end
     93                        fclose(fid);
     94                end %}}}
     95                function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
    10196
    102                          disp('uploading input file and queueing script');
    103                          issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
     97                        %compress the files into one zip.
     98                        compressstring=['tar -zcf ' dirname '.tar.gz '];
     99                        for i=1:numel(filelist),
     100                                compressstring = [compressstring ' ' filelist{i}];
     101                        end
     102                        system(compressstring);
    104103
    105                  end %}}}
    106                  function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
    107                          
    108                          disp('launching solution sequence on remote cluster');
    109                          if ~isempty(restart)
    110                                  launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue '];
    111                          else
    112                                  launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
    113                                          ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && qsub ' modelname '.queue '];
    114                          end
    115                          issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
    116                  end %}}}
    117                  function Download(cluster,dirname,filelist)% {{{
     104                        disp('uploading input file and queueing script');
     105                        issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
    118106
    119                          %copy files from cluster to current directory
    120                          directory=[cluster.executionpath '/' dirname '/'];
    121                          issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
     107                end %}}}
     108                function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
     109                       
     110                        disp('launching solution sequence on remote cluster');
     111                        if ~isempty(restart)
     112                                launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue '];
     113                        else
     114                                launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
     115                                        ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && qsub ' modelname '.queue '];
     116                        end
     117                        issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
     118                end %}}}
     119                function Download(cluster,dirname,filelist) % {{{
    122120
    123                  end %}}}
     121                        %copy files from cluster to current directory
     122                        directory=[cluster.executionpath '/' dirname '/'];
     123                        issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
     124
     125                end %}}}
    124126        end
    125127end
  • issm/trunk-jpl/src/m/classes/clusters/saga.py

    r25818 r26332  
    1515
    1616class saga(object):
    17     """
    18     Saga cluster class definition
     17    """SAGA cluster class definition
     18
    1919    This is a SLURM queue
    2020
    21        Usage:
    22           cluster = saga()
     21    Usage:
     22        cluster = saga()
    2323    """
    2424
     
    4444        self.valgrind = '/cluster/software/Valgrind/3.16.1-gompi-2019b/bin/valgrind'
    4545
    46     #use provided options to change fields
     46        # Use provided options to change fields
    4747        options = pairoptions(*args)
    48     #initialize cluster using user settings if provided
     48        # Initialize cluster using user settings if provided
    4949        self = saga_settings(self)
    50     #OK get other fields
     50        # OK get other fields
    5151        self = options.AssignObjectFields(self)
    5252        self.np = self.numnodes * self.cpuspernode
     
    5454
    5555    def __repr__(self):  # {{{
    56         #  display the object
     56        # Display the object
    5757        s = "class vilje object:"
    5858        s = "%s\n%s" % (s, fielddisplay(self, 'name', 'name of the cluster'))
     
    7272
    7373    def checkconsistency(self, md, solution, analyses):  # {{{
    74         #Queue dictionarry  gives queue name as key and max walltime, cpus and memory (GB) as var
     74        # Queue dictionarry  gives queue name as key and max walltime, CPUs, and memory (GB) as var
    7575        queuedict = {'normal': [7 * 24 * 60, 256, 8],
    7676                     'bigmem': [14 * 24 * 60, 256, 10],
     
    7878        QueueRequirements(queuedict, self.queue, self.np, self.time)
    7979
    80     #Miscelaneous
     80        # Miscellaneous
    8181        if not self.login:
    8282            md = md.checkmessage('login empty')
     
    9191
    9292    def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):  # {{{
    93 
    9493        executable = 'issm.exe'
    9594        if isdakota:
     
    10099        if isoceancoupling:
    101100            executable = 'issm_ocean.exe'
    102     #write queuing script
     101        # Write queuing script
    103102        shortname = modelname[0:min(12, len(modelname))]
    104103        timeobj = datetime.timedelta(minutes=self.time)
     
    146145    # }}}
    147146    def UploadQueueJob(self, modelname, dirname, filelist):  # {{{
    148         #compress the files into one zip.
     147        # Compress the files into one zip
    149148        compressstring = 'tar -zcf %s.tar.gz ' % dirname
    150149        for file in filelist:
    151             compressstring += ' %s' % file
     150            compressstring += ' {}'.format(file)
    152151        subprocess.call(compressstring, shell=True)
    153152
    154153        print('uploading input file and queueing script')
    155154        issmscpout(self.name, self.executionpath, self.login, self.port, [dirname + '.tar.gz'])
    156 
    157155    # }}}
    158156
    159157    def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):  # {{{
    160 
    161158        print('launching solution sequence on remote cluster')
    162159        if restart:
     
    165162            launchcommand = 'cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz  && sbatch %s.queue' % (self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname)
    166163        issmssh(self.name, self.login, self.port, launchcommand)
    167 
    168164    # }}}
    169165
    170166    def Download(self, dirname, filelist):  # {{{
    171         #copy files from cluster to current directory
     167        # Copy files from cluster to current directory
    172168        directory = '%s/%s/' % (self.executionpath, dirname)
    173169        issmscpin(self.name, self.login, self.port, directory, filelist)
  • issm/trunk-jpl/src/m/classes/clusters/sherlock.m

    r26330 r26332  
    3636                        disp(sprintf('    name: %s',cluster.name));
    3737                        disp(sprintf('    login: %s',cluster.login));
    38                         disp(sprintf('    port: %i',cluster.port));
    3938                        disp(sprintf('    numnodes: %i',cluster.numnodes));
    4039                        disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
    41                         disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
     40                        disp(sprintf('    np: %i',cluster.nprocs()));
     41                        disp(sprintf('    port: %i',cluster.port));
    4242                        disp(sprintf('    codepath: %s',cluster.codepath));
    4343                        disp(sprintf('    executionpath: %s',cluster.executionpath));
     
    5454                function md = checkconsistency(cluster,md,solution,analyses) % {{{
    5555
    56                         %Miscelaneous
     56                        %Miscellaneous
    5757                        if isempty(cluster.login), md = checkmessage(md,'login empty'); end
    5858                        if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
     
    7979                        fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
    8080                        fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
    81                         fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
     81                        fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname);
    8282                        if ~io_gather, %concatenate the output files:
    8383                                fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
     
    103103                        fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
    104104                        fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
    105                         fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     105                        fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
    106106                        if ~io_gather, %concatenate the output files:
    107107                                fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
     
    112112                        if cluster.interactive,
    113113                                fid=fopen([modelname '.run'],'w');
    114                                 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     114                                fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
    115115                                if ~io_gather, %concatenate the output files:
    116116                                        fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
  • issm/trunk-jpl/src/m/classes/clusters/tetralith.m

    r26330 r26332  
    3838                        disp(sprintf('    name: %s',cluster.name));
    3939                        disp(sprintf('    login: %s',cluster.login));
    40                         disp(sprintf('    accountname: %s',cluster.accountname));
    4140                        disp(sprintf('    numnodes: %i',cluster.numnodes));
    4241                        disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
    43                         disp(sprintf('    np: %i', cluster.cpuspernode*cluster.numnodes));
     42                        disp(sprintf('    np: %i',cluster.nprocs()));
     43                        disp(sprintf('    memory: %i',cluster.mem));
    4444                        disp(sprintf('    queue: %s',cluster.queue));
     45                        disp(sprintf('    time: %i',cluster.time));
    4546                        disp(sprintf('    codepath: %s',cluster.codepath));
    4647                        disp(sprintf('    executionpath: %s',cluster.executionpath));
    4748                        disp(sprintf('    interactive: %i',cluster.interactive));
    48                         disp(sprintf('    time: %i',cluster.time));
    49                         disp(sprintf('    memory: %i',cluster.mem));
     49                        disp(sprintf('    port: %s',cluster.port));
     50                        disp(sprintf('    accountname: %s',cluster.accountname));
    5051                end
    5152                %}}}
     
    5657                        queue_requirements_np=[1024 2*32];
    5758
    58                         QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)
    59 
    60                         %Miscelaneous
     59                        QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),1)
     60
     61                        %Miscellaneous
    6162                        if isempty(cluster.login), md = checkmessage(md,'login empty'); end
    6263                        if isempty(cluster.accountname), md = checkmessage(md,'accountname empty'); end
     
    7879                        %compute number of processors
    7980%                       cluster.np=cluster.numnodes*cluster.cpuspernode;
    80                         nprocs(cluster);%=cluster.numnodes*cluster.cpuspernode;
     81%                       nprocs(cluster);%=cluster.numnodes*cluster.cpuspernode;
    8182
    8283                        %write queuing script
     
    104105                        fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
    105106                        fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
    106 %                       fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
     107%                       fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
    107108%                       fprintf(fid,'mpiexec_mpt -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
    108                         fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
    109 %                       fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     109                        fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     110%                       fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
    110111                        if ~io_gather, %concatenate the output files:
    111112                                fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
     
    159160                        fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
    160161                        fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
    161 %                       fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
    162                         fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
    163 %                       fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
    164 %                       fprintf(fid,'mpiexec_mpt -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
     162%                       fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
     163                        fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     164%                       fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     165%                       fprintf(fid,'mpiexec_mpt -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
    165166
    166167                        if ~io_gather, %concatenate the output files:
     
    172173                        if cluster.interactive,
    173174                                fid=fopen([modelname '.run'],'w');
    174                                 fprintf(fid,'mpiexec_mpt -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
     175                                fprintf(fid,'mpiexec_mpt -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
    175176                                if ~io_gather, %concatenate the output files:
    176177                                        fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
  • issm/trunk-jpl/src/m/classes/clusters/yellowstone.m

    r26330 r26332  
    3838                        disp(sprintf('    name: %s',cluster.name));
    3939                        disp(sprintf('    login: %s',cluster.login));
    40                         modules=''; for i=1:length(cluster.modules), modules=[modules cluster.modules{i} ',']; end; modules=modules(1:end-1);
    41                         disp(sprintf('    modules: %s',modules));
    42                         disp(sprintf('    port: %i',cluster.port));
     40                        disp(sprintf('    modules: %s',strjoin(cluster.modules,', ')));
    4341                        disp(sprintf('    numnodes: %i',cluster.numnodes));
    4442                        disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
    45                         disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
     43                        disp(sprintf('    np: %i',cluster.nprocs()));
     44                        disp(sprintf('    port: %i',cluster.port));
    4645                        disp(sprintf('    queue: %s',cluster.queue));
    4746                        disp(sprintf('    time: %i',cluster.time));
     
    6362                        queue_requirements_np=[16384 16384];
    6463
    65                         QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
     64                        QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),cluster.time)
    6665
    67                         %Miscelaneous
     66                        %Miscellaneous
    6867                        if isempty(cluster.login), md = checkmessage(md,'login empty'); end
    6968                        if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
     
    9291                        fprintf(fid,'#BSUB -P %s\n',cluster.grouplist);
    9392                        fprintf(fid,'#BSUB -W %i:%i\n',floor(cluster.time/60),cluster.time-floor(cluster.time/60)*60);
    94                         fprintf(fid,'#BSUB -n %i\n',cluster.np);
     93                        fprintf(fid,'#BSUB -n %i\n',cluster.nprocs());
    9594                        fprintf(fid,'#BSUB -J %s\n',modelname);
    9695                        fprintf(fid,'#BSUB -o %s.outlog \n',[cluster.executionpath '/' dirname '/' modelname]);
     
    138137                function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
    139138
    140                         %lauch command, to be executed via ssh
     139                        %launch command, to be executed via ssh
    141140                        launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
    142141                                                ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && bsub < ' modelname '.queue '];
  • issm/trunk-jpl/src/m/dev/ISSM.py

    r24213 r26332  
    44import scipy.io as spio
    55from model import *
    6 from socket import gethostname
    76from triangle import *
    87from setmask import *
     
    109from setflowequation import *
    1110from solve import *
    12 from IssmConfing import *
     11from IssmConfig import *
     12from MatlabFuncs import *
    1313
    1414#Secondary imports
  • issm/trunk-jpl/src/m/miscellaneous/MatlabFuncs.py

    r26301 r26332  
     1"""
     2A collection of functions that replicate the behavior of MATLAB built-in
     3functions of the same, respective name.
     4
     5Where possible, users are encouraged to use native and/or the most efficient
     6methods in Python, but we provide these functions as a way to make translations
     7from the MATLAB to the Python ISSM API more seamless.
     8"""
     9
    110def acosd(X): #{{{
    211    """ function acosd - Inverse cosine in degrees
     
    5564#}}}
    5665
     66def find(*args): #{{{
     67    nargs = len(args)
     68    if nargs >= 1 or nargs <= 2:
     69        X = args[0]
     70        n = len(args[0])
     71        if nargs == 2:
     72            n = args[1]
     73        indices=[]
     74        for i in range(n):
     75            if X[i] != 0:
     76                indices.push(i)
     77        return indices
     78    else:
     79        raise Exception('find: must have 1 or 2 arguments')
     80#}}}
     81
    5782def heaviside(x): #{{{
    5883    import numpy as np
     
    105130#}}}
    106131
     132def mod(a, m): #{{{
     133    return a % m
     134#}}}
     135
    107136def oshostname(): #{{{
    108137    import socket
     
    141170#}}}
    142171
     172def strjoin(*args): #{{{
     173    nargs = len(args)
     174    if nargs >= 1 or nargs <= 2:
     175        sep = ' '
     176        if nargs == 2:
     177            sep = args[1]
     178        return sep.join(args[0])
     179    else:
     180        raise Exception('strjoin: must have 1 or 2 arguments')
     181#}}}
     182
    143183def strncmp(s1, s2, n): #{{{
    144184    if s1[0:n] == s2[0:n]:
  • issm/trunk-jpl/src/m/os/issmscpin.py

    r24252 r26332  
    1 from socket import gethostname
    2 import subprocess
    31import os
    42import shutil
    5 import MatlabFuncs as m
     3import subprocess
     4from MatlabFuncs import *
    65
    76
    87def issmscpin(host, login, port, path, packages):
    9     """
    10     ISSMSCPIN get packages from host, using scp on unix, and pscp on windows
    11        usage: issmscpin(host, packages, path)
     8    """ISSMSCPIN get packages from host, using scp on unix, and pscp on windows
     9
     10    Usage:
     11        issmscpin(host, packages, path)
    1212    """
    1313
    1414    #first get hostname
    15     hostname = gethostname()
     15    hostname = oshostname()
    1616    #first be sure packages are not in the current directory, this could conflict with pscp on windows.
    1717    #remove warnings in case the files do not exist
     
    2929                pass
    3030    else:
    31         if m.ispc():
     31        if ispc():
    3232            #use the putty project pscp.exe: it should be in the path.
    3333            #get ISSM_DIR variable
  • issm/trunk-jpl/src/m/os/issmscpout.m

    r26034 r26332  
    99hostname=oshostname();
    1010
    11 %are we dis-allowing symbolic links?
     11%are we disallowing symbolic links?
    1212if nargin==6,
    1313        no_symlinks=1;
  • issm/trunk-jpl/src/m/os/issmscpout.py

    r25817 r26332  
     1import os
    12from socket import gethostname
    23import subprocess
    3 import os
    4 import MatlabFuncs as m
     4from MatlabFuncs import *
    55
    66
    77def issmscpout(host, path, login, port, packages):
    8     """
    9     ISSMSCPOUT send packages to a host, using scp on unix, and pscp on windows
     8    """ISSMSCPOUT send packages to a host, using scp on unix, and pscp on windows
    109
    11        usage: issmscpout(host, path, packages)
     10    Usage:
     11        issmscpout(host, path, packages)
    1212    """
    1313
    1414    #get hostname
    15     hostname = gethostname()
     15    hostname = oshostname()
    1616
    1717    #if hostname and host are the same, do a simple copy
     
    2828            os.chdir(here)
    2929    else:
    30         if m.ispc():
     30        if ispc():
    3131            #use the putty project pscp.exe: it should be in the path.
    3232            #get ISSM_DIR variable
  • issm/trunk-jpl/src/m/os/issmssh.py

    r24252 r26332  
    1 from socket import gethostname
     1import os
     2import subprocess
    23from sys import platform as _platform
    3 import subprocess
    4 import os
    5 import MatlabFuncs as m
     4from MatlabFuncs import *
    65
    76
    87def issmssh(host, login, port, command):
    9     """
    10     ISSMSSH - wrapper for OS independent ssh command.
     8    """ISSMSSH - wrapper for OS independent ssh command.
    119
    12        usage:
    13           issmssh(host, command)
     10    Usage:
     11        issmssh(host, command)
    1412    """
    1513
    1614    #first get hostname
    17     hostname = gethostname()
     15    hostname = oshostname()
    1816
    1917    #if same as host, just run the command.
    20     if m.strcmpi(host, hostname):
     18    if strcmpi(host, hostname):
    2119        subprocess.call(command, shell=True)
    2220    else:
    23         if m.ispc():
     21        if ispc():
    2422            #use the putty project plink.exe: it should be in the path.
    2523            #get ISSM_DIR variable
  • issm/trunk-jpl/src/m/solve/loadresultsfromcluster.py

    r26178 r26332  
    11import os
    2 import socket
    32from helpers import *
    43from loadresultsfromdisk import loadresultsfromdisk
    5 from MatlabFuncs import ispc
     4from MatlabFuncs import *
    65from pairoptions import pairoptions
    76
     
    6362
    6463    # Erase input file if run was carried out on same platform
    65     hostname = socket.gethostname()
     64    hostname = oshostname()
    6665    if hostname == cluster.name:
    6766        remove(md.miscellaneous.name + '.bin')
  • issm/trunk-jpl/src/m/solve/waitonlock.py

    r24213 r26332  
    11import os
    2 from socket import gethostname
    32import time
    4 import MatlabFuncs as m
    5 
     3from MatlabFuncs import *
    64
    75def waitonlock(md):
    8     """
    9     WAITONLOCK - wait for a file
     6    """WAITONLOCK - wait for a file
    107
    11        This routine will return when a file named 'filename' is written to disk.
    12        If the time limit given in input is exceeded, return 0
     8    This routine will return when a file named 'filename' is written to disk.
     9    If the time limit given in input is exceeded, return 0
    1310
    14        Usage:
    15           flag = waitonlock(md)
     11    Usage:
     12        flag = waitonlock(md)
    1613    """
    1714
     
    2320
    2421    #waitonlock will work if the lock is on the same machine only:
    25     if not m.strcmpi(gethostname(), cluster):
     22    if not strcmpi(oshostname(), cluster):
    2623
    2724        print('solution launched on remote cluster. log in to detect job completion.')
    2825        choice = eval(input('Is the job successfully completed? (y / n) '))
    29         if not m.strcmp(choice, 'y'):
     26        if not strcmp(choice, 'y'):
    3027            print('Results not loaded... exiting')
    3128            flag = 0
     
    3532    #job is running on the same machine
    3633    else:
    37 
    3834        if 'interactive' in vars(md.cluster) and md.cluster.interactive:
    3935            #We are in interactive mode, no need to check for job completion
Note: See TracChangeset for help on using the changeset viewer.