1 |
jmc |
1.1 |
#! /usr/bin/env bash |
2 |
|
|
|
3 |
jmc |
1.32 |
# $Header: /u/gcmpack/MITgcm/tools/example_scripts/csail/test_baudelaire,v 1.31 2016/09/29 20:52:10 jmc Exp $ |
4 |
jmc |
1.1 |
|
5 |
jmc |
1.23 |
# Test script for MITgcm that should work on most of the csail.mit.edu Linux machines. |
6 |
|
|
|
7 |
|
|
tst_grp=0 ; if test $# = 1 ; then tst_grp=$1 ; fi |
8 |
|
|
if test $tst_grp != 'a' -a $tst_grp != 'b' ; then |
9 |
|
|
echo "missing or invalid argument (expect: 'a' or 'b') ==> exit" |
10 |
|
|
exit 1 |
11 |
|
|
fi |
12 |
jmc |
1.1 |
|
13 |
|
|
# defaults |
14 |
|
|
#export PATH="$PATH:/usr/local/bin" |
15 |
|
|
if [ -d ~/bin ]; then export PATH=$PATH:~/bin ; fi |
16 |
|
|
#- to get case insensitive "ls" (and order of tested experiments) |
17 |
|
|
export LC_ALL="en_US.UTF-8" |
18 |
|
|
# Turn off stack limit for FIZHI & AD-tests |
19 |
|
|
ulimit -s unlimited |
20 |
jmc |
1.4 |
# MPI test (for now, only with gfortran) |
21 |
|
|
export MPI_GCC_DIR=/srv/software/gcc/gcc-packages/gcc-4.4.5/mpich2/mpich2-1.3 |
22 |
|
|
export MPI_INC_DIR=$MPI_GCC_DIR/include |
23 |
|
|
export PATH="$PATH:$MPI_GCC_DIR/bin" |
24 |
jmc |
1.1 |
|
25 |
|
|
#- method to acces CVS: |
26 |
|
|
# export CVSROOT='/u/gcmpack' |
27 |
|
|
# export CVSROOT=':ext:@mitgcm.org:/u/gcmpack' |
28 |
|
|
# export CVS_RSH='ssh' ; cvs co -P MITgcm > /dev/null |
29 |
|
|
# cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack co -P MITgcm > /dev/null |
30 |
|
|
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack' |
31 |
|
|
cmdCVS='cvs -d /u/gcmpack' |
32 |
|
|
|
33 |
jmc |
1.19 |
# checkOut=2 : download new code ; |
34 |
jmc |
1.20 |
# =3 : skip download but, if sepDir, use a new copy |
35 |
jmc |
1.19 |
# =1 : update code (if no existing code -> swith to 2) |
36 |
|
|
# =0 : use existing code (if no existing code -> swith to 2) |
37 |
jmc |
1.11 |
dInWeek=`date +%a` |
38 |
jmc |
1.20 |
outDir=`hostname -s` |
39 |
|
|
TESTDIR="/scratch/jmc/test_${outDir}" |
40 |
jmc |
1.23 |
outDir="${outDir}-${tst_grp}" |
41 |
jmc |
1.3 |
MC=13 |
42 |
jmc |
1.1 |
sepDir=1 |
43 |
|
|
option= |
44 |
jmc |
1.20 |
#tst_list='g7a adm mpa g77 gfo+rs mth mp2+rs mpi ifc' |
45 |
|
|
#if test "x$dInWeek" = xSun ; then tst_list="$tst_list tlm oad" ; fi |
46 |
jmc |
1.23 |
if test $tst_grp = 'a' ; then |
47 |
|
|
checkOut=2 |
48 |
|
|
tst_list='g7a mpa mth mp2+rs mpi oad' |
49 |
|
|
else |
50 |
|
|
checkOut=3 |
51 |
|
|
tst_list='adm g77 gfo+rs ifc' |
52 |
|
|
if test "x$dInWeek" = xSun ; then tst_list="$tst_list tlm" ; fi |
53 |
|
|
fi |
54 |
|
|
echo " test: $outDir ; list='$tst_list'" |
55 |
jmc |
1.1 |
|
56 |
jmc |
1.19 |
#option="-nc" ; checkOut=1 |
57 |
|
|
#option="-q" ; checkOut=1 |
58 |
jmc |
1.1 |
|
59 |
|
|
TODAY=`date +%d` |
60 |
|
|
tdir=$TESTDIR |
61 |
jmc |
1.19 |
if test $checkOut != 2 ; then |
62 |
jmc |
1.7 |
if test -e $tdir/MITgcm/CVS ; then |
63 |
|
|
echo $tdir/MITgcm/CVS 'exist' |
64 |
jmc |
1.19 |
if test $sepDir = 0 -a $checkOut = 1 ; then |
65 |
jmc |
1.15 |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
66 |
|
|
cd $tdir/MITgcm |
67 |
jmc |
1.7 |
$cmdCVS update -P -d |
68 |
jmc |
1.15 |
echo " done" |
69 |
jmc |
1.7 |
fi |
70 |
jmc |
1.1 |
else |
71 |
jmc |
1.7 |
echo -n $tdir/MITgcm 'missing ; ' |
72 |
jmc |
1.19 |
checkOut=2 |
73 |
jmc |
1.1 |
fi |
74 |
|
|
fi |
75 |
jmc |
1.19 |
if test $checkOut = 2 ; then |
76 |
jmc |
1.1 |
if test -e $tdir ; then |
77 |
|
|
echo -n "Removing working copy: $tdir/MITgcm ..." |
78 |
|
|
test -e $tdir/MITgcm && rm -rf $tdir/MITgcm |
79 |
|
|
else |
80 |
|
|
echo -n "Creating a working dir: $tdir ..." |
81 |
|
|
mkdir $tdir |
82 |
|
|
fi |
83 |
|
|
echo " done" |
84 |
|
|
echo -n "Downloading the MITgcm code using: $cmdCVS ..." |
85 |
|
|
cd $tdir |
86 |
|
|
$cmdCVS co -P MITgcm > /dev/null |
87 |
|
|
echo " done" |
88 |
jmc |
1.28 |
if test -d other_input ; then |
89 |
|
|
list_dirs=`(cd other_input ; ls 2> /dev/null )` |
90 |
jmc |
1.29 |
echo "Updating ( $cmdCVS update -P -d ) 'other_input' extra dirs:" |
91 |
jmc |
1.28 |
for exd in $list_dirs ; do |
92 |
jmc |
1.29 |
if test -d other_input/$exd/CVS ; then echo " $exd" |
93 |
jmc |
1.28 |
( cd other_input/$exd ; $cmdCVS update -P -d ) |
94 |
jmc |
1.29 |
fi |
95 |
jmc |
1.28 |
done |
96 |
jmc |
1.29 |
echo " <-- update of 'other_input' dirs done" |
97 |
jmc |
1.28 |
fi |
98 |
jmc |
1.1 |
else |
99 |
|
|
cd $tdir |
100 |
|
|
fi |
101 |
|
|
|
102 |
|
|
#------------------------------------------------------------------------ |
103 |
|
|
|
104 |
|
|
firstTst=`echo $tst_list | awk '{print $1}'` |
105 |
|
|
last_Tst=`echo $tst_list | awk '{print $NF}'` |
106 |
|
|
for tt in $tst_list |
107 |
|
|
do |
108 |
|
|
|
109 |
jmc |
1.5 |
echo "================================================================" |
110 |
|
|
typ=`echo $tt | sed 's/+rs//'` |
111 |
jmc |
1.22 |
#- define list of additional experiences to test: |
112 |
|
|
addExp='' |
113 |
|
|
if test $typ = 'mp2' -o $typ = 'ifc' ; then |
114 |
jmc |
1.24 |
addExp="offline_cheapaml atm_gray" |
115 |
|
|
fi |
116 |
jmc |
1.27 |
if test $typ = 'gfo' -o $typ = 'ifc' ; then |
117 |
jmc |
1.26 |
addExp="$addExp global_oce_biogeo_bling" |
118 |
jmc |
1.29 |
addExp="$addExp shelfice_remeshing" |
119 |
jmc |
1.26 |
fi |
120 |
jmc |
1.27 |
if test $typ = 'mpi' ; then |
121 |
|
|
addExp="$addExp global_oce_cs32" |
122 |
|
|
fi |
123 |
jmc |
1.5 |
#- check day and time: |
124 |
|
|
curDay=`date +%d` ; curHour=`date +%H` |
125 |
|
|
if [ $curDay -ne $TODAY ] ; then |
126 |
|
|
date ; echo "day is over => skip test $typ" |
127 |
|
|
continue |
128 |
|
|
fi |
129 |
|
|
if [ $curHour -ge 18 ] ; then |
130 |
|
|
date ; echo "too late to run test $typ" |
131 |
|
|
continue |
132 |
|
|
fi |
133 |
jmc |
1.19 |
if test $sepDir = 0 -a "x$option" != x -a $tt != $last_Tst ; then |
134 |
|
|
echo "using option='$option' prevent multi-tests => skip test $typ" |
135 |
|
|
continue |
136 |
|
|
fi |
137 |
jmc |
1.5 |
#- clean-up old output files |
138 |
|
|
rm -f $tdir/output_${typ}* |
139 |
jmc |
1.12 |
touch $tdir/output_$tt |
140 |
jmc |
1.5 |
if test $sepDir = 1 ; then |
141 |
|
|
new_dir="MITgcm_$typ" |
142 |
jmc |
1.20 |
reUse=1 ; if [ $checkOut -ge 2 ] ; then reUse=0 ; fi |
143 |
|
|
if test -d $new_dir/CVS -a $reUse = 1 ; then |
144 |
jmc |
1.5 |
pushd $new_dir |
145 |
jmc |
1.14 |
if test $tt != $typ ; then |
146 |
|
|
( cd verification ; ../tools/do_tst_2+2 -clean ) |
147 |
|
|
fi |
148 |
jmc |
1.19 |
if test $checkOut = 1 ; then |
149 |
|
|
echo -n "Update the MITgcm code using: $cmdCVS ..." |
150 |
|
|
$cmdCVS update -P -d |
151 |
|
|
echo " done" |
152 |
|
|
fi |
153 |
jmc |
1.5 |
else |
154 |
jmc |
1.21 |
if test -d prev ; then |
155 |
|
|
#-- save previous summary: |
156 |
|
|
oldS=`ls -t ${new_dir}/verification/tr_${outDir}_*/summary.txt 2> /dev/null | head -1` |
157 |
|
|
if test "x$oldS" != x ; then cp -p -f $oldS prev/tr_out.$typ ; fi |
158 |
|
|
if test $tt != $typ ; then |
159 |
|
|
oldS=`ls -t ${new_dir}/verification/rs_${outDir}_*/summary.txt 2> /dev/null | head -1` |
160 |
|
|
if test "x$oldS" != x ; then cp -p -f $oldS prev/rs_out.$typ ; fi |
161 |
|
|
fi |
162 |
|
|
fi |
163 |
jmc |
1.5 |
test -e $new_dir && rm -rf $new_dir |
164 |
|
|
mkdir $new_dir |
165 |
|
|
pushd $new_dir |
166 |
|
|
cp -ra ../MITgcm/* . |
167 |
jmc |
1.22 |
#-- download additional experience from Contrib: |
168 |
|
|
for exp2add in $addExp ; do |
169 |
|
|
echo " add dir: $exp2add (from Contrib:verification_other)" |
170 |
|
|
( cd verification ; $cmdCVS co -P -d $exp2add \ |
171 |
|
|
MITgcm_contrib/verification_other/$exp2add > /dev/null ) |
172 |
jmc |
1.27 |
if test $exp2add = 'global_oce_cs32' ; then |
173 |
jmc |
1.30 |
echo " link dir 'other_input/core2_cnyf' in here" |
174 |
|
|
( cd verification/${exp2add} |
175 |
|
|
ln -s ../../../other_input/core2_cnyf . ) |
176 |
jmc |
1.27 |
fi |
177 |
jmc |
1.28 |
if test $exp2add = 'shelfice_remeshing' ; then |
178 |
|
|
echo " link dir 'other_input/remeshing_code' to 'extra_code'" |
179 |
|
|
( cd verification/${exp2add} |
180 |
|
|
ln -s ../../../other_input/remeshing_code extra_code ) |
181 |
|
|
fi |
182 |
jmc |
1.22 |
done |
183 |
jmc |
1.5 |
fi |
184 |
jmc |
1.1 |
else |
185 |
jmc |
1.5 |
pushd MITgcm |
186 |
jmc |
1.1 |
fi |
187 |
jmc |
1.5 |
cd verification |
188 |
jmc |
1.1 |
|
189 |
jmc |
1.5 |
#-- set the testreport command: |
190 |
jmc |
1.7 |
comm="./testreport" |
191 |
|
|
if test $typ = 'g7a' -o $typ = 'adm' -o $typ = 'mpa' ; then |
192 |
jmc |
1.12 |
comm="$comm -adm" |
193 |
jmc |
1.18 |
elif test $typ = 'oad' ; then |
194 |
|
|
comm="$comm -oad" |
195 |
jmc |
1.11 |
elif test $typ = 'tlm' ; then |
196 |
jmc |
1.12 |
comm="$comm -tlm" |
197 |
jmc |
1.5 |
elif test $typ = 'mth' -o $typ = 'mp2' ; then |
198 |
jmc |
1.4 |
export GOMP_STACKSIZE=400m |
199 |
jmc |
1.5 |
export OMP_NUM_THREADS=2 |
200 |
|
|
comm="$comm -mth" |
201 |
jmc |
1.17 |
else |
202 |
|
|
comm="$comm -md cyrus-makedepend" |
203 |
jmc |
1.5 |
fi |
204 |
jmc |
1.32 |
comm="$comm -odir $outDir -a jmc@dev.mitgcm.org" |
205 |
jmc |
1.5 |
#-- set the optfile (+ mpi & match-precision) |
206 |
|
|
MPI=0 |
207 |
|
|
case $typ in |
208 |
|
|
'g77'|'g7a') OPTFILE='../tools/build_options/linux_amd64_g77' ;; |
209 |
jmc |
1.18 |
'gfo'|'adm'|'oad'|'tlm'|'mth') comm="$comm -match $MC -devel" |
210 |
jmc |
1.11 |
OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
211 |
jmc |
1.20 |
'ifc') comm="$comm -devel" |
212 |
|
|
OPTFILE='../tools/build_options/linux_amd64_ifort11' ;; |
213 |
jmc |
1.5 |
'pgi') OPTFILE='../tools/build_options/linux_amd64_pgf77' ;; |
214 |
jmc |
1.11 |
'mpa'|'mpi'|'mp2') comm="$comm -match $MC -devel" ; MPI=6 |
215 |
|
|
OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
216 |
jmc |
1.5 |
*) OPTFILE= ;; |
217 |
|
|
esac |
218 |
|
|
#-- set MPI command: |
219 |
jmc |
1.8 |
if test $MPI != 0 ; then |
220 |
|
|
if test $typ = 'mp2' ; then MPI=3 ; fi |
221 |
jmc |
1.7 |
if test $typ = 'mpa' ; then |
222 |
jmc |
1.6 |
EXE="mpirun -np TR_NPROC ./mitgcmuv_ad" |
223 |
jmc |
1.5 |
else |
224 |
jmc |
1.6 |
EXE="mpirun -np TR_NPROC ./mitgcmuv" |
225 |
jmc |
1.5 |
fi |
226 |
|
|
fi |
227 |
jmc |
1.1 |
|
228 |
jmc |
1.7 |
#-- set specific Env Vars: |
229 |
jmc |
1.18 |
if test $typ = 'oad' ; then |
230 |
|
|
source ~jmc/mitgcm/bin/setenv_OpenAD.sh |
231 |
|
|
fi |
232 |
jmc |
1.7 |
if test $typ = 'ifc' ; then |
233 |
|
|
source /srv/software/intel/intel-11.1.073/bin/ifortvars.sh intel64 |
234 |
|
|
fi |
235 |
|
|
if test $typ = 'pgi' ; then |
236 |
jmc |
1.8 |
#listT='fizhi-cs-32x32x40 fizhi-cs-aqualev20' |
237 |
jmc |
1.7 |
export PGI=/srv/software/pgi/pgi-10.9 |
238 |
|
|
export PATH="$PATH:$PGI/linux86-64/10.9/bin" |
239 |
|
|
export LM_LICENSE_FILE=$PGI/license.dat |
240 |
|
|
fi |
241 |
|
|
|
242 |
jmc |
1.19 |
if test $sepDir = 0 -a "x$option" = x -a $tt = $firstTst -a $checkOut != 2 ; then |
243 |
jmc |
1.1 |
#-- cleaning: |
244 |
jmc |
1.5 |
echo "======================" |
245 |
jmc |
1.12 |
echo "Cleaning test directories:" | tee -a $tdir/output_$tt |
246 |
jmc |
1.1 |
cmdCLN="./testreport -clean" |
247 |
jmc |
1.12 |
echo " clean dir running: $cmdCLN" | tee -a $tdir/output_$tt |
248 |
|
|
$cmdCLN >> $tdir/output_$tt 2>&1 |
249 |
jmc |
1.5 |
echo "======================" |
250 |
jmc |
1.12 |
echo "" | tee -a $tdir/output_$tt |
251 |
jmc |
1.1 |
fi |
252 |
|
|
|
253 |
jmc |
1.5 |
#-- run the testreport command: |
254 |
jmc |
1.12 |
echo -n "Running testreport using:" | tee -a $tdir/output_$tt |
255 |
jmc |
1.1 |
if test "x$OPTFILE" != x ; then |
256 |
|
|
comm="$comm -of=$OPTFILE" |
257 |
|
|
fi |
258 |
jmc |
1.12 |
if test $MPI = 0 ; then echo '' | tee -a $tdir/output_$tt |
259 |
|
|
else echo " (EXE='$EXE')" | tee -a $tdir/output_$tt |
260 |
jmc |
1.8 |
comm="$comm -MPI $MPI -command \"\$EXE\"" |
261 |
|
|
fi |
262 |
jmc |
1.1 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
263 |
jmc |
1.8 |
#if test $typ = 'pgi' ; then comm="$comm -t \"\$listT\"" ; fi |
264 |
jmc |
1.12 |
echo " \"eval $comm\"" | tee -a $tdir/output_$tt |
265 |
jmc |
1.1 |
echo "======================" |
266 |
jmc |
1.12 |
eval $comm >> $tdir/output_$tt 2>&1 |
267 |
|
|
sed -n "/^An email /,/^======== End of testreport / p" $tdir/output_$tt |
268 |
|
|
echo "" | tee -a $tdir/output_$tt |
269 |
jmc |
1.1 |
|
270 |
jmc |
1.5 |
#-- also test restart (test 2+2=4) |
271 |
|
|
if test $tt != $typ |
272 |
|
|
then |
273 |
jmc |
1.12 |
echo "testing restart using:" | tee -a $tdir/output_$tt |
274 |
jmc |
1.32 |
comm="../tools/do_tst_2+2 -o $outDir -a jmc@dev.mitgcm.org" |
275 |
jmc |
1.8 |
if test $MPI = 0 ; then |
276 |
jmc |
1.12 |
echo " \"$comm\"" | tee -a $tdir/output_$tt |
277 |
jmc |
1.8 |
echo "======================" |
278 |
jmc |
1.12 |
$comm >> $tdir/output_$tt 2>&1 |
279 |
jmc |
1.8 |
else |
280 |
jmc |
1.12 |
echo " \"$comm -mpi -exe $EXE\"" | tee -a $tdir/output_$tt |
281 |
jmc |
1.5 |
echo "======================" |
282 |
jmc |
1.12 |
$comm -mpi -exe "$EXE" >> $tdir/output_$tt 2>&1 |
283 |
jmc |
1.5 |
fi |
284 |
|
|
echo ; cat tst_2+2_out.txt |
285 |
|
|
echo |
286 |
jmc |
1.1 |
fi |
287 |
jmc |
1.5 |
export OMP_NUM_THREADS=1 |
288 |
jmc |
1.1 |
|
289 |
jmc |
1.5 |
if test $sepDir = 0 ; then |
290 |
|
|
#-- cleaning: |
291 |
jmc |
1.7 |
echo "======================" |
292 |
jmc |
1.12 |
echo "Cleaning test directories:" | tee -a $tdir/output_$tt |
293 |
jmc |
1.7 |
if test $tt != $typ ; then |
294 |
|
|
cmdCLN="../tools/do_tst_2+2 -clean" |
295 |
jmc |
1.12 |
echo " clean tst_2+2 running: $cmdCLN" | tee -a $tdir/output_$tt |
296 |
|
|
$cmdCLN >> $tdir/output_$tt 2>&1 |
297 |
jmc |
1.7 |
fi |
298 |
|
|
if test $tt != $last_Tst ; then |
299 |
|
|
cmdCLN="./testreport -clean" |
300 |
jmc |
1.12 |
echo " clean dir running: $cmdCLN" | tee -a $tdir/output_$tt |
301 |
|
|
$cmdCLN >> $tdir/output_$tt 2>&1 |
302 |
jmc |
1.7 |
fi |
303 |
|
|
echo "======================" |
304 |
|
|
echo |
305 |
|
|
fi |
306 |
|
|
popd |
307 |
jmc |
1.1 |
|
308 |
|
|
done |