Ignore:
Timestamp:
09/23/10 09:37:37 (14 years ago)
Author:
Mathieu Morlighem
Message:

more flexible call to cluster

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/clusters/pfe.m

    r5963 r5980  
    66classdef pfe
    77    properties (SetAccess=public) 
    8                 % {{{1
    9                 name='pfe'
    10                 numnodes=20;
    11                 cpuspernode=8;
    12                 queue='long';
    13                 time=12*60;
    14                 processor='neh';
    15                 codepath='/staff/elarour/trunk/bin';
    16                 executionpath='/nobackupp10/elarour/Testing';
    17                 login='elarour';
    18                 port=1025;
    19         end
    20     properties (SetAccess=private)
    21                 np=20*8;
    22                 %}}}
    23     end
    24     methods
    25                 function []=disp(md) % {{{1
    26                 %  display the object
    27                 disp(sprintf('class ''%s'' object ''%s'' = ',class(md),inputname(1)));
    28                 disp(sprintf('    name: %s',md.name));
    29                 disp(sprintf('    numnodes: %i',md.numnodes));
    30                 disp(sprintf('    cpuspernode: %i',md.cpuspernode));
    31                 disp(sprintf('    np: %i',md.cpuspernode*md.numnodes));
    32                 disp(sprintf('    queue: %s',md.queue));
    33                 disp(sprintf('    time: %i',md.time));
    34                 disp(sprintf('    processor: %s',md.processor));
    35                 disp(sprintf('    codepath: %s',md.codepath));
    36                 disp(sprintf('    executionpath: %s',md.executionpath));
    37                 end
    38                 %}}}
    39                 function IsConsistent(md) % {{{1
     8                 % {{{1
     9                 name='pfe'
     10                 login='elarour';
     11                 numnodes=20;
     12                 cpuspernode=8;
     13                 port=1025;
     14                 queue='long';
     15                 time=12*60;
     16                 processor='neh';
     17                 codepath='/staff/elarour/trunk/bin';
     18                 executionpath='/nobackupp10/elarour/Testing';
     19         end
     20         properties (SetAccess=private)
     21                 np=20*8;
     22                 % }}}
     23         end
     24         methods
     25                 function cluster=pfe(varargin) % {{{1
     26                         options=pairoptions(varargin{:});
     27                         for i=1:size(options.list,1),
     28                                 fieldname=options.list{i,1};
     29                                 fieldvalue=options.list{i,2};
     30                                 if ismember(fieldname,properties(pfe)),
     31                                         cluster.(fieldname)=fieldvalue;
     32                                 else
     33                                         disp(['''' fieldname ''' is not a property of cluster pfe']);
     34                                 end
     35                         end
     36                 end
     37                 %}}}
     38                 function disp(cluster) % {{{1
     39                         %  display the object
     40                         disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
     41                         disp(sprintf('    name: %s',cluster.name));
     42                         disp(sprintf('    login: %s',cluster.login));
     43                         disp(sprintf('    port: %i',cluster.port));
     44                         disp(sprintf('    numnodes: %i',cluster.numnodes));
     45                         disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
     46                         disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
     47                         disp(sprintf('    queue: %s',cluster.queue));
     48                         disp(sprintf('    time: %i',cluster.time));
     49                         disp(sprintf('    processor: %s',cluster.processor));
     50                         disp(sprintf('    codepath: %s',cluster.codepath));
     51                         disp(sprintf('    executionpath: %s',cluster.executionpath));
     52                 end
     53                 %}}}
     54                 function IsConsistent(cluster) % {{{1
    4055
    41                         available_queues={'long'};
    42                         queue_requirements_time=[7200];
    43                         queue_requirements_np=[2048];
     56                         available_queues={'long'};
     57                         queue_requirements_time=[7200];
     58                         queue_requirements_np=[2048];
    4459
    45                         QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,md.queue,md.np,md.time)
     60                         QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
    4661
    47                         %now, check md.cpuspernode according to processor type
    48                         if (strcmpi(md.processor,'har') | strcmpi(md.processor,'neh')),
    49                                 if ((md.cpuspernode>8 ) | (md.cpuspernode<1)),
    50                                         error('IsConsistent error message: cpuspernode should be between 1 and 8 for ''neh'' and ''har'' processors');
    51                                 end
    52                         elseif strcmpi(md.processor,'wes'),
    53                                 if ((md.cpuspernode>12 ) | (md.cpuspernode<1)),
    54                                         error('IsConsistent error message: cpuspernode should be between 1 and 12 for ''wes'' processors');
    55                                 end
    56                         else
    57                                 error('IsConsistent error message: unknown processor type, should be ''neh'',''wes'' or ''har''');
    58                         end
     62                         %now, check cluster.cpuspernode according to processor type
     63                         if (strcmpi(cluster.processor,'har') | strcmpi(cluster.processor,'neh')),
     64                                 if ((cluster.cpuspernode>8 ) | (cluster.cpuspernode<1)),
     65                                         error('IsConsistent error message: cpuspernode should be between 1 and 8 for ''neh'' and ''har'' processors');
     66                                 end
     67                         elseif strcmpi(cluster.processor,'wes'),
     68                                 if ((cluster.cpuspernode>12 ) | (cluster.cpuspernode<1)),
     69                                         error('IsConsistent error message: cpuspernode should be between 1 and 12 for ''wes'' processors');
     70                                 end
     71                         else
     72                                 error('IsConsistent error message: unknown processor type, should be ''neh'',''wes'' or ''har''');
     73                         end
    5974
    60                 end
    61                 %}}}
    62                 function BuildQueueScript(md,modelname,analysis_type,mem_debug) % {{{1
     75                 end
     76                 %}}}
     77                 function BuildQueueScript(cluster,modelname,analysis_type,mem_debug) % {{{1
    6378
    64                         %compute number of processors
    65                         md.np=md.numnodes*md.cpuspernode;
    66                        
    67                         %open file for writing:
    68                         fid=fopen([modelname '.queue'],'w');
     79                         %compute number of processors
     80                         cluster.np=cluster.numnodes*cluster.cpuspernode;
    6981
    70                         fprintf(fid,'#PBS -S /bin/bash\n');
    71                         fprintf(fid,'#PBS -N %s\n',modelname);
    72                         fprintf(fid,'#PBS -l select=%i:ncpus=%i:model=%s\n',md.numnodes,md.cpuspernode,md.processor);
    73                         fprintf(fid,'#PBS -l walltime=%i\n',md.time*60); %walltime is in seconds.
    74                         fprintf(fid,'#PBS -W group_list=s1010\n');
    75                         fprintf(fid,'#PBS -m e\n');
    76                         fprintf(fid,'#PBS -o %s.outlog \n',modelname);
    77                         fprintf(fid,'#PBS -e %s.errlog \n\n',modelname);
     82                         %open file for writing:
     83                         fid=fopen([modelname '.queue'],'w');
    7884
    79                         fprintf(fid,'. /usr/share/modules/init/bash\n\n');
     85                         fprintf(fid,'#PBS -S /bin/bash\n');
     86                         fprintf(fid,'#PBS -N %s\n',modelname);
     87                         fprintf(fid,'#PBS -l select=%i:ncpus=%i:model=%s\n',cluster.numnodes,cluster.cpuspernode,cluster.processor);
     88                         fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
     89                         fprintf(fid,'#PBS -W group_list=s1010\n');
     90                         fprintf(fid,'#PBS -m e\n');
     91                         fprintf(fid,'#PBS -o %s.outlog \n',modelname);
     92                         fprintf(fid,'#PBS -e %s.errlog \n\n',modelname);
    8093
    81                         fprintf(fid,'module load comp-intel/11.1.046\n');
    82                         fprintf(fid,'module load mpi/mpt.1.25\n');
    83                         fprintf(fid,'module load math/intel_mkl_64_10.0.011\n\n');
     94                         fprintf(fid,'. /usr/share/modules/init/bash\n\n');
    8495
    85                         fprintf(fid,'export PATH="$PATH:."\n\n');
    86                         fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
     96                         fprintf(fid,'module load comp-intel/11.1.046\n');
     97                         fprintf(fid,'module load mpi/mpt.1.25\n');
     98                         fprintf(fid,'module load math/intel_mkl_64_10.0.011\n\n');
    8799
    88                         fprintf(fid,'cd $PBS_O_WORKDIR\n\n');
     100                         fprintf(fid,'export PATH="$PATH:."\n\n');
     101                         fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
    89102
    90                         fprintf(fid,'mpiexec -verbose -np %i %s/issm.exe %s $PBS_O_WORKDIR %s.bin %s.petsc %s.outbin %s.lock',md.np,md.codepath,EnumToString(analysis_type),modelname,modelname,modelname,modelname);
     103                         fprintf(fid,'cd $PBS_O_WORKDIR\n\n');
    91104
    92                         %close file
    93                         fclose(fid);
     105                         fprintf(fid,'mpiexec -verbose -np %i %s/issm.exe %s $PBS_O_WORKDIR %s.bin %s.petsc %s.outbin %s.lock',cluster.np,cluster.codepath,EnumToString(analysis_type),modelname,modelname,modelname,modelname);
    94106
    95                 end
    96                 %}}}
    97                 function command=LaunchCommand(md,modelruntimename,modelname)% {{{1
    98                         command=['cd ' md.executionpath ' && rm -rf ./' modelruntimename ' && mkdir ' modelruntimename ' && cd ' modelruntimename ' && mv ../' modelruntimename '.tar.gz ./ && tar -zxf ' modelruntimename '.tar.gz  && qsub ' modelname '.queue '];
    99                 end
    100                 %}}}
     107                         %close file
     108                         fclose(fid);
     109
     110                 end
     111                 %}}}
     112                 function command=LaunchCommand(cluster,modelruntimename,modelname)% {{{1
     113                         command=['cd ' cluster.executionpath ' && rm -rf ./' modelruntimename ' && mkdir ' modelruntimename ' && cd ' modelruntimename ' && mv ../' modelruntimename '.tar.gz ./ && tar -zxf ' modelruntimename '.tar.gz  && qsub ' modelname '.queue '];
     114                 end
     115                 %}}}
    101116        end
    102117end
Note: See TracChangeset for help on using the changeset viewer.