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

Annotation of /MITgcm/verification/testreport

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


Revision 1.20 - (hide annotations) (download)
Wed Nov 26 15:04:42 2003 UTC (20 years, 4 months ago) by edhill
Branch: MAIN
Changes since 1.19: +61 -38 lines
 o some small cleanups
 o re-work the way the emails ("-a" option) are sent -- should not change
     the way it works for anyone not using the email option

1 edhill 1.19 #! /usr/bin/env bash
2 edhill 1.1 #
3 edhill 1.20 # $Header: /u/u3/gcmpack/MITgcm/verification/testreport,v 1.19 2003/11/25 17:22:47 edhill Exp $
4 edhill 1.12 # $Name: $
5 edhill 1.1 #
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 edhill 1.7 echo " (-mpi) use MPI input files"
15 edhill 1.10 echo " (-ieee|-noieee) if possible, use IEEE compiler flags"
16 edhill 1.20 echo " (DEF=\"noieee\")"
17 edhill 1.6 echo " (-optfile=|-of=)STRING list of optfiles to use"
18 edhill 1.20 echo " (-a|-addr) STRING list of email recipients"
19 edhill 1.6 echo " (DEF=\"edhill@mitgcm.org\")"
20 edhill 1.20 echo " (-t|-tdir) STRING list of test dirs to use"
21 edhill 1.6 echo " (DEF=\"\" which builds all)"
22 edhill 1.20 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 edhill 1.6 echo " (DEF=\"make output.txt\")"
27 edhill 1.20 echo " (-m|-make) STRING command to use for \"make\""
28 edhill 1.8 echo " (DEF=\"make\")"
29 edhill 1.10 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 edhill 1.6 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 edhill 1.1 echo
40     exit 1
41     }
42    
43     # build the mpack utility
44     build_mpack()
45     {
46     echo -n "building the mpack utility... "
47     if test ! -x "$MPACKDIR/mpack" ; then
48     if test ! -d $MPACKDIR ; then
49 edhill 1.20 echo
50 edhill 1.1 echo "Error: can't find \"$MPACKDIR\""
51     echo " are you sure this program is being run in the correct "
52     echo " (that is, \"MITGCM_ROOT\verification\") directory?"
53 edhill 1.20 echo
54     HAVE_MPACK=f
55 edhill 1.1 fi
56     echo -n "building mpack... "
57 edhill 1.8 ( cd $MPACKDIR && ./configure && $MAKE ) > build_mpack.out 2>&1
58 edhill 1.1 RETVAL=$?
59     if test "x$RETVAL" != x0 ; then
60     echo
61     echo "Error building the mpack tools at: $MPACK_DIR"
62 edhill 1.20 echo
63     HAVE_MPACK=f
64     else
65     HAVE_MPACK=t
66 edhill 1.1 fi
67 edhill 1.20 else
68     HAVE_MPACK=t
69 edhill 1.1 fi
70     echo "OK"
71     }
72    
73     compare_lines()
74     {
75     # use codelet to compare lines
76     if [ $verbose -gt 1 ]; then
77     cat tmp3.txt 1>&2
78     fi
79     return `./a.out < tmp3.txt`
80     }
81    
82     testoutput_for_prop()
83     {
84     # testoutput_for_prop dir s1 label subdir
85     #
86     # compares files in $dir/$subdir/output.txt and $dir/results/output.txt
87     # using search strings s1 and text label
88    
89     if [ $debug -gt 0 ]; then
90     echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2
91     fi
92     if [ -r $1/$4/output.txt ]; then
93 edhill 1.15 grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt
94 edhill 1.1 lncnt=`wc -l tmp1.txt | awk '{print $1}' `
95     if [ $lncnt -lt 3 ]; then
96     if [ $verbose -gt 0 ]; then
97     echo Not enough lines of output when searching for "$2" 1>&2
98     fi
99     return 99
100     fi
101     else
102     echo testoutput_for_prop: output.txt from model run was not readable 1>&2
103     return 99
104     fi
105     if [ $debug -gt 0 ]; then
106     echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2
107     fi
108 edhill 1.15 grep "$2" $1/results/output.txt | sed 's/.*=//' | cat -n > tmp2.txt
109 edhill 1.1 lncnt=`wc -l tmp2.txt | awk '{print $1}' `
110     if [ $lncnt -lt 3 ]; then
111     if [ $verbose -gt 0 ]; then
112     echo Not enough lines of output when searching for "$2" 1>&2
113     fi
114     return 99
115     fi
116     if [ $debug -gt 0 ]; then
117     echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2
118     fi
119     join tmp1.txt tmp2.txt | awk '{print $1 " " $2 " " $3}' > tmp3.txt
120     if [ $debug -gt 0 ]; then
121     echo testoutput_for_prop: compare_lines 1>&2
122     fi
123     compare_lines
124     digits_of_similarity=$?
125     if [ $digits_of_similarity -eq 99 ]; then
126     if [ $verbose -gt 0 ]; then
127     echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2
128     fi
129     digits_of_similarity=99
130     else
131     if [ $verbose -gt 0 ]; then
132     echo There were $digits_of_similarity decimal places of similarity for \"$2\" 1>&2
133     fi
134     fi
135     rm tmp1.txt tmp2.txt tmp3.txt
136    
137     return $digits_of_similarity
138     }
139    
140     dashnum()
141     {
142     # dashnum n1 n2 n3 ...
143     #
144     # print numbers using %3i format or "--" if number = 99
145    
146     for num in $@ ; do
147     if [ $num = 99 ]; then
148     printf ' --'
149     else
150     printf '%3i' $num
151     fi
152     done
153     }
154    
155     testoutput()
156     {
157     # testoutput diretory subdir
158     #
159     # test output in "directory"
160    
161     if [ $debug -gt 0 ]; then
162     echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2
163     fi
164     testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2; cg2dres=$?
165     if [ $debug -gt 0 ]; then
166     echo testoutput: cg2dres=$cg2dres 1>&2
167     fi
168     testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$?
169     testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$?
170     testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$?
171     testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2; tsd=$?
172     testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2; smin=$?
173     testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2; smax=$?
174     testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2; smean=$?
175     testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2; ssd=$?
176     testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2; umin=$?
177     testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2; umax=$?
178     testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2; umean=$?
179     testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2; usd=$?
180     testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2; vmin=$?
181     testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2; vmax=$?
182     testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2; vmean=$?
183     testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2; vsd=$?
184    
185     dashnum $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \
186     $umin $umax $umean $usd $vmin $vmax $vmean $vsd
187     }
188    
189     genmakemodel()
190     {
191     # genmakemodel directory
192 edhill 1.10 if test "x$NOGENMAKE" = xt ; then
193     echo "genmake skipped!"
194     else
195     GENMAKE2="$BASH ../../../tools/genmake2"
196     (
197     cd $1;
198     command="$GENMAKE2 -ds -m $MAKE --mods=../code"
199     if test "x$OPTFILE" != xNONE ; then
200     command="$command --optfile=$OPTFILE"
201     # echo " command=\"$command\""
202     fi
203     if test "x$IEEE" != x ; then
204     command="$command -ieee"
205     fi
206     # echo "command: \"$command\""
207     printf 'genmake ... ' 1>&2
208     $command > make.log 2>&1
209     RETVAL=$?
210     for i in genmake_state genmake_optfile genmake_local Makefile ; do
211     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 edhill 1.20 echo "successful" 1>&2
222 edhill 1.1 fi
223 edhill 1.10 )
224     fi
225 edhill 1.1 }
226    
227     makeclean()
228     {
229     # makeclean directory
230 edhill 1.10 if test "x$NOCLEAN" = xt ; then
231     echo "make CLEAN skipped!"
232     else
233     (
234     cd $1;
235     if test -e output.txt ; then
236     rm -f output.txt
237     fi
238     printf 'make CLEAN ... ' 2>&1
239     if test -r Makefile ; then
240     $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 edhill 1.20 echo successful 1>&2
250 edhill 1.10 exit 0
251     )
252     fi
253     }
254    
255     makedependmodel()
256     {
257     # makedependmodel directory
258     if test "x$NODEPEND" = xt ; then
259     echo "make depend skipped!"
260     else
261     (
262     cd $1;
263     printf 'make depend ... ' 1>&2
264     $MAKE depend >> make.log 2>&1
265 edhill 1.1 RETVAL=$?
266     if test "x$RETVAL" != x0 ; then
267     tail make.log
268 edhill 1.10 echo "makedependmodel: make depend failed" 1>&2
269 edhill 1.1 cp make.log $CDIR"/make.log"
270     return 1
271 edhill 1.10 else
272 edhill 1.20 echo successful 1>&2
273 edhill 1.1 fi
274 edhill 1.10 )
275     fi
276 edhill 1.1 }
277    
278     makemodel()
279     {
280     # makemodel directory
281     (
282     cd $1;
283     if test -r Makefile ; then
284     printf 'make ... ' 1>&2
285 edhill 1.8 $MAKE >> make.log 2>&1
286 edhill 1.1 RETVAL=$?
287     if test "x$RETVAL" != x0 ; then
288     tail make.log
289     echo failed 1>&2
290     cp make.log $CDIR"/make.log"
291     return 1
292     else
293 edhill 1.20 echo successful 1>&2
294 edhill 1.1 fi
295     fi
296     )
297     }
298    
299     linkdata()
300     {
301     # linkdata flag
302     #
303     # symbolically link data files to run directory
304 edhill 1.12 if test "x$1" = x1 ; then
305     (
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 edhill 1.1 fi
315     }
316    
317     runmodel()
318     {
319 edhill 1.6 # runmodel directory
320 edhill 1.1 #
321 edhill 1.6 # runs "$COMMAND" in "directory"
322     # (where "$COMMAND" is relative to "directory")
323 edhill 1.1 (
324     cd $1
325 edhill 1.20 printf 'runmodel ... ' 1>&2
326 edhill 1.6 # make output.txt
327 edhill 1.20 $COMMAND >> run.log 2>&1
328 edhill 1.6 RETVAL=$?
329     if test "x$RETVAL" = x0 ; then
330 edhill 1.20 echo successful 1>&2
331 edhill 1.6 cp output.txt $CDIR"/output.txt"
332     return 0
333     else
334 edhill 1.20 tail run.log
335     echo failed 1>&2
336     cp run.log $CDIR"/run.log"
337 edhill 1.6 return 1
338 edhill 1.1 fi
339     )
340     }
341    
342     createcodelet()
343     {
344     # create codelet for comparing model output
345    
346     echo -n "creating the comparison code... "
347     cat > tmp_cmpnum.f <<EOFA
348     program cmpnum
349     implicit none
350     real*8 a,b,diff
351     integer linnum,best
352     best=-16
353     99 read(*,*,end=70,err=60) linnum,a,b
354     diff=0.5*(abs(a)+abs(b))
355     c print *,a,b,diff,abs(a-b)/diff
356     if (diff.gt.1.e-12) then
357     diff=abs(a-b)/diff
358     if (diff.gt.0.) then
359     c print *,int(log10(diff)),diff
360     linnum=int(log10(diff))
361     best=max(best,linnum)
362     endif
363     else
364     if (best.eq.-16.and.diff.ne.0.) best=-22
365     endif
366     goto 99
367     60 stop 'cmpnum: An error occured reading a,b'
368     70 print *,-best
369     end
370     EOFA
371    
372     f77 tmp_cmpnum.f
373     if [ -x ./a.out ]; then
374     echo "OK"
375     return 0
376     else
377     echo
378 edhill 1.3 echo "createcodelet: failed to compile codelet"
379 edhill 1.1 exit 1
380     fi
381     }
382    
383     formatresults()
384     {
385     # formatresults expt genmake depend make run results*
386    
387     nm=$1
388     printf '%s %s %s %s' $2 $3 $4 $5
389     shift; shift; shift; shift; shift;
390     printf '%3s' $@
391    
392     if [ $1 = '--' ]; then
393     printf ' N/O '
394     else
395     if [ $1 -gt 12 ]; then
396     printf ' pass'
397     else
398     printf ' FAIL'
399     fi
400     fi
401     printf ' %s' $nm
402     printf '\n'
403    
404     }
405    
406     show_help()
407     {
408     cat - << EOF
409     $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]
410 edhill 1.10
411     -help|-h Show this help message
412 edhill 1.1 -quiet Reduce the amount of output
413     -verbose Produce copious amounts of output
414     -debug Produce even more output which will mean nothing to most
415     -force Do "make CLEAN" before compiling. This forces a complete rebuild.
416     -clean Do "make CLEAN" after compiling and testing.
417     -cleanup Aggresively removes all model output, executables and object files
418     and then exits. Use with care.
419    
420     Normal usage:
421     $0 * Configure, compile, run and analyze in all experiment directories
422     EOF
423     }
424    
425     scandirs()
426     {
427     if [ $# -eq 0 ]; then
428     for arg in * ; do
429     test -d $arg/input && echo $arg
430     done
431     else
432     echo $*
433     fi
434     }
435    
436    
437     ###############################################################################
438     ###############################################################################
439     ###############################################################################
440    
441    
442     # Default properties
443     debug=0
444     verbose=1
445     clean=0
446     expts=''
447 edhill 1.6 # ieee=1
448 edhill 1.10
449     IEEE=
450     if test "x$MITGCM_IEEE" != x ; then
451     IEEE=$MITGCM_IEEE
452     fi
453    
454    
455     CLEANUP=f
456     QUICK=f
457     NOGENMAKE=f
458     NOCLEAN=f
459     NODEPEND=f
460 edhill 1.1
461 edhill 1.4 BASH=
462 edhill 1.10 OPTFILE=NONE
463     ADDRESSES=
464 edhill 1.1 TESTDIRS=
465     MPACKDIR="../tools/mpack-1.6"
466 edhill 1.20 HAVE_MPACK=
467 edhill 1.1 MPACK="$MPACKDIR/mpack"
468 edhill 1.6 COMMAND="make output.txt"
469 edhill 1.8 MAKE=make
470 edhill 1.7 MPI=f
471 edhill 1.1
472     echo -n "parsing options... "
473    
474     ac_prev=
475     for ac_option ; do
476    
477     # If the previous option needs an argument, assign it.
478     if test -n "$ac_prev"; then
479     eval "$ac_prev=\$ac_option"
480     ac_prev=
481     continue
482     fi
483    
484     ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
485    
486     case $ac_option in
487    
488     -help | --help | -h | --h)
489     usage ;;
490    
491 edhill 1.2 -optfile | --optfile | -of | --of)
492 edhill 1.10 ac_prev=OPTFILE ;;
493 edhill 1.2 -optfile=* | --optfile=* | -of=* | --of=*)
494 edhill 1.10 OPTFILE=$ac_optarg ;;
495 edhill 1.1
496     -addr | --addr | -a | --a)
497     ac_prev=ADDRESSES ;;
498     -addr=* | --addr=*)
499     ADDRESSES=$ac_optarg ;;
500    
501     -tdir | --tdir | -t | --t)
502     ac_prev=TESTDIRS ;;
503     -tdir=* | --tdir=*)
504     TESTDIRS=$ac_optarg ;;
505 edhill 1.4
506     -bash | --bash | -b | --b)
507     ac_prev=BASH ;;
508     -bash=* | --bash=*)
509     BASH=$ac_optarg ;;
510 edhill 1.5
511 edhill 1.6 -command | --command | -c | --c)
512     ac_prev=COMMAND ;;
513     -command=* | --command=*)
514     COMMAND=$ac_optarg ;;
515 edhill 1.8
516     -make | --make | -m | --m)
517     ac_prev=MAKE ;;
518     -make=* | --make=*)
519     MAKE=$ac_optarg ;;
520 edhill 1.1
521 edhill 1.10 -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 edhill 1.18 -mpi) MPI=t ;;
534 edhill 1.10
535     -ieee) IEEE=true ;;
536     -noieee) IEEE= ;;
537    
538 edhill 1.1 -verbose) verbose=2 ;;
539     -debug) debug=1 ;;
540     -quiet) verbose=0 ;;
541    
542     -*)
543     echo "Error: unrecognized option: "$ac_option
544     usage
545     ;;
546    
547     *)
548     echo "Error: unrecognized argument: "$ac_option
549     usage
550     ;;
551    
552     esac
553    
554     done
555    
556 edhill 1.10 if test "x$QUICK" = xt ; then
557     NOGENMAKE=t
558     NOCLEAN=t
559     NODEPEND=t
560     fi
561    
562 edhill 1.1 if test "x$TESTDIRS" = x ; then
563     TESTDIRS=`scandirs`
564     fi
565    
566 edhill 1.10 if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then
567     OPTFILE=$MITGCM_OF
568     fi
569    
570 edhill 1.1 echo "OK"
571    
572     # create the FORTRAN comparison code
573     createcodelet
574    
575     # build the mpack utility
576     build_mpack
577    
578     # Create a uniquely named directory to store results
579     MACH=`hostname`
580 edhill 1.2 UNAMEA=`uname -a`
581 edhill 1.1 DATE=`date +%Y%m%d`
582     BASE=$MACH"_"$DATE"_"
583     DNUM=0
584     DRESULTS="$BASE$DNUM"
585     while test -e $DRESULTS ; do
586     DNUM=$(( $DNUM + 1 ))
587     DRESULTS="$BASE$DNUM"
588     done
589     mkdir $DRESULTS
590     RETVAL=$?
591     if test "x$RETVAL" != x0 ; then
592 edhill 1.20 echo "ERROR: Can't create results directory \"./$DRESULTS\""
593 edhill 1.1 exit 1
594     fi
595     SUMMARY="$DRESULTS/summary.txt"
596 edhill 1.13 echo -n "Start time: " >> $SUMMARY
597 edhill 1.16 start_date=`date`
598 edhill 1.17 echo $start_date > $SUMMARY
599 edhill 1.20 cat << EOF | tee -a $SUMMARY
600 edhill 1.1 T S U V
601     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 .
603     N n k u 2 i a a d i a a d i a a d i a a d
604     2 d e n d n x n . n x n . n x n . n x n .
605    
606     EOF
607    
608     NDIR=0
609    
610 edhill 1.11 of_path=
611 edhill 1.10 if test "x$OPTFILE" != xNONE ; then
612     if test -r $OPTFILE ; then
613 edhill 1.11 # 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 edhill 1.10 fi
626     fi
627     echo
628     echo "OPTFILE=$OPTFILE" >> $SUMMARY
629     echo >> $SUMMARY
630 edhill 1.1
631 edhill 1.10 # ...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 edhill 1.1 fi
644 edhill 1.3
645 edhill 1.10 # Verify that the testdir exists and contains previous
646     # results in the correct location--or skip this directory!
647     if test ! -r $dir"/results/output.txt" ; then
648     echo "can't read \"$dir/results/output.txt\" -- skipping $dir"
649     continue
650     fi
651 edhill 1.7
652 edhill 1.10 echo "-------------------------------------------------------------------------------"
653     echo
654     echo "Experiment: $dir"
655     echo
656     unset genmake makedepend make run
657     results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
658 edhill 1.1
659 edhill 1.12 builddir="input"
660     rundir="input"
661     use_seperate_build=0
662     if test -d $dir/build -a -r $dir/build ; then
663     builddir="build"
664     rundir="build"
665     use_seperate_build=1
666     linkdata $use_seperate_build $dir/$rundir
667 edhill 1.10 fi
668    
669     CODE_DIR=$dir/code
670     BUILD_DIR=$dir/$builddir
671     MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi"
672     NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi"
673    
674     # Is this an MPI run?
675     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 edhill 1.2 fi
690 edhill 1.10 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 edhill 1.20 rel_CDIR=$DRESULTS"/"$dir
711     mkdir $rel_CDIR
712     CDIR=`pwd`"/$rel_CDIR"
713 edhill 1.10
714     if test "x$CLEANUP" = xt ; then
715     makeclean $dir/$builddir
716     else
717 edhill 1.1 genmakemodel $dir/$builddir && genmake=Y \
718     && makeclean $dir/$builddir \
719     && makedependmodel $dir/$builddir && makedepend=Y \
720     && makemodel $dir/$builddir && make=Y \
721 edhill 1.12 && linkdata $use_seperate_build $dir/$rundir \
722     && runmodel $dir/$rundir && run=Y \
723 edhill 1.1 && results=`testoutput $dir $rundir`
724 edhill 1.10 fi
725    
726     echo
727     formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \
728     ${run:-N} $results
729     echo
730     formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \
731     ${run:-N} $results >> $SUMMARY
732     echo "fresults='" > $CDIR"/summary.txt"
733     formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \
734     ${run:-N} $results >> $CDIR"/summary.txt"
735     echo "'" >> $CDIR"/summary.txt"
736     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 edhill 1.1 done
746    
747 edhill 1.13 echo -n "Start time: " >> $SUMMARY
748 edhill 1.16 echo $start_date >> $SUMMARY
749 edhill 1.13 echo -n "End time: " >> $SUMMARY
750     date >> $SUMMARY
751 edhill 1.20
752     # If addresses were supplied and mpack built successfully, then try
753     # to send email using mpack.
754     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 edhill 1.13
779 edhill 1.17 rm tmp_cmpnum.f a.out
780 edhill 1.1
781 edhill 1.12 if test "x$CLEANUP" != xt ; then
782     cat $SUMMARY
783 edhill 1.14 if test -e tr.out ; then
784     mv tr.out tr.out.old
785     fi
786     cat $SUMMARY > tr.out
787 edhill 1.12 fi
788 edhill 1.1

  ViewVC Help
Powered by ViewVC 1.1.22