1 |
#! /usr/bin/env bash |
2 |
|
3 |
# $Header: /u/gcmpack/MITgcm/tools/example_scripts/csail/test_baudelaire,v 1.3 2010/11/03 19:44:49 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 |
# MPI test (for now, only with gfortran) |
18 |
#if test $MPI = 1 ; then |
19 |
export MPI_GCC_DIR=/srv/software/gcc/gcc-packages/gcc-4.4.5/mpich2/mpich2-1.3 |
20 |
export MPI_INC_DIR=$MPI_GCC_DIR/include |
21 |
export PATH="$PATH:$MPI_GCC_DIR/bin" |
22 |
#fi |
23 |
|
24 |
#- method to acces CVS: |
25 |
# export CVSROOT='/u/gcmpack' |
26 |
# export CVSROOT=':ext:@mitgcm.org:/u/gcmpack' |
27 |
# export CVS_RSH='ssh' ; cvs co -P MITgcm > /dev/null |
28 |
# cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack co -P MITgcm > /dev/null |
29 |
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack' |
30 |
cmdCVS='cvs -d /u/gcmpack' |
31 |
|
32 |
TESTDIR="/scratch/jmc/test_"`hostname -s` |
33 |
MC=13 |
34 |
checkOut=1 |
35 |
sepDir=1 |
36 |
option= |
37 |
tst_list='g7a adm mpa g77 gfo+rs mth mp2+rs mpi ifc' |
38 |
#tst_list='g77 adm gfo ifc mth pgi+rs' |
39 |
#tst_list='g77 gfo+rs mth' |
40 |
|
41 |
#option="-nc" ; checkOut=0 |
42 |
#option="-q" ; checkOut=0 |
43 |
|
44 |
TODAY=`date +%d` |
45 |
tdir=$TESTDIR |
46 |
if test $checkOut = '0' ; then |
47 |
if test -e $tdir/MITgcm/CVS ; then |
48 |
echo $tdir/MITgcm/CVS 'exist' |
49 |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
50 |
cd $tdir/MITgcm |
51 |
if test $sepDir = 1 ; then |
52 |
$cmdCVS update -P -d > /dev/null |
53 |
else |
54 |
$cmdCVS update -P -d |
55 |
fi |
56 |
echo " done" |
57 |
else |
58 |
echo -n $tdir/MITgcm 'missing ; ' |
59 |
checkOut=1 |
60 |
fi |
61 |
fi |
62 |
if test $checkOut = '1' ; then |
63 |
if test -e $tdir ; then |
64 |
echo -n "Removing working copy: $tdir/MITgcm ..." |
65 |
test -e $tdir/MITgcm && rm -rf $tdir/MITgcm |
66 |
else |
67 |
echo -n "Creating a working dir: $tdir ..." |
68 |
mkdir $tdir |
69 |
fi |
70 |
echo " done" |
71 |
echo -n "Downloading the MITgcm code using: $cmdCVS ..." |
72 |
cd $tdir |
73 |
$cmdCVS co -P MITgcm > /dev/null |
74 |
echo " done" |
75 |
else |
76 |
cd $tdir |
77 |
fi |
78 |
|
79 |
#------------------------------------------------------------------------ |
80 |
|
81 |
firstTst=`echo $tst_list | awk '{print $1}'` |
82 |
last_Tst=`echo $tst_list | awk '{print $NF}'` |
83 |
for tt in $tst_list |
84 |
do |
85 |
|
86 |
echo "================================================================" |
87 |
typ=`echo $tt | sed 's/+rs//'` |
88 |
#- check day and time: |
89 |
curDay=`date +%d` ; curHour=`date +%H` |
90 |
if [ $curDay -ne $TODAY ] ; then |
91 |
date ; echo "day is over => skip test $typ" |
92 |
continue |
93 |
fi |
94 |
if [ $curHour -ge 18 ] ; then |
95 |
date ; echo "too late to run test $typ" |
96 |
continue |
97 |
fi |
98 |
#- clean-up old output files |
99 |
rm -f $tdir/output_${typ}* |
100 |
if test $sepDir = 1 ; then |
101 |
new_dir="MITgcm_$typ" |
102 |
if test -d $new_dir/CVS -a $checkOut = '0' ; then |
103 |
pushd $new_dir |
104 |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
105 |
$cmdCVS update -P -d |
106 |
echo " done" |
107 |
else |
108 |
test -e $new_dir && rm -rf $new_dir |
109 |
mkdir $new_dir |
110 |
pushd $new_dir |
111 |
cp -ra ../MITgcm/* . |
112 |
fi |
113 |
else |
114 |
pushd MITgcm |
115 |
fi |
116 |
cd verification |
117 |
|
118 |
MPI=0 |
119 |
case $typ in |
120 |
'g77'|'g7a') OPTFILE='../tools/build_options/linux_amd64_g77' ;; |
121 |
'gfo'|'adm'|'mth') OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
122 |
'ifc') OPTFILE='../tools/build_options/linux_amd64_ifort11' ;; |
123 |
'pgi') OPTFILE='../tools/build_options/linux_amd64_pgf77' ;; |
124 |
'mpa'|'mpi'|'mp2') OPTFILE='../tools/build_options/linux_amd64_gfortran+mpi_generic' |
125 |
MPI=1 ;; |
126 |
*) OPTFILE= ;; |
127 |
esac |
128 |
if test $typ = 'mth' -o $typ = 'mp2' ; then |
129 |
export GOMP_STACKSIZE=400m |
130 |
fi |
131 |
if test $MPI = 1 ; then |
132 |
export MPI_INC_DIR=$MPI_GCC_DIR/include |
133 |
EXE="mpirun -np 2 ./mitgcmuv" |
134 |
fi |
135 |
|
136 |
if test $sepDir = 0 -a $checkOut = '1' -a $tt = $firstTst ; then |
137 |
#-- cleaning: |
138 |
echo "======================" |
139 |
echo "Cleaning test directories:" |
140 |
cmdCLN="./testreport -clean" |
141 |
echo " clean dir running: $cmdCLN" |
142 |
$cmdCLN > /dev/null 2>&1 |
143 |
echo "======================" |
144 |
echo |
145 |
fi |
146 |
|
147 |
if test $typ = 'g77' |
148 |
then |
149 |
|
150 |
echo -n "Running testreport using:" |
151 |
comm="./testreport -a jmc@mitgcm.org" |
152 |
# comm="$comm -match $MC" |
153 |
if test "x$OPTFILE" != x ; then |
154 |
comm="$comm -of=$OPTFILE" |
155 |
fi |
156 |
if test $MPI = 1 ; then echo " (EXE='$EXE')" |
157 |
comm="$comm -mpi -command \"\$EXE\"" |
158 |
else echo '' ; fi |
159 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
160 |
echo " \"eval $comm\"" |
161 |
echo "======================" |
162 |
eval $comm > $tdir/output_$typ 2>&1 |
163 |
tail -100 $tdir/output_$typ |
164 |
echo |
165 |
|
166 |
fi |
167 |
|
168 |
if test $typ = 'gfo' |
169 |
then |
170 |
|
171 |
echo -n "Running testreport using:" |
172 |
comm="./testreport -a jmc@mitgcm.org" |
173 |
comm="$comm -match $MC" |
174 |
if test "x$OPTFILE" != x ; then |
175 |
comm="$comm -of=$OPTFILE" |
176 |
fi |
177 |
if test $MPI = 1 ; then echo " (EXE='$EXE')" |
178 |
comm="$comm -mpi -command \"\$EXE\"" |
179 |
else echo '' ; fi |
180 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
181 |
echo " \"eval $comm\"" |
182 |
echo "======================" |
183 |
eval $comm > $tdir/output_$typ 2>&1 |
184 |
tail -100 $tdir/output_$typ |
185 |
echo |
186 |
|
187 |
fi |
188 |
|
189 |
if test $typ = 'g7a' |
190 |
then |
191 |
|
192 |
echo -n "Running testreport using:" |
193 |
comm="./testreport -adm -a jmc@mitgcm.org" |
194 |
# comm="$comm -match $MC" |
195 |
if test "x$OPTFILE" != x ; then |
196 |
comm="$comm -of=$OPTFILE" |
197 |
fi |
198 |
if test $MPI = 1 ; then echo " (EXE='$EXE')" |
199 |
comm="$comm -mpi -command \"\$EXE\"" |
200 |
else echo '' ; fi |
201 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
202 |
echo " \"eval $comm\"" |
203 |
echo "======================" |
204 |
eval $comm > $tdir/output_$typ 2>&1 |
205 |
tail -60 $tdir/output_$typ |
206 |
echo |
207 |
|
208 |
fi |
209 |
|
210 |
if test $typ = 'adm' |
211 |
then |
212 |
|
213 |
echo -n "Running testreport using:" |
214 |
comm="./testreport -adm -a jmc@mitgcm.org" |
215 |
comm="$comm -match $MC" |
216 |
if test "x$OPTFILE" != x ; then |
217 |
comm="$comm -of=$OPTFILE" |
218 |
fi |
219 |
if test $MPI = 1 ; then echo " (EXE='$EXE')" |
220 |
comm="$comm -mpi -command \"\$EXE\"" |
221 |
else echo '' ; fi |
222 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
223 |
echo " \"eval $comm\"" |
224 |
echo "======================" |
225 |
eval $comm > $tdir/output_$typ 2>&1 |
226 |
tail -60 $tdir/output_$typ |
227 |
echo |
228 |
|
229 |
fi |
230 |
|
231 |
if test $typ = 'ifc' |
232 |
then |
233 |
|
234 |
source /srv/software/intel/intel-11.1.073/bin/ifortvars.sh intel64 |
235 |
echo -n "Running testreport using:" |
236 |
comm="./testreport -a jmc@mitgcm.org" |
237 |
# comm="$comm -match $MC" |
238 |
if test "x$OPTFILE" != x ; then |
239 |
comm="$comm -of=$OPTFILE" |
240 |
fi |
241 |
if test $MPI = 1 ; then echo " (EXE='$EXE')" |
242 |
comm="$comm -mpi -command \"\$EXE\"" |
243 |
else echo '' ; fi |
244 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
245 |
echo " \"eval $comm\"" |
246 |
echo "======================" |
247 |
eval $comm > $tdir/output_$typ 2>&1 |
248 |
tail -100 $tdir/output_$typ |
249 |
echo |
250 |
|
251 |
fi |
252 |
|
253 |
if test $typ = 'mth' |
254 |
then |
255 |
|
256 |
export OMP_NUM_THREADS=2 |
257 |
echo -n "Running testreport using:" |
258 |
comm="./testreport -mth -a jmc@mitgcm.org" |
259 |
comm="$comm -match $MC" |
260 |
if test "x$OPTFILE" != x ; then |
261 |
comm="$comm -of=$OPTFILE" |
262 |
fi |
263 |
if test $MPI = 1 ; then echo " (EXE='$EXE')" |
264 |
comm="$comm -mpi -command \"\$EXE\"" |
265 |
else echo '' ; fi |
266 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
267 |
echo " \"eval $comm\"" |
268 |
echo "======================" |
269 |
eval $comm > $tdir/output_$typ 2>&1 |
270 |
tail -100 $tdir/output_$typ |
271 |
echo |
272 |
|
273 |
fi |
274 |
|
275 |
if test $typ = 'pgi' |
276 |
then |
277 |
|
278 |
export PGI=/srv/software/pgi/pgi-10.9 |
279 |
export PATH="$PATH:$PGI/linux86-64/10.9/bin" |
280 |
export LM_LICENSE_FILE=$PGI/license.dat |
281 |
echo -n "Running testreport using:" |
282 |
comm="./testreport -a jmc@mitgcm.org" |
283 |
# comm="$comm -match $MC" |
284 |
#comm="$comm -skd tutorial_advection_in_gyre" |
285 |
if test "x$OPTFILE" != x ; then |
286 |
comm="$comm -of=$OPTFILE" |
287 |
fi |
288 |
if test $MPI = 1 ; then echo " (EXE='$EXE')" |
289 |
comm="$comm -mpi -command \"\$EXE\"" |
290 |
else echo '' ; fi |
291 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
292 |
echo " \"eval $comm\"" |
293 |
echo "======================" |
294 |
eval $comm > $tdir/output_$typ 2>&1 |
295 |
tail -100 $tdir/output_${typ} |
296 |
echo |
297 |
|
298 |
fi |
299 |
|
300 |
#-- MPI tests --- |
301 |
if test $typ = 'mpa' |
302 |
then |
303 |
|
304 |
EXE="mpirun -np 2 ./mitgcmuv_ad" |
305 |
echo -n "Running testreport using:" |
306 |
comm="./testreport -adm -a jmc@mitgcm.org" |
307 |
comm="$comm -match $MC" |
308 |
if test "x$OPTFILE" != x ; then |
309 |
comm="$comm -of=$OPTFILE" |
310 |
fi |
311 |
if test $MPI = 1 ; then echo " (EXE='$EXE')" |
312 |
comm="$comm -mpi -command \"\$EXE\"" |
313 |
else echo '' ; fi |
314 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
315 |
echo " \"eval $comm\"" |
316 |
echo "======================" |
317 |
eval $comm > $tdir/output_$typ 2>&1 |
318 |
tail -60 $tdir/output_$typ |
319 |
echo |
320 |
|
321 |
fi |
322 |
|
323 |
if test $typ = 'mpi' |
324 |
then |
325 |
|
326 |
echo -n "Running testreport using:" |
327 |
comm="./testreport -a jmc@mitgcm.org" |
328 |
comm="$comm -match $MC" |
329 |
if test "x$OPTFILE" != x ; then |
330 |
comm="$comm -of=$OPTFILE" |
331 |
fi |
332 |
if test $MPI = 1 ; then echo " (EXE='$EXE')" |
333 |
comm="$comm -mpi -command \"\$EXE\"" |
334 |
else echo '' ; fi |
335 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
336 |
echo " \"eval $comm\"" |
337 |
echo "======================" |
338 |
eval $comm > $tdir/output_$typ 2>&1 |
339 |
tail -100 $tdir/output_$typ |
340 |
echo |
341 |
|
342 |
fi |
343 |
|
344 |
if test $typ = 'mp2' |
345 |
then |
346 |
|
347 |
export OMP_NUM_THREADS=2 |
348 |
echo -n "Running testreport using:" |
349 |
comm="./testreport -mth -a jmc@mitgcm.org" |
350 |
comm="$comm -match $MC" |
351 |
if test "x$OPTFILE" != x ; then |
352 |
comm="$comm -of=$OPTFILE" |
353 |
fi |
354 |
if test $MPI = 1 ; then echo " (EXE='$EXE')" |
355 |
comm="$comm -mpi -command \"\$EXE\"" |
356 |
else echo '' ; fi |
357 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
358 |
echo " \"eval $comm\"" |
359 |
echo "======================" |
360 |
eval $comm > $tdir/output_$typ 2>&1 |
361 |
tail -100 $tdir/output_$typ |
362 |
echo |
363 |
|
364 |
fi |
365 |
|
366 |
#-- also test restart (test 2+2=4) |
367 |
if test $tt != $typ |
368 |
then |
369 |
echo "testing restart using:" |
370 |
comm="../tools/do_tst_2+2 -a jmc@mitgcm.org" |
371 |
if test $MPI = 1 ; then |
372 |
echo " \"$comm -mpi -exe $EXE\"" |
373 |
echo "======================" |
374 |
$comm -mpi -exe "$EXE" > $tdir/output_2+2 2>&1 |
375 |
else |
376 |
echo " \"$comm\"" |
377 |
echo "======================" |
378 |
$comm > $tdir/output_2+2 2>&1 |
379 |
fi |
380 |
#tail -100 $tdir/output_2+2 |
381 |
echo ; cat tst_2+2_out.txt |
382 |
echo |
383 |
fi |
384 |
export OMP_NUM_THREADS=1 |
385 |
|
386 |
if test $sepDir = 0 ; then |
387 |
#-- cleaning: |
388 |
echo "======================" |
389 |
echo "Cleaning test directories:" |
390 |
if test $tt != $typ ; then |
391 |
cmdCLN="../tools/do_tst_2+2 -clean" |
392 |
echo " clean tst_2+2 running: $cmdCLN" |
393 |
$cmdCLN >> $tdir/output_2+2 2>&1 |
394 |
fi |
395 |
if test $tt != $last_Tst ; then |
396 |
cmdCLN="./testreport -clean" |
397 |
echo " clean dir running: $cmdCLN" |
398 |
$cmdCLN > /dev/null 2>&1 |
399 |
fi |
400 |
echo "======================" |
401 |
echo |
402 |
fi |
403 |
popd |
404 |
|
405 |
done |