2 |
|
|
3 |
# $Header$ |
# $Header$ |
4 |
|
|
|
# Ed Hill |
|
|
|
|
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 |
6 |
# Linux machines. |
# Linux machines. |
7 |
|
|
12 |
export LC_ALL="en_US.UTF-8" |
export LC_ALL="en_US.UTF-8" |
13 |
# Turn off stack limit for FIZHI & AD-tests |
# Turn off stack limit for FIZHI & AD-tests |
14 |
ulimit -s unlimited |
ulimit -s unlimited |
15 |
|
# MPI test (for now, only with gfortran) |
16 |
|
export MPI_GCC_DIR=/srv/software/gcc/gcc-packages/gcc-4.4.5/mpich2/mpich2-1.3 |
17 |
|
export MPI_INC_DIR=$MPI_GCC_DIR/include |
18 |
|
export PATH="$PATH:$MPI_GCC_DIR/bin" |
19 |
|
|
20 |
#- method to acces CVS: |
#- method to acces CVS: |
21 |
# export CVSROOT='/u/gcmpack' |
# export CVSROOT='/u/gcmpack' |
25 |
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack' |
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack' |
26 |
cmdCVS='cvs -d /u/gcmpack' |
cmdCVS='cvs -d /u/gcmpack' |
27 |
|
|
28 |
TESTDIR="/scratch/jmc/test_"`hostname -s` |
# checkOut=2 : download new code ; |
29 |
|
# =3 : skip download but, if sepDir, use a new copy |
30 |
|
# =1 : update code (if no existing code -> swith to 2) |
31 |
|
# =0 : use existing code (if no existing code -> swith to 2) |
32 |
|
dInWeek=`date +%a` |
33 |
|
outDir=`hostname -s` |
34 |
|
TESTDIR="/scratch/jmc/test_${outDir}" |
35 |
MC=13 |
MC=13 |
36 |
checkOut=1 |
checkOut=2 |
37 |
sepDir=1 |
sepDir=1 |
38 |
option= |
option= |
39 |
tst_list='g7a adm g77 gfo+rs mth ifc' |
#tst_list='g7a adm mpa g77 gfo+rs mth mp2+rs mpi ifc' |
40 |
#tst_list='g77 adm gfo ifc mth pgi+rs' |
#if test "x$dInWeek" = xSun ; then tst_list="$tst_list tlm oad" ; fi |
41 |
#tst_list='g77 gfo+rs mth' |
outDir="${outDir}-a" |
42 |
|
tst_list='g7a mpa mth mp2+rs mpi oad' |
43 |
|
#outDir="${outDir}-b" |
44 |
|
#tst_list='adm g77 gfo+rs ifc' |
45 |
|
#if test "x$dInWeek" = xSun ; then tst_list="$tst_list tlm" ; fi |
46 |
|
|
47 |
#option="-nc" ; checkOut=0 |
#option="-nc" ; checkOut=1 |
48 |
#option="-q" ; checkOut=0 |
#option="-q" ; checkOut=1 |
49 |
|
|
50 |
TODAY=`date +%d` |
TODAY=`date +%d` |
51 |
tdir=$TESTDIR |
tdir=$TESTDIR |
52 |
if test $checkOut = '0' ; then |
if test $checkOut != 2 ; then |
53 |
if test -e $tdir/MITgcm/CVS ; then |
if test -e $tdir/MITgcm/CVS ; then |
54 |
echo $tdir/MITgcm/CVS 'exist' |
echo $tdir/MITgcm/CVS 'exist' |
55 |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
if test $sepDir = 0 -a $checkOut = 1 ; then |
56 |
cd $tdir/MITgcm |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
57 |
if test $sepDir = 1 ; then |
cd $tdir/MITgcm |
58 |
$cmdCVS update -P -d > /dev/null |
$cmdCVS update -P -d |
59 |
|
echo " done" |
60 |
|
fi |
61 |
else |
else |
62 |
$cmdCVS update -P -d |
echo -n $tdir/MITgcm 'missing ; ' |
63 |
|
checkOut=2 |
64 |
fi |
fi |
|
echo " done" |
|
|
else |
|
|
echo -n $tdir/MITgcm 'missing ; ' |
|
|
checkOut=1 |
|
|
fi |
|
65 |
fi |
fi |
66 |
if test $checkOut = '1' ; then |
if test $checkOut = 2 ; then |
67 |
if test -e $tdir ; then |
if test -e $tdir ; then |
68 |
echo -n "Removing working copy: $tdir/MITgcm ..." |
echo -n "Removing working copy: $tdir/MITgcm ..." |
69 |
test -e $tdir/MITgcm && rm -rf $tdir/MITgcm |
test -e $tdir/MITgcm && rm -rf $tdir/MITgcm |
87 |
for tt in $tst_list |
for tt in $tst_list |
88 |
do |
do |
89 |
|
|
90 |
echo "================================================================" |
echo "================================================================" |
91 |
typ=`echo $tt | sed 's/+rs//'` |
typ=`echo $tt | sed 's/+rs//'` |
92 |
#- check day and time: |
#- check day and time: |
93 |
curDay=`date +%d` ; curHour=`date +%H` |
curDay=`date +%d` ; curHour=`date +%H` |
94 |
if [ $curDay -ne $TODAY ] ; then |
if [ $curDay -ne $TODAY ] ; then |
95 |
date ; echo "day is over => skip test $typ" |
date ; echo "day is over => skip test $typ" |
96 |
continue |
continue |
97 |
fi |
fi |
98 |
if [ $curHour -ge 18 ] ; then |
if [ $curHour -ge 18 ] ; then |
99 |
date ; echo "too late to run test $typ" |
date ; echo "too late to run test $typ" |
100 |
continue |
continue |
101 |
fi |
fi |
102 |
#- clean-up old output files |
if test $sepDir = 0 -a "x$option" != x -a $tt != $last_Tst ; then |
103 |
rm -f $tdir/output_${typ}* |
echo "using option='$option' prevent multi-tests => skip test $typ" |
104 |
if test $sepDir = 1 ; then |
continue |
105 |
new_dir="MITgcm_$typ" |
fi |
106 |
if test -d $new_dir/CVS -a $checkOut = '0' ; then |
#- clean-up old output files |
107 |
pushd $new_dir |
rm -f $tdir/output_${typ}* |
108 |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
touch $tdir/output_$tt |
109 |
$cmdCVS update -P -d |
if test $sepDir = 1 ; then |
110 |
echo " done" |
new_dir="MITgcm_$typ" |
111 |
|
reUse=1 ; if [ $checkOut -ge 2 ] ; then reUse=0 ; fi |
112 |
|
if test -d $new_dir/CVS -a $reUse = 1 ; then |
113 |
|
pushd $new_dir |
114 |
|
if test $tt != $typ ; then |
115 |
|
( cd verification ; ../tools/do_tst_2+2 -clean ) |
116 |
|
fi |
117 |
|
if test $checkOut = 1 ; then |
118 |
|
echo -n "Update the MITgcm code using: $cmdCVS ..." |
119 |
|
$cmdCVS update -P -d |
120 |
|
echo " done" |
121 |
|
fi |
122 |
|
else |
123 |
|
if test -d prev ; then |
124 |
|
#-- save previous summary: |
125 |
|
oldS=`ls -t ${new_dir}/verification/tr_${outDir}_*/summary.txt 2> /dev/null | head -1` |
126 |
|
if test "x$oldS" != x ; then cp -p -f $oldS prev/tr_out.$typ ; fi |
127 |
|
if test $tt != $typ ; then |
128 |
|
oldS=`ls -t ${new_dir}/verification/rs_${outDir}_*/summary.txt 2> /dev/null | head -1` |
129 |
|
if test "x$oldS" != x ; then cp -p -f $oldS prev/rs_out.$typ ; fi |
130 |
|
fi |
131 |
|
fi |
132 |
|
test -e $new_dir && rm -rf $new_dir |
133 |
|
mkdir $new_dir |
134 |
|
pushd $new_dir |
135 |
|
cp -ra ../MITgcm/* . |
136 |
|
fi |
137 |
else |
else |
138 |
test -e $new_dir && rm -rf $new_dir |
pushd MITgcm |
|
mkdir $new_dir |
|
|
pushd $new_dir |
|
|
cp -ra ../MITgcm/* . |
|
|
fi |
|
|
else |
|
|
pushd MITgcm |
|
|
fi |
|
|
cd verification |
|
|
|
|
|
case $typ in |
|
|
'g77'|'g7a') OPTFILE='../tools/build_options/linux_amd64_g77' ;; |
|
|
'gfo'|'adm') OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
|
|
'ifc') OPTFILE='../tools/build_options/linux_amd64_ifort11' ;; |
|
|
'pgi') OPTFILE='../tools/build_options/linux_amd64_pgf77' ;; |
|
|
'mth') OPTFILE='../tools/build_options/linux_amd64_gfortran' |
|
|
export GOMP_STACKSIZE=400m ;; |
|
|
*) OPTFILE= ;; |
|
|
esac |
|
|
|
|
|
if test $sepDir = 0 -a $checkOut = '1' -a $tt = $firstTst ; then |
|
|
#-- cleaning: |
|
|
echo "======================" |
|
|
echo "Cleaning test directories:" |
|
|
cmdCLN="./testreport -clean" |
|
|
echo " clean dir running: $cmdCLN" |
|
|
$cmdCLN > /dev/null 2>&1 |
|
|
echo "======================" |
|
|
echo |
|
|
fi |
|
|
|
|
|
if test $typ = 'g77' |
|
|
then |
|
|
|
|
|
echo "Running testreport using:" |
|
|
comm="./testreport -a jmc@mitgcm.org" |
|
|
# comm="$comm -match $MC" |
|
|
if test "x$OPTFILE" != x ; then |
|
|
comm="$comm -of=$OPTFILE" |
|
|
fi |
|
|
if test "x$option" != x ; then comm="$comm $option" ; fi |
|
|
echo " \"$comm\"" |
|
|
echo "======================" |
|
|
$comm > $tdir/output_$typ 2>&1 |
|
|
tail -100 $tdir/output_$typ |
|
|
echo |
|
|
|
|
|
fi |
|
|
|
|
|
if test $typ = 'gfo' |
|
|
then |
|
|
|
|
|
echo "Running testreport using:" |
|
|
comm="./testreport -a jmc@mitgcm.org" |
|
|
comm="$comm -match $MC" |
|
|
if test "x$OPTFILE" != x ; then |
|
|
comm="$comm -of=$OPTFILE" |
|
139 |
fi |
fi |
140 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
cd verification |
141 |
echo " \"$comm\"" |
|
142 |
echo "======================" |
#-- set the testreport command: |
143 |
$comm > $tdir/output_$typ 2>&1 |
comm="./testreport" |
144 |
tail -100 $tdir/output_$typ |
if test $typ = 'g7a' -o $typ = 'adm' -o $typ = 'mpa' ; then |
145 |
echo |
comm="$comm -adm" |
146 |
|
elif test $typ = 'oad' ; then |
147 |
fi |
comm="$comm -oad" |
148 |
|
elif test $typ = 'tlm' ; then |
149 |
if test $typ = 'g7a' |
comm="$comm -tlm" |
150 |
then |
elif test $typ = 'mth' -o $typ = 'mp2' ; then |
151 |
|
export GOMP_STACKSIZE=400m |
152 |
echo "Running testreport using:" |
export OMP_NUM_THREADS=2 |
153 |
comm="./testreport -adm -a jmc@mitgcm.org" |
comm="$comm -mth" |
154 |
# comm="$comm -match $MC" |
else |
155 |
if test "x$OPTFILE" != x ; then |
comm="$comm -md cyrus-makedepend" |
|
comm="$comm -of=$OPTFILE" |
|
156 |
fi |
fi |
157 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
comm="$comm -odir $outDir -a jmc@mitgcm.org" |
158 |
echo " \"$comm\"" |
#-- set the optfile (+ mpi & match-precision) |
159 |
echo "======================" |
MPI=0 |
160 |
$comm > $tdir/output_$typ 2>&1 |
case $typ in |
161 |
tail -60 $tdir/output_$typ |
'g77'|'g7a') OPTFILE='../tools/build_options/linux_amd64_g77' ;; |
162 |
echo |
'gfo'|'adm'|'oad'|'tlm'|'mth') comm="$comm -match $MC -devel" |
163 |
|
OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
164 |
fi |
'ifc') comm="$comm -devel" |
165 |
|
OPTFILE='../tools/build_options/linux_amd64_ifort11' ;; |
166 |
if test $typ = 'adm' |
'pgi') OPTFILE='../tools/build_options/linux_amd64_pgf77' ;; |
167 |
then |
'mpa'|'mpi'|'mp2') comm="$comm -match $MC -devel" ; MPI=6 |
168 |
|
OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
169 |
echo "Running testreport using:" |
*) OPTFILE= ;; |
170 |
comm="./testreport -adm -a jmc@mitgcm.org" |
esac |
171 |
comm="$comm -match $MC" |
#-- set MPI command: |
172 |
if test "x$OPTFILE" != x ; then |
if test $MPI != 0 ; then |
173 |
comm="$comm -of=$OPTFILE" |
if test $typ = 'mp2' ; then MPI=3 ; fi |
174 |
|
if test $typ = 'mpa' ; then |
175 |
|
EXE="mpirun -np TR_NPROC ./mitgcmuv_ad" |
176 |
|
else |
177 |
|
EXE="mpirun -np TR_NPROC ./mitgcmuv" |
178 |
|
fi |
179 |
|
fi |
180 |
|
|
181 |
|
#-- set specific Env Vars: |
182 |
|
if test $typ = 'oad' ; then |
183 |
|
source ~jmc/mitgcm/bin/setenv_OpenAD.sh |
184 |
|
fi |
185 |
|
if test $typ = 'ifc' ; then |
186 |
|
source /srv/software/intel/intel-11.1.073/bin/ifortvars.sh intel64 |
187 |
|
fi |
188 |
|
if test $typ = 'pgi' ; then |
189 |
|
#listT='fizhi-cs-32x32x40 fizhi-cs-aqualev20' |
190 |
|
export PGI=/srv/software/pgi/pgi-10.9 |
191 |
|
export PATH="$PATH:$PGI/linux86-64/10.9/bin" |
192 |
|
export LM_LICENSE_FILE=$PGI/license.dat |
193 |
fi |
fi |
194 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
|
195 |
echo " \"$comm\"" |
if test $sepDir = 0 -a "x$option" = x -a $tt = $firstTst -a $checkOut != 2 ; then |
196 |
echo "======================" |
#-- cleaning: |
197 |
$comm > $tdir/output_$typ 2>&1 |
echo "======================" |
198 |
tail -60 $tdir/output_$typ |
echo "Cleaning test directories:" | tee -a $tdir/output_$tt |
199 |
echo |
cmdCLN="./testreport -clean" |
200 |
|
echo " clean dir running: $cmdCLN" | tee -a $tdir/output_$tt |
201 |
fi |
$cmdCLN >> $tdir/output_$tt 2>&1 |
202 |
|
echo "======================" |
203 |
if test $typ = 'ifc' |
echo "" | tee -a $tdir/output_$tt |
|
then |
|
|
|
|
|
source /srv/software/intel/intel-11.1.073/bin/ifortvars.sh intel64 |
|
|
echo "Running testreport using:" |
|
|
comm="./testreport -a jmc@mitgcm.org" |
|
|
# comm="$comm -match $MC" |
|
|
if test "x$OPTFILE" != x ; then |
|
|
comm="$comm -of=$OPTFILE" |
|
204 |
fi |
fi |
205 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
|
206 |
echo " \"$comm\"" |
#-- run the testreport command: |
207 |
echo "======================" |
echo -n "Running testreport using:" | tee -a $tdir/output_$tt |
|
$comm > $tdir/output_$typ 2>&1 |
|
|
tail -100 $tdir/output_$typ |
|
|
echo |
|
|
|
|
|
fi |
|
|
|
|
|
if test $typ = 'mth' |
|
|
then |
|
|
|
|
|
export OMP_NUM_THREADS=2 |
|
|
echo "Running testreport using:" |
|
|
comm="./testreport -mth -a jmc@mitgcm.org" |
|
|
comm="$comm -match $MC" |
|
208 |
if test "x$OPTFILE" != x ; then |
if test "x$OPTFILE" != x ; then |
209 |
comm="$comm -of=$OPTFILE" |
comm="$comm -of=$OPTFILE" |
210 |
fi |
fi |
211 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
if test $MPI = 0 ; then echo '' | tee -a $tdir/output_$tt |
212 |
echo " \"$comm\"" |
else echo " (EXE='$EXE')" | tee -a $tdir/output_$tt |
213 |
echo "======================" |
comm="$comm -MPI $MPI -command \"\$EXE\"" |
|
$comm > $tdir/output_$typ 2>&1 |
|
|
tail -100 $tdir/output_$typ |
|
|
echo |
|
|
|
|
|
fi |
|
|
|
|
|
if test $typ = 'pgi' |
|
|
then |
|
|
|
|
|
export PGI=/srv/software/pgi/pgi-10.9 |
|
|
export PATH=$PGI/linux86-64/10.9/bin:$PATH |
|
|
export LM_LICENSE_FILE=$PGI/license.dat |
|
|
echo "Running testreport using:" |
|
|
comm="./testreport -a jmc@mitgcm.org" |
|
|
# comm="$comm -match $MC" |
|
|
#comm="$comm -skd tutorial_advection_in_gyre" |
|
|
if test "x$OPTFILE" != x ; then |
|
|
comm="$comm -of=$OPTFILE" |
|
214 |
fi |
fi |
215 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
if test "x$option" != x ; then comm="$comm $option" ; fi |
216 |
echo " \"$comm\"" |
#if test $typ = 'pgi' ; then comm="$comm -t \"\$listT\"" ; fi |
217 |
|
echo " \"eval $comm\"" | tee -a $tdir/output_$tt |
218 |
echo "======================" |
echo "======================" |
219 |
$comm > $tdir/output_${typ} 2>&1 |
eval $comm >> $tdir/output_$tt 2>&1 |
220 |
tail -100 $tdir/output_${typ} |
sed -n "/^An email /,/^======== End of testreport / p" $tdir/output_$tt |
221 |
echo |
echo "" | tee -a $tdir/output_$tt |
|
|
|
|
fi |
|
222 |
|
|
223 |
#-- also test restart (test 2+2=4) |
#-- also test restart (test 2+2=4) |
224 |
if test $tt != $typ |
if test $tt != $typ |
225 |
then |
then |
226 |
echo "testing restart using:" |
echo "testing restart using:" | tee -a $tdir/output_$tt |
227 |
comm="../tools/do_tst_2+2 -a jmc@mitgcm.org" |
comm="../tools/do_tst_2+2 -o $outDir -a jmc@mitgcm.org" |
228 |
echo " \"$comm\"" |
if test $MPI = 0 ; then |
229 |
echo "======================" |
echo " \"$comm\"" | tee -a $tdir/output_$tt |
230 |
$comm > $tdir/output_2+2 2>&1 |
echo "======================" |
231 |
#tail -100 $tdir/output_2+2 |
$comm >> $tdir/output_$tt 2>&1 |
232 |
echo ; cat tst_2+2_out.txt |
else |
233 |
echo |
echo " \"$comm -mpi -exe $EXE\"" | tee -a $tdir/output_$tt |
234 |
fi |
echo "======================" |
235 |
export OMP_NUM_THREADS=1 |
$comm -mpi -exe "$EXE" >> $tdir/output_$tt 2>&1 |
236 |
|
fi |
237 |
|
echo ; cat tst_2+2_out.txt |
238 |
|
echo |
239 |
|
fi |
240 |
|
export OMP_NUM_THREADS=1 |
241 |
|
|
242 |
if test $sepDir = 0 ; then |
if test $sepDir = 0 ; then |
243 |
#-- cleaning: |
#-- cleaning: |
244 |
echo "======================" |
echo "======================" |
245 |
echo "Cleaning test directories:" |
echo "Cleaning test directories:" | tee -a $tdir/output_$tt |
246 |
if test $tt != $typ ; then |
if test $tt != $typ ; then |
247 |
cmdCLN="../tools/do_tst_2+2 -clean" |
cmdCLN="../tools/do_tst_2+2 -clean" |
248 |
echo " clean tst_2+2 running: $cmdCLN" |
echo " clean tst_2+2 running: $cmdCLN" | tee -a $tdir/output_$tt |
249 |
$cmdCLN >> $tdir/output_2+2 2>&1 |
$cmdCLN >> $tdir/output_$tt 2>&1 |
250 |
|
fi |
251 |
|
if test $tt != $last_Tst ; then |
252 |
|
cmdCLN="./testreport -clean" |
253 |
|
echo " clean dir running: $cmdCLN" | tee -a $tdir/output_$tt |
254 |
|
$cmdCLN >> $tdir/output_$tt 2>&1 |
255 |
|
fi |
256 |
|
echo "======================" |
257 |
|
echo |
258 |
fi |
fi |
259 |
if test $tt != $last_Tst ; then |
popd |
|
cmdCLN="./testreport -clean" |
|
|
echo " clean dir running: $cmdCLN" |
|
|
$cmdCLN > /dev/null 2>&1 |
|
|
fi |
|
|
echo "======================" |
|
|
echo |
|
|
fi |
|
|
popd |
|
260 |
|
|
261 |
done |
done |