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