1 |
#! /usr/bin/env bash |
2 |
|
3 |
# $Header: /u/gcmpack/MITgcm/tools/example_scripts/csail/test_dickens,v 1.14 2010/09/18 00:07:53 jmc Exp $ |
4 |
|
5 |
# Ed Hill |
6 |
|
7 |
# Test script for MITgcm that should work on most of the csail.mit.edu |
8 |
# Linux machines. |
9 |
|
10 |
# defaults |
11 |
export PATH="$PATH:/usr/local/bin" |
12 |
#- to get case insensitive "ls" (and order of tested experiments) |
13 |
export LC_ALL="en_US.UTF-8" |
14 |
# Turn off stack limit for FIZHI & AD-tests |
15 |
ulimit -s unlimited |
16 |
|
17 |
#- method to acces CVS: |
18 |
# export CVSROOT='/u/gcmpack' |
19 |
# export CVSROOT=':ext:@mitgcm.org:/u/gcmpack' |
20 |
# export CVS_RSH='ssh' ; cvs co -P MITgcm > /dev/null |
21 |
# cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack co -P MITgcm > /dev/null |
22 |
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack' |
23 |
cmdCVS='cvs -d /u/gcmpack' |
24 |
|
25 |
TESTDIR="/tmp/jmc/test_"`hostname -s` |
26 |
MC=13 |
27 |
checkOut=1 |
28 |
sepDir=0 |
29 |
option= |
30 |
#tst_list='g7a adm g77 gfo+rs mth ifc' |
31 |
#tst_list='g77 adm ifc mth pgi+rs' |
32 |
tst_list='g77 gfo+rs mth' |
33 |
|
34 |
#option="-nc" ; checkOut=0 |
35 |
#option="-q" ; checkOut=0 |
36 |
|
37 |
TODAY=`date +%d` |
38 |
tdir=$TESTDIR |
39 |
if test $checkOut = '0' ; then |
40 |
if test -e $tdir/MITgcm/CVS ; then |
41 |
echo $tdir/MITgcm/CVS 'exist' |
42 |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
43 |
cd $tdir/MITgcm |
44 |
if test $sepDir = 1 ; then |
45 |
$cmdCVS update -P -d > /dev/null |
46 |
else |
47 |
$cmdCVS update -P -d |
48 |
fi |
49 |
echo " done" |
50 |
else |
51 |
echo -n $tdir/MITgcm 'missing ; ' |
52 |
checkOut=1 |
53 |
fi |
54 |
fi |
55 |
if test $checkOut = '1' ; then |
56 |
if test -e $tdir ; then |
57 |
echo -n "Removing working copy: $tdir/MITgcm ..." |
58 |
test -e $tdir/MITgcm && rm -rf $tdir/MITgcm |
59 |
else |
60 |
echo -n "Creating a working dir: $tdir ..." |
61 |
mkdir $tdir |
62 |
fi |
63 |
echo " done" |
64 |
echo -n "Downloading the MITgcm code using: $cmdCVS ..." |
65 |
cd $tdir |
66 |
$cmdCVS co -P MITgcm > /dev/null |
67 |
echo " done" |
68 |
else |
69 |
cd $tdir |
70 |
fi |
71 |
|
72 |
#------------------------------------------------------------------------ |
73 |
|
74 |
firstTst=`echo $tst_list | awk '{print $1}'` |
75 |
last_Tst=`echo $tst_list | awk '{print $NF}'` |
76 |
for tt in $tst_list |
77 |
do |
78 |
|
79 |
echo "================================================================" |
80 |
typ=`echo $tt | sed 's/+rs//'` |
81 |
#- check day and time: |
82 |
curDay=`date +%d` ; curHour=`date +%H` |
83 |
if [ $curDay -ne $TODAY ] ; then |
84 |
date ; echo "day is over => skip test $typ" |
85 |
continue |
86 |
fi |
87 |
if [ $curHour -ge 18 ] ; then |
88 |
date ; echo "too late to run test $typ" |
89 |
continue |
90 |
fi |
91 |
#- clean-up old output files |
92 |
rm -f $tdir/output_${typ}* |
93 |
if test $sepDir = 1 ; then |
94 |
new_dir="MITgcm_$typ" |
95 |
if test -d $new_dir/CVS -a $checkOut = '0' ; then |
96 |
pushd $new_dir |
97 |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
98 |
$cmdCVS update -P -d |
99 |
echo " done" |
100 |
else |
101 |
test -e $new_dir && rm -rf $new_dir |
102 |
mkdir $new_dir |
103 |
pushd $new_dir |
104 |
cp -ra ../MITgcm/* . |
105 |
fi |
106 |
else |
107 |
pushd MITgcm |
108 |
fi |
109 |
cd verification |
110 |
|
111 |
case $typ in |
112 |
'g77'|'g7a') OPTFILE='../tools/build_options/linux_amd64_g77' ;; |
113 |
'gfo'|'adm') OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
114 |
'ifc') OPTFILE='../tools/build_options/linux_amd64_ifort11' ;; |
115 |
'pgi') OPTFILE='../tools/build_options/linux_amd64_pgf77' ;; |
116 |
'mth') OPTFILE='../tools/build_options/linux_amd64_gfortran' |
117 |
export GOMP_STACKSIZE=400m ;; |
118 |
*) OPTFILE= ;; |
119 |
esac |
120 |
|
121 |
if test $sepDir = 0 -a $checkOut = '1' -a $tt = $firstTst ; then |
122 |
#-- cleaning: |
123 |
echo "======================" |
124 |
echo "Cleaning test directories:" |
125 |
cmdCLN="./testreport -clean" |
126 |
echo " clean dir running: $cmdCLN" |
127 |
$cmdCLN > /dev/null 2>&1 |
128 |
echo "======================" |
129 |
echo |
130 |
fi |
131 |
|
132 |
if test $typ = 'g77' |
133 |
then |
134 |
|
135 |
echo "Running testreport using:" |
136 |
comm="./testreport -a jmc@mitgcm.org" |
137 |
# comm="$comm -match $MC" |
138 |
if test "x$OPTFILE" != x ; then |
139 |
comm="$comm -of=$OPTFILE" |
140 |
fi |
141 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
142 |
echo " \"$comm\"" |
143 |
echo "======================" |
144 |
$comm > $tdir/output_$typ 2>&1 |
145 |
tail -100 $tdir/output_$typ |
146 |
echo |
147 |
|
148 |
fi |
149 |
|
150 |
if test $typ = 'gfo' |
151 |
then |
152 |
|
153 |
echo "Running testreport using:" |
154 |
comm="./testreport -a jmc@mitgcm.org" |
155 |
comm="$comm -match $MC" |
156 |
if test "x$OPTFILE" != x ; then |
157 |
comm="$comm -of=$OPTFILE" |
158 |
fi |
159 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
160 |
echo " \"$comm\"" |
161 |
echo "======================" |
162 |
$comm > $tdir/output_$typ 2>&1 |
163 |
tail -100 $tdir/output_$typ |
164 |
echo |
165 |
|
166 |
fi |
167 |
|
168 |
if test $typ = 'g7a' |
169 |
then |
170 |
|
171 |
echo "Running testreport using:" |
172 |
comm="./testreport -adm -a jmc@mitgcm.org" |
173 |
# comm="$comm -match $MC" |
174 |
if test "x$OPTFILE" != x ; then |
175 |
comm="$comm -of=$OPTFILE" |
176 |
fi |
177 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
178 |
echo " \"$comm\"" |
179 |
echo "======================" |
180 |
$comm > $tdir/output_$typ 2>&1 |
181 |
tail -60 $tdir/output_$typ |
182 |
echo |
183 |
|
184 |
fi |
185 |
|
186 |
if test $typ = 'adm' |
187 |
then |
188 |
|
189 |
echo "Running testreport using:" |
190 |
comm="./testreport -adm -a jmc@mitgcm.org" |
191 |
comm="$comm -match $MC" |
192 |
if test "x$OPTFILE" != x ; then |
193 |
comm="$comm -of=$OPTFILE" |
194 |
fi |
195 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
196 |
echo " \"$comm\"" |
197 |
echo "======================" |
198 |
$comm > $tdir/output_$typ 2>&1 |
199 |
tail -60 $tdir/output_$typ |
200 |
echo |
201 |
|
202 |
fi |
203 |
|
204 |
if test $typ = 'ifc' |
205 |
then |
206 |
|
207 |
echo "Running testreport using:" |
208 |
comm="./testreport -a jmc@mitgcm.org" |
209 |
# comm="$comm -match $MC" |
210 |
if test "x$OPTFILE" != x ; then |
211 |
comm="$comm -of=$OPTFILE" |
212 |
fi |
213 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
214 |
echo " \"$comm\"" |
215 |
echo "======================" |
216 |
$comm > $tdir/output_$typ 2>&1 |
217 |
tail -100 $tdir/output_$typ |
218 |
echo |
219 |
|
220 |
fi |
221 |
|
222 |
if test $typ = 'mth' |
223 |
then |
224 |
|
225 |
export OMP_NUM_THREADS=2 |
226 |
echo "Running testreport using:" |
227 |
comm="./testreport -mth -a jmc@mitgcm.org" |
228 |
comm="$comm -match $MC" |
229 |
if test "x$OPTFILE" != x ; then |
230 |
comm="$comm -of=$OPTFILE" |
231 |
fi |
232 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
233 |
echo " \"$comm\"" |
234 |
echo "======================" |
235 |
$comm > $tdir/output_$typ 2>&1 |
236 |
tail -100 $tdir/output_$typ |
237 |
echo |
238 |
|
239 |
fi |
240 |
|
241 |
if test $typ = 'pgi' |
242 |
then |
243 |
|
244 |
export PGI=/usr/local/pkg/pgi/pgi-6.1-5 |
245 |
echo "Running testreport using:" |
246 |
comm="./testreport -a jmc@mitgcm.org" |
247 |
# comm="$comm -match $MC" |
248 |
#comm="$comm -skd tutorial_advection_in_gyre" |
249 |
if test "x$OPTFILE" != x ; then |
250 |
comm="$comm -of=$OPTFILE" |
251 |
fi |
252 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
253 |
echo " \"$comm\"" |
254 |
echo "======================" |
255 |
$comm > $tdir/output_${typ} 2>&1 |
256 |
tail -100 $tdir/output_${typ} |
257 |
echo |
258 |
|
259 |
fi |
260 |
|
261 |
#-- also test restart (test 2+2=4) |
262 |
if test $tt != $typ |
263 |
then |
264 |
echo "testing restart using:" |
265 |
comm="../tools/do_tst_2+2 -a jmc@mitgcm.org" |
266 |
echo " \"$comm\"" |
267 |
echo "======================" |
268 |
$comm > $tdir/output_2+2 2>&1 |
269 |
#tail -100 $tdir/output_2+2 |
270 |
echo ; cat tst_2+2_out.txt |
271 |
echo |
272 |
fi |
273 |
export OMP_NUM_THREADS=1 |
274 |
|
275 |
if test $sepDir = 0 ; then |
276 |
#-- cleaning: |
277 |
echo "======================" |
278 |
echo "Cleaning test directories:" |
279 |
if test $tt != $typ ; then |
280 |
cmdCLN="../tools/do_tst_2+2 -clean" |
281 |
echo " clean tst_2+2 running: $cmdCLN" |
282 |
$cmdCLN >> $tdir/output_2+2 2>&1 |
283 |
fi |
284 |
if test $tt != $last_Tst ; then |
285 |
cmdCLN="./testreport -clean" |
286 |
echo " clean dir running: $cmdCLN" |
287 |
$cmdCLN > /dev/null 2>&1 |
288 |
fi |
289 |
echo "======================" |
290 |
echo |
291 |
fi |
292 |
popd |
293 |
|
294 |
done |