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