1 | #!/bin/bash |
---|
2 | #SBATCH --ntasks-per-node=15 |
---|
3 | #SBATCH --cpus-per-task=4 |
---|
4 | #SBATCH --partition=zen4 # zen4: 64cores/node and 240GB of memory |
---|
5 | ##SBATCH --partition=zen16 # zen16: 32 cores/node core and 496GB of memory |
---|
6 | #SBATCH -J run_month1 |
---|
7 | #SBATCH --time=3:00:00 |
---|
8 | #SBATCH --output %x.%j.out |
---|
9 | |
---|
10 | # A few parameters that might need be changed depending on your setup: |
---|
11 | # Path to the arch.env to source |
---|
12 | source ../trunk/LMDZ.COMMON/arch.env |
---|
13 | |
---|
14 | # Number of threads to use (must be the same as "#MSUB -c" above) |
---|
15 | export OMP_NUM_THREADS=4 |
---|
16 | export OMP_STACKSIZE=400M |
---|
17 | |
---|
18 | set -xv |
---|
19 | ls -al |
---|
20 | |
---|
21 | ## set starting month and ending month below: |
---|
22 | num_now=1 |
---|
23 | num_end=12 |
---|
24 | (( num_previous = $num_now - 1 )) |
---|
25 | |
---|
26 | echo "$num_previous" > num_run |
---|
27 | # next month number |
---|
28 | (( num_next = $num_now + 1 )) |
---|
29 | # true (i.e. modulo 12) month number |
---|
30 | (( true_num = $num_now % 12 )) |
---|
31 | |
---|
32 | \rm -f error; touch error |
---|
33 | |
---|
34 | case $true_num in |
---|
35 | 1 ) sed s/9999/61/ run.def.ref > run.def ; run0 >> error ;; #1 |
---|
36 | 2 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;; #2 |
---|
37 | 3 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;; #3 |
---|
38 | 4 ) sed s/9999/65/ run.def.ref > run.def ; run0 >> error ;; #4 |
---|
39 | 5 ) sed s/9999/60/ run.def.ref > run.def ; run0 >> error ;; #5 |
---|
40 | 6 ) sed s/9999/54/ run.def.ref > run.def ; run0 >> error ;; #6 |
---|
41 | 7 ) sed s/9999/50/ run.def.ref > run.def ; run0 >> error ;; #7 |
---|
42 | 8 ) sed s/9999/46/ run.def.ref > run.def ; run0 >> error ;; #8 |
---|
43 | 9 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;; #9 |
---|
44 | 10 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;; #10 |
---|
45 | 11 ) sed s/9999/51/ run.def.ref > run.def ; run0 >> error ;; #11 |
---|
46 | 0 ) sed s/9999/56/ run.def.ref > run.def ; run0 >> error ;; #12 |
---|
47 | * ) echo "error" ;; |
---|
48 | esac |
---|
49 | |
---|
50 | # launch job for next month |
---|
51 | if (( $num_next <= $num_end )) ; then |
---|
52 | cp -f run_month$num_now tmp |
---|
53 | sed -e "s@run_month${num_now}@run_month${num_next}@" \ |
---|
54 | -e "s@num_now=${num_now}@num_now=${num_next}@" tmp > run_month$num_next |
---|
55 | rm tmp |
---|
56 | |
---|
57 | sbatch run_month$num_next |
---|
58 | fi |
---|