/[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.25 - (show annotations) (download)
Thu Dec 4 16:36:18 2003 UTC (20 years, 3 months ago) by edhill
Branch: MAIN
Changes since 1.24: +7 -6 lines
 o remove most of the testtreport files from cvs attention

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

  ViewVC Help
Powered by ViewVC 1.1.22