Changeset 20120


Ignore:
Timestamp:
02/11/16 14:55:01 (9 years ago)
Author:
Eric.Larour
Message:

CHG: added batch flag for the LaunchQueueJob and reordered the sequence in solve because
in generic clusters, in batch mode, we were not uploading anything!

Location:
issm/trunk-jpl/src/m
Files:
6 edited

Legend:

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

    r19958 r20120  
    155155                end
    156156                %}}}
     157                function BuildQueueScriptMultipleModels(cluster,dirname,modelname,solution,dirnames,modelnames,nps) % {{{
     158               
     159                        %some checks:
     160                        if isempty(modelname), error('BuildQueueScriptMultipleModels error message: need a non empty model name!');end
     161
     162                        %what is the executable being called?
     163                        executable='issm_slr.exe';
     164
     165                        if ispc(), error('BuildQueueScriptMultipleModels not support yet on windows machines');end;
     166                       
     167                        %write queuing script
     168                        fid=fopen([modelname '.queue'],'w');
     169                       
     170                        fprintf(fid,'#!%s\n',cluster.shell);
     171
     172                        %number of cpus:
     173                        mpistring=sprintf('mpiexec -np %i ',cluster.np);
     174
     175                        %executable:
     176                        mpistring=[mpistring sprintf('%s/%s ',cluster.codepath,executable)];
     177                       
     178                        %solution name:
     179                        mpistring=[mpistring sprintf('%s ',EnumToString(solution))];
     180
     181                        %execution directory and model name:
     182                        mpistring=[mpistring sprintf('%s/%s %s',cluster.executionpath,dirname,modelname)];
     183
     184                        %inform main executable of how many icecaps, glaciers and earth models are being run:
     185                        mpistring=[mpistring sprintf(' %i ',length(dirnames))];
     186                       
     187                        %icecaps, glaciers and earth location, names and number of processors associated:
     188                        for i=1:length(dirnames),
     189                        mpistring=[mpistring sprintf(' %s/%s %s %i ',cluster.executionpath,dirnames{i},modelnames{i},nps{i})];
     190                        end
     191
     192                        %log files:
     193                        if ~cluster.interactive,
     194                                mpistring=[mpistring sprintf('2> %s.errlog> %s.outlog',modelname,modelname)];
     195                        end
     196
     197                        %write this long string to disk:
     198                        fprintf(fid,mpistring);
     199                        fclose(fid);
     200
     201                        %in interactive mode, create a run file, and errlog and outlog file
     202                        if cluster.interactive,
     203                                fid=fopen([modelname '.errlog'],'w'); fclose(fid);
     204                                fid=fopen([modelname '.outlog'],'w'); fclose(fid);
     205                        end
     206                end
     207                %}}}
    157208                function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
    158209
     
    219270                        end
    220271                end %}}}
    221                 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{
     272                function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
    222273
    223274                        if ~ispc,
     
    235286                                        launchcommand=['source ' cluster.etcpath '/environment.' shellext ' && cd ' cluster.executionpath ' && cd ' dirname ' && source ' modelname '.queue '];
    236287                                else
     288                                        if ~batch,
    237289                                        launchcommand=['source ' cluster.etcpath '/environment.' shellext ' && cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
    238290                                                ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && source  ' modelname '.queue '];
     291                                        else
     292                                        launchcommand=['source ' cluster.etcpath '/environment.' shellext ' && cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
     293                                                ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz '];
     294                                        end
    239295                                end
    240296                                issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
  • issm/trunk-jpl/src/m/classes/clusters/generic.py

    r19674 r20120  
    183183
    184184        # }}}
    185         def LaunchQueueJob(self,modelname,dirname,filelist,restart):    # {{{
     185        def LaunchQueueJob(self,modelname,dirname,filelist,restart,batch):    # {{{
    186186
    187187                print 'launching solution sequence on remote cluster'
     
    189189                        launchcommand='cd %s && cd %s chmod 777 %s.queue && ./%s.queue' % (self.executionpath,dirname,modelname,modelname)
    190190                else:
    191                         launchcommand='cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz  && chmod 777 %s.queue && ./%s.queue' % \
     191                        if batch:
     192                                launchcommand='cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz  && chmod 777 %s.queue && ./%s.queue' % \
    192193                                (self.executionpath,dirname,dirname,dirname,dirname,dirname,modelname,modelname)
     194                        else:
     195                                launchcommand='cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz' % \
     196                                (self.executionpath,dirname,dirname,dirname,dirname,dirname)
     197
    193198                issmssh(self.name,self.login,self.port,launchcommand)
    194199        # }}}
  • issm/trunk-jpl/src/m/classes/clusters/pfe.m

    r20042 r20120  
    308308                 end
    309309                 %}}}
    310                  function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{
     310                 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
    311311
    312312                         %lauch command, to be executed via ssh
  • issm/trunk-jpl/src/m/classes/clusters/pfe.py

    r19674 r20120  
    180180
    181181                # }}}
    182         def LaunchQueueJob(self,modelname,dirname,filelist,restart):
     182        def LaunchQueueJob(self,modelname,dirname,filelist,restart,batch):
    183183                        # {{{
    184184
  • issm/trunk-jpl/src/m/solve/solve.m

    r19638 r20120  
    3636md.private.solution=solutionenum;
    3737cluster=md.cluster;
     38if strcmpi(getfieldvalue(options,'batch','no'),'yes') batch=1; else batch=0; end
    3839
    3940%check model consistency
     
    99100BuildQueueScript(cluster,md.private.runtimename,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof,md.qmu.isdakota); % queue file
    100101
    101 %Stop here if batch mode
    102 if strcmpi(getfieldvalue(options,'batch','no'),'yes')
    103         if md.verbose.solution,
    104                 disp('batch mode requested: not launching job interactively');
    105                 disp('launch solution sequence on remote cluster by hand');
    106         end
    107         return;
    108 end
    109 
    110102%Upload all required files
    111103modelname = md.miscellaneous.name;
     
    126118
    127119%launch queue job:
    128 LaunchQueueJob(cluster,md.miscellaneous.name,md.private.runtimename,filelist,restart);
     120LaunchQueueJob(cluster,md.miscellaneous.name,md.private.runtimename,filelist,restart,batch);
    129121
     122%return if batch:
     123if batch,
     124        if md.verbose.solution,
     125                disp('batch mode requested: not launching job interactively');
     126                disp('launch solution sequence on remote cluster by hand');
     127        end
     128        return;
     129end
    130130%wait on lock
    131131if isnan(md.settings.waitonlock),
  • issm/trunk-jpl/src/m/solve/solve.py

    r19638 r20120  
    4747        #recover some fields
    4848        md.private.solution=solutionenum
    49         cluster=md.cluster
     49        cluster=md.cluster
     50        if m.strcmpi(options.getfieldvalue('batch','no'),'yes'):
     51                batch=1
     52        else:
     53                batch=0;
    5054
    5155        #check model consistency
     
    113117       
    114118        #Launch job
    115         cluster.LaunchQueueJob(md.miscellaneous.name,md.private.runtimename,filelist,restart)
     119        cluster.LaunchQueueJob(md.miscellaneous.name,md.private.runtimename,filelist,restart,batch)
    116120
    117121        #wait on lock
Note: See TracChangeset for help on using the changeset viewer.