/[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.23 - (hide annotations) (download)
Sat Nov 29 01:45:25 2003 UTC (20 years, 4 months ago) by edhill
Branch: MAIN
Changes since 1.22: +5 -12 lines
 o fix for the SGI O3K:
   - On the SGI O3K, and *not* the O2K (or *ANY* other system we use for
     that matter), "cat -n" adds a ":" immediately following each line
     number.  <sarcasm> What a nice touch!  Thank you, SGI. </sarcasm>

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

  ViewVC Help
Powered by ViewVC 1.1.22