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