1 | #!/bin/bash |
---|
2 | #SBATCH --nodes=6 #A |
---|
3 | #SBATCH --ntasks-per-node=4 #B |
---|
4 | #SBATCH --cpus-per-task=5 #C |
---|
5 | #SBATCH -J clim |
---|
6 | #SBATCH --time=13:00:00 |
---|
7 | #SBATCH --output run_month1.%j.out |
---|
8 | ##SBATCH --mem=8GB |
---|
9 | #SBATCH --constraint=[BDW28] |
---|
10 | #SBATCH --exclusive |
---|
11 | |
---|
12 | ## Script to run chained simulations on Occigen |
---|
13 | ## (uses script "run0" and reference file "run.def.ref") |
---|
14 | ## Set values of "num_now" and "num_end" in the script below |
---|
15 | ## to set initial month # and final month # of the simulation |
---|
16 | |
---|
17 | # source the environment (you might need to adapt this path to your case) |
---|
18 | source ../trunk/LMDZ.COMMON/arch/arch-X64_OCCIGEN.env |
---|
19 | |
---|
20 | set -xv |
---|
21 | ls -al |
---|
22 | |
---|
23 | ## set starting month and ending month below: |
---|
24 | num_now=1 |
---|
25 | num_end=12 |
---|
26 | (( num_previous = $num_now - 1 )) |
---|
27 | |
---|
28 | echo "$num_previous" > num_run |
---|
29 | # next month number |
---|
30 | (( num_next = $num_now + 1 )) |
---|
31 | # true (i.e. modulo 12) month number |
---|
32 | (( true_num = $num_now % 12 )) |
---|
33 | |
---|
34 | \rm -f error; touch error |
---|
35 | |
---|
36 | # environment setup for OpenMP: |
---|
37 | export I_MPI_DOMAIN=auto |
---|
38 | export I_MPI_PIN_RESPECT_CPUSET=0 |
---|
39 | #Make sure that OMP_NUM_THREADS = cpus-per-task * KMP_HW_SUBSET |
---|
40 | export KMP_HW_SUBSET=1T |
---|
41 | export OMP_NUM_THREADS=5 #C |
---|
42 | export OMP_STACKSIZE=400M |
---|
43 | export KMP_AFFINITY=granularity=fine,compact,1,0,verbose |
---|
44 | |
---|
45 | case $true_num in |
---|
46 | 1 ) sed s/9999/61/ run.def.ref > run.def ; run0 >> error ;; #1 |
---|
47 | 2 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;; #2 |
---|
48 | 3 ) sed s/9999/66/ run.def.ref > run.def ; run0 >> error ;; #3 |
---|
49 | 4 ) sed s/9999/65/ run.def.ref > run.def ; run0 >> error ;; #4 |
---|
50 | 5 ) sed s/9999/60/ run.def.ref > run.def ; run0 >> error ;; #5 |
---|
51 | 6 ) sed s/9999/54/ run.def.ref > run.def ; run0 >> error ;; #6 |
---|
52 | 7 ) sed s/9999/50/ run.def.ref > run.def ; run0 >> error ;; #7 |
---|
53 | 8 ) sed s/9999/46/ run.def.ref > run.def ; run0 >> error ;; #8 |
---|
54 | 9 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;; #9 |
---|
55 | 10 ) sed s/9999/47/ run.def.ref > run.def ; run0 >> error ;; #10 |
---|
56 | 11 ) sed s/9999/51/ run.def.ref > run.def ; run0 >> error ;; #11 |
---|
57 | 0 ) sed s/9999/56/ run.def.ref > run.def ; run0 >> error ;; #12 |
---|
58 | * ) echo "error" ;; |
---|
59 | esac |
---|
60 | |
---|
61 | # launch job for next month |
---|
62 | if (( $num_next <= $num_end )) ; then |
---|
63 | cp -f run_month$num_now tmp |
---|
64 | sed -e "s@run_month${num_now}@run_month${num_next}@" \ |
---|
65 | -e "s@num_now=${num_now}@num_now=${num_next}@" tmp > run_month$num_next |
---|
66 | rm tmp |
---|
67 | |
---|
68 | sbatch run_month$num_next |
---|
69 | fi |
---|
70 | |
---|