Changeset 27949


Ignore:
Timestamp:
10/08/23 10:33:56 (19 months ago)
Author:
jdquinn
Message:

BUG: Forgot to commit changes to generic cluster

Location:
issm/trunk-jpl/src/m/classes/clusters
Files:
3 edited

Legend:

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

    r27488 r27949  
    3333
    3434                        %Change the defaults if ispc
    35                         if ispc & ~ismingw,
     35                        if ispc,
    3636                                cluster.codepath      = [issmdir() '\bin'];
    3737                                cluster.etcpath       = [issmdir() '\etc'];
     
    9999
    100100                        if ~ispc(),
     101                                % Check that executable exists at the right path
     102                                if ~exist([cluster.codepath '/' executable],'file'),
     103                                        error(['File ' cluster.codepath '/' executable ' does not exist']);
     104                                end
     105
     106                                % Process codepath and prepend empty spaces with \ to avoid errors in queuing script
     107                                codepath=strrep(cluster.codepath,' ','\ ');
     108
     109                                % Write queuing script
    101110                                fid=fopen([modelname '.queue'],'w');
    102111                                fprintf(fid,'#!%s\n',cluster.shell);
    103                                 if ~isvalgrind,
    104                                         if cluster.interactive
    105                                                 if IssmConfig('_HAVE_MPI_'),
    106                                                         fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
    107                                                 else
    108                                                         fprintf(fid,'%s/%s %s %s %s',cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
    109                                                 end
    110                                         else
    111                                                 if IssmConfig('_HAVE_MPI_'),
    112                                                         fprintf(fid,'mpiexec -np %i %s/%s %s %s %s 2> %s.errlog > %s.outlog &',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname,modelname,modelname);
    113                                                 else
    114                                                         fprintf(fid,'%s/%s %s %s %s 2> %s.errlog > %s.outlog &',cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname,modelname,modelname);
    115                                                 end
    116                                         end
    117                                 elseif isgprof,
    118                                         fprintf(fid,'\n gprof %s/issm.exe gmon.out > %s.performance',cluster.codepath,modelname);
    119                                 else
     112                                if isvalgrind,
    120113                                        %Add --gen-suppressions=all to get suppression lines
    121114                                        %fprintf(fid,'LD_PRELOAD=%s \\\n',cluster.valgrindlib); it could be deleted
     
    137130                                                end
    138131                                        end
     132                                elseif isgprof,
     133                                        fprintf(fid,'\n gprof %s/issm.exe gmon.out > %s.performance',cluster.codepath,modelname);
     134                                else
     135                                        if cluster.interactive
     136                                                if IssmConfig('_HAVE_MPI_'),
     137                                                        fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
     138                                                else
     139                                                        fprintf(fid,'%s/%s %s %s %s',cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
     140                                                end
     141                                        else
     142                                                if IssmConfig('_HAVE_MPI_'),
     143                                                        fprintf(fid,'mpiexec -np %i %s/%s %s %s %s 2> %s.errlog > %s.outlog &',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname,modelname,modelname);
     144                                                else
     145                                                        fprintf(fid,'%s/%s %s %s %s 2> %s.errlog > %s.outlog &',cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname,modelname,modelname);
     146                                                end
     147                                        end
    139148                                end
    140149                                if ~io_gather, %concatenate the output files:
     
    144153
    145154                        else % Windows
    146 
    147155                                fid=fopen([modelname '.bat'],'w');
    148156                                fprintf(fid,'@echo off\n');
    149157
    150                                 % if IssmConfig('_HAVE_PETSC_MPI_'),
    151                                 %       warning('parallel runs not allowed yet in Windows. Defaulting to 1 cpus');
    152                                 %       cluster.np=1;
    153                                 % end
    154 
    155158                                if cluster.np>1,
    156                                         % fprintf(fid,'"C:\\Program Files\\MPICH2\\bin\\mpiexec.exe" -n %i "%s/%s" %s ./ %s',cluster.np,cluster.codepath,executable,solution,modelname);
    157159                                        fprintf(fid,'"C:\\Program Files\\Microsoft MPI\\Bin\\mpiexec.exe" -n %i "%s/%s" %s ./ %s',cluster.np,cluster.codepath,executable,solution,modelname);
    158160                                else
    159                                         fprintf(fid,'"%s/%s" %s ./ %s',cluster.codepath,executable,solution,modelname);
     161                                        fprintf(fid,'"%s\\%s" %s ./ %s',cluster.codepath,executable,solution,modelname);
    160162                                end
    161163                                fclose(fid);
  • issm/trunk-jpl/src/m/classes/clusters/generic.py

    r27262 r27949  
    1818
    1919class generic(object):
    20     """GENERIC cluster class definition
     20    """generic cluster class definition
    2121
    2222    Usage:
  • issm/trunk-jpl/src/m/classes/clusters/generic_static.m

    r27262 r27949  
    33%   Usage:
    44%      cluster=generic_static('name','astrid','np',3);
     5%      cluster=generic('name',oshostname(),'np',3,'login','username');
     6%
     7%   TODO:
     8%   - Add support for restart to Windows (under MSYS2), then activate tests 125
     9%   and 126 in test suite
     10%
    511
    612classdef generic_static
     
    1723        methods
    1824                function cluster=generic_static(varargin) % {{{
     25
    1926                        %use provided options to change fields
    2027                        options=pairoptions(varargin{:});
     
    6976                        end
    7077
    71                         % Check that executable exists at the right path
    72                         if ~exist([cluster.codepath '/' executable],'file'),
    73                                 error(['File ' cluster.codepath '/' executable ' does not exist']);
     78                        if ~ispc(),
     79                                % Check that executable exists at the right path
     80                                if ~exist([cluster.codepath '/' executable],'file'),
     81                                        error(['File ' cluster.codepath '/' executable ' does not exist']);
     82                                end
     83
     84                                % Process codepath and prepend empty spaces with \ to avoid errors in queuing script
     85                                codepath=strrep(cluster.codepath,' ','\ ');
     86
     87                                % Write queuing script
     88                                fid=fopen([modelname '.queue'],'w');
     89                                fprintf(fid,'#!%s\n',cluster.shell);
     90                                if cluster.interactive
     91                                        if IssmConfig('_HAVE_MPI_'),
     92                                                fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
     93                                        else
     94                                                fprintf(fid,'%s/%s %s %s %s',cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
     95                                        end
     96                                else
     97                                        if IssmConfig('_HAVE_MPI_'),
     98                                                fprintf(fid,'mpiexec -np %i %s/%s %s %s %s 2> %s.errlog > %s.outlog &',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname,modelname,modelname);
     99                                        else
     100                                                fprintf(fid,'%s/%s %s %s %s 2> %s.errlog > %s.outlog &',cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname,modelname,modelname);
     101                                        end
     102                                end
     103                                fclose(fid);
     104                        else % Windows
     105                                fid=fopen([modelname '.bat'],'w');
     106                                fprintf(fid,'@echo off\n');
     107
     108                                if cluster.np>1,
     109                                        fprintf(fid,'"%s\\mpiexec.exe" -n %i "%s/%s" %s ./ %s',cluster.codepath,cluster.np,cluster.codepath,executable,solution,modelname);
     110                                else
     111                                        fprintf(fid,'"%s\\%s" %s ./ %s',cluster.codepath,executable,solution,modelname);
     112                                end
     113                                fclose(fid);
    74114                        end
    75115
    76                         % Process codepath and prepend empty spaces with \ to avoid errors in queuing script
    77                         codepath=strrep(cluster.codepath,' ','\ ');
    78 
    79                         % Write queuing script
    80                         fid=fopen([modelname '.queue'],'w');
    81                         fprintf(fid,'#!%s\n',cluster.shell);
    82                         fprintf(fid,['%s/mpiexec -np %i %s/%s %s %s %s \n'],codepath,cluster.np,codepath,executable,solution,'./',modelname);
    83                         fclose(fid);
    84 
    85                         % Create an errlog and outlog file
    86                         fid=fopen([modelname '.errlog'],'w');
    87                         fclose(fid);
    88                         fid=fopen([modelname '.outlog'],'w');
    89                         fclose(fid);
     116                        %in interactive mode, create a run file, and errlog and outlog file
     117                        if cluster.interactive,
     118                                fid=fopen([modelname '.errlog'],'w');
     119                                fclose(fid);
     120                                fid=fopen([modelname '.outlog'],'w');
     121                                fclose(fid);
     122                        end
    90123                end
    91124                %}}}
Note: See TracChangeset for help on using the changeset viewer.