1 | #!/bin/bash |
---|
2 | # |
---|
3 | # BENCH launching scripts for beaufix, Meteo-France |
---|
4 | # and curie, TGCC |
---|
5 | # To be modified for other machines |
---|
6 | # |
---|
7 | set -u |
---|
8 | set -vx |
---|
9 | # |
---|
10 | cores=$1 |
---|
11 | ncore_node=$2 |
---|
12 | resolution=$3 |
---|
13 | machine=$( hostname | sed -e "s/[0-9]*//g" ) |
---|
14 | ###################################################################### |
---|
15 | # |
---|
16 | # number of processes for each executable |
---|
17 | nproc_exe1=$( echo $cores | bc ) |
---|
18 | (( nproc = $nproc_exe1 )) |
---|
19 | (( nnode = $nproc / $ncore_node )) |
---|
20 | [ $nnode -lt 1 ] && nnode=1 |
---|
21 | |
---|
22 | nproc5=$( printf "%05d\n" ${nproc_exe1} ) |
---|
23 | |
---|
24 | if [ "$machine" == "beaufixlogin" ] |
---|
25 | then |
---|
26 | |
---|
27 | cat > Log/run_bench << EOF |
---|
28 | #!/bin/bash |
---|
29 | #SBATCH --time=00:1:00 |
---|
30 | #SBATCH -p normal64 # partition/queue |
---|
31 | #SBATCH --job-name=bench # job name |
---|
32 | #SBATCH -N $nnode # number of nodes |
---|
33 | #SBATCH -n $nproc # number of procs |
---|
34 | #SBATCH -o /scratch/work/cglo315/ESIWACE/dev_r9759_HPC09_ESIWACE/tests/LBENCH_RN/EXP00/Log/job.out%j |
---|
35 | #SBATCH -e /scratch/work/cglo315/ESIWACE/dev_r9759_HPC09_ESIWACE/tests/LBENCH_RN/EXP00/Log/job.out%j |
---|
36 | #SBATCH --exclusive |
---|
37 | |
---|
38 | module unload intelmpi intel grib_api |
---|
39 | module load intel/16.1.150 intelmpi/5.1.2.150 |
---|
40 | |
---|
41 | itac=0 |
---|
42 | xpmpi=0 |
---|
43 | |
---|
44 | if [ \$xpmpi == 1 ]; then |
---|
45 | module load bullxde |
---|
46 | module load xPMPI/1.1_intelmpi |
---|
47 | fi |
---|
48 | |
---|
49 | [ \$itac == 1 ] && module load itac/2017.2.028 |
---|
50 | |
---|
51 | set -vx |
---|
52 | |
---|
53 | cd \${TMPDIR} |
---|
54 | cp /scratch/work/cglo315/ESIWACE/dev_r9759_HPC09_ESIWACE/tests/LBENCH_RN/EXP00/* . |
---|
55 | |
---|
56 | # Best decompositions BENCH-1 |
---|
57 | jpni=${cores/\**/} |
---|
58 | jpnj=${cores/?*\*/} |
---|
59 | |
---|
60 | sed -e "s/jpni *=.*/jpni = \${jpni}/" -e "s/jpnj *=.*/jpnj = \${jpnj}/" namelist_cfg_orca${resolution}_like > namelist_cfg |
---|
61 | |
---|
62 | export OMP_NUM_THREADS=1 |
---|
63 | ulimit -s unlimited |
---|
64 | # |
---|
65 | if [ \$itac == 1 ]; then |
---|
66 | source /opt/softs/intel/2017/update_1/itac_latest/bin/itacvars.sh |
---|
67 | time mpirun -ordered-output -prepend-rank -trace -np $nproc_exe1 ./nemo > jobout 2>joberr |
---|
68 | else |
---|
69 | time mpirun -ordered-output -prepend-rank -np $nproc_exe1 ./nemo > jobout_${resolution}_${nproc5} |
---|
70 | fi |
---|
71 | /opt/softs/bin/ja |
---|
72 | |
---|
73 | if [ \$xpmpi == 1 ]; then |
---|
74 | module unload xPMPI/1.1_intelmpi |
---|
75 | module unload bullxde |
---|
76 | fi |
---|
77 | # |
---|
78 | EOF |
---|
79 | |
---|
80 | |
---|
81 | ###################################################################### |
---|
82 | ### |
---|
83 | ### 4. Execute the model |
---|
84 | |
---|
85 | echo 'Submitting the job to queue using sbatch' |
---|
86 | sbatch Log/run_bench |
---|
87 | squeue -u cglo315 |
---|
88 | |
---|
89 | echo 'is executed or submitted to queue.' |
---|
90 | |
---|
91 | ###################################################################### |
---|
92 | |
---|
93 | fi |
---|
94 | |
---|
95 | if [ "$machine" == "curie" ] |
---|
96 | then |
---|
97 | |
---|
98 | case ${resolution} in |
---|
99 | "1") |
---|
100 | if [ $nproc_exe1 -lt 50 ] |
---|
101 | then |
---|
102 | timejob=3600 |
---|
103 | else |
---|
104 | timejob=1800 |
---|
105 | fi |
---|
106 | ;; |
---|
107 | "025") |
---|
108 | if [ $nproc_exe1 -lt 50 ] |
---|
109 | then |
---|
110 | timejob=15000 |
---|
111 | elif [ $nproc_exe1 -lt 100 ] |
---|
112 | then |
---|
113 | timejob=7000 |
---|
114 | elif [ $nproc_exe1 -lt 200 ] |
---|
115 | then |
---|
116 | timejob=3600 |
---|
117 | else |
---|
118 | timejob=1800 |
---|
119 | fi |
---|
120 | ;; |
---|
121 | "12") |
---|
122 | if [ $nproc_exe1 -lt 200 ] |
---|
123 | then |
---|
124 | timejob=36000 |
---|
125 | elif [ $nproc_exe1 -lt 400 ] |
---|
126 | then |
---|
127 | timejob=20000 |
---|
128 | elif [ $nproc_exe1 -lt 800 ] |
---|
129 | then |
---|
130 | timejob=10000 |
---|
131 | elif [ $nproc_exe1 -lt 1600 ] |
---|
132 | then |
---|
133 | timejob=5000 |
---|
134 | elif [ $nproc_exe1 -lt 3200 ] |
---|
135 | then |
---|
136 | timejob=3600 |
---|
137 | else |
---|
138 | timejob=1800 |
---|
139 | fi |
---|
140 | ;; |
---|
141 | esac |
---|
142 | |
---|
143 | |
---|
144 | jobname=$HOME/binrun/jobbench |
---|
145 | cat > $jobname << EOF |
---|
146 | #!/bin/bash |
---|
147 | #MSUB -r jobbench${nproc5} |
---|
148 | #MSUB -n ${nproc_exe1} |
---|
149 | #MSUB -T $timejob |
---|
150 | #MSUB -e bench_${resolution}_${nproc5}_%I.eo |
---|
151 | #MSUB -o bench_${resolution}_${nproc5}_%I.eo |
---|
152 | #MSUB -j oe |
---|
153 | #MSUB -x |
---|
154 | #MSUB -q standard |
---|
155 | #MSUB -A gen6895 |
---|
156 | #========================================== |
---|
157 | set -u |
---|
158 | # |
---|
159 | |
---|
160 | cd \${BRIDGE_MSUB_PWD}/.. |
---|
161 | |
---|
162 | rsync -av --exclude="*eo" EXPREF/ EXP_${resolution}_${nproc5}/ |
---|
163 | rsync -av EXP00/nemo EXP_${resolution}_${nproc5}/nemo |
---|
164 | cd EXP_${resolution}_${nproc5}/ |
---|
165 | |
---|
166 | jpni=${cores/\**/} |
---|
167 | jpnj=${cores/?*\*/} |
---|
168 | |
---|
169 | sed -e "s/jpni *=.*/jpni = \${jpni}/" -e "s/jpnj *=.*/jpnj = \${jpnj}/" namelist_cfg_orca${resolution}_like > namelist_cfg |
---|
170 | |
---|
171 | time ccc_mprun -n \${BRIDGE_MSUB_NPROC} ./nemo > jobout_${resolution}_${nproc5} |
---|
172 | |
---|
173 | EOF |
---|
174 | |
---|
175 | ccc_msub $jobname |
---|
176 | |
---|
177 | fi |
---|