1 |
#!/bin/bash |
#! /usr/bin/env bash |
2 |
# |
# |
3 |
# $Header$ |
# $Header$ |
4 |
|
# $Name$ |
5 |
# |
# |
6 |
|
|
7 |
usage() |
usage() |
11 |
echo |
echo |
12 |
echo "where possible OPTIONS are:" |
echo "where possible OPTIONS are:" |
13 |
echo " (-help|-h) print usage" |
echo " (-help|-h) print usage" |
14 |
echo " (-optfile=|-of=)STRING list of genmake2 \"optfiles\"" |
echo " (-mpi) use MPI input files" |
15 |
echo " (-a|-addr)STRING list of email recipients" |
echo " (-ieee|-noieee) if possible, use IEEE compiler flags" |
16 |
echo " (-t|-tdir)STRING list of \"test\" dirs" |
echo " (DEF=\"noieee\")" |
17 |
|
echo " (-optfile=|-of=)STRING list of optfiles to use" |
18 |
|
echo " (-a|-addr) STRING list of email recipients" |
19 |
|
echo " (DEF=\"edhill@mitgcm.org\")" |
20 |
|
echo " (-t|-tdir) STRING list of test dirs to use" |
21 |
|
echo " (DEF=\"\" which builds all)" |
22 |
|
echo " (-b|-bash) STRING preferred location of a \"bash\" or" |
23 |
|
echo " Bourne-compatible \"sh\" shell" |
24 |
|
echo " (DEF=\"\" for \"bash\")" |
25 |
|
echo " (-command) STRING command to run" |
26 |
|
echo " (DEF=\"make output.txt\")" |
27 |
|
echo " (-m|-make) STRING command to use for \"make\"" |
28 |
|
echo " (DEF=\"make\")" |
29 |
|
echo " (-clean) *ONLY* run \"make CLEAN\"" |
30 |
|
echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\"" |
31 |
|
echo " (-nogenmake|-ng) skip the genmake stage" |
32 |
|
echo " (-noclean|-nc) skip the \"make clean\" stage" |
33 |
|
echo " (-nodepend|-nd) skip the \"make depend\" stage" |
34 |
|
echo |
35 |
|
echo "and where STRING follows a whitespace-delimited format" |
36 |
|
echo "such as:" |
37 |
|
echo " -t 'exp0 exp2 exp3' " |
38 |
|
echo " -addr='abc@123.com testing@home.org'" |
39 |
echo |
echo |
40 |
exit 1 |
exit 1 |
41 |
} |
} |
46 |
echo -n "building the mpack utility... " |
echo -n "building the mpack utility... " |
47 |
if test ! -x "$MPACKDIR/mpack" ; then |
if test ! -x "$MPACKDIR/mpack" ; then |
48 |
if test ! -d $MPACKDIR ; then |
if test ! -d $MPACKDIR ; then |
49 |
|
echo |
50 |
echo "Error: can't find \"$MPACKDIR\"" |
echo "Error: can't find \"$MPACKDIR\"" |
51 |
echo " are you sure this program is being run in the correct " |
echo " are you sure this program is being run in the correct " |
52 |
echo " (that is, \"MITGCM_ROOT\verification\") directory?" |
echo " (that is, \"MITGCM_ROOT\verification\") directory?" |
53 |
exit 1 |
echo |
54 |
|
HAVE_MPACK=f |
55 |
fi |
fi |
56 |
echo -n "building mpack... " |
echo -n "building mpack... " |
57 |
( cd $MPACKDIR && ./configure && make ) > build_mpack.out 2>&1 |
( cd $MPACKDIR && ./configure && $MAKE ) > build_mpack.out 2>&1 |
58 |
RETVAL=$? |
RETVAL=$? |
59 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
60 |
echo |
echo |
61 |
echo "Error building the mpack tools at: $MPACK_DIR" |
echo "Error building the mpack tools at: $MPACK_DIR" |
62 |
exit 1 |
echo |
63 |
|
HAVE_MPACK=f |
64 |
|
else |
65 |
|
HAVE_MPACK=t |
66 |
fi |
fi |
67 |
|
else |
68 |
|
HAVE_MPACK=t |
69 |
fi |
fi |
70 |
echo "OK" |
echo "OK" |
71 |
} |
} |
90 |
echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 |
echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 |
91 |
fi |
fi |
92 |
if [ -r $1/$4/output.txt ]; then |
if [ -r $1/$4/output.txt ]; then |
93 |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | nl > tmp1.txt |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt |
94 |
lncnt=`wc -l tmp1.txt | awk '{print $1}' ` |
lncnt=`wc -l tmp1.txt | awk '{print $1}' ` |
95 |
if [ $lncnt -lt 3 ]; then |
if [ $lncnt -lt 3 ]; then |
96 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
105 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
106 |
echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2 |
echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2 |
107 |
fi |
fi |
108 |
grep "$2" $1/results/output.txt | sed 's/.*=//' | nl > tmp2.txt |
grep "$2" $1/results/output.txt | sed 's/.*=//' | cat -n > tmp2.txt |
109 |
lncnt=`wc -l tmp2.txt | awk '{print $1}' ` |
lncnt=`wc -l tmp2.txt | awk '{print $1}' ` |
110 |
if [ $lncnt -lt 3 ]; then |
if [ $lncnt -lt 3 ]; then |
111 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
165 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
166 |
echo testoutput: cg2dres=$cg2dres 1>&2 |
echo testoutput: cg2dres=$cg2dres 1>&2 |
167 |
fi |
fi |
|
|
|
168 |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$? |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$? |
169 |
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$? |
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$? |
170 |
testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$? |
testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$? |
189 |
genmakemodel() |
genmakemodel() |
190 |
{ |
{ |
191 |
# genmakemodel directory |
# genmakemodel directory |
192 |
GENMAKE2="../../../tools/genmake2" |
if test "x$NOGENMAKE" = xt ; then |
193 |
( |
echo "genmake skipped!" |
194 |
cd $1; |
else |
195 |
printf 'genmake ... ' 1>&2 |
GENMAKE2="$BASH ../../../tools/genmake2" |
196 |
# ../../../tools/genmake -ieee -mods=../code > make.log 2>&1 |
( |
197 |
$GENMAKE2 -ds --mods=../code "--optfile="$OPTFILE > make.log 2>&1 |
cd $1; |
198 |
RETVAL=$? |
command="$GENMAKE2 -ds -m $MAKE --mods=../code" |
199 |
for i in gm_state gm_optfile gm_local Makefile ; do |
if test "x$OPTFILE" != xNONE ; then |
200 |
if test -r $i ; then |
command="$command --optfile=$OPTFILE" |
201 |
cp $i $CDIR |
# echo " command=\"$command\"" |
202 |
fi |
fi |
203 |
done |
if test "x$IEEE" != x ; then |
204 |
if test "x$RETVAL" != x0 ; then |
command="$command -ieee" |
205 |
tail make.log |
fi |
206 |
echo "genmakemodel: genmake failed" 1>&2 |
# echo "command: \"$command\"" |
207 |
cp make.log $CDIR |
printf 'genmake ... ' 1>&2 |
208 |
return 1 |
$command > make.log 2>&1 |
209 |
else |
RETVAL=$? |
210 |
echo "succesful" 1>&2 |
for i in genmake_state genmake_optfile genmake_local Makefile ; do |
211 |
fi |
if test -r $i ; then |
212 |
) |
cp $i $CDIR |
213 |
|
fi |
214 |
|
done |
215 |
|
if test "x$RETVAL" != x0 ; then |
216 |
|
tail make.log |
217 |
|
echo "genmakemodel: genmake failed" 1>&2 |
218 |
|
cp make.log $CDIR |
219 |
|
return 1 |
220 |
|
else |
221 |
|
echo "successful" 1>&2 |
222 |
|
fi |
223 |
|
) |
224 |
|
fi |
225 |
} |
} |
226 |
|
|
227 |
makeclean() |
makeclean() |
228 |
{ |
{ |
229 |
# makeclean directory |
# makeclean directory |
230 |
( |
if test "x$NOCLEAN" = xt ; then |
231 |
cd $1; |
echo "make CLEAN skipped!" |
232 |
rm -f output.txt |
else |
233 |
printf 'make CLEAN ... ' 2>&1 |
( |
234 |
if test -r Makefile ; then |
cd $1; |
235 |
make CLEAN >> make.log 2>&1 |
if test -e output.txt ; then |
236 |
RETVAL=$? |
rm -f output.txt |
|
if test "x$RETVAL" != x0 ; then |
|
|
tail make.log |
|
|
echo "makeclean: \"make CLEAN\" failed" 1>&2 |
|
|
cp make.log $CDIR"/make.log" |
|
|
return 1 |
|
237 |
fi |
fi |
238 |
fi |
printf 'make CLEAN ... ' 2>&1 |
239 |
echo succesful 1>&2 |
if test -r Makefile ; then |
240 |
exit 0 |
$MAKE CLEAN >> make.log 2>&1 |
241 |
) |
RETVAL=$? |
242 |
|
if test "x$RETVAL" != x0 ; then |
243 |
|
tail make.log |
244 |
|
echo "makeclean: \"make CLEAN\" failed" 1>&2 |
245 |
|
cp make.log $CDIR"/make.log" |
246 |
|
return 1 |
247 |
|
fi |
248 |
|
fi |
249 |
|
echo successful 1>&2 |
250 |
|
exit 0 |
251 |
|
) |
252 |
|
fi |
253 |
} |
} |
254 |
|
|
255 |
makedependmodel() |
makedependmodel() |
256 |
{ |
{ |
257 |
# makedependmodel directory |
# makedependmodel directory |
258 |
( |
if test "x$NODEPEND" = xt ; then |
259 |
cd $1; |
echo "make depend skipped!" |
260 |
printf 'make depend ... ' 1>&2 |
else |
261 |
make depend >> make.log 2>&1 |
( |
262 |
RETVAL=$? |
cd $1; |
263 |
if test "x$RETVAL" != x0 ; then |
printf 'make depend ... ' 1>&2 |
264 |
tail make.log |
$MAKE depend >> make.log 2>&1 |
265 |
echo "makedependmodel: make depend failed" 1>&2 |
RETVAL=$? |
266 |
cp make.log $CDIR"/make.log" |
if test "x$RETVAL" != x0 ; then |
267 |
return 1 |
tail make.log |
268 |
else |
echo "makedependmodel: make depend failed" 1>&2 |
269 |
echo succesful 1>&2 |
cp make.log $CDIR"/make.log" |
270 |
fi |
return 1 |
271 |
) |
else |
272 |
|
echo successful 1>&2 |
273 |
|
fi |
274 |
|
) |
275 |
|
fi |
276 |
} |
} |
277 |
|
|
278 |
makemodel() |
makemodel() |
282 |
cd $1; |
cd $1; |
283 |
if test -r Makefile ; then |
if test -r Makefile ; then |
284 |
printf 'make ... ' 1>&2 |
printf 'make ... ' 1>&2 |
285 |
make >> make.log 2>&1 |
$MAKE >> make.log 2>&1 |
286 |
RETVAL=$? |
RETVAL=$? |
287 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
288 |
tail make.log |
tail make.log |
290 |
cp make.log $CDIR"/make.log" |
cp make.log $CDIR"/make.log" |
291 |
return 1 |
return 1 |
292 |
else |
else |
293 |
echo succesful 1>&2 |
echo successful 1>&2 |
294 |
fi |
fi |
295 |
fi |
fi |
296 |
) |
) |
301 |
# linkdata flag |
# linkdata flag |
302 |
# |
# |
303 |
# symbolically link data files to run directory |
# symbolically link data files to run directory |
304 |
if [ $1 -ne 0 ]; then |
if test "x$1" = x1 ; then |
305 |
( cd $2 ; ln -sf ../input/* . ) |
( |
306 |
|
cd $2 |
307 |
|
files=`( cd ../input ; ls -1 | grep -v CVS )` |
308 |
|
for i in $files ; do |
309 |
|
if test ! -d "../input/"$i ; then |
310 |
|
ln -sf "../input/"$i $i |
311 |
|
fi |
312 |
|
done |
313 |
|
) |
314 |
fi |
fi |
315 |
} |
} |
316 |
|
|
317 |
runmodel() |
runmodel() |
318 |
{ |
{ |
319 |
# runmodel directory exe |
# runmodel directory |
320 |
# |
# |
321 |
# runs the model "exe" in "directory" (exe is relative to directory) |
# runs "$COMMAND" in "directory" |
322 |
|
# (where "$COMMAND" is relative to "directory") |
323 |
( |
( |
324 |
cd $1 |
cd $1 |
325 |
if [ -x $2 ]; then |
printf 'runmodel ... ' 1>&2 |
326 |
if [ $quick -eq 0 ]; then |
# make output.txt |
327 |
rm -f output.txt |
$COMMAND >> run.log 2>&1 |
328 |
fi |
RETVAL=$? |
329 |
printf 'runmodel: ' 1>&2 |
if test "x$RETVAL" = x0 ; then |
330 |
make output.txt |
echo successful 1>&2 |
331 |
RETVAL=$? |
cp output.txt $CDIR"/output.txt" |
332 |
if test "x$RETVAL" = x0 ; then |
return 0 |
333 |
cp output.txt $CDIR"/output.txt" |
else |
334 |
return 0 |
tail run.log |
335 |
else |
echo failed 1>&2 |
336 |
return 1 |
cp run.log $CDIR"/run.log" |
337 |
fi |
return 1 |
338 |
fi |
fi |
339 |
) |
) |
340 |
} |
} |
375 |
return 0 |
return 0 |
376 |
else |
else |
377 |
echo |
echo |
378 |
echo "createcodelet: failed to compile codelet" | tee |
echo "createcodelet: failed to compile codelet" |
379 |
exit 1 |
exit 1 |
380 |
fi |
fi |
381 |
} |
} |
407 |
{ |
{ |
408 |
cat - << EOF |
cat - << EOF |
409 |
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
410 |
-help Show this help message |
|
411 |
-quick Skip "genmake" and "make depend" if the Makefile exists |
-help|-h Show this help message |
412 |
-quiet Reduce the amount of output |
-quiet Reduce the amount of output |
413 |
-verbose Produce copious amounts of output |
-verbose Produce copious amounts of output |
414 |
-debug Produce even more output which will mean nothing to most |
-debug Produce even more output which will mean nothing to most |
415 |
-force Do "make CLEAN" before compiling. This forces a complete rebuild. |
-force Do "make CLEAN" before compiling. This forces a complete rebuild. |
416 |
-clean Do "make CLEAN" after compiling and testing. |
-clean Do "make CLEAN" after compiling and testing. |
|
-noieee By default, $0 uses the -ieee option for genmake. This turns it off. |
|
417 |
-cleanup Aggresively removes all model output, executables and object files |
-cleanup Aggresively removes all model output, executables and object files |
418 |
and then exits. Use with care. |
and then exits. Use with care. |
419 |
|
|
442 |
# Default properties |
# Default properties |
443 |
debug=0 |
debug=0 |
444 |
verbose=1 |
verbose=1 |
|
quick=0 |
|
445 |
clean=0 |
clean=0 |
|
ieee=1 |
|
446 |
expts='' |
expts='' |
447 |
|
# ieee=1 |
448 |
|
|
449 |
|
IEEE= |
450 |
|
if test "x$MITGCM_IEEE" != x ; then |
451 |
|
IEEE=$MITGCM_IEEE |
452 |
|
fi |
453 |
|
|
454 |
OPTFILES= |
|
455 |
ADDRESSES=edhill@mitgcm.org |
CLEANUP=f |
456 |
|
QUICK=f |
457 |
|
NOGENMAKE=f |
458 |
|
NOCLEAN=f |
459 |
|
NODEPEND=f |
460 |
|
|
461 |
|
BASH= |
462 |
|
OPTFILE=NONE |
463 |
|
ADDRESSES= |
464 |
TESTDIRS= |
TESTDIRS= |
465 |
MPACKDIR="../tools/mpack-1.6" |
MPACKDIR="../tools/mpack-1.6" |
466 |
|
HAVE_MPACK= |
467 |
MPACK="$MPACKDIR/mpack" |
MPACK="$MPACKDIR/mpack" |
468 |
|
COMMAND="make output.txt" |
469 |
|
MAKE=make |
470 |
|
MPI=f |
471 |
|
|
472 |
echo -n "parsing options... " |
echo -n "parsing options... " |
473 |
|
|
488 |
-help | --help | -h | --h) |
-help | --help | -h | --h) |
489 |
usage ;; |
usage ;; |
490 |
|
|
491 |
-optfile | --optfile | -f | --f) |
-optfile | --optfile | -of | --of) |
492 |
ac_prev=OPTFILES ;; |
ac_prev=OPTFILE ;; |
493 |
-optfile=* | --optfile=*) |
-optfile=* | --optfile=* | -of=* | --of=*) |
494 |
OPTFILES=$ac_optarg ;; |
OPTFILE=$ac_optarg ;; |
495 |
|
|
496 |
-addr | --addr | -a | --a) |
-addr | --addr | -a | --a) |
497 |
ac_prev=ADDRESSES ;; |
ac_prev=ADDRESSES ;; |
503 |
-tdir=* | --tdir=*) |
-tdir=* | --tdir=*) |
504 |
TESTDIRS=$ac_optarg ;; |
TESTDIRS=$ac_optarg ;; |
505 |
|
|
506 |
-quick) quick=1 ;; |
-bash | --bash | -b | --b) |
507 |
|
ac_prev=BASH ;; |
508 |
|
-bash=* | --bash=*) |
509 |
|
BASH=$ac_optarg ;; |
510 |
|
|
511 |
|
-command | --command | -c | --c) |
512 |
|
ac_prev=COMMAND ;; |
513 |
|
-command=* | --command=*) |
514 |
|
COMMAND=$ac_optarg ;; |
515 |
|
|
516 |
|
-make | --make | -m | --m) |
517 |
|
ac_prev=MAKE ;; |
518 |
|
-make=* | --make=*) |
519 |
|
MAKE=$ac_optarg ;; |
520 |
|
|
521 |
|
-clean | --clean) |
522 |
|
CLEANUP=t ;; |
523 |
|
|
524 |
|
-quick | --quick | -q | --q) |
525 |
|
QUICK=t ;; |
526 |
|
-nogenmake | --nogenmake | -ng | --ng) |
527 |
|
NOGENMAKE=t ;; |
528 |
|
-noclean | --noclean | -nc | --nc) |
529 |
|
NOCLEAN=t ;; |
530 |
|
-nodepend | --nodepend | -nd | --nd) |
531 |
|
NODEPEND=t ;; |
532 |
|
|
533 |
|
-mpi) MPI=t ;; |
534 |
|
|
535 |
|
-ieee) IEEE=true ;; |
536 |
|
-noieee) IEEE= ;; |
537 |
|
|
538 |
-verbose) verbose=2 ;; |
-verbose) verbose=2 ;; |
539 |
-debug) debug=1 ;; |
-debug) debug=1 ;; |
|
-clean) clean=1 ;; |
|
|
-noieee) ieee=0 ;; |
|
540 |
-quiet) verbose=0 ;; |
-quiet) verbose=0 ;; |
541 |
|
|
542 |
-*) |
-*) |
553 |
|
|
554 |
done |
done |
555 |
|
|
556 |
|
if test "x$QUICK" = xt ; then |
557 |
|
NOGENMAKE=t |
558 |
|
NOCLEAN=t |
559 |
|
NODEPEND=t |
560 |
|
fi |
561 |
|
|
562 |
if test "x$TESTDIRS" = x ; then |
if test "x$TESTDIRS" = x ; then |
563 |
TESTDIRS=`scandirs` |
TESTDIRS=`scandirs` |
564 |
fi |
fi |
565 |
|
|
566 |
|
if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then |
567 |
|
OPTFILE=$MITGCM_OF |
568 |
|
fi |
569 |
|
|
570 |
echo "OK" |
echo "OK" |
571 |
|
|
572 |
# create the FORTRAN comparison code |
# create the FORTRAN comparison code |
577 |
|
|
578 |
# Create a uniquely named directory to store results |
# Create a uniquely named directory to store results |
579 |
MACH=`hostname` |
MACH=`hostname` |
580 |
|
UNAMEA=`uname -a` |
581 |
DATE=`date +%Y%m%d` |
DATE=`date +%Y%m%d` |
582 |
BASE=$MACH"_"$DATE"_" |
BASE=$MACH"_"$DATE"_" |
583 |
DNUM=0 |
DNUM=0 |
589 |
mkdir $DRESULTS |
mkdir $DRESULTS |
590 |
RETVAL=$? |
RETVAL=$? |
591 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
592 |
echo "Error: can't create results directory \"./$DRESULTS\"" |
echo "ERROR: Can't create results directory \"./$DRESULTS\"" |
593 |
exit 1 |
exit 1 |
594 |
fi |
fi |
595 |
SUMMARY="$DRESULTS/summary.txt" |
SUMMARY="$DRESULTS/summary.txt" |
596 |
date > $SUMMARY |
echo -n "Start time: " >> $SUMMARY |
597 |
cat << EOF >> $SUMMARY |
start_date=`date` |
598 |
|
echo $start_date > $SUMMARY |
599 |
|
cat << EOF | tee -a $SUMMARY |
600 |
T S U V |
T S U V |
601 |
G D M c m s m s m s m s |
G D M c m s m s m s m s |
602 |
E p a R g m m e . m m e . m m e . m m e . |
E p a R g m m e . m m e . m m e . m m e . |
607 |
|
|
608 |
NDIR=0 |
NDIR=0 |
609 |
|
|
610 |
# For each optfile... |
of_path= |
611 |
for OPTFILE in $OPTFILES ; do |
if test "x$OPTFILE" != xNONE ; then |
612 |
|
if test -r $OPTFILE ; then |
613 |
|
# get the path |
614 |
|
path=${OPTFILE%/*} |
615 |
|
if test "x$path" = x ; then |
616 |
|
of_path=`pwd` |
617 |
|
else |
618 |
|
of_path=`( cd $path > /dev/null 2>&1 ; pwd )` |
619 |
|
fi |
620 |
|
file=${OPTFILE##*/} |
621 |
|
OPTFILE=$of_path/$file |
622 |
|
else |
623 |
|
echo |
624 |
|
echo "WARNING: can't read OPTFILE=\"$OPTFILE\" but will try to use it..." |
625 |
|
fi |
626 |
|
fi |
627 |
|
echo |
628 |
|
echo "OPTFILE=$OPTFILE" >> $SUMMARY |
629 |
|
echo >> $SUMMARY |
630 |
|
|
631 |
|
# ...and each test directory... |
632 |
|
for dir in $TESTDIRS ; do |
633 |
|
|
634 |
|
# Cleanup only! |
635 |
|
if test "x$CLEANUP" = xt ; then |
636 |
|
if test -r $dir/build/Makefile ; then |
637 |
|
( cd $dir/build ; make CLEAN ) |
638 |
|
fi |
639 |
|
if test -r $dir/input/Makefile ; then |
640 |
|
( cd $dir/input ; make CLEAN ) |
641 |
|
fi |
642 |
|
continue |
643 |
|
fi |
644 |
|
|
645 |
OPTFILE=`pwd`"/$OPTFILE" |
# Verify that the testdir exists and contains previous |
646 |
if test ! -r $OPTFILE ; then |
# results in the correct location--or skip this directory! |
647 |
echo "Error: can't read optfile \"$OPTFILE\"" |
if test ! -r $dir"/results/output.txt" ; then |
648 |
exit 1 |
echo "can't read \"$dir/results/output.txt\" -- skipping $dir" |
649 |
|
continue |
650 |
fi |
fi |
651 |
|
|
652 |
|
echo "-------------------------------------------------------------------------------" |
653 |
echo |
echo |
654 |
echo "OPTFILE=$OPTFILE" >> $SUMMARY |
echo "Experiment: $dir" |
655 |
echo >> $SUMMARY |
echo |
656 |
|
unset genmake makedepend make run |
657 |
# ...and each test directory... |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
|
for dir in $TESTDIRS ; do |
|
|
|
|
|
# Create an output dir for each OPTFILE/tdir combination |
|
|
CDIR=$DRESULTS"/"$NDIR |
|
|
mkdir $CDIR |
|
|
CDIR=`pwd`"/$CDIR" |
|
658 |
|
|
659 |
# ...configue, make, run, and compare the output. |
builddir="input" |
660 |
echo "-------------------------------------------------------------------------------" |
rundir="input" |
661 |
echo |
use_seperate_build=0 |
662 |
echo "Experiment: $dir" |
if test -d $dir/build -a -r $dir/build ; then |
663 |
echo |
builddir="build" |
664 |
unset genmake makedepend make run |
rundir="build" |
665 |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
use_seperate_build=1 |
666 |
( cd $dir/input; rm -f *.{o,f,c,F} *.[f,F]90 work* output.txt Make* make.log; ) |
linkdata $use_seperate_build $dir/$rundir |
667 |
if [ -r $dir/build ]; then |
fi |
668 |
seperatebuilddir=1 |
|
669 |
builddir=build |
CODE_DIR=$dir/code |
670 |
rundir=build |
BUILD_DIR=$dir/$builddir |
671 |
( cd $dir/build; ln -sf ../input/* . ) |
MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi" |
672 |
else |
NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi" |
673 |
seperatebuilddir=0 |
|
674 |
builddir=input |
# Is this an MPI run? |
675 |
rundir=input |
if test "x$MPI" = xt ; then |
676 |
|
FILES=$MPI_FILES |
677 |
|
endings="_mpi" |
678 |
|
else |
679 |
|
FILES=$NOMPI_FILES |
680 |
|
endings="_nompi" |
681 |
|
fi |
682 |
|
|
683 |
|
# Check to see that we have the files |
684 |
|
have_files=t |
685 |
|
for i in $FILES ; do |
686 |
|
if test ! -r $CODE_DIR/$i ; then |
687 |
|
echo "Warning: can't read file $CODE_DIR/$i" |
688 |
|
have_files=f |
689 |
fi |
fi |
690 |
|
done |
691 |
|
if test "x$have_files" != xt -a "x$MPI" = xt ; then |
692 |
|
echo "Skipping $dir due to lack of input files (see above warning)" |
693 |
|
continue |
694 |
|
fi |
695 |
|
|
696 |
|
# If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR |
697 |
|
if test "x$have_files" = xt ; then |
698 |
|
for i in $FILES ; do |
699 |
|
sstr="s|$endings||" |
700 |
|
name=`echo $i | sed -e $sstr ` |
701 |
|
cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1 |
702 |
|
RETVAL=$? |
703 |
|
if test "x$RETVAL" != x0 ; then |
704 |
|
cp $CODE_DIR/$i $BUILD_DIR/$name |
705 |
|
fi |
706 |
|
done |
707 |
|
fi |
708 |
|
|
709 |
|
# Create an output dir for each OPTFILE/tdir combination |
710 |
|
rel_CDIR=$DRESULTS"/"$dir |
711 |
|
mkdir $rel_CDIR |
712 |
|
CDIR=`pwd`"/$rel_CDIR" |
713 |
|
|
714 |
|
if test "x$CLEANUP" = xt ; then |
715 |
|
makeclean $dir/$builddir |
716 |
|
else |
717 |
genmakemodel $dir/$builddir && genmake=Y \ |
genmakemodel $dir/$builddir && genmake=Y \ |
718 |
&& makeclean $dir/$builddir \ |
&& makeclean $dir/$builddir \ |
719 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
720 |
&& makemodel $dir/$builddir && make=Y \ |
&& makemodel $dir/$builddir && make=Y \ |
721 |
&& linkdata $seperatebuilddir $dir/$rundir \ |
&& linkdata $use_seperate_build $dir/$rundir \ |
722 |
&& runmodel $dir/$builddir mitgcmuv && run=Y \ |
&& runmodel $dir/$rundir && run=Y \ |
723 |
&& results=`testoutput $dir $rundir` |
&& results=`testoutput $dir $rundir` |
724 |
echo |
fi |
725 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results |
|
726 |
echo |
echo |
727 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results >> $SUMMARY |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
728 |
|
${run:-N} $results |
729 |
( cd $DRESULTS"/"$NDIR ; gzip * ) |
echo |
730 |
|
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
731 |
tar -cf $DRESULTS"/"$NDIR".tar" $DRESULTS"/"$NDIR |
${run:-N} $results >> $SUMMARY |
732 |
$MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar" $ADDRESSES |
echo "fresults='" > $CDIR"/summary.txt" |
733 |
|
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
734 |
NDIR=$(( $NDIR + 1 )) |
${run:-N} $results >> $CDIR"/summary.txt" |
735 |
|
echo "'" >> $CDIR"/summary.txt" |
736 |
done |
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
737 |
|
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
738 |
|
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
739 |
|
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
740 |
|
|
741 |
|
echo "-------------------------------------------------------------------------------" |
742 |
|
|
743 |
|
NDIR=$(( $NDIR + 1 )) |
744 |
|
|
745 |
done |
done |
746 |
|
|
747 |
# rm tmp_cmpnum.f a.out |
echo -n "Start time: " >> $SUMMARY |
748 |
|
echo $start_date >> $SUMMARY |
749 |
echo ------------------------------------------------------------------------------- |
echo -n "End time: " >> $SUMMARY |
|
echo |
|
|
echo >> $SUMMARY |
|
750 |
date >> $SUMMARY |
date >> $SUMMARY |
|
cat $SUMMARY |
|
751 |
|
|
752 |
# tar -cf $DRESULTS".tar" $DRESULTS |
# If addresses were supplied and mpack built successfully, then try |
753 |
# |
# to send email using mpack. |
754 |
# $MPACK -s MITgcm-test -m 1000000 $DRESULTS".tar" $ADDRESSES |
if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then |
755 |
|
echo "No results email was sent." |
756 |
|
else |
757 |
|
if test "x$HAVE_MPACK" = xt ; then |
758 |
|
tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \ |
759 |
|
&& gzip $DRESULTS".tar" \ |
760 |
|
&& $MPACK -s MITgcm-test -m 1500000 $DRESULTS".tar.gz" $ADDRESSES |
761 |
|
RETVAL=$? |
762 |
|
if test "x$RETVAL" != x0 ; then |
763 |
|
echo |
764 |
|
echo "Warning: The tar, gzip, & mpack step failed. Please send email" |
765 |
|
echo " to <MITgcm-support@mitgcm.org> for help. You may copy the " |
766 |
|
echo " summary of results from the directory \"$DRESULTS\"." |
767 |
|
echo |
768 |
|
else |
769 |
|
echo |
770 |
|
echo "An email containing results was sent to the following addresses:" |
771 |
|
echo " \"$ADDRESSES\"" |
772 |
|
echo |
773 |
|
fi |
774 |
|
test -f $DRESULTS".tar" && rm -f $DRESULTS".tar" |
775 |
|
test -f $DRESULTS".tar.gz" && rm -f $DRESULTS".tar.gz" |
776 |
|
fi |
777 |
|
fi |
778 |
|
|
779 |
|
rm tmp_cmpnum.f a.out |
780 |
|
|
781 |
|
if test "x$CLEANUP" != xt ; then |
782 |
|
cat $SUMMARY |
783 |
|
if test -e tr.out ; then |
784 |
|
mv tr.out tr.out.old |
785 |
|
fi |
786 |
|
cat $SUMMARY > tr.out |
787 |
|
fi |
788 |
|
|