-
Notifications
You must be signed in to change notification settings - Fork 177
/
Copy pathrun_gfsmos_master.sh.cray
executable file
·330 lines (291 loc) · 9.34 KB
/
run_gfsmos_master.sh.cray
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
#!/bin/sh
#######################################################################
# run_gfsmos.sh
#
# History:
# 03/29/13 Scallion Created (Adapted from Eric Engle's
# "master" scripts)
# 12/03/13 Scallion Added ptype/wxgrid
# 04/18/18 J Wagner Set up to run GFSMOS after GFS FV3 retros
#
# Purpose:
# To run the GFS-MOS operational suite
#
#######################################################################
set -x
if (( $# > 1 )); then
echo "Incorrect number of arguments."
echo "Syntax: $0 [PDYCYC (optional)]"
echo "Exiting..."
exit 1
fi
#######################################################################
# Source bash_profile to run with proper modules on cron
#######################################################################
#. ~/.profile
#######################################################################
# Set global variables neede in the run script and/or each individual
# job script.
#######################################################################
. $MODULESHOME/init/sh 2>/dev/null
module load prod_envir/1.1.0
module load cfp-intel-sandybridge
module load craype-hugepages2M
export FORT_BUFFERED=TRUE
export KMP_AFFINITY=disabled
export envir=prod
#export QUEUE=dev
#------------------
export SENDCOM_SAVE=$SENDCOM
export SENDCOM=YES
#------------------
dateIn=$1
export PDY=`echo $dateIn | cut -c 1-8`
export cyc=`echo $dateIn | cut -c 9-10`
export prevday=`$NDATE -24 ${PDY}00 | cut -c1-8`
#
# VARIABLES TO SET
# PTMPROOT and STMPROOT should be set to the user's directories
# COMDATEROOT defined by module prod_util
#export PTMPROOT=/gpfs/hps3/ptmp/$USER
export PTMPROOT=$ROTDIR/gfsmos.$PDY
#export STMPROOT=/gpfs/hps3/stmp/$USER
export STMPROOT=$RUNDIR/gfsmos.$PDY
export DATAROOT=$STMPROOT
export MODELROOT=$NWROOThps
export MODELDIR=$MODELROOT/gfsmos.v5.0.6
export CODEDIR=$MODELROOT/mos_shared.v2.6.1
if [[ $SITE == "SURGE" ]]; then
export siteprefix=g
elif [[ $SITE == "LUNA" ]]; then
export siteprefix=t
else
echo "SITE $SITE not recognized"
exit
fi
export range=${range:-"both"}
export skipmodel=n
export skipprep=n
export stnonly=Y
export cycle="t${cyc}z"
export pid="gfs.$$"
export dailylog=$PTMPROOT/dailylog/log.$PDY
export jlogfile=$dailylog/jlogfile_gfsmos
mkdir -p $dailylog
export SENDDBN=NO
export GET_IOPROFILE=NO
# Specify Execution Areas
export HOMEmdl=$MODELDIR
export HOMEcode=$CODEDIR
if [ ! -d $HOMEmdl ]; then
echo "$HOMEmdl does not exist"
exit 1
fi
if [ ! -d $HOMEcode ]; then
echo "$HOMEcode does not exist"
exit 1
fi
# Load modules
module load prod_util
module unload grib_util/1.0.3
module use /usrx/local/nceplibs/modulefiles
module load grib_util/1.1.0
# VARIABLES TO SET
# GFSDIR should be set to the directory containing the input GFS FV3 data
# COMOUT should be set to the directory where the GFSMOS output files will be saved
#export GFSDIR=/gpfs/hps3/ptmp/emc.glopara/fv3fy18retro2
export GFSDIR=$ROTDIR
export COMINgfs=$GFSDIR/gfs.${PDY}/${cyc}
export COMOUT=$ROTDIR/gfsmos.$PDY
if [[ ! -d $PTMPROOT/qprod ]]; then
mkdir -p $PTMPROOT/qprod
fi
if [[ ! -d $COMOUT ]]; then
mkdir -p $COMOUT
fi
export PCOM=$COMOUT
if [[ ! -d $PCOM ]]; then
mkdir -p $PCOM
fi
# NOTE: On WCOSS_C the directory from which bsub
# is executed must exist when the submitted job
# begins. Otherwise, the submitted job fails
# with TERM_CWD_NOTEXIST error.
mkdir -p $DATAROOT
cd $DATAROOT
########################################################################
# JGFSMOS_PREP47
########################################################################
export job=gfsmos_prep_${cyc}_${pid}
export COMIN=$GFSDIR
jobCard=$HOMEmdl/jobs/JGFSMOS_PREP
# Define DATA and create directory
export DATA=$DATAROOT/gfsmos_prep_${cyc}
export logfile=$dailylog/$job.out
export out_dir=$dailylog
export PTILE=7
export NTASK=7
export OMP_NUM_THREADS=1
bsub -J $job \
-o $logfile \
-q $QUEUE \
-W 2:00 \
-M 2500 \
-P $ACCOUNT \
-extsched 'CRAYLINUX[]' \
-R '1*{select[craylinux && !vnode]} + 24*{select[craylinux && vnode]span[ptile=24]}' \
$jobCard
########################################################################
# JGFSMOS_FORECAST
########################################################################
if [ $prevday -lt `date -u +%Y%m%d -d "48 hours ago"` ]; then
export COMINhourly=$PTMPROOT/hourly.$PDY
if [[ ! -d $COMINhourly ]]; then
mkdir -p $COMINhourly
fi
\cp /gpfs/${siteprefix}d1/mdl/mdlstat/save/rotate/hry/${PDY}03 $COMINhourly/sfctbl.03
\cp /gpfs/${siteprefix}d1/mdl/mdlstat/save/rotate/hry/${PDY}09 $COMINhourly/sfctbl.09
\cp /gpfs/${siteprefix}d1/mdl/mdlstat/save/rotate/hry/${PDY}15 $COMINhourly/sfctbl.15
\cp /gpfs/${siteprefix}d1/mdl/mdlstat/save/rotate/hry/${PDY}21 $COMINhourly/sfctbl.21
fi
#
# Change COMIN to get files from user's PTMP "qprod" area
export COMIN=$COMOUT
#
export job=gfsmos_fcst_${cyc}_${pid}
jobCard=$HOMEmdl/jobs/JGFSMOS_FORECAST
export DATA=$DATAROOT/gfsmos_fcst_${cyc}
export logfile=$dailylog/$job.out
export out_dir=$dailylog
# Set dependencies
deps="done(gfsmos_prep_${cyc}_${pid})"
complist="metar cooprfcmeso tstms"
complist2=""
export PTILE=3
export NTASK=3
export OMP_NUM_THREADS=1
bsub -J ${job} -oo $logfile -q ${QUEUE} -P $ACCOUNT \
-W 2:30 -M 2000 \
-extsched 'CRAYLINUX[]' \
-R '1*{select[craylinux && !vnode]} + 72*{select[craylinux && vnode]span[ptile=24]}' \
-w "$deps" \
$jobCard
#
########################################################################
# JGFSMOS_PRDGEN
########################################################################
jobCard=$HOMEmdl/jobs/JGFSMOS_PRDGEN
export job=gfsmos_prdgen_${cyc}_${pid}
# Change COMIN back to COMOUT
export COMIN=$COMOUT
# Define DATA and create directory
export DATA=$DATAROOT/gfsmos_prdgen_${cyc}
export logfile=$dailylog/$job.out
export out_dir=$dailylog
# Set dependencies
deps="done(gfsmos_fcst_${cyc}_${pid})"
nodes='1*{select[craylinux && !vnode]} + 24*{select[craylinux && vnode]span[ptile=24]}'
export PTILE=1
export NTASK=1
export OMP_NUM_THREADS=1
#
bsub -J ${job} -oo $logfile -q ${QUEUE} -P $ACCOUNT \
-W 1:00 -M 2000 \
-extsched 'CRAYLINUX[]' \
-R "$nodes" \
-w "$deps" \
$jobCard
#
########################################################################
# EXTENDED-RANGE JOBS
########################################################################
########################################################################
# JGFSMOS_EXT_PREP47
########################################################################
export job=gfsmos_extprep_${cyc}_${pid}
export COMIN=$GFSDIR
jobCard=$HOMEmdl/jobs/JGFSMOS_EXT_PREP
# Define DATA and create directory
export DATA=$DATAROOT/gfsmos_extprep_${cyc}
export logfile=$dailylog/$job.out
export out_dir=$dailylog
export PTILE=5
export NTASK=10
export OMP_NUM_THREADS=1
bsub -J $job \
-o $logfile \
-q $QUEUE \
-W 2:00 \
-M 2500 \
-P $ACCOUNT \
-extsched 'CRAYLINUX[]' \
-R '1*{select[craylinux && !vnode]} + 48*{select[craylinux && vnode]span[ptile=24]}' \
$jobCard
# Skip EXT_FORECAST for 06/18
if [ $cyc -eq 00 -o $cyc -eq 12 ]; then
########################################################################
# JGFSMOS_EXT_FORECAST
########################################################################
#
# Change COMIN to get files from user's PTMP "qprod" area
export COMIN=$COMOUT
#
export job=gfsmos_extfcst_${cyc}_${pid}
jobCard=$HOMEmdl/jobs/JGFSMOS_EXT_FORECAST
export DATA=$DATAROOT/gfsmos_extfcst_${cyc}
export logfile=$dailylog/$job.out
export out_dir=$dailylog
# Set dependencies
if [[ "$skipprep" != "y" && "$range" == "both" ]]; then
deps="done(gfsmos_extprep_${cyc}_${pid}) && done(gfsmos_prdgen_${cyc}_${pid})"
elif [[ "$skipprep" != "y" && "$range" == "ext" ]]; then
deps="done(gfsmos_extprep_${cyc}_${pid})"
elif [[ "$skipprep" == "y" && "$range" == "ext" ]]; then
deps=""
else
deps="done(gfsmos_prdgen_${cyc}_${pid})"
fi
#
export PTILE=4
export NTASK=10
export OMP_NUM_THREADS=1
#
bsub -J ${job} -oo $logfile -q $QUEUE -P $ACCOUNT \
-W 4:00 -M 2000 \
-extsched 'CRAYLINUX[]' \
-R '1*{select[craylinux && !vnode]} + 72*{select[craylinux && vnode]span[ptile=24]}' \
-w "$deps" \
$jobCard
#
fi #endif for skipping 06/18 ext_fcst
#########################################################################
## JGFSMOS_EXT_PRDGEN
#########################################################################
jobCard=$HOMEmdl/jobs/JGFSMOS_EXT_PRDGEN
export job=gfsmos_extprdgen_${cyc}_${pid}
# Change COMIN back to COMOUT
export COMIN=$COMOUT
# Define DATA and create directory
export DATA=$DATAROOT/gfsmos_extprdgen_${cyc}
export logfile=$dailylog/$job.out
export out_dir=$dailylog
# Set dependencies
if [[ "$cyc" == "06" || "$cyc" == "18" ]]; then
deps="done(gfsmos_prdgen_${cyc}_${pid})"
elif [[ "$range" == "both" ]]; then
deps="done(gfsmos_extfcst_${cyc}_${pid}) && done(gfsmos_prdgen_${cyc}_${pid})"
else
deps="done(gfsmos_extfcst_${cyc}_${pid})"
fi
nodes='1*{select[craylinux && !vnode]} + 24*{select[craylinux && vnode]span[ptile=24]}'
export PTILE=1
export NTASK=1
export OMP_NUM_THREADS=1
bsub -J ${job} -oo $logfile -q ${QUEUE} -P $ACCOUNT \
-W 2:00 -M 2000 \
-extsched 'CRAYLINUX[]' \
-R "$nodes" \
-w "$deps" \
$jobCard
#---------------------
export SENDCOM=$SENDCOM_SAVE