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

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.