Changes between Initial Version and Version 1 of nowaitlock


Ignore:
Timestamp:
06/27/23 08:12:26 (20 months ago)
Author:
Mathieu Morlighem
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • nowaitlock

    v1 v1  
     1It is sometimes convenient to submit jobs and let them run in the background. This easiest way to do this is to run the same step twice, with a variable `loadonly` that indicates whether we want to submit the job (when it is 0) or load results once the job is completed (1).
     2{{{
     3#!m
     4%Do we need to submit the job or download the results?
     5loadonly = 0;
     6
     7if perform(org,'Stepname')
     8   loadmodel(org,'PreviousStepName');
     9
     10   %Make sure jobs are submitted without MATLAB waiting for the results, and job name is unique
     11   md.settings.waitonlock = 0;
     12   md.cluster.interactive = 0; %only needed if you are using the generic cluster
     13   md.miscellaneous.name = 'YourJobName';
     14
     15  %Submit job or download results, make sure that there is no runtime name (that includes the date)
     16   md=solve(md,'Transient','runtimename',false,'loadonly',loadonly);
     17
     18   %Save model if necessary
     19   if  loadonly
     20      savemodel(org,md);
     21   end
     22end
     23}}}
     24
     25Now, to submit jobs, set `loadonly = 0` and launch your simulation. Once it is fully completed, you can set `loadonly = 1` and run the same script, all the results will be downloaded and the model will be saved with a unique name. Good luck!