1 |
#! /usr/bin/env bash |
2 |
|
3 |
# $Header: /u/gcmpack/MITgcm/tools/example_scripts/csail/test_dickens,v 1.11 2009/06/26 16:51:23 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=10 |
27 |
checkOut=1 |
28 |
sepDir=0 |
29 |
option= |
30 |
#tst_list='g77 adm ifc mth pgi+rs' |
31 |
tst_list='adm g77 gfo+rs mth' |
32 |
|
33 |
#option="-nc" ; checkOut=0 |
34 |
#option="-q" ; checkOut=0 |
35 |
|
36 |
tdir=$TESTDIR |
37 |
if test $checkOut = '0' ; then |
38 |
if test -e $tdir/MITgcm/CVS ; then |
39 |
echo $tdir/MITgcm/CVS 'exist' |
40 |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
41 |
cd $tdir/MITgcm |
42 |
if test $sepDir = 1 ; then |
43 |
$cmdCVS update -P -d > /dev/null |
44 |
else |
45 |
$cmdCVS update -P -d |
46 |
fi |
47 |
echo " done" |
48 |
else |
49 |
echo -n $tdir/MITgcm 'missing ; ' |
50 |
checkOut=1 |
51 |
fi |
52 |
fi |
53 |
if test $checkOut = '1' ; then |
54 |
if test -e $tdir ; then |
55 |
echo -n "Removing working copy: $tdir/MITgcm ..." |
56 |
test -e $tdir/MITgcm && rm -rf $tdir/MITgcm |
57 |
else |
58 |
echo -n "Creating a working dir: $tdir ..." |
59 |
mkdir $tdir |
60 |
fi |
61 |
echo " done" |
62 |
echo -n "Downloading the MITgcm code using: $cmdCVS ..." |
63 |
cd $tdir |
64 |
$cmdCVS co -P MITgcm > /dev/null |
65 |
echo " done" |
66 |
else |
67 |
cd $tdir |
68 |
fi |
69 |
|
70 |
#------------------------------------------------------------------------ |
71 |
|
72 |
firstTst=`echo $tst_list | awk '{print $1}'` |
73 |
last_Tst=`echo $tst_list | awk '{print $NF}'` |
74 |
for tt in $tst_list |
75 |
do |
76 |
|
77 |
echo "================================================================" |
78 |
typ=`echo $tt | sed 's/+rs//'` |
79 |
#- clean-up old output files |
80 |
rm -f $tdir/output_${typ}* |
81 |
if test $sepDir = 1 ; then |
82 |
new_dir="MITgcm_$typ" |
83 |
if test -d $new_dir/CVS -a $checkOut = '0' ; then |
84 |
pushd $new_dir |
85 |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
86 |
$cmdCVS update -P -d |
87 |
echo " done" |
88 |
else |
89 |
test -e $new_dir && rm -rf $new_dir |
90 |
mkdir $new_dir |
91 |
pushd $new_dir |
92 |
cp -ra ../MITgcm/* . |
93 |
fi |
94 |
else |
95 |
pushd MITgcm |
96 |
fi |
97 |
cd verification |
98 |
|
99 |
case $typ in |
100 |
'g77') OPTFILE='../tools/build_options/linux_amd64_g77' ;; |
101 |
'gfo') OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
102 |
'adm') OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
103 |
'ifc') OPTFILE='../tools/build_options/linux_amd64_ifort' ;; |
104 |
'pgi') OPTFILE='../tools/build_options/linux_amd64_pgf77' ;; |
105 |
'mth') OPTFILE='../tools/build_options/linux_amd64_gfortran' |
106 |
export GOMP_STACKSIZE=400m ;; |
107 |
*) OPTFILE= ;; |
108 |
esac |
109 |
|
110 |
if test $sepDir = 0 -a $checkOut = '1' -a $tt = $firstTst ; then |
111 |
#-- cleaning: |
112 |
echo "======================" |
113 |
echo "Cleaning test directories:" |
114 |
cmdCLN="./testreport -clean" |
115 |
echo " clean dir running: $cmdCLN" |
116 |
$cmdCLN > /dev/null 2>&1 |
117 |
echo "======================" |
118 |
echo |
119 |
fi |
120 |
|
121 |
if test $typ = 'g77' |
122 |
then |
123 |
|
124 |
echo "Running testreport using:" |
125 |
comm="./testreport -a jmc@mitgcm.org" |
126 |
if test "x$OPTFILE" != x ; then |
127 |
comm="$comm -of=$OPTFILE" |
128 |
fi |
129 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
130 |
echo " \"$comm\"" |
131 |
echo "======================" |
132 |
$comm > $tdir/output_$typ 2>&1 |
133 |
tail -100 $tdir/output_$typ |
134 |
echo |
135 |
#-- also test restart (test 2+2=4) |
136 |
if test $tt != $typ |
137 |
then |
138 |
echo "testing restart using:" |
139 |
comm="../tools/do_tst_2+2 -a jmc@mitgcm.org" |
140 |
echo " \"$comm\"" |
141 |
echo "======================" |
142 |
$comm > $tdir/output_2+2 2>&1 |
143 |
#tail -100 $tdir/output_2+2 |
144 |
echo ; cat tst_2+2_out.txt |
145 |
echo |
146 |
fi |
147 |
|
148 |
fi |
149 |
|
150 |
if test $typ = 'gfo' |
151 |
then |
152 |
|
153 |
echo "Running testreport using:" |
154 |
comm="./testreport -match $MC -a jmc@mitgcm.org" |
155 |
if test "x$OPTFILE" != x ; then |
156 |
comm="$comm -of=$OPTFILE" |
157 |
fi |
158 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
159 |
echo " \"$comm\"" |
160 |
echo "======================" |
161 |
$comm > $tdir/output_$typ 2>&1 |
162 |
tail -100 $tdir/output_$typ |
163 |
echo |
164 |
#-- also test restart (test 2+2=4) |
165 |
if test $tt != $typ |
166 |
then |
167 |
echo "testing restart using:" |
168 |
comm="../tools/do_tst_2+2 -a jmc@mitgcm.org" |
169 |
echo " \"$comm\"" |
170 |
echo "======================" |
171 |
$comm > $tdir/output_2+2 2>&1 |
172 |
#tail -100 $tdir/output_2+2 |
173 |
echo ; cat tst_2+2_out.txt |
174 |
echo |
175 |
fi |
176 |
|
177 |
fi |
178 |
|
179 |
if test $typ = 'adm' |
180 |
then |
181 |
|
182 |
echo "Running testreport using:" |
183 |
comm="./testreport -adm -match $MC -a jmc@mitgcm.org" |
184 |
if test "x$OPTFILE" != x ; then |
185 |
comm="$comm -of=$OPTFILE" |
186 |
fi |
187 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
188 |
echo " \"$comm\"" |
189 |
echo "======================" |
190 |
$comm > $tdir/output_$typ 2>&1 |
191 |
tail -60 $tdir/output_$typ |
192 |
echo |
193 |
|
194 |
fi |
195 |
|
196 |
if test $typ = 'ifc' |
197 |
then |
198 |
|
199 |
echo "Running testreport using:" |
200 |
comm="./testreport -match $MC -a jmc@mitgcm.org" |
201 |
if test "x$OPTFILE" != x ; then |
202 |
comm="$comm -of=$OPTFILE" |
203 |
fi |
204 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
205 |
echo " \"$comm\"" |
206 |
echo "======================" |
207 |
$comm > $tdir/output_$typ 2>&1 |
208 |
tail -100 $tdir/output_$typ |
209 |
echo |
210 |
#-- also test restart (test 2+2=4) |
211 |
if test $tt != $typ |
212 |
then |
213 |
echo "testing restart using:" |
214 |
comm="../tools/do_tst_2+2 -a jmc@mitgcm.org" |
215 |
echo " \"$comm\"" |
216 |
echo "======================" |
217 |
$comm > $tdir/output_2+2 2>&1 |
218 |
#tail -100 $tdir/output_2+2 |
219 |
echo ; cat tst_2+2_out.txt |
220 |
echo |
221 |
fi |
222 |
|
223 |
fi |
224 |
|
225 |
if test $typ = 'mth' |
226 |
then |
227 |
|
228 |
export OMP_NUM_THREADS=2 |
229 |
echo "Running testreport using:" |
230 |
comm="./testreport -mth -match $MC -a jmc@mitgcm.org" |
231 |
if test "x$OPTFILE" != x ; then |
232 |
comm="$comm -of=$OPTFILE" |
233 |
fi |
234 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
235 |
echo " \"$comm\"" |
236 |
echo "======================" |
237 |
$comm > $tdir/output_$typ 2>&1 |
238 |
tail -100 $tdir/output_$typ |
239 |
echo |
240 |
#-- also test restart (test 2+2=4) |
241 |
if test $tt != $typ |
242 |
then |
243 |
echo "testing restart using:" |
244 |
comm="../tools/do_tst_2+2 -a jmc@mitgcm.org" |
245 |
echo " \"$comm\"" |
246 |
echo "======================" |
247 |
$comm > $tdir/output_2+2 2>&1 |
248 |
#tail -100 $tdir/output_2+2 |
249 |
echo ; cat tst_2+2_out.txt |
250 |
echo |
251 |
fi |
252 |
export OMP_NUM_THREADS=1 |
253 |
|
254 |
fi |
255 |
|
256 |
if test $typ = 'pgi' |
257 |
then |
258 |
|
259 |
export PGI=/usr/local/pkg/pgi/pgi-6.1-5 |
260 |
echo "Running testreport using:" |
261 |
comm="./testreport -match $MC -dd" |
262 |
#comm="$comm -skd tutorial_advection_in_gyre" |
263 |
if test "x$OPTFILE" != x ; then |
264 |
comm="$comm -of=$OPTFILE" |
265 |
fi |
266 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
267 |
echo " \"$comm\"" |
268 |
echo "======================" |
269 |
$comm > $tdir/output_${typ}_1 2>&1 |
270 |
tail -100 $tdir/output_${typ}_1 |
271 |
echo |
272 |
echo "Running testreport using:" |
273 |
comm="./testreport -match $MC -q -a jmc@mitgcm.org" |
274 |
#comm="$comm -skd tutorial_advection_in_gyre" |
275 |
if test "x$OPTFILE" != x ; then |
276 |
comm="$comm -of=$OPTFILE" |
277 |
fi |
278 |
echo " \"$comm\"" |
279 |
echo "======================" |
280 |
$comm > $tdir/output_${typ}_2 2>&1 |
281 |
tail -100 $tdir/output_${typ}_2 |
282 |
echo |
283 |
#-- also test restart (test 2+2=4) |
284 |
if test $tt != $typ |
285 |
then |
286 |
echo "testing restart using:" |
287 |
comm="../tools/do_tst_2+2 -a jmc@mitgcm.org" |
288 |
echo " \"$comm\"" |
289 |
echo "======================" |
290 |
$comm > $tdir/output_2+2 2>&1 |
291 |
#tail -100 $tdir/output_2+2 |
292 |
echo ; cat tst_2+2_out.txt |
293 |
echo |
294 |
fi |
295 |
|
296 |
fi |
297 |
|
298 |
if test $sepDir = 0 ; then |
299 |
#-- cleaning: |
300 |
echo "======================" |
301 |
echo "Cleaning test directories:" |
302 |
if test $tt != $typ ; then |
303 |
cmdCLN="../tools/do_tst_2+2 -clean" |
304 |
echo " clean tst_2+2 running: $cmdCLN" |
305 |
$cmdCLN >> $tdir/output_2+2 2>&1 |
306 |
fi |
307 |
if test $tt != $last_Tst ; then |
308 |
cmdCLN="./testreport -clean" |
309 |
echo " clean dir running: $cmdCLN" |
310 |
$cmdCLN > /dev/null 2>&1 |
311 |
fi |
312 |
echo "======================" |
313 |
echo |
314 |
fi |
315 |
popd |
316 |
|
317 |
done |