Changes between Version 2 and Version 3 of multiplejobs


Ignore:
Timestamp:
10/02/20 12:55:39 (4 years ago)
Author:
Mathieu Morlighem
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • multiplejobs

    v2 v3  
     1Sometimes we want to submit multiple jobs with a parameter that changes value. Here is how you can do that for basal friction changing from 50 to 100 by increments of 1 (as an example).
     2
     3We are going to use a variable in the MATLAB workspace called `friction` that will be changing within a loop. In your `runme.m` script, prepare your step with a dynamic step name:
     4
    15{{{
    26#!m
    3 for N=1:20
    4 runme
    5 end
    6 md.settings.waitonlock = 0;
     7%Do we need to submit the job or download the results?
     8loadonly = 0;
     9
     10if perform(org,['FrictionTest_' num2str(friction) ])
     11   loadmodel(org,'PreviousStepName');
     12   
     13   %Change friction according to friction variable
     14   md.friction.coefficient = friction;
     15
     16   %Make sure jobs are submitted without MATLAB waiting for the results, and job name is unique
    717   md.settings.waitonlock = 0;
    8    md.miscellaneous.name = 'NAMEforTHISstep;
     18   md.miscellaneous.name = ['FrictionTest_' num2str(friction) ];
     19
     20  %Submit job or download results, make sure that there is no runtime name (that includes the date)
    921   md=solve(md,'Transient','runtimename',false,'loadonly',loadonly);
     22
     23   %Save model if necessary
    1024   if  loadonly,
    1125      savemodel(org,md);
    1226   end
    13 if perform(org,['Transient_TF_+' num2str(TFextra) 'C_qsg_x' num2str(qsgmult) ])
    14  md.miscellaneous.name =  ['Transient_TF_+' num2str(TFextra) 'C_qsg_x' num2str(qsgmult) ];
    1527}}}
     28
     29Now, to submit jobs, set `loadonly = 0` and launch your jobs:
     30
     31{{{
     32#!m
     33for friction=50:100
     34   runme;
     35end
     36}}}
     37
     38Once all the jobs are fully completed, you can set `loadonly = 1` and run the same loop, all the results will be downloaded and the model will be saved with a unique name. Good luck!