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