/[MITgcm]/MITgcm/verification/testreport
ViewVC logotype

Contents of /MITgcm/verification/testreport

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.33 - (show annotations) (download)
Thu Dec 18 15:12:34 2003 UTC (20 years, 3 months ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint52l_pre, checkpoint52e_pre, hrcube4, checkpoint52j_post, checkpoint52e_post, hrcube_1, checkpoint52l_post, checkpoint52k_post, checkpoint52f_post, checkpoint52i_post, checkpoint52j_pre, checkpoint52i_pre, checkpoint52h_pre, checkpoint52f_pre, hrcube_3
Changes since 1.32: +5 -3 lines
Hack to catch problem on cg01 with small numbers: "C" scanf doesn't properly
translate formatted number below 1E-99 which the model does write out on rare
occasions. Perhaps this little codelet should be in fortran?

1 #! /usr/bin/env bash
2 #
3 # $Header: /u/gcmpack/MITgcm/verification/testreport,v 1.32 2003/12/07 07:06:13 edhill Exp $
4 # $Name: $
5 #
6
7 usage()
8 {
9 echo
10 echo "Usage: $0 [OPTIONS]"
11 echo
12 echo "where possible OPTIONS are:"
13 echo " (-help|-h) print usage"
14 echo " (-mpi) use MPI input files"
15 echo " (-ieee|-noieee) if possible, use IEEE compiler flags"
16 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 " (-adm|-ad) perform an adjoint run"
26 echo " (-command) STRING command to run"
27 echo " (DEF=\"make output.txt\")"
28 echo " (-m|-make) STRING command to use for \"make\""
29 echo " (DEF=\"make\")"
30 echo " (-clean) *ONLY* run \"make CLEAN\""
31 echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\""
32 echo " (-nogenmake|-ng) skip the genmake stage"
33 echo " (-noclean|-nc) skip the \"make clean\" stage"
34 echo " (-nodepend|-nd) skip the \"make depend\" stage"
35 echo
36 echo "and where STRING follows a whitespace-delimited format"
37 echo "such as:"
38 echo " -t 'exp0 exp2 exp3' "
39 echo " -addr='abc@123.com testing@home.org'"
40 echo
41 exit 1
42 }
43
44 # build the mpack utility
45 build_mpack()
46 {
47 echo -n "building the mpack utility... "
48 if test ! -x "$MPACKDIR/mpack" ; then
49 if test ! -d $MPACKDIR ; then
50 echo
51 echo "Error: can't find \"$MPACKDIR\""
52 echo " are you sure this program is being run in the correct "
53 echo " (that is, \"MITGCM_ROOT\verification\") directory?"
54 echo
55 HAVE_MPACK=f
56 fi
57 echo -n "building mpack... "
58 if test "x$CC" = x ; then
59 export CC=cc
60 fi
61 ( cd $MPACKDIR && ./configure && $MAKE ) > tr_build_mpack.out 2>&1
62 RETVAL=$?
63 if test "x$RETVAL" != x0 ; then
64 echo
65 echo "Error building the mpack tools at: $MPACK_DIR"
66 echo
67 HAVE_MPACK=f
68 else
69 rm -f tr_build_mpack.out
70 HAVE_MPACK=t
71 fi
72 else
73 HAVE_MPACK=t
74 fi
75 echo "OK"
76 }
77
78 testoutput_for_prop()
79 {
80 # testoutput_for_prop dir s1 label subdir
81 #
82 # compares files in $dir/$subdir/output.txt and $dir/results/output.txt
83 # using search strings s1 and text label
84
85 if [ $debug -gt 0 ]; then
86 echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2
87 fi
88 if [ -r $1/$4/output.txt ]; then
89 grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt
90 lncnt=`wc -l tmp1.txt | awk '{print $1}' `
91 if [ $lncnt -lt 3 ]; then
92 if [ $verbose -gt 0 ]; then
93 echo Not enough lines of output when searching for "$2" 1>&2
94 fi
95 return 99
96 fi
97 else
98 echo testoutput_for_prop: output.txt from model run was not readable 1>&2
99 return 99
100 fi
101 if [ $debug -gt 0 ]; then
102 echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2
103 fi
104 grep "$2" $1/results/output.txt | sed 's/.*=//' | cat -n > tmp2.txt
105 lncnt=`wc -l tmp2.txt | awk '{print $1}' `
106 if [ $lncnt -lt 3 ]; then
107 if [ $verbose -gt 0 ]; then
108 echo Not enough lines of output when searching for "$2" 1>&2
109 fi
110 return 99
111 fi
112 if [ $debug -gt 0 ]; then
113 echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2
114 fi
115 join tmp1.txt tmp2.txt | awk '{print $1 " " $2 " " $3}' > tmp3.txt
116 if [ $debug -gt 0 ]; then
117 echo testoutput_for_prop: compare_lines 1>&2
118 fi
119 if [ $verbose -gt 1 ]; then
120 cat tmp3.txt 1>&2
121 fi
122 echo "-1" >> tmp3.txt
123 # On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number
124 cat tmp3.txt | sed -e 's|:||g' > tmp4.txt
125 digits_of_similarity=`./tmp_cmpnum < tmp4.txt`
126 if [ $digits_of_similarity -eq 99 ]; then
127 if [ $verbose -gt 0 ]; then
128 echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2
129 fi
130 digits_of_similarity=99
131 else
132 if [ $verbose -gt 0 ]; then
133 echo There were $digits_of_similarity decimal places of similarity for \"$2\" 1>&2
134 fi
135 fi
136 rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt
137
138 return $digits_of_similarity
139 }
140
141 dashnum()
142 {
143 # dashnum n1 n2 n3 ...
144 #
145 # print numbers using %3i format or "--" if number = 99
146
147 for num in $@ ; do
148 if [ $num = 99 ]; then
149 printf ' --'
150 else
151 printf '%3i' $num
152 fi
153 done
154 }
155
156 testoutput_ad()
157 {
158 grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $5}' > t05.txt
159 grep $3 $1/$2/output.txt_adm | awk '{print NR " " $5}' > t15.txt
160 grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $6}' > t06.txt
161 grep $3 $1/$2/output.txt_adm | awk '{print NR " " $6}' > t16.txt
162 join t05.txt t15.txt > t5.txt
163 join t06.txt t16.txt > t6.txt
164 echo "-1" >> t5.txt
165 echo "-1" >> t6.txt
166 digits_5=`./tmp_cmpnum < t5.txt`
167 digits_6=`./tmp_cmpnum < t6.txt`
168 dashnum $digits_5 $digits_6
169 rm -f t[01][56].txt t[56].txt
170 }
171
172 testoutput()
173 {
174 # testoutput directory subdir
175 #
176 # test output in "directory"
177 if test "x$ADM" = x ; then
178 if [ $debug -gt 0 ]; then
179 echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2
180 fi
181 testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2; cg2dres=$?
182 if [ $debug -gt 0 ]; then
183 echo testoutput: cg2dres=$cg2dres 1>&2
184 fi
185 testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$?
186 testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$?
187 testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$?
188 testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2; tsd=$?
189 testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2; smin=$?
190 testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2; smax=$?
191 testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2; smean=$?
192 testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2; ssd=$?
193 testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2; umin=$?
194 testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2; umax=$?
195 testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2; umean=$?
196 testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2; usd=$?
197 testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2; vmin=$?
198 testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2; vmax=$?
199 testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2; vmean=$?
200 testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2; vsd=$?
201 dashnum $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \
202 $umin $umax $umean $usd $vmin $vmax $vmean $vsd
203 else
204 testoutput_ad $1 $2 "precision_grdchk_result"
205 fi
206 }
207
208 genmakemodel()
209 {
210 # genmakemodel directory
211 if test "x$NOGENMAKE" = xt ; then
212 echo "genmake skipped!"
213 else
214 GENMAKE2="$BASH ../../../tools/genmake2"
215 (
216 cd $1;
217 command="$GENMAKE2 -ds -m $MAKE"
218 if test "x$ADM" = x ; then
219 command="$command --mods=../code"
220 else
221 command="$command --mods=../code_ad"
222 command="$command -adof=../../../tools/adjoint_options/adjoint_staf"
223 fi
224 if test "x$OPTFILE" != xNONE ; then
225 command="$command --optfile=$OPTFILE"
226 fi
227 if test "x$IEEE" != x ; then
228 command="$command -ieee"
229 fi
230 printf 'genmake ... ' 1>&2
231 $command > make.log 2>&1
232 RETVAL=$?
233 cp Makefile $CDIR
234 if test "x$RETVAL" != x0 ; then
235 tail make.log
236 echo "genmakemodel: genmake failed" 1>&2
237 cp genmake_* make.log $CDIR
238 return 1
239 else
240 echo "successful" 1>&2
241 fi
242 )
243 fi
244 }
245
246 makeclean()
247 {
248 # makeclean directory
249 if test "x$NOCLEAN" = xt ; then
250 echo "make CLEAN skipped!"
251 else
252 (
253 cd $1;
254 if test -e output.txt ; then
255 rm -f output.txt
256 fi
257 printf 'make CLEAN ... ' 2>&1
258 if test -r Makefile ; then
259 $MAKE CLEAN >> make.log 2>&1
260 RETVAL=$?
261 if test "x$RETVAL" != x0 ; then
262 tail make.log
263 echo "makeclean: \"make CLEAN\" failed" 1>&2
264 cp make.log $CDIR"/make.log"
265 return 1
266 fi
267 fi
268 echo successful 1>&2
269 exit 0
270 )
271 fi
272 }
273
274 makedependmodel()
275 {
276 # makedependmodel directory
277 if test "x$NODEPEND" = xt ; then
278 echo "make depend skipped!"
279 else
280 (
281 cd $1;
282 printf 'make depend ... ' 1>&2
283 $MAKE depend >> make.log 2>&1
284 RETVAL=$?
285 if test "x$RETVAL" != x0 ; then
286 tail make.log
287 echo "makedependmodel: make depend failed" 1>&2
288 cp make.log $CDIR"/make.log"
289 return 1
290 else
291 echo successful 1>&2
292 fi
293 )
294 fi
295 }
296
297 makemodel()
298 {
299 # makemodel directory
300 (
301 cd $1;
302 if test -r Makefile ; then
303 printf 'make ... ' 1>&2
304 if test "x$ADM" = x ; then
305 $MAKE >> make.log 2>&1
306 else
307 $MAKE adall >> make.log 2>&1
308 fi
309 RETVAL=$?
310 if test "x$RETVAL" != x0 ; then
311 tail make.log
312 echo failed 1>&2
313 cp make.log $CDIR"/make.log"
314 return 1
315 else
316 echo successful 1>&2
317 fi
318 fi
319 )
320 }
321
322 symlink_mpifiles()
323 {
324 # Put special links so that MPI specific files are used
325 # This MUST be invoked between makeclean and makelinks because
326 # the Makefile will link to non-mpi files by default
327
328 dir=$1
329 code_dir=$2
330 BUILD_DIR=$dir/$3
331 CODE_DIR=$dir/$code_dir
332
333 # These are files that should replace their counter-part when using -mpi
334 MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi")`
335
336 # Is this an MPI run?
337 if test "x$MPI" = xt ; then
338 # YES: We symbolically link these files to the build
339 # dir so long as there is no real file in place
340 for ii in $MPI_FILES ; do
341 i=`echo $ii | sed 's:^\./::'`
342 name=`echo $i | sed 's:_mpi::' `
343 cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1
344 RETVAL=$?
345 if test "x$RETVAL" != x0 ; then
346 if ! test -f $BUILD_DIR/$i ; then
347 #echo Linking $name to $i
348 (cd $BUILD_DIR; ln -sf ../$code_dir/$i $name)
349 fi
350 fi
351 done
352 else
353 # NO: We undo any _mpi symbolically linked files
354 for ii in $MPI_FILES ; do
355 i=`echo $ii | sed 's:^\./::'`
356 name=`echo $i | sed 's:_mpi::' `
357 if test -L $BUILD_DIR/$name ; then
358 linktarg=`(cd $BUILD_DIR; readlink $name)`
359 if test $linktarg = "../$code_dir/$name"_mpi ; then
360 #echo Un-linking $name from $linktarg
361 rm -f $BUILD_DIR/$name
362 fi
363 fi
364 done
365 fi
366
367 }
368
369 linkdata()
370 {
371 # linkdata flag
372 #
373 # symbolically link data files to run directory
374 if test "x$1" = x1 ; then
375 (
376 cd $2
377 if test "x$ADM" = x ; then
378 files=`( cd ../input ; ls -1 | grep -v CVS )`
379 for i in $files ; do
380 if test ! -d "../input/"$i ; then
381 ln -sf "../input/"$i $i
382 fi
383 done
384 else
385 files=`( cd ../input ; ls -1 *.bin | grep -v CVS )`
386 for i in $files ; do
387 if test ! -d "../input/"$i ; then
388 ln -sf "../input/"$i $i
389 fi
390 done
391 files=`( cd ../input_ad ; ls -1 | grep -v CVS )`
392 for i in $files ; do
393 if test ! -d "../input_ad/"$i ; then
394 ln -sf "../input_ad/"$i $i
395 fi
396 done
397 fi
398 )
399 fi
400 }
401
402 runmodel()
403 {
404 # runmodel directory
405 #
406 # runs "$COMMAND in "directory"
407 # (where "$COMMAND" is relative to "directory")
408 (
409 cd $1
410 printf 'runmodel ... ' 1>&2
411 # make output.txt
412 $COMMAND >> run.log 2>&1
413 RETVAL=$?
414 if test "x$RETVAL" = x0 ; then
415 echo successful 1>&2
416 if test "x$ADM" = x ; then
417 cp output.txt $CDIR"/output.txt"
418 else
419 cp output.txt_adm $CDIR"/output.txt_adm"
420 fi
421 return 0
422 else
423 tail run.log
424 echo failed 1>&2
425 cp run.log $CDIR"/run.log"
426 return 1
427 fi
428 )
429 }
430
431 createcodelet()
432 {
433 # create codelet for comparing model output
434
435 echo -n "creating the comparison code... "
436 cat > tmp_cmpnum.c <<EOF
437 #include <stdio.h>
438 #include <math.h>
439 int main( int argc, char** argv ) {
440 int linnum,best,lncnt;
441 double a,b,diff;
442 best = -16;
443 lncnt = 0;
444 while( 1 & (lncnt+=1) < 999 ) {
445 scanf("%d", &linnum);
446 if (linnum == -1) break;
447 scanf("%lf", &a); scanf("%lf", &b);
448 diff = 0.5*(fabs(a)+fabs(b));
449 if (diff > 1.e-12) {
450 diff=fabs(a-b)/diff;
451 if (diff > 0.0) {
452 linnum = (int)log10(diff);
453 best = (best > linnum) ? best : linnum;
454 }
455 else {
456 if (best == -16 && diff != 0) best = -22;
457 }
458 }
459 }
460 if (lncnt == 999) best=-29;
461 printf("%d\n", -best);
462 return 0;
463 }
464 EOF
465 cc -o tmp_cmpnum tmp_cmpnum.c -lm
466
467 if [ -x ./tmp_cmpnum ]; then
468 echo "OK"
469 return 0
470 else
471 echo
472 echo "ERROR: failed to compile comparison code"
473 exit 1
474 fi
475 }
476
477 formatresults()
478 {
479 # formatresults expt genmake depend make run results*
480
481 nm=$1
482 printf '%s %s %s %s' $2 $3 $4 $5
483 shift; shift; shift; shift; shift;
484 printf '%3s' $@
485
486 if [ $1 = '--' ]; then
487 printf ' N/O '
488 else
489 if [ $1 -gt 12 ]; then
490 printf ' pass'
491 else
492 printf ' FAIL'
493 fi
494 fi
495 printf ' %s' $nm
496 printf '\n'
497
498 }
499
500 show_help()
501 {
502 cat - << EOF
503 $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]
504
505 -help|-h Show this help message
506 -quiet Reduce the amount of output
507 -verbose Produce copious amounts of output
508 -debug Produce even more output which will mean nothing to most
509 -force Do "make CLEAN" before compiling. This forces a complete rebuild.
510 -clean Do "make CLEAN" after compiling and testing.
511 -cleanup Aggresively removes all model output, executables and object files
512 and then exits. Use with care.
513
514 Normal usage:
515 $0 * Configure, compile, run and analyze in all experiment directories
516 EOF
517 }
518
519 scandirs()
520 {
521 if [ $# -eq 0 ]; then
522 for arg in * ; do
523 test -d $arg/input && echo $arg
524 done
525 else
526 echo $*
527 fi
528 }
529
530
531 ###############################################################################
532
533
534 # Default properties
535 debug=0
536 verbose=1
537 clean=0
538 expts=''
539 # ieee=1
540
541 IEEE=
542 if test "x$MITGCM_IEEE" != x ; then
543 IEEE=$MITGCM_IEEE
544 fi
545
546
547 CLEANUP=f
548 QUICK=f
549 NOGENMAKE=f
550 NOCLEAN=f
551 NODEPEND=f
552
553 BASH=
554 OPTFILE=NONE
555 ADDRESSES=
556 TESTDIRS=
557 MPACKDIR="../tools/mpack-1.6"
558 HAVE_MPACK=
559 MPACK="$MPACKDIR/mpack"
560 COMMAND=
561 MAKE=make
562 MPI=f
563
564 ADM=
565
566 echo -n "parsing options... "
567
568 ac_prev=
569 for ac_option ; do
570
571 # If the previous option needs an argument, assign it.
572 if test -n "$ac_prev"; then
573 eval "$ac_prev=\$ac_option"
574 ac_prev=
575 continue
576 fi
577
578 ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
579
580 case $ac_option in
581
582 -help | --help | -h | --h)
583 usage ;;
584
585 -optfile | --optfile | -of | --of)
586 ac_prev=OPTFILE ;;
587 -optfile=* | --optfile=* | -of=* | --of=*)
588 OPTFILE=$ac_optarg ;;
589
590 -addr | --addr | -a | --a)
591 ac_prev=ADDRESSES ;;
592 -addr=* | --addr=*)
593 ADDRESSES=$ac_optarg ;;
594
595 -tdir | --tdir | -t | --t)
596 ac_prev=TESTDIRS ;;
597 -tdir=* | --tdir=*)
598 TESTDIRS=$ac_optarg ;;
599
600 -bash | --bash | -b | --b)
601 ac_prev=BASH ;;
602 -bash=* | --bash=*)
603 BASH=$ac_optarg ;;
604
605 -command | --command | -c | --c)
606 ac_prev=COMMAND ;;
607 -command=* | --command=*)
608 COMMAND=$ac_optarg ;;
609
610 -make | --make | -m | --m)
611 ac_prev=MAKE ;;
612 -make=* | --make=*)
613 MAKE=$ac_optarg ;;
614
615 -clean | --clean)
616 CLEANUP=t ;;
617
618 -quick | --quick | -q | --q)
619 QUICK=t ;;
620 -nogenmake | --nogenmake | -ng | --ng)
621 NOGENMAKE=t ;;
622 -noclean | --noclean | -nc | --nc)
623 NOCLEAN=t ;;
624 -nodepend | --nodepend | -nd | --nd)
625 NODEPEND=t ;;
626
627 -mpi) MPI=t ;;
628
629 -adm | -ad) ADM=t ;;
630
631 -ieee) IEEE=true ;;
632 -noieee) IEEE= ;;
633
634 -verbose) verbose=2 ;;
635 -debug) debug=1 ;;
636 -quiet) verbose=0 ;;
637
638 -*)
639 echo "Error: unrecognized option: "$ac_option
640 usage
641 ;;
642
643 *)
644 echo "Error: unrecognized argument: "$ac_option
645 usage
646 ;;
647
648 esac
649
650 done
651
652 if test "x$QUICK" = xt ; then
653 NOGENMAKE=t
654 NOCLEAN=t
655 NODEPEND=t
656 fi
657
658 if test "x$TESTDIRS" = x ; then
659 TESTDIRS=`scandirs`
660 fi
661
662 if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then
663 OPTFILE=$MITGCM_OF
664 fi
665
666 if test "x$ADM" = xt -a "x$COMMAND" = x ; then
667 COMMAND="./mitgcmuv_ad > output.txt_adm 2>&1"
668 fi
669
670 if test "x$COMMAND" = x ; then
671 COMMAND="make output.txt"
672 fi
673
674 echo "OK"
675
676 # create the FORTRAN comparison code
677 createcodelet
678
679 # build the mpack utility
680 if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
681 echo "skipping mpack build"
682 else
683 build_mpack
684 fi
685
686 # Create a uniquely named directory to store results
687 MACH=`hostname`
688 UNAMEA=`uname -a`
689 DATE=`date +%Y%m%d`
690 BASE="tr_"$MACH"_"$DATE"_"
691 DNUM=0
692 DRESULTS="$BASE$DNUM"
693 while test -e $DRESULTS ; do
694 DNUM=$(( $DNUM + 1 ))
695 DRESULTS="$BASE$DNUM"
696 done
697 mkdir $DRESULTS
698 RETVAL=$?
699 if test "x$RETVAL" != x0 ; then
700 echo "ERROR: Can't create results directory \"./$DRESULTS\""
701 exit 1
702 fi
703 SUMMARY="$DRESULTS/summary.txt"
704 echo -n "Start time: " >> $SUMMARY
705 start_date=`date`
706 echo $start_date > $SUMMARY
707
708 of_path=
709 if test "x$OPTFILE" != xNONE ; then
710 if test -r $OPTFILE ; then
711 # get the path
712 path=${OPTFILE%/*}
713 if test "x$path" = x ; then
714 of_path=`pwd`
715 else
716 of_path=`( cd $path > /dev/null 2>&1 ; pwd )`
717 fi
718 file=${OPTFILE##*/}
719 OPTFILE=$of_path/$file
720 cp $OPTFILE $DRESULTS
721 echo >> $SUMMARY
722 echo " OPTFILE=$OPTFILE" >> $SUMMARY
723 else
724 echo | tee $SUMMARY
725 echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee $SUMMARY
726 exit 1
727 fi
728 else
729 echo >> $SUMMARY
730 echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY
731 echo " so the genmake default will be used." >> $SUMMARY
732 fi
733 echo
734 echo >> $SUMMARY
735 if test "x$ADM" = x ; then
736 cat << EOF | tee -a $SUMMARY
737 T S U V
738 G D M c m s m s m s m s
739 E p a R g m m e . m m e . m m e . m m e .
740 N n k u 2 i a a d i a a d i a a d i a a d
741 2 d e n d n x n . n x n . n x n . n x n .
742
743 EOF
744 else
745 echo "ADJOINT=true" >> $SUMMARY
746 echo >> $SUMMARY
747 cat << EOF | tee -a $SUMMARY
748 G D M C G
749 E p a R o r
750 N n k u s a
751 2 d e n t d
752
753 EOF
754 fi
755
756 # ...and each test directory...
757 for dir in $TESTDIRS ; do
758
759 # Cleanup only!
760 if test "x$CLEANUP" = xt ; then
761 if test -r $dir/build/Makefile ; then
762 ( cd $dir/build ; make CLEAN )
763 fi
764 if test -r $dir/input/Makefile ; then
765 ( cd $dir/input ; make CLEAN )
766 fi
767 continue
768 fi
769
770 # Verify that the testdir exists and contains previous
771 # results in the correct location--or skip this directory!
772 fout=
773 if test "x$ADM" = x ; then
774 fout=$dir"/results/output.txt"
775 else
776 fout=$dir"/results_ad/output.txt_adm"
777 fi
778 if test ! -r $fout ; then
779 echo "can't read \"$fout\" -- skipping $dir"
780 continue
781 fi
782
783 builddir="input"
784 rundir="input"
785 use_seperate_build=0
786 if test -d $dir/build -a -r $dir/build ; then
787 builddir="build"
788 rundir="build"
789 use_seperate_build=1
790 linkdata $use_seperate_build $dir/$rundir
791 fi
792
793 if test "x$ADM" = x ; then
794 code_dir=code
795 CODE_DIR=$dir/code
796 else
797 code_dir=code_ad
798 CODE_DIR=$dir/code_ad
799 fi
800 BUILD_DIR=$dir/$builddir
801
802 if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then
803 echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"
804 continue
805 fi
806
807 echo "-------------------------------------------------------------------------------"
808 echo
809 echo "Experiment: $dir"
810 echo
811 unset genmake makedepend make run
812 results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
813
814 # Create an output dir for each OPTFILE/tdir combination
815 rel_CDIR=$DRESULTS"/"$dir
816 mkdir $rel_CDIR
817 CDIR=`pwd`"/$rel_CDIR"
818
819 if test "x$CLEANUP" = xt ; then
820 makeclean $dir/$builddir
821 else
822 genmakemodel $dir/$builddir && genmake=Y \
823 && makeclean $dir/$builddir \
824 && symlink_mpifiles $dir $code_dir $builddir \
825 && makedependmodel $dir/$builddir && makedepend=Y \
826 && makemodel $dir/$builddir && make=Y \
827 && linkdata $use_seperate_build $dir/$rundir \
828 && runmodel $dir/$rundir && run=Y \
829 && results=`testoutput $dir $rundir`
830 fi
831
832 echo
833 if test "x$ADM" = x ; then
834 fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
835 else
836 fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`
837 fres=$fres"$results $dir"
838 fi
839 echo
840 echo "$fres" >> $SUMMARY
841 echo "fresults='$fres'" > $CDIR"/summary.txt"
842 echo "MACH='$MACH'" >> $CDIR"/summary.txt"
843 echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
844 echo "DATE='$DATE'" >> $CDIR"/summary.txt"
845 echo "tdir='$dir'" >> $CDIR"/summary.txt"
846
847 echo "-------------------------------------------------------------------------------"
848
849 done
850
851 echo -n "Start time: " >> $SUMMARY
852 echo $start_date >> $SUMMARY
853 echo -n "End time: " >> $SUMMARY
854 date >> $SUMMARY
855
856 # If addresses were supplied and mpack built successfully, then try
857 # to send email using mpack.
858 if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
859 echo "No results email was sent."
860 else
861 if test "x$HAVE_MPACK" = xt ; then
862 tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \
863 && gzip $DRESULTS".tar" \
864 && $MPACK -s MITgcm-test -m 1500000 $DRESULTS".tar.gz" $ADDRESSES
865 RETVAL=$?
866 if test "x$RETVAL" != x0 ; then
867 echo
868 echo "Warning: The tar, gzip, & mpack step failed. Please send email"
869 echo " to <MITgcm-support@mitgcm.org> for help. You may copy the "
870 echo " summary of results from the directory \"$DRESULTS\"."
871 echo
872 else
873 echo
874 echo "An email containing results was sent to the following addresses:"
875 echo " \"$ADDRESSES\""
876 echo
877 fi
878 test -f $DRESULTS".tar" && rm -f $DRESULTS".tar"
879 test -f $DRESULTS".tar.gz" && rm -f $DRESULTS".tar.gz"
880 fi
881 fi
882
883 # rm -f tmp_cmpnum.f a.out
884 rm -f tmp_cmpnum.c tmp_cmpnum
885
886 if test "x$CLEANUP" != xt ; then
887 cat $SUMMARY
888 if test -e tr_out.txt ; then
889 mv tr_out.txt tr_out.txt.old
890 fi
891 cat $SUMMARY > tr_out.txt
892 fi

  ViewVC Help
Powered by ViewVC 1.1.22