1 |
jmc |
1.1 |
#! /usr/bin/env bash |
2 |
|
|
|
3 |
jmc |
1.15 |
# $Header: /u/gcmpack/MITgcm/tools/example_scripts/csail/test_dickens,v 1.14 2010/09/18 00:07:53 jmc Exp $ |
4 |
jmc |
1.1 |
|
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 |
jmc |
1.9 |
#- 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 |
jmc |
1.12 |
#- 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 |
jmc |
1.1 |
TESTDIR="/tmp/jmc/test_"`hostname -s` |
26 |
jmc |
1.15 |
MC=13 |
27 |
jmc |
1.1 |
checkOut=1 |
28 |
|
|
sepDir=0 |
29 |
jmc |
1.8 |
option= |
30 |
jmc |
1.15 |
#tst_list='g7a adm g77 gfo+rs mth ifc' |
31 |
jmc |
1.12 |
#tst_list='g77 adm ifc mth pgi+rs' |
32 |
jmc |
1.15 |
tst_list='g77 gfo+rs mth' |
33 |
jmc |
1.1 |
|
34 |
jmc |
1.8 |
#option="-nc" ; checkOut=0 |
35 |
|
|
#option="-q" ; checkOut=0 |
36 |
|
|
|
37 |
jmc |
1.14 |
TODAY=`date +%d` |
38 |
jmc |
1.1 |
tdir=$TESTDIR |
39 |
|
|
if test $checkOut = '0' ; then |
40 |
|
|
if test -e $tdir/MITgcm/CVS ; then |
41 |
|
|
echo $tdir/MITgcm/CVS 'exist' |
42 |
jmc |
1.12 |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
43 |
jmc |
1.1 |
cd $tdir/MITgcm |
44 |
jmc |
1.8 |
if test $sepDir = 1 ; then |
45 |
jmc |
1.12 |
$cmdCVS update -P -d > /dev/null |
46 |
jmc |
1.8 |
else |
47 |
jmc |
1.12 |
$cmdCVS update -P -d |
48 |
jmc |
1.8 |
fi |
49 |
jmc |
1.1 |
echo " done" |
50 |
jmc |
1.10 |
else |
51 |
jmc |
1.1 |
echo -n $tdir/MITgcm 'missing ; ' |
52 |
|
|
checkOut=1 |
53 |
|
|
fi |
54 |
|
|
fi |
55 |
|
|
if test $checkOut = '1' ; then |
56 |
jmc |
1.12 |
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 |
jmc |
1.1 |
fi |
63 |
|
|
echo " done" |
64 |
jmc |
1.12 |
echo -n "Downloading the MITgcm code using: $cmdCVS ..." |
65 |
jmc |
1.1 |
cd $tdir |
66 |
jmc |
1.12 |
$cmdCVS co -P MITgcm > /dev/null |
67 |
jmc |
1.1 |
echo " done" |
68 |
jmc |
1.10 |
else |
69 |
|
|
cd $tdir |
70 |
jmc |
1.1 |
fi |
71 |
|
|
|
72 |
|
|
#------------------------------------------------------------------------ |
73 |
|
|
|
74 |
jmc |
1.11 |
firstTst=`echo $tst_list | awk '{print $1}'` |
75 |
|
|
last_Tst=`echo $tst_list | awk '{print $NF}'` |
76 |
jmc |
1.1 |
for tt in $tst_list |
77 |
|
|
do |
78 |
|
|
|
79 |
|
|
echo "================================================================" |
80 |
|
|
typ=`echo $tt | sed 's/+rs//'` |
81 |
jmc |
1.14 |
#- 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 |
jmc |
1.1 |
#- clean-up old output files |
92 |
|
|
rm -f $tdir/output_${typ}* |
93 |
|
|
if test $sepDir = 1 ; then |
94 |
|
|
new_dir="MITgcm_$typ" |
95 |
jmc |
1.8 |
if test -d $new_dir/CVS -a $checkOut = '0' ; then |
96 |
|
|
pushd $new_dir |
97 |
jmc |
1.12 |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
98 |
|
|
$cmdCVS update -P -d |
99 |
jmc |
1.8 |
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 |
jmc |
1.1 |
else |
107 |
|
|
pushd MITgcm |
108 |
|
|
fi |
109 |
|
|
cd verification |
110 |
|
|
|
111 |
|
|
case $typ in |
112 |
jmc |
1.15 |
'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 |
jmc |
1.1 |
esac |
120 |
|
|
|
121 |
jmc |
1.11 |
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 |
jmc |
1.1 |
if test $typ = 'g77' |
133 |
|
|
then |
134 |
|
|
|
135 |
|
|
echo "Running testreport using:" |
136 |
|
|
comm="./testreport -a jmc@mitgcm.org" |
137 |
jmc |
1.13 |
# comm="$comm -match $MC" |
138 |
jmc |
1.1 |
if test "x$OPTFILE" != x ; then |
139 |
|
|
comm="$comm -of=$OPTFILE" |
140 |
|
|
fi |
141 |
jmc |
1.8 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
142 |
jmc |
1.1 |
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 |
jmc |
1.13 |
comm="./testreport -a jmc@mitgcm.org" |
155 |
|
|
comm="$comm -match $MC" |
156 |
jmc |
1.1 |
if test "x$OPTFILE" != x ; then |
157 |
|
|
comm="$comm -of=$OPTFILE" |
158 |
|
|
fi |
159 |
jmc |
1.8 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
160 |
jmc |
1.1 |
echo " \"$comm\"" |
161 |
|
|
echo "======================" |
162 |
|
|
$comm > $tdir/output_$typ 2>&1 |
163 |
|
|
tail -100 $tdir/output_$typ |
164 |
|
|
echo |
165 |
|
|
|
166 |
|
|
fi |
167 |
|
|
|
168 |
jmc |
1.15 |
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 |
jmc |
1.1 |
if test $typ = 'adm' |
187 |
|
|
then |
188 |
|
|
|
189 |
|
|
echo "Running testreport using:" |
190 |
jmc |
1.13 |
comm="./testreport -adm -a jmc@mitgcm.org" |
191 |
|
|
comm="$comm -match $MC" |
192 |
jmc |
1.1 |
if test "x$OPTFILE" != x ; then |
193 |
|
|
comm="$comm -of=$OPTFILE" |
194 |
|
|
fi |
195 |
jmc |
1.8 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
196 |
jmc |
1.1 |
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 |
jmc |
1.13 |
comm="./testreport -a jmc@mitgcm.org" |
209 |
jmc |
1.15 |
# comm="$comm -match $MC" |
210 |
jmc |
1.1 |
if test "x$OPTFILE" != x ; then |
211 |
|
|
comm="$comm -of=$OPTFILE" |
212 |
|
|
fi |
213 |
jmc |
1.8 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
214 |
jmc |
1.1 |
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 |
jmc |
1.13 |
comm="./testreport -mth -a jmc@mitgcm.org" |
228 |
|
|
comm="$comm -match $MC" |
229 |
jmc |
1.1 |
if test "x$OPTFILE" != x ; then |
230 |
|
|
comm="$comm -of=$OPTFILE" |
231 |
|
|
fi |
232 |
jmc |
1.8 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
233 |
jmc |
1.1 |
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 |
jmc |
1.15 |
comm="./testreport -a jmc@mitgcm.org" |
247 |
|
|
# comm="$comm -match $MC" |
248 |
jmc |
1.12 |
#comm="$comm -skd tutorial_advection_in_gyre" |
249 |
jmc |
1.1 |
if test "x$OPTFILE" != x ; then |
250 |
|
|
comm="$comm -of=$OPTFILE" |
251 |
|
|
fi |
252 |
jmc |
1.8 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
253 |
jmc |
1.1 |
echo " \"$comm\"" |
254 |
|
|
echo "======================" |
255 |
jmc |
1.15 |
$comm > $tdir/output_${typ} 2>&1 |
256 |
|
|
tail -100 $tdir/output_${typ} |
257 |
jmc |
1.1 |
echo |
258 |
jmc |
1.13 |
|
259 |
|
|
fi |
260 |
|
|
|
261 |
jmc |
1.1 |
#-- also test restart (test 2+2=4) |
262 |
jmc |
1.13 |
if test $tt != $typ |
263 |
|
|
then |
264 |
jmc |
1.1 |
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 |
jmc |
1.13 |
export OMP_NUM_THREADS=1 |
274 |
jmc |
1.1 |
|
275 |
|
|
if test $sepDir = 0 ; then |
276 |
|
|
#-- cleaning: |
277 |
|
|
echo "======================" |
278 |
|
|
echo "Cleaning test directories:" |
279 |
jmc |
1.5 |
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 |
jmc |
1.11 |
if test $tt != $last_Tst ; then |
285 |
jmc |
1.5 |
cmdCLN="./testreport -clean" |
286 |
|
|
echo " clean dir running: $cmdCLN" |
287 |
|
|
$cmdCLN > /dev/null 2>&1 |
288 |
jmc |
1.11 |
fi |
289 |
jmc |
1.1 |
echo "======================" |
290 |
|
|
echo |
291 |
|
|
fi |
292 |
|
|
popd |
293 |
|
|
|
294 |
|
|
done |