Ignore:
Timestamp:
Jun 20, 2024, 5:27:58 PM (5 months ago)
Author:
jbclement
Message:

PEM:

  • Correction of the way the PEM stops before it reaches the SLURM time limit.
  • Small correction for 1D related to r3386.
  • Improvement of launching script.

JBC

Location:
trunk/LMDZ.COMMON/libf/evolution
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/evolution/changelog.txt

    r3386 r3387  
    381381- Correction of files cleaning in the launching script.
    382382- Improvement of the launching script to take into account the modification of parameters for a relaunch.
     383
     384== 20/06/2024 == JBC
     385- Correction of the way the PEM stops before it reaches the SLURM time limit.
     386- Small correction for 1D related to r3386.
     387- Improvement of launching script.
  • trunk/LMDZ.COMMON/libf/evolution/deftank/jobPEM.slurm

    r3386 r3387  
    3737read i_myear n_myear convert_years iPCM iPEM nPCM nPCM_ini < info_PEM.txt
    3838cp run_PEM.def run.def
    39 ./$exePEM > out_runPEM${iPEM} 2>&1
     39./$exePEM $SLURM_JOB_ID > out_runPEM${iPEM} 2>&1
    4040if [ ! -f "restartfi.nc" ] || ! (tail -n 1 out_runPEM${iPEM} | grep -iq "so far, so good!"); then # Check if it ended abnormally
    4141    echo "Error: the run PEM $iPEM crashed!"
  • trunk/LMDZ.COMMON/libf/evolution/deftank/lib_launchPEM.sh

    r3386 r3387  
    153153        echo "Run PCM $iPCM: call $ii/$1..."
    154154        cp jobPCM.slurm jobPCM${iPCM}.slurm
    155         sed -i "s/#SBATCH --job-name=jobPCM.*/#SBATCH --job-name=jobPCM${iPCM}/" jobPCM${iPCM}.slurm
     155        sed -i -E "s/(#SBATCH --job-name=[^0-9]*[0-9]*[^0-9]*)[0-9]+$/\1${iPCM}/" jobPCM${iPCM}.slurm
    156156        sed -i "s/^k=[0-9]\+$/k=$(echo "3 - $nPCM_ini" | bc -l)/" jobPCM${iPCM}.slurm
    157157        jobID=$(sbatch --parsable jobPCM${iPCM}.slurm)
     
    170170            echo "Run PCM $iPCM: call $i/$1..."
    171171            cp jobPCM.slurm jobPCM${iPCM}.slurm
    172             sed -i "s/#SBATCH --job-name=jobPCM.*/#SBATCH --job-name=jobPCM${iPCM}/" jobPCM${iPCM}.slurm
     172            sed -i -E "s/(#SBATCH --job-name=[^0-9]*[0-9]*[^0-9]*)[0-9]+$/\1${iPCM}/" jobPCM${iPCM}.slurm
    173173            sed -i "s/^k=[0-9]\+$/k=$(echo "$i + 2 - $nPCM_ini" | bc -l)/" jobPCM${iPCM}.slurm
    174174            jobID=$(sbatch --parsable --dependency=afterok:${jobID} jobPCM${iPCM}.slurm)
     
    186186    if [ $i_myear -lt $n_myear ]; then
    187187        echo "Run PEM $iPEM"
    188         sed -i "s/#SBATCH --job-name=jobPEM.*/#SBATCH --job-name=jobPEM${iPEM}/" jobPEM.slurm
     188        sed -i -E "s/(#SBATCH --job-name=[^0-9]*[0-9]*[^0-9]*)[0-9]+$/\1${iPEM}/" jobPEM.slurm
    189189        jobID=$(sbatch --parsable jobPEM.slurm)
    190190        # Create a file to cancel the dependent jobs of the cycle
     
    207207    if [ $i_myear -lt $n_myear ]; then
    208208        echo "Run PEM $iPEM"
    209         sed -i "s/#SBATCH --job-name=jobPEM.*/#SBATCH --job-name=jobPEM${iPEM}/" jobPEM.slurm
     209        sed -i -E "s/(#SBATCH --job-name=[^0-9]*[0-9]*[^0-9]*)[0-9]+$/\1${iPEM}/" jobPEM.slurm
    210210        jobID=$(sbatch --parsable --dependency=afterok:${jobID} jobPEM.slurm)
    211211        echo "scancel" $jobID >> kill_launchPEM.sh
  • trunk/LMDZ.COMMON/libf/evolution/info_PEM_mod.F90

    r3349 r3387  
    3333
    3434!----- Code
    35 inquire(file = 'info_PEM.txt', exist = ok)
     35inquire(file = 'info_PEM.txt',exist = ok)
    3636if (ok) then
    3737    write(ich1,'(i0)') i_myear
  • trunk/LMDZ.COMMON/libf/evolution/pem.F90

    r3386 r3387  
    307307        error stop 'pem: command execution not supported!'
    308308    endif
    309     ! Assume 'chtimelimit' format is "D-HH:MM:SS" or "HH:MM:SS"
    310     if (index(chtimelimit,'-') > 0) then
     309    if (index(chtimelimit,'-') > 0) then ! 'chtimelimit' format is "D-HH:MM:SS"
    311310        read(chtimelimit, '(i1,a1,i2,a1,i2,a1,i2)') days, sep, hours, sep, minutes, sep, seconds
    312311        timelimit = days*86400 + hours*3600 + minutes*60 + seconds
    313     else
    314         read(chtimelimit,'(i2,a1,i2,a1,i2)') hours, sep, minutes, sep, seconds
     312    else if (index(chtimelimit,':') > 0 .and. len_trim(chtimelimit) > 5) then ! 'chtimelimit' format is "HH:MM:SS"
     313        read(chtimelimit, '(i2,a1,i2,a1,i2)') hours, sep, minutes, sep, seconds
    315314        timelimit = hours*3600 + minutes*60 + seconds
     315    else ! 'chtimelimit' format is "MM:SS"
     316        read(chtimelimit,'(i2,a1,i2)') minutes, sep, seconds
     317        timelimit = minutes*60 + seconds
    316318    endif
    317319endif
     
    343345#ifndef CPP_1D
    344346    dtphys = daysec/48. ! Dummy value (overwritten in phyetat0)
    345     day_step = steps_per_sol
    346347    call conf_gcm(99,.true.)
    347348    call infotrac_init
     
    350351    allocate(longitude(ngrid),latitude(ngrid),cell_area(ngrid))
    351352#else
     353    day_step = steps_per_sol
    352354    allocate(q(1,llm,nqtot))
    353355    allocate(longitude(1),latitude(1),cell_area(1))
     
    724726endif
    725727
    726 do while (year_iter < year_iter_max .and. i_myear < n_myear)
     728do while (year_iter < 10000)
    727729! II.a.1. Compute updated global pressure
    728730    write(*,*) "Recomputing the new pressure..."
     
    996998!------------------------
    997999    call system_clock(c2)
    998     if (timelimit - real((c2 - c1)/cr) <= antetime) stopPEM = 7
     1000    if (real((c2 - c1)/cr) >= timelimit - antetime) stopPEM = 7
    9991001    call stopping_crit_h2o_ice(cell_area,h2oice_ini_surf,ini_h2oice_sublim,h2o_ice,stopPEM,ngrid)
    10001002    call stopping_crit_co2(cell_area,co2ice_ini_surf,ini_co2ice_sublim,co2_ice,stopPEM,ngrid,global_avg_press_PCM,global_avg_press_new,nslope)
Note: See TracChangeset for help on using the changeset viewer.