source: trunk/LMDZ.COMMON/libf/evolution/deftank/PCMrun.job @ 3579

Last change on this file since 3579 was 3579, checked in by jbclement, 2 weeks ago

PEM:
Improvement of the Bash script tools in the deftank with an automatic error detection which ends the script with a message.
JBC

  • Property svn:executable set to *
File size: 2.6 KB
RevLine 
[3349]1#!/bin/bash
2#SBATCH --job-name=jobPCM0
3#SBATCH --account=cin0391
4### GENOA nodes accommodate 96 cores
5#SBATCH --constraint=GENOA
6### Number of Nodes to use
7#SBATCH --nodes=1
[3351]8#SBATCH --ntasks-per-node=24
[3349]9#SBATCH --cpus-per-task=4
10#SBATCH --threads-per-core=1 # --hint=nomultithread
11###SBATCH --exclusive
[3403]12#SBATCH --output=jobPCM_%j.out
[3416]13#SBATCH --time=10:00:00
[3349]14
[3579]15########################################################################
16# Modify here the parameters depending on your setup
17####################################################
[3351]18# Path to the arch.env to source:
[3349]19source ../trunk/LMDZ.COMMON/arch.env
20
[3403]21# Number of threads to use (must be the same as "#SBATCH --cpus-per-task=" above)
22export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
[3349]23export OMP_STACKSIZE=400M
24
[3351]25# Name of executable for the PCM:
26exePCM="gcm_64x48x32_phymars_para.e"
[3495]27
28# Execution command:
[3518]29exe_cmd="srun --cpu-bind=threads --label -c${OMP_NUM_THREADS:=1} $exePCM"
[3351]30########################################################################
31
[3403]32
33ulimit -s unlimited
34
[3354]35# Running the PCM
[3556]36read i_myear n_myear convert_years iPCM iPEM nPCM nPCM_ini < info_PEM.txt
[3351]37echo "Run PCM $iPCM is starting."
[3349]38cp run_PCM.def run.def
[3518]39eval "$exe_cmd > out_runPCM${iPCM} 2>&1"
[3495]40if [ ! -f "restartfi.nc" ] || ! (tail -n 100 out_runPCM${iPCM} | grep -iq "everything is cool!"); then # Check if it ended abnormally
[3349]41    echo "Error: the run PCM $iPCM crashed!"
[3556]42    if [ $mode -ne 0 ]; then
43        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\"."
44    fi
[3349]45    exit 1
46fi
[3354]47
[3349]48# Copy data files and prepare the next run
49mv out_runPCM${iPCM} out_PCM/run${iPCM}
[3386]50if [ -f "diagfi.nc" ]; then
51    mv diagfi.nc diags/diagfi${iPCM}.nc
52fi
[3349]53if [ -f "diagsoil.nc" ]; then
54    mv diagsoil.nc diags/diagsoil${iPCM}.nc
55fi
56if [ -f "stats.nc" ]; then
57    mv stats.nc diags/stats${iPCM}.nc
58fi
59k=0
60if [ $(echo "$k < 1" | bc -l) -eq 1 ]; then # Only the last 2 years are taken for the PEM
61    mv Xdiurnalave.nc diags/data2reshape${iPCM}.nc
62else
63    cp Xdiurnalave.nc diags/data2reshape${iPCM}.nc
64    mv Xdiurnalave.nc data2reshape_Y${k}.nc
65fi
66cp restartfi.nc starts/restartfi${iPCM}.nc
67mv restartfi.nc startfi.nc
68if [ -f "restart.nc" ]; then
69    cp restart.nc starts/restart${iPCM}.nc
70    mv restart.nc start.nc
71elif [ -f "restart1D.txt" ]; then
72    cp restart1D.txt starts/restart1D${iPCM}.txt
73    mv restart1D.txt start1D.txt
74fi
75((iPCM++))
[3556]76if [ $counting -ne 0 ]; then
77    i_myear=$(echo "$i_myear + 1." | bc -l)
78fi
[3349]79sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt
Note: See TracBrowser for help on using the repository browser.