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