1 |
#! /usr/bin/env bash |
2 |
|
3 |
# $Header: /u/gcmpack/MITgcm/tools/example_scripts/csail/test_baudelaire,v 1.2 2010/11/02 13:44:39 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 |
if [ -d ~/bin ]; then export PATH=$PATH:~/bin ; fi |
13 |
#- to get case insensitive "ls" (and order of tested experiments) |
14 |
export LC_ALL="en_US.UTF-8" |
15 |
# Turn off stack limit for FIZHI & AD-tests |
16 |
ulimit -s unlimited |
17 |
|
18 |
#- method to acces CVS: |
19 |
# export CVSROOT='/u/gcmpack' |
20 |
# export CVSROOT=':ext:@mitgcm.org:/u/gcmpack' |
21 |
# export CVS_RSH='ssh' ; cvs co -P MITgcm > /dev/null |
22 |
# cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack co -P MITgcm > /dev/null |
23 |
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack' |
24 |
cmdCVS='cvs -d /u/gcmpack' |
25 |
|
26 |
TESTDIR="/scratch/jmc/test_"`hostname -s` |
27 |
MC=13 |
28 |
checkOut=1 |
29 |
sepDir=1 |
30 |
option= |
31 |
tst_list='g7a adm g77 gfo+rs mth ifc' |
32 |
#tst_list='g77 adm gfo ifc mth pgi+rs' |
33 |
#tst_list='g77 gfo+rs mth' |
34 |
|
35 |
#option="-nc" ; checkOut=0 |
36 |
#option="-q" ; checkOut=0 |
37 |
|
38 |
TODAY=`date +%d` |
39 |
tdir=$TESTDIR |
40 |
if test $checkOut = '0' ; then |
41 |
if test -e $tdir/MITgcm/CVS ; then |
42 |
echo $tdir/MITgcm/CVS 'exist' |
43 |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
44 |
cd $tdir/MITgcm |
45 |
if test $sepDir = 1 ; then |
46 |
$cmdCVS update -P -d > /dev/null |
47 |
else |
48 |
$cmdCVS update -P -d |
49 |
fi |
50 |
echo " done" |
51 |
else |
52 |
echo -n $tdir/MITgcm 'missing ; ' |
53 |
checkOut=1 |
54 |
fi |
55 |
fi |
56 |
if test $checkOut = '1' ; then |
57 |
if test -e $tdir ; then |
58 |
echo -n "Removing working copy: $tdir/MITgcm ..." |
59 |
test -e $tdir/MITgcm && rm -rf $tdir/MITgcm |
60 |
else |
61 |
echo -n "Creating a working dir: $tdir ..." |
62 |
mkdir $tdir |
63 |
fi |
64 |
echo " done" |
65 |
echo -n "Downloading the MITgcm code using: $cmdCVS ..." |
66 |
cd $tdir |
67 |
$cmdCVS co -P MITgcm > /dev/null |
68 |
echo " done" |
69 |
else |
70 |
cd $tdir |
71 |
fi |
72 |
|
73 |
#------------------------------------------------------------------------ |
74 |
|
75 |
firstTst=`echo $tst_list | awk '{print $1}'` |
76 |
last_Tst=`echo $tst_list | awk '{print $NF}'` |
77 |
for tt in $tst_list |
78 |
do |
79 |
|
80 |
echo "================================================================" |
81 |
typ=`echo $tt | sed 's/+rs//'` |
82 |
#- check day and time: |
83 |
curDay=`date +%d` ; curHour=`date +%H` |
84 |
if [ $curDay -ne $TODAY ] ; then |
85 |
date ; echo "day is over => skip test $typ" |
86 |
continue |
87 |
fi |
88 |
if [ $curHour -ge 18 ] ; then |
89 |
date ; echo "too late to run test $typ" |
90 |
continue |
91 |
fi |
92 |
#- clean-up old output files |
93 |
rm -f $tdir/output_${typ}* |
94 |
if test $sepDir = 1 ; then |
95 |
new_dir="MITgcm_$typ" |
96 |
if test -d $new_dir/CVS -a $checkOut = '0' ; then |
97 |
pushd $new_dir |
98 |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
99 |
$cmdCVS update -P -d |
100 |
echo " done" |
101 |
else |
102 |
test -e $new_dir && rm -rf $new_dir |
103 |
mkdir $new_dir |
104 |
pushd $new_dir |
105 |
cp -ra ../MITgcm/* . |
106 |
fi |
107 |
else |
108 |
pushd MITgcm |
109 |
fi |
110 |
cd verification |
111 |
|
112 |
case $typ in |
113 |
'g77'|'g7a') OPTFILE='../tools/build_options/linux_amd64_g77' ;; |
114 |
'gfo'|'adm') OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
115 |
'ifc') OPTFILE='../tools/build_options/linux_amd64_ifort11' ;; |
116 |
'pgi') OPTFILE='../tools/build_options/linux_amd64_pgf77' ;; |
117 |
'mth') OPTFILE='../tools/build_options/linux_amd64_gfortran' |
118 |
export GOMP_STACKSIZE=400m ;; |
119 |
*) OPTFILE= ;; |
120 |
esac |
121 |
|
122 |
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 |
if test $typ = 'g77' |
134 |
then |
135 |
|
136 |
echo "Running testreport using:" |
137 |
comm="./testreport -a jmc@mitgcm.org" |
138 |
# comm="$comm -match $MC" |
139 |
if test "x$OPTFILE" != x ; then |
140 |
comm="$comm -of=$OPTFILE" |
141 |
fi |
142 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
143 |
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 |
comm="./testreport -a jmc@mitgcm.org" |
156 |
comm="$comm -match $MC" |
157 |
if test "x$OPTFILE" != x ; then |
158 |
comm="$comm -of=$OPTFILE" |
159 |
fi |
160 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
161 |
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 = 'g7a' |
170 |
then |
171 |
|
172 |
echo "Running testreport using:" |
173 |
comm="./testreport -adm -a jmc@mitgcm.org" |
174 |
# comm="$comm -match $MC" |
175 |
if test "x$OPTFILE" != x ; then |
176 |
comm="$comm -of=$OPTFILE" |
177 |
fi |
178 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
179 |
echo " \"$comm\"" |
180 |
echo "======================" |
181 |
$comm > $tdir/output_$typ 2>&1 |
182 |
tail -60 $tdir/output_$typ |
183 |
echo |
184 |
|
185 |
fi |
186 |
|
187 |
if test $typ = 'adm' |
188 |
then |
189 |
|
190 |
echo "Running testreport using:" |
191 |
comm="./testreport -adm -a jmc@mitgcm.org" |
192 |
comm="$comm -match $MC" |
193 |
if test "x$OPTFILE" != x ; then |
194 |
comm="$comm -of=$OPTFILE" |
195 |
fi |
196 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
197 |
echo " \"$comm\"" |
198 |
echo "======================" |
199 |
$comm > $tdir/output_$typ 2>&1 |
200 |
tail -60 $tdir/output_$typ |
201 |
echo |
202 |
|
203 |
fi |
204 |
|
205 |
if test $typ = 'ifc' |
206 |
then |
207 |
|
208 |
source /srv/software/intel/intel-11.1.073/bin/ifortvars.sh intel64 |
209 |
echo "Running testreport using:" |
210 |
comm="./testreport -a jmc@mitgcm.org" |
211 |
# comm="$comm -match $MC" |
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 |
|
222 |
fi |
223 |
|
224 |
if test $typ = 'mth' |
225 |
then |
226 |
|
227 |
export OMP_NUM_THREADS=2 |
228 |
echo "Running testreport using:" |
229 |
comm="./testreport -mth -a jmc@mitgcm.org" |
230 |
comm="$comm -match $MC" |
231 |
if test "x$OPTFILE" != x ; then |
232 |
comm="$comm -of=$OPTFILE" |
233 |
fi |
234 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
235 |
echo " \"$comm\"" |
236 |
echo "======================" |
237 |
$comm > $tdir/output_$typ 2>&1 |
238 |
tail -100 $tdir/output_$typ |
239 |
echo |
240 |
|
241 |
fi |
242 |
|
243 |
if test $typ = 'pgi' |
244 |
then |
245 |
|
246 |
export PGI=/srv/software/pgi/pgi-10.9 |
247 |
export PATH=$PGI/linux86-64/10.9/bin:$PATH |
248 |
export LM_LICENSE_FILE=$PGI/license.dat |
249 |
echo "Running testreport using:" |
250 |
comm="./testreport -a jmc@mitgcm.org" |
251 |
# comm="$comm -match $MC" |
252 |
#comm="$comm -skd tutorial_advection_in_gyre" |
253 |
if test "x$OPTFILE" != x ; then |
254 |
comm="$comm -of=$OPTFILE" |
255 |
fi |
256 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
257 |
echo " \"$comm\"" |
258 |
echo "======================" |
259 |
$comm > $tdir/output_${typ} 2>&1 |
260 |
tail -100 $tdir/output_${typ} |
261 |
echo |
262 |
|
263 |
fi |
264 |
|
265 |
#-- also test restart (test 2+2=4) |
266 |
if test $tt != $typ |
267 |
then |
268 |
echo "testing restart using:" |
269 |
comm="../tools/do_tst_2+2 -a jmc@mitgcm.org" |
270 |
echo " \"$comm\"" |
271 |
echo "======================" |
272 |
$comm > $tdir/output_2+2 2>&1 |
273 |
#tail -100 $tdir/output_2+2 |
274 |
echo ; cat tst_2+2_out.txt |
275 |
echo |
276 |
fi |
277 |
export OMP_NUM_THREADS=1 |
278 |
|
279 |
if test $sepDir = 0 ; then |
280 |
#-- cleaning: |
281 |
echo "======================" |
282 |
echo "Cleaning test directories:" |
283 |
if test $tt != $typ ; then |
284 |
cmdCLN="../tools/do_tst_2+2 -clean" |
285 |
echo " clean tst_2+2 running: $cmdCLN" |
286 |
$cmdCLN >> $tdir/output_2+2 2>&1 |
287 |
fi |
288 |
if test $tt != $last_Tst ; then |
289 |
cmdCLN="./testreport -clean" |
290 |
echo " clean dir running: $cmdCLN" |
291 |
$cmdCLN > /dev/null 2>&1 |
292 |
fi |
293 |
echo "======================" |
294 |
echo |
295 |
fi |
296 |
popd |
297 |
|
298 |
done |