[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 | |
---|
[3351] | 15 | # A few parameters that might need to be changed depending on your setup |
---|
| 16 | # Path to the arch.env to source: |
---|
[3349] | 17 | source ../trunk/LMDZ.COMMON/arch.env |
---|
| 18 | |
---|
[3403] | 19 | # Number of threads to use (must be the same as "#SBATCH --cpus-per-task=" above) |
---|
| 20 | export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK |
---|
[3349] | 21 | export OMP_STACKSIZE=400M |
---|
| 22 | |
---|
[3351] | 23 | # Name of executable for the PCM: |
---|
| 24 | exePCM="gcm_64x48x32_phymars_para.e" |
---|
[3495] | 25 | |
---|
| 26 | # Execution command: |
---|
[3518] | 27 | exe_cmd="srun --cpu-bind=threads --label -c${OMP_NUM_THREADS:=1} $exePCM" |
---|
[3351] | 28 | ######################################################################## |
---|
| 29 | |
---|
[3403] | 30 | |
---|
| 31 | ulimit -s unlimited |
---|
| 32 | |
---|
[3354] | 33 | # Running the PCM |
---|
[3351] | 34 | echo "Run PCM $iPCM is starting." |
---|
[3349] | 35 | read i_myear n_myear convert_years iPCM iPEM nPCM nPCM_ini < info_PEM.txt |
---|
| 36 | cp run_PCM.def run.def |
---|
[3518] | 37 | eval "$exe_cmd > out_runPCM${iPCM} 2>&1" |
---|
[3495] | 38 | if [ ! -f "restartfi.nc" ] || ! (tail -n 100 out_runPCM${iPCM} | grep -iq "everything is cool!"); then # Check if it ended abnormally |
---|
[3349] | 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\"." |
---|
| 41 | exit 1 |
---|
| 42 | fi |
---|
[3354] | 43 | |
---|
[3349] | 44 | # Copy data files and prepare the next run |
---|
| 45 | mv out_runPCM${iPCM} out_PCM/run${iPCM} |
---|
[3386] | 46 | if [ -f "diagfi.nc" ]; then |
---|
| 47 | mv diagfi.nc diags/diagfi${iPCM}.nc |
---|
| 48 | fi |
---|
[3349] | 49 | if [ -f "diagsoil.nc" ]; then |
---|
| 50 | mv diagsoil.nc diags/diagsoil${iPCM}.nc |
---|
| 51 | fi |
---|
| 52 | if [ -f "stats.nc" ]; then |
---|
| 53 | mv stats.nc diags/stats${iPCM}.nc |
---|
| 54 | fi |
---|
| 55 | k=0 |
---|
| 56 | if [ $(echo "$k < 1" | bc -l) -eq 1 ]; then # Only the last 2 years are taken for the PEM |
---|
| 57 | mv Xdiurnalave.nc diags/data2reshape${iPCM}.nc |
---|
| 58 | else |
---|
| 59 | cp Xdiurnalave.nc diags/data2reshape${iPCM}.nc |
---|
| 60 | mv Xdiurnalave.nc data2reshape_Y${k}.nc |
---|
| 61 | fi |
---|
| 62 | cp restartfi.nc starts/restartfi${iPCM}.nc |
---|
| 63 | mv restartfi.nc startfi.nc |
---|
| 64 | if [ -f "restart.nc" ]; then |
---|
| 65 | cp restart.nc starts/restart${iPCM}.nc |
---|
| 66 | mv restart.nc start.nc |
---|
| 67 | elif [ -f "restart1D.txt" ]; then |
---|
| 68 | cp restart1D.txt starts/restart1D${iPCM}.txt |
---|
| 69 | mv restart1D.txt start1D.txt |
---|
| 70 | fi |
---|
| 71 | ((iPCM++)) |
---|
| 72 | ((i_myear++)) |
---|
| 73 | sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt |
---|