1 |
jmc |
1.1 |
#! /usr/bin/env bash |
2 |
|
|
|
3 |
jmc |
1.4 |
# $Header: /u/gcmpack/MITgcm/tools/example_scripts/csail/test_baudelaire,v 1.3 2010/11/03 19:44:49 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="$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 |
jmc |
1.4 |
# 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 |
jmc |
1.1 |
|
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 |
jmc |
1.3 |
MC=13 |
34 |
jmc |
1.1 |
checkOut=1 |
35 |
|
|
sepDir=1 |
36 |
|
|
option= |
37 |
jmc |
1.4 |
tst_list='g7a adm mpa g77 gfo+rs mth mp2+rs mpi ifc' |
38 |
jmc |
1.1 |
#tst_list='g77 adm gfo ifc mth pgi+rs' |
39 |
jmc |
1.2 |
#tst_list='g77 gfo+rs mth' |
40 |
jmc |
1.1 |
|
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 |
jmc |
1.4 |
MPI=0 |
119 |
jmc |
1.1 |
case $typ in |
120 |
jmc |
1.4 |
'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 |
jmc |
1.1 |
esac |
128 |
jmc |
1.4 |
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 |
jmc |
1.1 |
|
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 |
jmc |
1.4 |
echo -n "Running testreport using:" |
151 |
jmc |
1.1 |
comm="./testreport -a jmc@mitgcm.org" |
152 |
jmc |
1.3 |
# comm="$comm -match $MC" |
153 |
jmc |
1.1 |
if test "x$OPTFILE" != x ; then |
154 |
|
|
comm="$comm -of=$OPTFILE" |
155 |
|
|
fi |
156 |
jmc |
1.4 |
if test $MPI = 1 ; then echo " (EXE='$EXE')" |
157 |
|
|
comm="$comm -mpi -command \"\$EXE\"" |
158 |
|
|
else echo '' ; fi |
159 |
jmc |
1.1 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
160 |
jmc |
1.4 |
echo " \"eval $comm\"" |
161 |
jmc |
1.1 |
echo "======================" |
162 |
jmc |
1.4 |
eval $comm > $tdir/output_$typ 2>&1 |
163 |
jmc |
1.1 |
tail -100 $tdir/output_$typ |
164 |
|
|
echo |
165 |
|
|
|
166 |
|
|
fi |
167 |
|
|
|
168 |
|
|
if test $typ = 'gfo' |
169 |
|
|
then |
170 |
|
|
|
171 |
jmc |
1.4 |
echo -n "Running testreport using:" |
172 |
jmc |
1.1 |
comm="./testreport -a jmc@mitgcm.org" |
173 |
jmc |
1.3 |
comm="$comm -match $MC" |
174 |
jmc |
1.2 |
if test "x$OPTFILE" != x ; then |
175 |
|
|
comm="$comm -of=$OPTFILE" |
176 |
|
|
fi |
177 |
jmc |
1.4 |
if test $MPI = 1 ; then echo " (EXE='$EXE')" |
178 |
|
|
comm="$comm -mpi -command \"\$EXE\"" |
179 |
|
|
else echo '' ; fi |
180 |
jmc |
1.2 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
181 |
jmc |
1.4 |
echo " \"eval $comm\"" |
182 |
jmc |
1.2 |
echo "======================" |
183 |
jmc |
1.4 |
eval $comm > $tdir/output_$typ 2>&1 |
184 |
jmc |
1.2 |
tail -100 $tdir/output_$typ |
185 |
|
|
echo |
186 |
|
|
|
187 |
|
|
fi |
188 |
|
|
|
189 |
|
|
if test $typ = 'g7a' |
190 |
|
|
then |
191 |
|
|
|
192 |
jmc |
1.4 |
echo -n "Running testreport using:" |
193 |
jmc |
1.2 |
comm="./testreport -adm -a jmc@mitgcm.org" |
194 |
jmc |
1.3 |
# comm="$comm -match $MC" |
195 |
jmc |
1.1 |
if test "x$OPTFILE" != x ; then |
196 |
|
|
comm="$comm -of=$OPTFILE" |
197 |
|
|
fi |
198 |
jmc |
1.4 |
if test $MPI = 1 ; then echo " (EXE='$EXE')" |
199 |
|
|
comm="$comm -mpi -command \"\$EXE\"" |
200 |
|
|
else echo '' ; fi |
201 |
jmc |
1.1 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
202 |
jmc |
1.4 |
echo " \"eval $comm\"" |
203 |
jmc |
1.1 |
echo "======================" |
204 |
jmc |
1.4 |
eval $comm > $tdir/output_$typ 2>&1 |
205 |
jmc |
1.2 |
tail -60 $tdir/output_$typ |
206 |
jmc |
1.1 |
echo |
207 |
|
|
|
208 |
|
|
fi |
209 |
|
|
|
210 |
|
|
if test $typ = 'adm' |
211 |
|
|
then |
212 |
|
|
|
213 |
jmc |
1.4 |
echo -n "Running testreport using:" |
214 |
jmc |
1.1 |
comm="./testreport -adm -a jmc@mitgcm.org" |
215 |
jmc |
1.3 |
comm="$comm -match $MC" |
216 |
jmc |
1.1 |
if test "x$OPTFILE" != x ; then |
217 |
|
|
comm="$comm -of=$OPTFILE" |
218 |
|
|
fi |
219 |
jmc |
1.4 |
if test $MPI = 1 ; then echo " (EXE='$EXE')" |
220 |
|
|
comm="$comm -mpi -command \"\$EXE\"" |
221 |
|
|
else echo '' ; fi |
222 |
jmc |
1.1 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
223 |
jmc |
1.4 |
echo " \"eval $comm\"" |
224 |
jmc |
1.1 |
echo "======================" |
225 |
jmc |
1.4 |
eval $comm > $tdir/output_$typ 2>&1 |
226 |
jmc |
1.1 |
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 |
jmc |
1.4 |
echo -n "Running testreport using:" |
236 |
jmc |
1.1 |
comm="./testreport -a jmc@mitgcm.org" |
237 |
jmc |
1.3 |
# comm="$comm -match $MC" |
238 |
jmc |
1.1 |
if test "x$OPTFILE" != x ; then |
239 |
|
|
comm="$comm -of=$OPTFILE" |
240 |
|
|
fi |
241 |
jmc |
1.4 |
if test $MPI = 1 ; then echo " (EXE='$EXE')" |
242 |
|
|
comm="$comm -mpi -command \"\$EXE\"" |
243 |
|
|
else echo '' ; fi |
244 |
jmc |
1.1 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
245 |
jmc |
1.4 |
echo " \"eval $comm\"" |
246 |
jmc |
1.1 |
echo "======================" |
247 |
jmc |
1.4 |
eval $comm > $tdir/output_$typ 2>&1 |
248 |
jmc |
1.1 |
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 |
jmc |
1.4 |
echo -n "Running testreport using:" |
258 |
jmc |
1.1 |
comm="./testreport -mth -a jmc@mitgcm.org" |
259 |
jmc |
1.3 |
comm="$comm -match $MC" |
260 |
jmc |
1.1 |
if test "x$OPTFILE" != x ; then |
261 |
|
|
comm="$comm -of=$OPTFILE" |
262 |
|
|
fi |
263 |
jmc |
1.4 |
if test $MPI = 1 ; then echo " (EXE='$EXE')" |
264 |
|
|
comm="$comm -mpi -command \"\$EXE\"" |
265 |
|
|
else echo '' ; fi |
266 |
jmc |
1.1 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
267 |
jmc |
1.4 |
echo " \"eval $comm\"" |
268 |
jmc |
1.1 |
echo "======================" |
269 |
jmc |
1.4 |
eval $comm > $tdir/output_$typ 2>&1 |
270 |
jmc |
1.1 |
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 |
jmc |
1.4 |
export PATH="$PATH:$PGI/linux86-64/10.9/bin" |
280 |
jmc |
1.1 |
export LM_LICENSE_FILE=$PGI/license.dat |
281 |
jmc |
1.4 |
echo -n "Running testreport using:" |
282 |
jmc |
1.3 |
comm="./testreport -a jmc@mitgcm.org" |
283 |
|
|
# comm="$comm -match $MC" |
284 |
jmc |
1.1 |
#comm="$comm -skd tutorial_advection_in_gyre" |
285 |
|
|
if test "x$OPTFILE" != x ; then |
286 |
|
|
comm="$comm -of=$OPTFILE" |
287 |
|
|
fi |
288 |
jmc |
1.4 |
if test $MPI = 1 ; then echo " (EXE='$EXE')" |
289 |
|
|
comm="$comm -mpi -command \"\$EXE\"" |
290 |
|
|
else echo '' ; fi |
291 |
jmc |
1.1 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
292 |
jmc |
1.4 |
echo " \"eval $comm\"" |
293 |
jmc |
1.1 |
echo "======================" |
294 |
jmc |
1.4 |
eval $comm > $tdir/output_$typ 2>&1 |
295 |
jmc |
1.3 |
tail -100 $tdir/output_${typ} |
296 |
jmc |
1.1 |
echo |
297 |
|
|
|
298 |
|
|
fi |
299 |
|
|
|
300 |
jmc |
1.4 |
#-- 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 |
jmc |
1.1 |
#-- 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 |
jmc |
1.4 |
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 |
jmc |
1.1 |
#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 |