2 |
|
|
3 |
# $Header$ |
# $Header$ |
4 |
|
|
5 |
# Test script for MITgcm that should work on most of the csail.mit.edu |
# Test script for MITgcm that should work on most of the csail.mit.edu Linux machines. |
6 |
# Linux machines. |
|
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 |
|
|
13 |
# defaults |
# defaults |
14 |
#export PATH="$PATH:/usr/local/bin" |
#export PATH="$PATH:/usr/local/bin" |
30 |
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack' |
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack' |
31 |
cmdCVS='cvs -d /u/gcmpack' |
cmdCVS='cvs -d /u/gcmpack' |
32 |
|
|
33 |
TESTDIR="/scratch/jmc/test_"`hostname -s` |
# checkOut=2 : download new code ; |
34 |
|
# =3 : skip download but, if sepDir, use a new copy |
35 |
|
# =1 : update code (if no existing code -> swith to 2) |
36 |
|
# =0 : use existing code (if no existing code -> swith to 2) |
37 |
|
dInWeek=`date +%a` |
38 |
|
outDir=`hostname -s` |
39 |
|
TESTDIR="/scratch/jmc/test_${outDir}" |
40 |
|
outDir="${outDir}-${tst_grp}" |
41 |
MC=13 |
MC=13 |
|
checkOut=1 |
|
42 |
sepDir=1 |
sepDir=1 |
43 |
option= |
option= |
44 |
tst_list='g7a adm mpa g77 gfo+rs mth mp2+rs mpi ifc' |
#tst_list='g7a adm mpa g77 gfo+rs mth mp2+rs mpi ifc' |
45 |
#tst_list='g77 adm gfo ifc mth pgi+rs' |
#if test "x$dInWeek" = xSun ; then tst_list="$tst_list tlm oad" ; fi |
46 |
#tst_list='adm gfo+rs mth' |
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 |
|
|
56 |
#option="-nc" ; checkOut=0 |
#option="-nc" ; checkOut=1 |
57 |
#option="-q" ; checkOut=0 |
#option="-q" ; checkOut=1 |
58 |
|
|
59 |
TODAY=`date +%d` |
TODAY=`date +%d` |
60 |
tdir=$TESTDIR |
tdir=$TESTDIR |
61 |
if test $checkOut = '0' ; then |
if test $checkOut != 2 ; then |
62 |
if test -e $tdir/MITgcm/CVS ; then |
if test -e $tdir/MITgcm/CVS ; then |
63 |
echo $tdir/MITgcm/CVS 'exist' |
echo $tdir/MITgcm/CVS 'exist' |
64 |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
if test $sepDir = 0 -a $checkOut = 1 ; then |
65 |
cd $tdir/MITgcm |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
66 |
if test $sepDir = 1 ; then |
cd $tdir/MITgcm |
|
$cmdCVS update -P -d > /dev/null |
|
|
else |
|
67 |
$cmdCVS update -P -d |
$cmdCVS update -P -d |
68 |
|
echo " done" |
69 |
fi |
fi |
|
echo " done" |
|
70 |
else |
else |
71 |
echo -n $tdir/MITgcm 'missing ; ' |
echo -n $tdir/MITgcm 'missing ; ' |
72 |
checkOut=1 |
checkOut=2 |
73 |
fi |
fi |
74 |
fi |
fi |
75 |
if test $checkOut = '1' ; then |
if test $checkOut = 2 ; then |
76 |
if test -e $tdir ; then |
if test -e $tdir ; then |
77 |
echo -n "Removing working copy: $tdir/MITgcm ..." |
echo -n "Removing working copy: $tdir/MITgcm ..." |
78 |
test -e $tdir/MITgcm && rm -rf $tdir/MITgcm |
test -e $tdir/MITgcm && rm -rf $tdir/MITgcm |
98 |
|
|
99 |
echo "================================================================" |
echo "================================================================" |
100 |
typ=`echo $tt | sed 's/+rs//'` |
typ=`echo $tt | sed 's/+rs//'` |
101 |
|
#- define list of additional experiences to test: |
102 |
|
addExp='' |
103 |
|
if test $typ = 'mp2' -o $typ = 'ifc' ; then |
104 |
|
addExp="offline_cheapaml atm_gray" |
105 |
|
fi |
106 |
|
if test $typ = 'gfo' -o $typ = 'ifc' ; then |
107 |
|
addExp="$addExp global_oce_biogeo_bling" |
108 |
|
fi |
109 |
|
if test $typ = 'mpi' ; then |
110 |
|
addExp="$addExp global_oce_cs32" |
111 |
|
fi |
112 |
|
if test $typ = 'gfo' ; then |
113 |
|
addExp="$addExp shelfice_remeshing" |
114 |
|
fi |
115 |
#- check day and time: |
#- check day and time: |
116 |
curDay=`date +%d` ; curHour=`date +%H` |
curDay=`date +%d` ; curHour=`date +%H` |
117 |
if [ $curDay -ne $TODAY ] ; then |
if [ $curDay -ne $TODAY ] ; then |
122 |
date ; echo "too late to run test $typ" |
date ; echo "too late to run test $typ" |
123 |
continue |
continue |
124 |
fi |
fi |
125 |
|
if test $sepDir = 0 -a "x$option" != x -a $tt != $last_Tst ; then |
126 |
|
echo "using option='$option' prevent multi-tests => skip test $typ" |
127 |
|
continue |
128 |
|
fi |
129 |
#- clean-up old output files |
#- clean-up old output files |
130 |
rm -f $tdir/output_${typ}* |
rm -f $tdir/output_${typ}* |
131 |
|
touch $tdir/output_$tt |
132 |
if test $sepDir = 1 ; then |
if test $sepDir = 1 ; then |
133 |
new_dir="MITgcm_$typ" |
new_dir="MITgcm_$typ" |
134 |
if test -d $new_dir/CVS -a $checkOut = '0' ; then |
reUse=1 ; if [ $checkOut -ge 2 ] ; then reUse=0 ; fi |
135 |
|
if test -d $new_dir/CVS -a $reUse = 1 ; then |
136 |
pushd $new_dir |
pushd $new_dir |
137 |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
if test $tt != $typ ; then |
138 |
$cmdCVS update -P -d |
( cd verification ; ../tools/do_tst_2+2 -clean ) |
139 |
echo " done" |
fi |
140 |
|
if test $checkOut = 1 ; then |
141 |
|
echo -n "Update the MITgcm code using: $cmdCVS ..." |
142 |
|
$cmdCVS update -P -d |
143 |
|
echo " done" |
144 |
|
fi |
145 |
else |
else |
146 |
|
if test -d prev ; then |
147 |
|
#-- save previous summary: |
148 |
|
oldS=`ls -t ${new_dir}/verification/tr_${outDir}_*/summary.txt 2> /dev/null | head -1` |
149 |
|
if test "x$oldS" != x ; then cp -p -f $oldS prev/tr_out.$typ ; fi |
150 |
|
if test $tt != $typ ; then |
151 |
|
oldS=`ls -t ${new_dir}/verification/rs_${outDir}_*/summary.txt 2> /dev/null | head -1` |
152 |
|
if test "x$oldS" != x ; then cp -p -f $oldS prev/rs_out.$typ ; fi |
153 |
|
fi |
154 |
|
fi |
155 |
test -e $new_dir && rm -rf $new_dir |
test -e $new_dir && rm -rf $new_dir |
156 |
mkdir $new_dir |
mkdir $new_dir |
157 |
pushd $new_dir |
pushd $new_dir |
158 |
cp -ra ../MITgcm/* . |
cp -ra ../MITgcm/* . |
159 |
|
#-- download additional experience from Contrib: |
160 |
|
for exp2add in $addExp ; do |
161 |
|
echo " add dir: $exp2add (from Contrib:verification_other)" |
162 |
|
( cd verification ; $cmdCVS co -P -d $exp2add \ |
163 |
|
MITgcm_contrib/verification_other/$exp2add > /dev/null ) |
164 |
|
if test $exp2add = 'global_oce_cs32' ; then |
165 |
|
echo " link dir 'other_input/gael_oce_cs32_input' to 'input_fields'" |
166 |
|
( cd verification/global_oce_cs32 |
167 |
|
ln -s ../../../other_input/gael_oce_cs32_input input_fields ) |
168 |
|
fi |
169 |
|
done |
170 |
fi |
fi |
171 |
else |
else |
172 |
pushd MITgcm |
pushd MITgcm |
174 |
cd verification |
cd verification |
175 |
|
|
176 |
#-- set the testreport command: |
#-- set the testreport command: |
|
nbl='-100' |
|
177 |
comm="./testreport" |
comm="./testreport" |
178 |
if test $typ = 'g7a' -o $typ = 'adm' -o $typ = 'mpa' ; then |
if test $typ = 'g7a' -o $typ = 'adm' -o $typ = 'mpa' ; then |
|
nbl='-60' |
|
179 |
comm="$comm -adm" |
comm="$comm -adm" |
180 |
|
elif test $typ = 'oad' ; then |
181 |
|
comm="$comm -oad" |
182 |
|
elif test $typ = 'tlm' ; then |
183 |
|
comm="$comm -tlm" |
184 |
elif test $typ = 'mth' -o $typ = 'mp2' ; then |
elif test $typ = 'mth' -o $typ = 'mp2' ; then |
185 |
export GOMP_STACKSIZE=400m |
export GOMP_STACKSIZE=400m |
186 |
export OMP_NUM_THREADS=2 |
export OMP_NUM_THREADS=2 |
187 |
comm="$comm -mth" |
comm="$comm -mth" |
188 |
|
else |
189 |
|
comm="$comm -md cyrus-makedepend" |
190 |
fi |
fi |
191 |
comm="$comm -a jmc@mitgcm.org" |
comm="$comm -odir $outDir -a jmc@mitgcm.org" |
192 |
#-- set the optfile (+ mpi & match-precision) |
#-- set the optfile (+ mpi & match-precision) |
193 |
MPI=0 |
MPI=0 |
194 |
case $typ in |
case $typ in |
195 |
'g77'|'g7a') OPTFILE='../tools/build_options/linux_amd64_g77' ;; |
'g77'|'g7a') OPTFILE='../tools/build_options/linux_amd64_g77' ;; |
196 |
'gfo'|'adm'|'mth') OPTFILE='../tools/build_options/linux_amd64_gfortran' |
'gfo'|'adm'|'oad'|'tlm'|'mth') comm="$comm -match $MC -devel" |
197 |
comm="$comm -match $MC -devel" ;; |
OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
198 |
'ifc') OPTFILE='../tools/build_options/linux_amd64_ifort11' ;; |
'ifc') comm="$comm -devel" |
199 |
|
OPTFILE='../tools/build_options/linux_amd64_ifort11' ;; |
200 |
'pgi') OPTFILE='../tools/build_options/linux_amd64_pgf77' ;; |
'pgi') OPTFILE='../tools/build_options/linux_amd64_pgf77' ;; |
201 |
'mpa'|'mpi'|'mp2') OPTFILE='../tools/build_options/linux_amd64_gfortran' |
'mpa'|'mpi'|'mp2') comm="$comm -match $MC -devel" ; MPI=6 |
202 |
comm="$comm -match $MC -devel" ; MPI=6 ;; |
OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
203 |
*) OPTFILE= ;; |
*) OPTFILE= ;; |
204 |
esac |
esac |
205 |
#-- set MPI command: |
#-- set MPI command: |
213 |
fi |
fi |
214 |
|
|
215 |
#-- set specific Env Vars: |
#-- set specific Env Vars: |
216 |
|
if test $typ = 'oad' ; then |
217 |
|
source ~jmc/mitgcm/bin/setenv_OpenAD.sh |
218 |
|
fi |
219 |
if test $typ = 'ifc' ; then |
if test $typ = 'ifc' ; then |
220 |
source /srv/software/intel/intel-11.1.073/bin/ifortvars.sh intel64 |
source /srv/software/intel/intel-11.1.073/bin/ifortvars.sh intel64 |
221 |
fi |
fi |
226 |
export LM_LICENSE_FILE=$PGI/license.dat |
export LM_LICENSE_FILE=$PGI/license.dat |
227 |
fi |
fi |
228 |
|
|
229 |
if test $sepDir = 0 -a $checkOut = '1' -a $tt = $firstTst ; then |
if test $sepDir = 0 -a "x$option" = x -a $tt = $firstTst -a $checkOut != 2 ; then |
230 |
#-- cleaning: |
#-- cleaning: |
231 |
echo "======================" |
echo "======================" |
232 |
echo "Cleaning test directories:" |
echo "Cleaning test directories:" | tee -a $tdir/output_$tt |
233 |
cmdCLN="./testreport -clean" |
cmdCLN="./testreport -clean" |
234 |
echo " clean dir running: $cmdCLN" |
echo " clean dir running: $cmdCLN" | tee -a $tdir/output_$tt |
235 |
$cmdCLN > /dev/null 2>&1 |
$cmdCLN >> $tdir/output_$tt 2>&1 |
236 |
echo "======================" |
echo "======================" |
237 |
echo |
echo "" | tee -a $tdir/output_$tt |
238 |
fi |
fi |
239 |
|
|
240 |
#-- run the testreport command: |
#-- run the testreport command: |
241 |
echo -n "Running testreport using:" |
echo -n "Running testreport using:" | tee -a $tdir/output_$tt |
242 |
if test "x$OPTFILE" != x ; then |
if test "x$OPTFILE" != x ; then |
243 |
comm="$comm -of=$OPTFILE" |
comm="$comm -of=$OPTFILE" |
244 |
fi |
fi |
245 |
if test $MPI = 0 ; then echo '' |
if test $MPI = 0 ; then echo '' | tee -a $tdir/output_$tt |
246 |
else echo " (EXE='$EXE')" |
else echo " (EXE='$EXE')" | tee -a $tdir/output_$tt |
247 |
comm="$comm -MPI $MPI -command \"\$EXE\"" |
comm="$comm -MPI $MPI -command \"\$EXE\"" |
248 |
fi |
fi |
249 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
if test "x$option" != x ; then comm="$comm $option" ; fi |
250 |
#if test $typ = 'pgi' ; then comm="$comm -t \"\$listT\"" ; fi |
#if test $typ = 'pgi' ; then comm="$comm -t \"\$listT\"" ; fi |
251 |
echo " \"eval $comm\"" |
echo " \"eval $comm\"" | tee -a $tdir/output_$tt |
252 |
echo "======================" |
echo "======================" |
253 |
eval $comm > $tdir/output_$typ 2>&1 |
eval $comm >> $tdir/output_$tt 2>&1 |
254 |
tail $nbl $tdir/output_$typ |
sed -n "/^An email /,/^======== End of testreport / p" $tdir/output_$tt |
255 |
echo |
echo "" | tee -a $tdir/output_$tt |
256 |
|
|
257 |
#-- also test restart (test 2+2=4) |
#-- also test restart (test 2+2=4) |
258 |
if test $tt != $typ |
if test $tt != $typ |
259 |
then |
then |
260 |
echo "testing restart using:" |
echo "testing restart using:" | tee -a $tdir/output_$tt |
261 |
comm="../tools/do_tst_2+2 -a jmc@mitgcm.org" |
comm="../tools/do_tst_2+2 -o $outDir -a jmc@mitgcm.org" |
262 |
if test $MPI = 0 ; then |
if test $MPI = 0 ; then |
263 |
echo " \"$comm\"" |
echo " \"$comm\"" | tee -a $tdir/output_$tt |
264 |
echo "======================" |
echo "======================" |
265 |
$comm > $tdir/output_2+2 2>&1 |
$comm >> $tdir/output_$tt 2>&1 |
266 |
else |
else |
267 |
echo " \"$comm -mpi -exe $EXE\"" |
echo " \"$comm -mpi -exe $EXE\"" | tee -a $tdir/output_$tt |
268 |
echo "======================" |
echo "======================" |
269 |
$comm -mpi -exe "$EXE" > $tdir/output_2+2 2>&1 |
$comm -mpi -exe "$EXE" >> $tdir/output_$tt 2>&1 |
270 |
fi |
fi |
|
#tail $nbl $tdir/output_2+2 |
|
271 |
echo ; cat tst_2+2_out.txt |
echo ; cat tst_2+2_out.txt |
272 |
echo |
echo |
273 |
fi |
fi |
276 |
if test $sepDir = 0 ; then |
if test $sepDir = 0 ; then |
277 |
#-- cleaning: |
#-- cleaning: |
278 |
echo "======================" |
echo "======================" |
279 |
echo "Cleaning test directories:" |
echo "Cleaning test directories:" | tee -a $tdir/output_$tt |
280 |
if test $tt != $typ ; then |
if test $tt != $typ ; then |
281 |
cmdCLN="../tools/do_tst_2+2 -clean" |
cmdCLN="../tools/do_tst_2+2 -clean" |
282 |
echo " clean tst_2+2 running: $cmdCLN" |
echo " clean tst_2+2 running: $cmdCLN" | tee -a $tdir/output_$tt |
283 |
$cmdCLN >> $tdir/output_2+2 2>&1 |
$cmdCLN >> $tdir/output_$tt 2>&1 |
284 |
fi |
fi |
285 |
if test $tt != $last_Tst ; then |
if test $tt != $last_Tst ; then |
286 |
cmdCLN="./testreport -clean" |
cmdCLN="./testreport -clean" |
287 |
echo " clean dir running: $cmdCLN" |
echo " clean dir running: $cmdCLN" | tee -a $tdir/output_$tt |
288 |
$cmdCLN > /dev/null 2>&1 |
$cmdCLN >> $tdir/output_$tt 2>&1 |
289 |
fi |
fi |
290 |
echo "======================" |
echo "======================" |
291 |
echo |
echo |