-
Notifications
You must be signed in to change notification settings - Fork 16
/
config_JURECA.ksh
executable file
·302 lines (256 loc) · 8.22 KB
/
config_JURECA.ksh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
#! /bin/ksh
getMachineDefaults(){
route "${cyellow}>> getMachineDefaults${cnormal}"
comment " init lmod functionality"
. /p/software/jurecadc/lmod/lmod/init/ksh >> $log_file 2>> $err_file
check
comment " source and load Modules on JURECA"
. $rootdir/bldsva/machines/loadenvs.$compiler >> $log_file 2>> $err_file
check
defaultMpiPath="$EBROOTPSMPI"
defaultNcdfPath="$EBROOTNETCDFMINFORTRAN"
if [[ $compiler == "Gnu" ]] ; then
defaultGrib1Path="/p/project/cslts/local/jureca/DWD-libgrib1_20110128_Gnu/lib/"
elif [[ $compiler == "Intel" ]] ; then
defaultGrib1Path="/p/project/cslts/local/jureca/DWD-libgrib1_20110128_Intel/lib/"
else
defaultGrib1Path="/p/project/cslts/local/jureca/DWD-libgrib1_20110128_Intel/lib/"
fi
defaultGribPath="$EBROOTECCODES"
defaultGribapiPath="$EBROOTECCODES"
defaultJasperPath="$EBROOTJASPER"
defaultTclPath="$EBROOTTCL"
defaultHyprePath="$EBROOTHYPRE"
defaultSiloPath="$EBROOTSILO"
defaultLapackPath="$EBROOTIMKL"
defaultPncdfPath="$EBROOTPARALLELMINNETCDF"
# Additional option for GPU compilation
gpuMpiSettings=
cuda_architectures=""
# Default Compiler/Linker optimization
if [[ $compiler == "Gnu" ]] ; then
defaultOptC="-O2" # Gnu
elif [[ $compiler == "Intel" ]] ; then
defaultOptC="-O2 -xHost" # Intel
else
defaultOptC="-O2" # Default
fi
profilingImpl=" no scalasca "
if [[ $profiling == "scalasca" ]] ; then ; profComp="" ; profRun="scalasca -analyse" ; profVar="" ;fi
# Default Processor settings
defaultwtime="01:00:00"
defaultQ="dc-cpu-devel"
route "${cyellow}<< getMachineDefaults${cnormal}"
}
finalizeMachine(){
route "${cyellow}>> finalizeMachine${cnormal}"
route "${cyellow}<< finalizeMachine${cnormal}"
}
# computes nodes based on number of processors and resources
computeNodes(){
processes=$1
resources=$2
echo $((processes%resources?processes/resources+1:processes/resources))
}
createRunscript(){
route "${cyellow}>> createRunscript${cnormal}"
comment " copy JURECA module load script into rundirectory"
cp $rootdir/bldsva/machines/loadenvs.$compiler $rundir/loadenvs
check
mpitasks=$((numInst * ($nproc_icon + $nproc_cos + $nproc_clm + $nproc_pfl + $nproc_oas)))
nnodes=`echo "scale = 2; $mpitasks / $nppn" | bc | perl -nl -MPOSIX -e 'print ceil($_);'`
#DA
if [[ $withPDAF == "true" ]] ; then
srun="srun -n $mpitasks ./tsmp-pdaf -n_modeltasks $(($numInst-$startInst)) -filtertype 2 -subtype 1 -delt_obs $delta_obs -rms_obs 0.03 -obs_filename swc_crp"
else
srun="srun --multi-prog slm_multiprog_mapping.conf"
fi
if [[ $processor == "GPU" || $processor == "MSA" ]]; then
nnode_cos=$((($nproc_cos)/$nppn))
nnode_clm=$((($nproc_clm)/$nppn))
nnode_pfl=$((($nproc_pfl)/$ngpn))
nnode_cos=$(computeNodes $nproc_cos $nppn)
nnode_clm=$(computeNodes $nproc_clm $nppn)
nnode_pfl=$(computeNodes $nproc_pfl $ngpn)
route "${cyellow}<< setting up heterogeneous/modular job${cnormal}"
comment " nppn=$nppn\t\t ngpn=$ngpn\n"
comment " Nproc: COSMO=$nproc_cos\tCLM=$nproc_clm\tPFL=$nproc_pfl\n"
comment " Nnode: COSMO=$nnode_cos\tCLM=$nnode_clm\tPFL=$nnode_pfl\n"
cat << EOF >> $rundir/tsmp_slm_run.bsh
#!/bin/bash
#SBATCH --account=slts
#SBATCH --job-name="TSMP_Hetero"
#SBATCH --output=hetro_job-out.%j
#SBATCH --error=hetro_job-err.%j
#SBATCH --time=$wtime
#SBATCH -N $nnode_cos --ntasks-per-node=$nppn -p dc-cpu-devel
#SBATCH hetjob
#SBATCH -N $nnode_clm --ntasks-per-node=$nppn -p dc-cpu-devel
#SBATCH hetjob
#SBATCH -N $nnode_pfl --ntasks-per-node=$ngpn --gres=gpu:$ngpn -p dc-gpu-devel
cd $rundir
source $rundir/loadenvs
export LD_LIBRARY_PATH="$rootdir/${mList[3]}_${platform}_${combination}/rmm/lib:\$LD_LIBRARY_PATH"
date
echo "started" > started.txt
rm -rf YU*
srun --het-group=0 ./lmparbin_pur :\\
--het-group=1 ./clm :\\
--het-group=2 ./parflow $pflrunname
date
echo "ready" > ready.txt
exit 0
EOF
else
cat << EOF >> $rundir/tsmp_slm_run.bsh
#!/bin/bash
#SBATCH --job-name="TSMP"
#SBATCH --nodes=$nnodes
#SBATCH --ntasks=$mpitasks
#SBATCH --ntasks-per-node=$nppn
#SBATCH --output=mpiMPMD-out.%j
#SBATCH --error=mpiMPMD-err.%j
#SBATCH --time=$wtime
#SBATCH --partition=$queue
#SBATCH --mail-type=NONE
#SBATCH --account=slts
export PSP_RENDEZVOUS_OPENIB=-1
cd $rundir
source $rundir/loadenvs
date
echo "started" > started.txt
rm -rf YU*
export $profVar
$srun
date
echo "ready" > ready.txt
exit 0
EOF
fi
counter=0
#for mapfile
start_oas=$counter
end_oas=$(($start_oas+$nproc_oas-1))
start_cos=$(($nproc_oas+$counter))
end_cos=$(($start_cos+($numInst*$nproc_cos)-1))
start_icon=$(($nproc_oas+$counter))
end_icon=$(($start_icon+($numInst*$nproc_icon)-1))
start_pfl=$(($numInst*($nproc_cos+$nproc_icon)+$nproc_oas+$counter))
end_pfl=$(($start_pfl+($numInst*$nproc_pfl)-1))
start_clm=$((($numInst*($nproc_cos+$nproc_icon))+$nproc_oas+($numInst*$nproc_pfl)+$counter))
end_clm=$(($start_clm+($numInst*$nproc_clm)-1))
if [[ $numInst > 1 && $withOASMCT == "true" ]] then
for instance in {$startInst..$(($startInst+$numInst-1))}
do
for iter in {1..$nproc_cos}
do
if [[ $withCOS == "true" ]] then ; echo $instance >> $rundir/instanceMap.txt ;fi
if [[ $withICON == "true" ]] then ; echo $instance >> $rundir/instanceMap.txt ;fi
done
done
fi
if [[ $numInst > 1 && $withOASMCT == "true" ]] then
for instance in {$startInst..$(($startInst+$numInst-1))}
do
for iter in {1..$nproc_icon}
do
if [[ $withICON == "true" ]] then ; echo $instance >> $rundir/instanceMap.txt ;fi
done
done
for instance in {$startInst..$(($startInst+$numInst-1))}
do
for iter in {1..$nproc_pfl}
do
if [[ $withPFL == "true" ]] then ; echo $instance >> $rundir/instanceMap.txt ;fi
done
done
for instance in {$startInst..$(($startInst+$numInst-1))}
do
for iter in {1..$nproc_clm}
do
if [[ $withCLM == "true" ]] then ; echo $instance >> $rundir/instanceMap.txt ;fi
done
done
fi
if [[ $withCOS == "true" ]]; then
cat << EOF >> $rundir/slm_multiprog_mapping.conf
__oas__
__cos__
__pfl__
__clm__
EOF
else
cat << EOF >> $rundir/slm_multiprog_mapping.conf
__oas__
__icon__
__pfl__
__clm__
EOF
fi
comment " sed executables and processors into mapping file"
if [[ $withOAS == "false" || $withOASMCT == "true" ]] then ; sed "s/__oas__//" -i $rundir/slm_multiprog_mapping.conf >> $log_file 2>> $err_file; check; fi
if [[ $withCOS == "false" ]] then ; sed "s/__cos__//" -i $rundir/slm_multiprog_mapping.conf >> $log_file 2>> $err_file; check; fi
if [[ $withICON == "false" ]] then ; sed "s/__icon__//" -i $rundir/slm_multiprog_mapping.conf >> $log_file 2>> $err_file; check; fi
if [[ $withPFL == "false" ]] then ; sed "s/__pfl__//" -i $rundir/slm_multiprog_mapping.conf >> $log_file 2>> $err_file; check; fi
if [[ $withCLM == "false" ]] then ; sed "s/__clm__//" -i $rundir/slm_multiprog_mapping.conf >> $log_file 2>> $err_file; check; fi
sed "s/__oas__/$start_oas $profRun \.\/oasis3.MPI1.x/" -i $rundir/slm_multiprog_mapping.conf >> $log_file 2>> $err_file
check
sed "s/__cos__/$start_cos-$end_cos $profRun \.\/lmparbin_pur/" -i $rundir/slm_multiprog_mapping.conf >> $log_file 2>> $err_file
check
sed "s/__icon__/$start_icon-$end_icon $profRun \.\/icon/" -i $rundir/slm_multiprog_mapping.conf >> $log_file 2>> $err_file
check
sed "s/__pfl__/$start_pfl-$end_pfl $profRun \.\/parflow $pflrunname/" -i $rundir/slm_multiprog_mapping.conf >> $log_file 2>> $err_file
check
sed "s/__clm__/$start_clm-$end_clm $profRun \.\/clm/" -i $rundir/slm_multiprog_mapping.conf >> $log_file 2>> $err_file
check
comment " change permission of runscript and mapfile"
chmod 755 $rundir/tsmp_slm_run.bsh >> $log_file 2>> $err_file
check
chmod 755 $rundir/slm_multiprog_mapping.conf >> $log_file 2>> $err_file
check
route "${cyellow}<< createRunscript${cnormal}"
}
Npp=128
Ngp=4
PFLProcXg=1
PFLProcYg=4
CLMProcXg=6
CLMProcYg=8
COSProcXg=16
COSProcYg=16
if [[ $refSetup == "cordex" ]] then
PFLProcX=9
PFLProcY=8
CLMProcX=3
CLMProcY=8
COSProcX=16
COSProcY=18
elif [[ $refSetup == "cordex0275" ]] then
PFLProcX=32
PFLProcY=16
CLMProcX=64
CLMProcY=2
COSProcX=48
COSProcY=48
elif [[ $refSetup == "nrw" ]] then
PFLProcX=5
PFLProcY=8
CLMProcX=4
CLMProcY=4
COSProcX=6
COSProcY=12
elif [[ $refSetup == "idealRTD" ]] then
PFLProcX=2
PFLProcY=2
CLMProcX=2
CLMProcY=2
COSProcX=6
COSProcY=5
else
PFLProcX=4
PFLProcY=4
CLMProcX=4
CLMProcY=2
COSProcX=8
COSProcY=8
fi