1 |
#! /usr/bin/env bash |
2 |
|
3 |
# $Header: /u/gcmpack/MITgcm/tools/example_scripts/csail/test_dickens,v 1.1 2009/03/25 20:52: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 |
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 mth' |
18 |
|
19 |
# Turn off stack limit for FIZHI |
20 |
#ulimit -s unlimited <- this is the default |
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+mth' |
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 |
if test "x$OPTFILE" != x ; then |
146 |
comm="$comm -of=$OPTFILE" |
147 |
fi |
148 |
echo " \"$comm\"" |
149 |
echo "======================" |
150 |
$comm > $tdir/output_$typ 2>&1 |
151 |
tail -60 $tdir/output_$typ |
152 |
echo |
153 |
|
154 |
fi |
155 |
|
156 |
if test $typ = 'ifc' |
157 |
then |
158 |
|
159 |
echo "Running testreport using:" |
160 |
comm="./testreport -match $MC -a jmc@mitgcm.org" |
161 |
if test "x$OPTFILE" != x ; then |
162 |
comm="$comm -of=$OPTFILE" |
163 |
fi |
164 |
echo " \"$comm\"" |
165 |
echo "======================" |
166 |
$comm > $tdir/output_$typ 2>&1 |
167 |
tail -100 $tdir/output_$typ |
168 |
echo |
169 |
#-- also test restart (test 2+2=4) |
170 |
if test $tt != $typ |
171 |
then |
172 |
echo "testing restart using:" |
173 |
comm="../tools/do_tst_2+2 -a jmc@mitgcm.org" |
174 |
echo " \"$comm\"" |
175 |
echo "======================" |
176 |
$comm > $tdir/output_2+2 2>&1 |
177 |
#tail -100 $tdir/output_2+2 |
178 |
echo ; cat tst_2+2_out.txt |
179 |
echo |
180 |
fi |
181 |
|
182 |
fi |
183 |
|
184 |
if test $typ = 'mth' |
185 |
then |
186 |
|
187 |
export OMP_NUM_THREADS=2 |
188 |
echo "Running testreport using:" |
189 |
comm="./testreport -mth -match $MC -a jmc@mitgcm.org" |
190 |
if test "x$OPTFILE" != x ; then |
191 |
comm="$comm -of=$OPTFILE" |
192 |
fi |
193 |
echo " \"$comm\"" |
194 |
echo "======================" |
195 |
$comm > $tdir/output_$typ 2>&1 |
196 |
tail -100 $tdir/output_$typ |
197 |
echo |
198 |
#-- also test restart (test 2+2=4) |
199 |
if test $tt != $typ |
200 |
then |
201 |
echo "testing restart using:" |
202 |
comm="../tools/do_tst_2+2 -a jmc@mitgcm.org" |
203 |
echo " \"$comm\"" |
204 |
echo "======================" |
205 |
$comm > $tdir/output_2+2 2>&1 |
206 |
#tail -100 $tdir/output_2+2 |
207 |
echo ; cat tst_2+2_out.txt |
208 |
echo |
209 |
fi |
210 |
export OMP_NUM_THREADS=1 |
211 |
|
212 |
fi |
213 |
|
214 |
if test $typ = 'pgi' |
215 |
then |
216 |
|
217 |
export PGI=/usr/local/pkg/pgi/pgi-6.1-5 |
218 |
echo "Running testreport using:" |
219 |
comm="./testreport -match $MC -dd" |
220 |
if test "x$OPTFILE" != x ; then |
221 |
comm="$comm -of=$OPTFILE" |
222 |
fi |
223 |
echo " \"$comm\"" |
224 |
echo "======================" |
225 |
$comm > $tdir/output_${typ}_1 2>&1 |
226 |
tail -100 $tdir/output_${typ}_1 |
227 |
echo |
228 |
echo "Running testreport using:" |
229 |
comm="./testreport -match $MC -q -a jmc@mitgcm.org" |
230 |
if test "x$OPTFILE" != x ; then |
231 |
comm="$comm -of=$OPTFILE" |
232 |
fi |
233 |
echo " \"$comm\"" |
234 |
echo "======================" |
235 |
$comm > $tdir/output_${typ}_2 2>&1 |
236 |
tail -100 $tdir/output_${typ}_2 |
237 |
echo |
238 |
#-- also test restart (test 2+2=4) |
239 |
if test $tt != $typ |
240 |
then |
241 |
echo "testing restart using:" |
242 |
comm="../tools/do_tst_2+2 -a jmc@mitgcm.org" |
243 |
echo " \"$comm\"" |
244 |
echo "======================" |
245 |
$comm > $tdir/output_2+2 2>&1 |
246 |
#tail -100 $tdir/output_2+2 |
247 |
echo ; cat tst_2+2_out.txt |
248 |
echo |
249 |
fi |
250 |
|
251 |
fi |
252 |
|
253 |
if test $sepDir = 0 ; then |
254 |
#-- cleaning: |
255 |
echo "======================" |
256 |
echo "Cleaning test directories:" |
257 |
./testreport -clean > /dev/null 2>&1 |
258 |
echo "======================" |
259 |
echo |
260 |
fi |
261 |
popd |
262 |
|
263 |
done |