Ignore:
Timestamp:
Nov 7, 2024, 10:27:18 AM (2 weeks ago)
Author:
jbclement
Message:

PEM:
Modifications related to the launching script:

  • There is actually no launching difference between the 1D and 3D models. It is more about how and where you want to execute. So now, the user can choose between two launching modes with the parameter "mode" (0 = "processing scripts"; any other values = "submitting jobs"). The former option is usually used to process the script on a local machine while the latter is used to submit jobs on supercomputer;
  • The execution command line in the job scripts that should be modified by the user according to the set-up is now given as an argument at the beginning to be more identifiable and adaptable;
  • Making the job scripts more robust to detect a successful end.

JBC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/evolution/deftank/lib_launchPEM.sh

    r3446 r3495  
    3232        submit_job="sbatch --parsable"
    3333        submit_dependjob="sbatch --parsable --dependency"
    34         sed -i 's/\$PBS_JOBID/\$SLURM_JOB_ID/g' PEMrun.job
    3534    elif command -v qstat &> /dev/null; then
    3635        echo "PBS/TORQUE is installed on $machine."
     
    3938        submit_job="qsub"
    4039        submit_dependjob="qsub -W depend"
    41         sed -i 's/\$SLURM_JOB_ID/\$PBS_JOBID/g' PEMrun.job
    4240    else
    4341        echo "Error: neither SLURM nor TORQUE/PBS is installed on $machine!"
     
    119117        mkdir diags
    120118    fi
    121     if [ $dim -ne 1 ]; then
     119    if [ $mode -ne 0 ]; then
    122120        job_scheduler
    123121    fi
     
    161159
    162160# To submit the PCM runs
    163 # arg1: model dimension
     161# arg1: launching mode
    164162# arg2: number of PCM runs to launch
    165163# arg3: local number of the PCM run from which to start (optional)
     
    172170    if [ $i_myear -lt $n_myear ]; then
    173171        echo "Run PCM $iPCM: call $ii/$2..."
    174         if [ $1 -eq 1 ]; then # 1D model
     172        if [ $1 -eq 0 ]; then # Mode: processing scripts
    175173            sed -i "s/^k=[0-9]\+$/k=$(echo "3 - $nPCM_ini" | bc)/" PCMrun.job
    176174            ./PCMrun.job
     
    178176                errlaunch
    179177            fi
    180         else # 3D model
     178        else # Mode: launching jobs
    181179            cp PCMrun.job PCMrun${iPCM}.job
    182180            sed -i -E "s/($name_job[^0-9]*[0-9]*[^0-9]*)[0-9]+$/\1${iPCM}/" PCMrun${iPCM}.job
     
    197195        if [ $i_myear -lt $n_myear ]; then
    198196            echo "Run PCM $iPCM: call $i/$2..."
    199             if [ $1 -eq 1 ]; then # 1D model
     197            if [ $1 -eq 0 ]; then # Mode: processing scripts
    200198                sed -i "s/^k=[0-9]\+$/k=$(echo "$i + 2 - $nPCM_ini" | bc)/" PCMrun.job
    201199                ./PCMrun.job
     
    203201                    errlaunch
    204202                fi
    205             else # 3D model
     203            else # Mode: launching jobs
    206204                cp PCMrun.job PCMrun${iPCM}.job
    207205                sed -i -E "s/($name_job[^0-9]*[0-9]*[^0-9]*)[0-9]+$/\1${iPCM}/" PCMrun${iPCM}.job
     
    219217
    220218# To submit the PEM run
    221 # arg1: model dimension
     219# arg1: launching mode
    222220submitPEM() {
    223221    if [ $i_myear -lt $n_myear ]; then
    224222        echo "Run PEM $iPEM"
    225         if [ $1 -eq 1 ]; then # 1D model
     223        if [ $1 -eq 0 ]; then # Mode: processing scripts
    226224            ./PEMrun.job
    227225            if [ $? -ne 0 ]; then
    228226                errlaunch
    229227            fi
    230         else # 3D model
     228        else # Mode: launching jobs
    231229            sed -i -E "s/($name_job[^0-9]*[0-9]*[^0-9]*)[0-9]+$/\1${iPEM}/" PEMrun.job
    232230            jobID=$(eval "$submit_job PEMrun.job")
     
    242240
    243241# To make one cycle of PCM and PEM runs
    244 # arg1: model dimension
     242# arg1: launching mode
    245243# arg2: number of PCM runs to launch
    246244# arg3: local number of the PCM run from which to start (optional)
     
    252250    if [ $i_myear -lt $n_myear ]; then
    253251        echo "Run PEM $iPEM"
    254         if [ $1 -eq 1 ]; then # 1D model
     252        if [ $1 -eq 0 ]; then # Mode: processing scripts
    255253            ./PEMrun.job
    256254            if [ $? -ne 0 ]; then
    257255                errlaunch
    258256            fi
    259         else # 3D model
     257        else # Mode: launching jobs
    260258            sed -i -E "s/($name_job[^0-9]*[0-9]*[^0-9]*)[0-9]+$/\1${iPEM}/" PEMrun.job
    261259            jobID=$(eval "$submit_dependjob=afterok:${jobID} PEMrun.job")
     
    293291
    294292# To relaunch from PCM run
    295 # arg1: model dimension
     293# arg1: launching mode
    296294relaunchPCM() {
    297295    iPCM=$(($irelaunch + 1))
     
    361359
    362360# To relaunch from PEM run
    363 # arg1: model dimension
     361# arg1: launching mode
    364362relaunchPEM() {
    365363    iPEM=$(echo "$irelaunch + 1" | bc)
Note: See TracChangeset for help on using the changeset viewer.