source: trunk/LMDZ.MARS/deftank/adastra/run_month1 @ 3817

Last change on this file since 3817 was 3817, checked in by emillour, 2 days ago

Mars PCM:
Move adastra_cpu_binding.sh to "adastra" subforlder of deftank.
And adapt scripts and README there.
EM

File size: 2.8 KB
Line 
1#!/bin/bash
2#SBATCH --job-name=run_month1
3#SBATCH --account=cin0391
4#SBATCH --constraint=GENOA
5#SBATCH --nodes=1
6#SBATCH --ntasks-per-node=24
7#SBATCH --cpus-per-task=8
8#SBATCH --threads-per-core=1 # --hint=nomultithread
9#SBATCH --exclusive
10#SBATCH --output=run_month1_%A.out
11#SBATCH --time=01:25:00
12
13## Script to run chained simulations
14## (uses script "run0" and reference file "run.def.ref")
15## Set values of "num_now" and "num_end" in the script below
16## to set initial month # and final month # of the simulation
17
18# A few parameters that might need be changed depending on your setup:
19# Path to the arch.env to source
20source ../trunk/LMDZ.COMMON/arch.env
21# Number of threads to use (must be the same as "#SBATCH --cpus-per-task=" above)
22export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
23export OMP_STACKSIZE=400M
24#
25########################################################################
26set -exv
27ls -al
28trap 'echo -e "Error at line $LINENO!"' ERR
29
30# Set starting month and ending month below:
31num_now=1
32num_end=12
33num_previous=$(( num_now - 1 ))
34
35echo "$num_previous" > num_run
36# next month number
37num_next=$(( num_now + 1 ))
38# true (i.e. modulo 12) month number
39true_num=$(( num_now % 12 ))
40
41# Check if required files exist
42\rm -f  error; touch error
43
44if [ ! -f run.def.ref ]; then
45  echo "Error: file \"run.def.ref\" not found in current directory!" > error
46  exit 1
47fi
48
49if [ ! -x run0 ]; then
50  echo "Error: file \"run0\" not found or not executable in current directory!" > error
51  exit 1
52fi
53
54if [ ! -f run_month$num_now ]; then
55  echo "Error: file \"run_month${num_now}\" not found in current directory!" > error
56  exit 1
57fi
58
59# Run model depending on current month
60case $true_num in
61  1 ) sed s/9999/61/ run.def.ref > run.def ; ./run0 >> error ;;    #1
62  2 ) sed s/9999/66/ run.def.ref > run.def ; ./run0 >> error ;;    #2
63  3 ) sed s/9999/66/ run.def.ref > run.def ; ./run0 >> error ;;    #3
64  4 ) sed s/9999/65/ run.def.ref > run.def ; ./run0 >> error ;;    #4
65  5 ) sed s/9999/60/ run.def.ref > run.def ; ./run0 >> error ;;    #5
66  6 ) sed s/9999/54/ run.def.ref > run.def ; ./run0 >> error ;;    #6
67  7 ) sed s/9999/50/ run.def.ref > run.def ; ./run0 >> error ;;    #7
68  8 ) sed s/9999/46/ run.def.ref > run.def ; ./run0 >> error ;;    #8
69  9 ) sed s/9999/47/ run.def.ref > run.def ; ./run0 >> error ;;    #9
70 10 ) sed s/9999/47/ run.def.ref > run.def ; ./run0 >> error ;;    #10
71 11 ) sed s/9999/51/ run.def.ref > run.def ; ./run0 >> error ;;    #11
72  0 ) sed s/9999/56/ run.def.ref > run.def ; ./run0 >> error ;;    #12
73  * ) echo "Error: Invalid value of true_num ($true_num)" ; exit 1 ;;
74esac
75
76# Launch job for next month
77if (( num_next <= num_end )) ; then
78  cp -f run_month$num_now tmp
79  sed -e "s@run_month${num_now}@run_month${num_next}@" \
80      -e "s@num_now=${num_now}@num_now=${num_next}@" tmp > run_month$num_next
81  rm tmp
82  sbatch run_month$num_next
83fi
Note: See TracBrowser for help on using the repository browser.