-
Notifications
You must be signed in to change notification settings - Fork 177
/
Copy pathconfig.resources
363 lines (322 loc) · 10.4 KB
/
config.resources
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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
#! /usr/bin/env bash
########## config.resources ##########
# Set resource information for job tasks
# e.g. walltime, node, cores per node, memory etc.
if (( $# != 1 )); then
echo "Must specify an input task argument to set resource variables!"
exit 1
fi
step=$1
echo "BEGIN: config.resources"
case ${machine} in
"WCOSS2") max_tasks_per_node=128;;
"HERA") max_tasks_per_node=40;;
"ORION") max_tasks_per_node=40;;
"HERCULES") max_tasks_per_node=80;;
"JET")
case ${PARTITION_BATCH} in
"xjet") max_tasks_per_node=24;;
"vjet" | "sjet") max_tasks_per_node=16;;
"kjet") max_tasks_per_node=40;;
*)
echo "FATAL ERROR: Unknown partition ${PARTITION_BATCH} specified for ${machine}"
exit 3
esac
;;
"S4")
case ${PARTITION_BATCH} in
"s4") max_tasks_per_node=32;;
"ivy") max_tasks_per_node=20;;
*)
echo "FATAL ERROR: Unknown partition ${PARTITION_BATCH} specified for ${machine}"
exit 3
esac
;;
"AWSPW")
export PARTITION_BATCH="compute"
max_tasks_per_node=48
;;
"AZUREPW")
export PARTITION_BATCH="compute"
max_tasks_per_node=36
;;
"GOOGLEPW")
export PARTITION_BATCH="compute"
max_tasks_per_node=30
;;
*)
echo "FATAL ERROR: Unknown machine encountered by ${BASH_SOURCE[0]}"
exit 2
;;
esac
export max_tasks_per_node
case ${step} in
"stage_ic")
export walltime="00:15:00"
export ntasks=1
export tasks_per_node=1
export threads_per_task=1
export memory="4096M"
;;
"waveinit")
export walltime="00:10:00"
export ntasks=12
export threads_per_task=1
export tasks_per_node=$(( max_tasks_per_node / threads_per_task ))
export NTASKS=${ntasks}
export memory="2GB"
;;
"prep_emissions")
export walltime="00:10:00"
export ntasks=1
export threads_per_task=1
export tasks_per_node=$(( max_tasks_per_node / threads_per_task ))
export memory="1GB"
;;
"fcst" | "efcs")
export is_exclusive=True
export layout_x=${layout_x_gfs}
export layout_y=${layout_y_gfs}
export WRITE_GROUP=${WRITE_GROUP_GFS}
export WRTTASK_PER_GROUP_PER_THREAD=${WRTTASK_PER_GROUP_PER_THREAD_GFS}
ntasks_fv3=${ntasks_fv3_gfs}
ntasks_quilt=${ntasks_quilt_gfs}
nthreads_fv3=${nthreads_fv3_gfs}
nthreads_ufs=${nthreads_ufs_gfs}
# Determine if using ESMF-managed threading or traditional threading
# If using traditional threading, set them to 1
if [[ "${USE_ESMF_THREADING:-}" == "YES" ]]; then
export UFS_THREADS=1
else # traditional threading
export UFS_THREADS=${nthreads_ufs:-1}
nthreads_fv3=1
nthreads_mediator=1
[[ "${DO_WAVE}" == "YES" ]] && nthreads_ww3=1
[[ "${DO_OCN}" == "YES" ]] && nthreads_mom6=1
[[ "${DO_ICE}" == "YES" ]] && nthreads_cice6=1
fi
# FV3
if [[ "${USE_ESMF_THREADING:-}" == "YES" ]]; then
(( FV3THREADS = nthreads_fv3 ))
(( FV3PETS = ntasks_fv3 * nthreads_fv3 ))
else
(( FV3THREADS = UFS_THREADS ))
(( FV3PETS = ntasks_fv3 ))
fi
echo "FV3 using (nthreads, PETS) = (${FV3THREADS}, ${FV3PETS})"
# Write grid component
QUILTPETS=0; QUILTTHREADS=0
if [[ "${QUILTING:-}" == ".true." ]]; then
if [[ "${USE_ESMF_THREADING:-}" == "YES" ]]; then
(( QUILTTHREADS = nthreads_fv3 ))
(( QUILTPETS = ntasks_quilt * nthreads_fv3 ))
else
(( QUILTTHREADS = UFS_THREADS ))
(( QUILTPETS = ntasks_quilt ))
fi
(( WRTTASK_PER_GROUP = WRTTASK_PER_GROUP_PER_THREAD ))
export WRTTASK_PER_GROUP
fi
echo "QUILT using (nthreads, PETS) = (${QUILTTHREADS}, ${QUILTPETS})"
# Total PETS for the atmosphere component
ATMTHREADS=${FV3THREADS}
(( ATMPETS = FV3PETS + QUILTPETS ))
export ATMPETS ATMTHREADS
echo "FV3ATM using (nthreads, PETS) = (${ATMTHREADS}, ${ATMPETS})"
# Total PETS for the coupled model (starting w/ the atmosphere)
NTASKS_TOT=${ATMPETS}
# Mediator
# The mediator PETS can overlap with other components, usually it lands on the atmosphere tasks.
# However, it is suggested limiting mediator PETS to 300, as it may cause the slow performance.
# See https://docs.google.com/document/d/1bKpi-52t5jIfv2tuNHmQkYUe3hkKsiG_DG_s6Mnukog/edit
# TODO: Update reference when moved to ufs-weather-model RTD
MEDTHREADS=${nthreads_mediator:-1}
MEDPETS=${MEDPETS:-${FV3PETS}}
(( "${MEDPETS}" > 300 )) && MEDPETS=300
export MEDPETS MEDTHREADS
echo "MEDIATOR using (threads, PETS) = (${MEDTHREADS}, ${MEDPETS})"
# GOCART
CHMPETS=0; CHMTHREADS=0
if [[ "${DO_AERO_FCST}" == "YES" ]]; then
# GOCART shares the same grid and forecast tasks as FV3 (do not add write grid component tasks).
(( CHMTHREADS = ATMTHREADS ))
(( CHMPETS = FV3PETS ))
# Do not add to NTASKS_TOT
echo "GOCART using (threads, PETS) = (${CHMTHREADS}, ${CHMPETS})"
fi
export CHMPETS CHMTHREADS
# Waves
WAVPETS=0; WAVTHREADS=0
if [[ "${DO_WAVE}" == "YES" ]]; then
if [[ "${USE_ESMF_THREADING:-}" == "YES" ]]; then
(( WAVTHREADS = nthreads_ww3 ))
(( WAVPETS = ntasks_ww3 * nthreads_ww3 ))
else
(( WAVTHREADS = UFS_THREADS ))
(( WAVPETS = ntasks_ww3 ))
fi
echo "WW3 using (threads, PETS) = (${WAVTHREADS}, ${WAVPETS})"
(( NTASKS_TOT = NTASKS_TOT + WAVPETS ))
fi
export WAVPETS WAVTHREADS
# Ocean
OCNPETS=0; OCNTHREADS=0
if [[ "${DO_OCN}" == "YES" ]]; then
if [[ "${USE_ESMF_THREADING:-}" == "YES" ]]; then
(( OCNTHREADS = nthreads_mom6 ))
(( OCNPETS = ntasks_mom6 * nthreads_mom6 ))
else
(( OCNTHREADS = UFS_THREADS ))
(( OCNPETS = ntasks_mom6 ))
fi
echo "MOM6 using (threads, PETS) = (${OCNTHREADS}, ${OCNPETS})"
(( NTASKS_TOT = NTASKS_TOT + OCNPETS ))
fi
export OCNPETS OCNTHREADS
# Ice
ICEPETS=0; ICETHREADS=0
if [[ "${DO_ICE}" == "YES" ]]; then
if [[ "${USE_ESMF_THREADING:-}" == "YES" ]]; then
(( ICETHREADS = nthreads_cice6 ))
(( ICEPETS = ntasks_cice6 * nthreads_cice6 ))
else
(( ICETHREADS = UFS_THREADS ))
(( ICEPETS = ntasks_cice6 ))
fi
echo "CICE6 using (threads, PETS) = (${ICETHREADS}, ${ICEPETS})"
(( NTASKS_TOT = NTASKS_TOT + ICEPETS ))
fi
export ICEPETS ICETHREADS
echo "Total PETS = ${NTASKS_TOT}"
declare -x "ntasks"="${NTASKS_TOT}"
declare -x "threads_per_task"="${UFS_THREADS}"
tasks_per_node=$(( max_tasks_per_node / threads_per_task ))
case "${CASE}" in
"C48" | "C96" | "C192")
declare -x "walltime"="04:00:00"
;;
"C384" | "C768" | "C1152")
declare -x "walltime"="06:00:00"
;;
*)
echo "FATAL ERROR: Resources not defined for job ${step} at resolution ${CASE}"
exit 4
;;
esac
unset NTASKS_TOT
;;
"atmos_products")
# Walltime is per forecast hour; will be multipled by group size
export walltime="00:15:00"
export ntasks=24
export threads_per_task=1
export tasks_per_node="${ntasks}"
export is_exclusive=True
;;
"atmos_ensstat")
# Walltime is per forecast hour; will be multipled by group size
export walltime="00:15:00"
export ntasks=6
export threads_per_task=1
export tasks_per_node="${ntasks}"
export is_exclusive=True
;;
"oceanice_products")
# Walltime is per forecast hour; will be multipled by group size
export walltime="00:15:00"
export ntasks=1
export tasks_per_node=1
export threads_per_task=1
export memory="96GB"
;;
"wavepostsbs")
# Walltime is per forecast hour; will be multipled by group size
export walltime="00:15:00"
export ntasks=1
export threads_per_task=1
export tasks_per_node=$(( max_tasks_per_node / threads_per_task ))
export NTASKS=${ntasks}
export memory="10GB"
;;
# The wavepost*pnt* jobs are I/O heavy and do not scale well to large nodes.
# Limit the number of tasks/node to 40.
"wavepostbndpnt")
export walltime="03:00:00"
export ntasks=240
export threads_per_task=1
export tasks_per_node=$(( max_tasks_per_node / threads_per_task ))
export is_exclusive=True
if [[ ${tasks_per_node} -gt 40 ]]; then
export tasks_per_node=40
export is_exclusive=False
fi
export NTASKS=${ntasks}
;;
"wavepostbndpntbll")
export walltime="01:00:00"
export ntasks=448
export threads_per_task=1
export tasks_per_node=$(( max_tasks_per_node / threads_per_task ))
export is_exclusive=True
if [[ ${tasks_per_node} -gt 40 ]]; then
export tasks_per_node=40
export is_exclusive=False
fi
export NTASKS=${ntasks}
;;
"wavepostpnt")
export walltime="04:00:00"
export ntasks=200
export threads_per_task=1
export tasks_per_node=$(( max_tasks_per_node / threads_per_task ))
export is_exclusive=True
if [[ ${tasks_per_node} -gt 40 ]]; then
export tasks_per_node=40
export is_exclusive=False
fi
export NTASKS=${ntasks}
;;
"extractvars")
export walltime_gefs="00:30:00"
export ntasks_gefs=1
export threads_per_task_gefs=1
export tasks_per_node_gefs="${ntasks_gefs}"
export walltime_gfs="${walltime_gefs}"
export ntasks_gfs="${ntasks_gefs}"
export threads_per_tasks_gfs="${threads_per_task_gefs}"
export tasks_per_node_gfs="${tasks_per_node_gefs}"
export is_exclusive=False
;;
"arch")
export walltime="06:00:00"
export ntasks=1
export tasks_per_node=1
export threads_per_task=1
export memory="4096M"
;;
"cleanup")
export walltime="00:30:00"
export ntasks=1
export tasks_per_node=1
export threads_per_task=1
export memory="4096M"
;;
*)
echo "FATAL ERROR: Invalid job ${step} passed to ${BASH_SOURCE[0]}"
exit 1
;;
esac
# Get machine-specific resources, overriding/extending the above assignments
if [[ -f "${EXPDIR}/config.resources.${machine}" ]]; then
source "${EXPDIR}/config.resources.${machine}"
fi
# Check for RUN-specific variables and export them
for resource_var in threads_per_task ntasks tasks_per_node NTASKS memory walltime; do
run_resource_var="${resource_var}_${RUN}"
if [[ -n "${!run_resource_var+0}" ]]; then
declare -x "${resource_var}"="${!run_resource_var}"
elif [[ -n "${!resource_var+0}" ]]; then
export "${resource_var?}"
fi
done
echo "END: config.resources"