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