Changeset 3556 for trunk/LMDZ.COMMON/libf/evolution/deftank
- Timestamp:
- Dec 17, 2024, 12:15:17 PM (16 months ago)
- Location:
- trunk/LMDZ.COMMON/libf/evolution/deftank
- Files:
-
- 4 edited
-
PCMrun.job (modified) (2 diffs)
-
README (modified) (1 diff)
-
launchPEM.sh (modified) (5 diffs)
-
lib_launchPEM.sh (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/deftank/PCMrun.job
r3518 r3556 32 32 33 33 # Running the PCM 34 read i_myear n_myear convert_years iPCM iPEM nPCM nPCM_ini < info_PEM.txt 34 35 echo "Run PCM $iPCM is starting." 35 read i_myear n_myear convert_years iPCM iPEM nPCM nPCM_ini < info_PEM.txt36 36 cp run_PCM.def run.def 37 37 eval "$exe_cmd > out_runPCM${iPCM} 2>&1" 38 38 if [ ! -f "restartfi.nc" ] || ! (tail -n 100 out_runPCM${iPCM} | grep -iq "everything is cool!"); then # Check if it ended abnormally 39 39 echo "Error: the run PCM $iPCM crashed!" 40 echo "Be careful: there may be dependent jobs remaining in the SLURM queue with status 'DependencyNeverSatisfied'! You can cancel them by executing the script \"kill_launchPEM.sh\"." 40 if [ $mode -ne 0 ]; then 41 echo "Be careful: there may be dependent jobs remaining in the SLURM queue with status 'DependencyNeverSatisfied'! You can cancel them by executing the script \"kill_launchPEM.sh\"." 42 fi 41 43 exit 1 42 44 fi … … 70 72 fi 71 73 ((iPCM++)) 72 ((i_myear++)) 74 if [ $counting -ne 0 ]; then 75 i_myear=$(echo "$i_myear + 1." | bc -l) 76 fi 73 77 sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt -
trunk/LMDZ.COMMON/libf/evolution/deftank/README
r3498 r3556 7 7 (ii) nPCM_ini -> the number of initial PCM runs (at least 2); 8 8 (iii) nPCM -> the number of PCM runs between each PEM run (usually 2); 9 (iv) mode -> the launching 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 a supercomputer. 9 (iv) counting -> the counting method for the number of years to be simulated (0 = "only PEM runs count"; any other values = "PCM runs are taken into account"). The former option is the PEM default use; 10 (v) mode -> the launching 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 a supercomputer. 10 11 The script can take an argument: 11 12 - If there is no argument, then the script initiates a PEM simulation from scratch. -
trunk/LMDZ.COMMON/libf/evolution/deftank/launchPEM.sh
r3537 r3556 23 23 nPCM=2 24 24 25 # Set the counting method for the number of years to be simulated (0 = "only PEM runs count"; any other values = "PCM runs are taken into account"): 26 counting=0 27 25 28 # Set the launching 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 a supercomputer: 26 29 mode=1 … … 38 41 39 42 source lib_launchPEM.sh 43 export counting mode 40 44 41 45 if [ $# -eq 0 ]; then … … 48 52 checklaunch 49 53 initlaunch 50 cyclelaunch $mode $ nPCM_ini54 cyclelaunch $mode $counting $nPCM_ini 51 55 52 56 else … … 61 65 fi 62 66 read i_myear n_myear convert_years iPCM iPEM nPCM nPCM_ini < info_PEM.txt 63 cyclelaunch $mode $ nPCM67 cyclelaunch $mode $counting $nPCM 64 68 65 69 # Starting a relaunch … … 122 126 fi 123 127 if [ $relaunch = "PCM" ]; then 124 relaunchPCM $mode 128 relaunchPCM $mode $counting 125 129 else 126 relaunchPEM $mode 130 relaunchPEM $mode $counting 127 131 fi 128 132 -
trunk/LMDZ.COMMON/libf/evolution/deftank/lib_launchPEM.sh
r3538 r3556 160 160 # To submit the PCM runs 161 161 # arg1: launching mode 162 # arg2: number of PCM runs to launch 163 # arg3: local number of the PCM run from which to start (optional) 162 # arg2: counting method 163 # arg3: number of PCM runs to launch 164 # arg4: local number of the PCM run from which to start (optional) 164 165 submitPCM() { 165 166 find . -type f -name "PCMrun*.job" ! -name "PCMrun.job" -delete 166 167 ii=1 167 if [ ! -z $ 3]; then168 ii=$ 3168 if [ ! -z $4 ]; then 169 ii=$4 169 170 fi 170 171 if [ $(echo "$i_myear < $n_myear" | bc -l) -eq 1 ]; then 171 echo "Run PCM $iPCM: call $ii/$ 2..."172 echo "Run PCM $iPCM: call $ii/$3..." 172 173 if [ $1 -eq 0 ]; then # Mode: processing scripts 173 174 sed -i "s/^k=[0-9]\+$/k=$(echo "3 - $nPCM_ini" | bc)/" PCMrun.job … … 187 188 fi 188 189 ((iPCM++)) 189 i_myear=$(echo "$i_myear + 1." | bc -l) 190 if [ $2 -ne 0 ]; then # Counting: PCM runs taken into account 191 i_myear=$(echo "$i_myear + 1." | bc -l) 192 fi 190 193 ((ii++)) 191 194 else 192 195 endlaunch 193 196 fi 194 for ((i = $ii; i <= $ 2; i++)); do197 for ((i = $ii; i <= $3; i++)); do 195 198 if [ $(echo "$i_myear < $n_myear" | bc -l) -eq 1 ]; then 196 echo "Run PCM $iPCM: call $i/$ 2..."199 echo "Run PCM $iPCM: call $i/$3..." 197 200 if [ $1 -eq 0 ]; then # Mode: processing scripts 198 201 sed -i "s/^k=[0-9]\+$/k=$(echo "$i + 2 - $nPCM_ini" | bc)/" PCMrun.job … … 209 212 fi 210 213 ((iPCM++)) 211 i_myear=$(echo "$i_myear + 1." | bc -l) 214 if [ $2 -ne 0 ]; then # Counting: PCM runs taken into account 215 i_myear=$(echo "$i_myear + 1." | bc -l) 216 fi 212 217 else 213 218 endlaunch … … 241 246 # To make one cycle of PCM and PEM runs 242 247 # arg1: launching mode 243 # arg2: number of PCM runs to launch 244 # arg3: local number of the PCM run from which to start (optional) 248 # arg2: counting method 249 # arg3: number of PCM runs to launch 250 # arg4: local number of the PCM run from which to start (optional) 245 251 cyclelaunch() { 246 252 # PCM runs 247 submitPCM $1 $2 $3 253 submitPCM $1 $2 $3 $4 248 254 249 255 # PEM run … … 292 298 # To relaunch from PCM run 293 299 # arg1: launching mode 300 # arg2: counting method 294 301 relaunchPCM() { 295 302 iPCM=$(($irelaunch + 1)) … … 310 317 # PCM relaunch during the initialization cycle 311 318 iPEM=1 319 if [ $2 -ne 0 ]; then # Counting: PCM runs taken into account 320 i_myear=$irelaunch 321 else # Counting: only PEM runs count 322 i_myear=0 323 fi 324 sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt 312 325 cleanfiles diags/diagpem .nc $(($iPEM - 1)) 313 326 cleanfiles diags/diagsoilpem .nc $(($iPEM - 1)) … … 317 330 cleanfiles starts/restartfi_postPEM .nc $(($iPEM - 1)) 318 331 cleanfiles starts/restartpem .nc $(($iPEM - 1)) 319 i_myear=$irelaunch320 sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt321 332 rm -f startpem.nc 322 333 if [ $irelaunch -eq $(($nPCM_ini - 1)) ]; then 323 334 cp diags/data2reshape${irelaunch}.nc data2reshape_Y1.nc 324 cyclelaunch $1 $ nPCM_ini $iPCM335 cyclelaunch $1 $2 $nPCM_ini $iPCM 325 336 elif [ $irelaunch -eq $nPCM_ini ]; then 326 337 cp diags/data2reshape$(($irelaunch - 1)).nc data2reshape_Y1.nc … … 328 339 submitPEM $1 # The next job is a PEM run 329 340 else 330 cyclelaunch $1 $ nPCM_ini $iPCM341 cyclelaunch $1 $2 $nPCM_ini $iPCM 331 342 fi 332 343 else … … 334 345 iPEM=$(echo "($iPCM - $nPCM_ini)/$nPCM + 1" | bc) 335 346 il=$(echo "($irelaunch - $nPCM_ini + 1)%$nPCM + 1" | bc) 347 if [ $2 -ne 0 ]; then # Counting: PCM runs taken into account 348 i_myear=$(($(awk "NR==$iPEM {print \$3}" "info_PEM.txt") + $il)) 349 else # Counting: only PEM runs count 350 i_myear=$(awk "NR==$iPEM {print \$3}" "info_PEM.txt") 351 fi 352 sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt 336 353 cleanfiles diags/diagpem .nc $(($iPEM - 1)) 337 354 cleanfiles diags/diagsoilpem .nc $(($iPEM - 1)) … … 343 360 cp starts/restartpem$(($iPEM - 1)).nc startpem.nc 344 361 if [ $il -eq $(($nPCM - 1)) ]; then # Second to last PCM run 345 i_myear=$(($(awk "NR==$iPEM {print \$1}" "info_PEM.txt") + $il))346 sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt347 362 cp diags/data2reshape${irelaunch}.nc data2reshape_Y1.nc 348 cyclelaunch $1 $ nPCM $il363 cyclelaunch $1 $2 $nPCM $il 349 364 elif [ $il -eq $nPCM ]; then # Last PCM run so the next job is a PEM run 350 i_myear=$(($(awk "NR==$iPEM {print \$1}" "info_PEM.txt") + $nPCM))351 sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt352 365 cp diags/data2reshape$(($irelaunch - 1)).nc data2reshape_Y1.nc 353 366 cp diags/data2reshape${irelaunch}.nc data2reshape_Y2.nc 354 367 submitPEM $1 355 368 else 356 i_myear=$(($(awk "NR==$iPEM {print \$1}" "info_PEM.txt") + $il)) 357 sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt 358 cyclelaunch $1 $nPCM $il 369 cyclelaunch $1 $2 $nPCM $il 359 370 fi 360 371 fi … … 363 374 # To relaunch from PEM run 364 375 # arg1: launching mode 376 # arg2: counting method 365 377 relaunchPEM() { 366 378 iPEM=$(echo "$irelaunch + 1" | bc) 367 379 iPCM=$(echo "$nPCM_ini + $nPCM*($irelaunch - 1) + 1" | bc) 368 i_myear=$(awk "NR==$(($iPEM + 1)) {print \$ 1}" "info_PEM.txt")380 i_myear=$(awk "NR==$(($iPEM + 1)) {print \$3}" "info_PEM.txt") 369 381 sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt 370 382 cleanfiles diags/diagfi .nc $(($iPCM - 1)) … … 389 401 cp starts/restart1D_postPEM${irelaunch}.txt start1D.txt 390 402 fi 391 cyclelaunch $1 $ nPCM392 } 403 cyclelaunch $1 $2 $nPCM 404 }
Note: See TracChangeset
for help on using the changeset viewer.
