-
Notifications
You must be signed in to change notification settings - Fork 11
/
run_ens_fv3.sh
executable file
·104 lines (91 loc) · 2.75 KB
/
run_ens_fv3.sh
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
#!/bin/sh
export VERBOSE=YES
date
# run model
export DATOUT=${datapath}/${analdatep1}
export OMP_NUM_THREADS=$fg_threads
export OMP_STACKSIZE=512M
export nprocs=`expr $fg_proc \/ $OMP_NUM_THREADS`
countproc=`python -c "from __future__ import print_function; import math; print(${corespernode}*int(math.ceil(float(${fg_proc})/${corespernode})))"`
echo "countproc = $countproc"
export mpitaskspernode=`expr $corespernode \/ $OMP_NUM_THREADS`
nhosts=$cores
echo "nhosts = $nhosts"
nhost1=1
nhost=$nhost1
nanal=1
while [ $nanal -le $nanals ]; do
export charnanal="mem`printf %03i $nanal`"
# check to see if output files already created.
fhr=$FHMIN
outfiles=""
while [ $fhr -le $FHMAX ]; do
charhr="fhr`printf %02i $fhr`"
outfiles="${outfiles} ${datapath}/${analdatep1}/sfg_${analdatep1}_${charhr}_${charnanal} ${datapath}/${analdatep1}/bfg_${analdatep1}_${charhr}_${charnanal}"
fhr=$((fhr+FHOUT))
done
filemissing='no'
for outfile in $outfiles; do
if [ ! -s $outfile ]; then
echo "${outfile} is missing"
filemissing='yes'
else
echo "${outfile} is OK"
fi
done
node=$nhost
node_end=$node
node_end=$((node_end+${countproc}-1))
if [ $filemissing == 'yes' ]; then
echo "nanal = ${nanal}, nhost = ${nhost}, node = ${node}, node_end = ${node_end}"
sh ${enkfscripts}/${rungfs} > ${current_logdir}/run_fg_${charnanal}.iter${niter}.out 2>&1 &
nhost=$((nhost+countproc))
else
echo "skipping nanal = ${nanal}, output files already created"
fi
node_end_next=$((node_end+${countproc}-1))
if [ $node_end -gt $nhosts ] || [ $node_end_next -gt $nhosts ]; then
echo "$node_end $node_end_next $nhosts"
echo "waiting at nanal = ${nanal} `date`"
wait
nhost=$nhost1
fi
nanal=$((nanal+1))
done
echo "waiting at nanal = ${nanal} `date`"
wait
echo "all done `date`"
# check to see all files created
echo "checking output files .."`date`
nanal=1
anyfilemissing='no'
while [ $nanal -le $nanals ]; do
export charnanal="mem`printf %03i $nanal`"
fhr=$FHMIN
outfiles="${datapath}/${analdatep1}/${charnanal}/INPUT/sfc_data.tile6.nc"
while [ $fhr -le $FHMAX ]; do
charhr="fhr`printf %02i $fhr`"
outfiles="${outfiles} ${datapath}/${analdatep1}/sfg_${analdatep1}_${charhr}_${charnanal} ${datapath}/${analdatep1}/bfg_${analdatep1}_${charhr}_${charnanal}"
fhr=$((fhr+FHOUT))
done
filemissing='no'
for outfile in $outfiles; do
ls -l $outfile
if [ ! -s $outfile ]; then
echo "${outfile} is missing"
filemissing='yes'
anyfilemissing='yes'
else
echo "${outfile} is OK"
fi
done
nanal=$((nanal+1))
done
if [ $anyfilemissing == 'yes' ]; then
echo "there are output files missing!"
exit 1
else
echo "all output files seem OK"
date
exit 0
fi