/[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.83 - (hide annotations) (download)
Wed Jul 5 22:39:57 2006 UTC (17 years, 8 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint58k_post
Changes since 1.82: +130 -94 lines
modified version of testreport:
 - always build in dir. build (if not there, mkdir build instead
    of building in input)
 - run in dir run (if it exists), in build otherwise.
 - call prepare_run (if input/prepare_run exists)
 - run multi-threaded test (with new option "-mth") if file input/eedata.mth exists.
 - added some debug print

1 edhill 1.19 #! /usr/bin/env bash
2 edhill 1.1 #
3 jmc 1.83 # $Header: /u/gcmpack/MITgcm/verification/testreport,v 1.82 2006/06/18 21:20:51 jmc 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 jmc 1.83 echo " (-mth) run multi threaded (using eedata.mth)"
15     echo " (-mpi) compile and run using MPI"
16 edhill 1.10 echo " (-ieee|-noieee) if possible, use IEEE compiler flags"
17 edhill 1.41 echo " (DEF=\"-ieee\")"
18 edhill 1.6 echo " (-optfile=|-of=)STRING list of optfiles to use"
19 edhill 1.20 echo " (-a|-addr) STRING list of email recipients"
20 edhill 1.6 echo " (DEF=\"edhill@mitgcm.org\")"
21 edhill 1.20 echo " (-t|-tdir) STRING list of test dirs to use"
22 edhill 1.6 echo " (DEF=\"\" which builds all)"
23 edhill 1.20 echo " (-b|-bash) STRING preferred location of a \"bash\" or"
24     echo " Bourne-compatible \"sh\" shell"
25     echo " (DEF=\"\" for \"bash\")"
26 edhill 1.24 echo " (-adm|-ad) perform an adjoint run"
27 edhill 1.20 echo " (-command) STRING command to run"
28 edhill 1.6 echo " (DEF=\"make output.txt\")"
29 edhill 1.20 echo " (-m|-make) STRING command to use for \"make\""
30 edhill 1.8 echo " (DEF=\"make\")"
31 jmc 1.70 echo " (-odir) STRING used to build output directory name"
32     echo " (DEF=\"hostname\")"
33 edhill 1.50 echo " (-ptracers|-ptr) STRING specify which ptracers to test"
34     echo " (DEF=\"1 2 3 4 5\")"
35 edhill 1.43 echo " (-j) JOBS use \"make -j JOBS\" for parallel builds"
36 edhill 1.10 echo " (-clean) *ONLY* run \"make CLEAN\""
37     echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\""
38     echo " (-nogenmake|-ng) skip the genmake stage"
39     echo " (-noclean|-nc) skip the \"make clean\" stage"
40     echo " (-nodepend|-nd) skip the \"make depend\" stage"
41 edhill 1.40 echo " (-deldir|-dd) on success, delete the output directory"
42 edhill 1.6 echo
43 edhill 1.50 echo "and where STRING can be a whitespace-delimited list"
44 edhill 1.6 echo "such as:"
45 edhill 1.50 echo
46 edhill 1.6 echo " -t 'exp0 exp2 exp3' "
47     echo " -addr='abc@123.com testing@home.org'"
48 edhill 1.1 echo
49 edhill 1.50 echo "provided that the expression is properly quoted within the current"
50     echo "shell (note the use of single quotes to protect white space)."
51     echo
52 edhill 1.1 exit 1
53     }
54    
55     # build the mpack utility
56     build_mpack()
57     {
58 edhill 1.34 printf "building the mpack utility... "
59 edhill 1.1 if test ! -x "$MPACKDIR/mpack" ; then
60     if test ! -d $MPACKDIR ; then
61 edhill 1.20 echo
62 edhill 1.1 echo "Error: can't find \"$MPACKDIR\""
63     echo " are you sure this program is being run in the correct "
64     echo " (that is, \"MITGCM_ROOT\verification\") directory?"
65 edhill 1.20 echo
66     HAVE_MPACK=f
67 edhill 1.1 fi
68 edhill 1.34 printf "building mpack... "
69 edhill 1.26 if test "x$CC" = x ; then
70     export CC=cc
71     fi
72 edhill 1.25 ( cd $MPACKDIR && ./configure && $MAKE ) > tr_build_mpack.out 2>&1
73 edhill 1.1 RETVAL=$?
74     if test "x$RETVAL" != x0 ; then
75     echo
76     echo "Error building the mpack tools at: $MPACK_DIR"
77 edhill 1.20 echo
78     HAVE_MPACK=f
79     else
80 edhill 1.25 rm -f tr_build_mpack.out
81 edhill 1.20 HAVE_MPACK=t
82 edhill 1.1 fi
83 edhill 1.20 else
84     HAVE_MPACK=t
85 edhill 1.1 fi
86     echo "OK"
87     }
88    
89     testoutput_for_prop()
90     {
91 edhill 1.34 # testoutput_for_prop dir s1 label subdir extension
92 edhill 1.1 #
93     # compares files in $dir/$subdir/output.txt and $dir/results/output.txt
94     # using search strings s1 and text label
95    
96     if [ $debug -gt 0 ]; then
97     echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2
98     fi
99     if [ -r $1/$4/output.txt ]; then
100 edhill 1.15 grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt
101 jmc 1.67 lncntA=`wc -l tmp1.txt | awk '{print $1}' `
102     if [ $lncntA -lt 3 ]; then
103 edhill 1.1 if [ $verbose -gt 0 ]; then
104     echo Not enough lines of output when searching for "$2" 1>&2
105     fi
106     return 99
107     fi
108     else
109     echo testoutput_for_prop: output.txt from model run was not readable 1>&2
110     return 99
111     fi
112     if [ $debug -gt 0 ]; then
113 edhill 1.34 echo testoutput_for_prop: grep "$2" $1/results/output.txt$5 1>&2
114 edhill 1.1 fi
115 edhill 1.34 grep "$2" $1/results/output.txt$5 | sed 's/.*=//' | cat -n > tmp2.txt
116 jmc 1.67 lncntB=`wc -l tmp2.txt | awk '{print $1}' `
117     if [ $lncntB -lt 3 ]; then
118 edhill 1.1 if [ $verbose -gt 0 ]; then
119     echo Not enough lines of output when searching for "$2" 1>&2
120     fi
121     return 99
122     fi
123 jmc 1.67 if [ $lncntA -ne $lncntB ]; then
124     if [ $verbose -gt 0 ]; then
125     echo Not same Nb of lines when searching for "$2" ":" $lncntA $lncntB 1>&2
126     fi
127     return 99
128     fi
129 edhill 1.72 has_nan=`cat tmp1.txt | grep -i nan | wc -l`
130     if [ $has_nan -gt 0 ] ; then
131     echo testoutput_for_prop: output.txt contains $has_nan NaN values 1>&2
132     return 99
133     fi
134     has_inf=`cat tmp1.txt | grep -i inf | wc -l`
135     if [ $has_inf -gt 0 ] ; then
136     echo testoutput_for_prop: output.txt contains $has_inf Inf values 1>&2
137 jmc 1.71 return 99
138     fi
139 edhill 1.1 if [ $debug -gt 0 ]; then
140     echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2
141     fi
142     join tmp1.txt tmp2.txt | awk '{print $1 " " $2 " " $3}' > tmp3.txt
143     if [ $debug -gt 0 ]; then
144     echo testoutput_for_prop: compare_lines 1>&2
145     fi
146 edhill 1.22 if [ $verbose -gt 1 ]; then
147     cat tmp3.txt 1>&2
148     fi
149     echo "-1" >> tmp3.txt
150 edhill 1.23 # On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number
151     cat tmp3.txt | sed -e 's|:||g' > tmp4.txt
152     digits_of_similarity=`./tmp_cmpnum < tmp4.txt`
153 edhill 1.1 if [ $digits_of_similarity -eq 99 ]; then
154     if [ $verbose -gt 0 ]; then
155     echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2
156     fi
157     digits_of_similarity=99
158     else
159     if [ $verbose -gt 0 ]; then
160     echo There were $digits_of_similarity decimal places of similarity for \"$2\" 1>&2
161     fi
162     fi
163 edhill 1.23 rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt
164 edhill 1.1
165     return $digits_of_similarity
166     }
167    
168     dashnum()
169     {
170     # dashnum n1 n2 n3 ...
171     #
172     # print numbers using %3i format or "--" if number = 99
173    
174     for num in $@ ; do
175     if [ $num = 99 ]; then
176     printf ' --'
177     else
178     printf '%3i' $num
179     fi
180     done
181     }
182    
183 edhill 1.24 testoutput_ad()
184     {
185 jmc 1.78 grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $5}' > t05.txt
186     grep $3 $1/$2/output_adm.txt | awk '{print NR " " $5}' > t15.txt
187     grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $6}' > t06.txt
188     grep $3 $1/$2/output_adm.txt | awk '{print NR " " $6}' > t16.txt
189 edhill 1.24 join t05.txt t15.txt > t5.txt
190     join t06.txt t16.txt > t6.txt
191     echo "-1" >> t5.txt
192     echo "-1" >> t6.txt
193     digits_5=`./tmp_cmpnum < t5.txt`
194     digits_6=`./tmp_cmpnum < t6.txt`
195     dashnum $digits_5 $digits_6
196     rm -f t[01][56].txt t[56].txt
197     }
198    
199 edhill 1.49 check_for_add_mon_output()
200     {
201     # Check for additional types of monitor output
202     if test "x$1" = x ; then
203     return
204     fi
205    
206 edhill 1.50 for ii in $PTRACERS_NUM ; do
207     eval "HAVE_PTR0"$ii"=f"
208     done
209    
210 edhill 1.49 ptr_add="trcstat_ptracerXX_min trcstat_ptracerXX_max"
211     ptr_add="$ptr_add trcstat_ptracerXX_mean trcstat_ptracerXX_sd"
212 edhill 1.50 for ii in $PTRACERS_NUM ; do
213 edhill 1.49 for jj in $ptr_add ; do
214     name=`eval "echo $jj | sed -e 's|XX|0"$ii"|g'"`
215     tst=`grep $name $1 | wc -l | awk '{print $1}'`
216     if test ! "x$tst" = x0 ; then
217     eval "HAVE_PTR0"$ii"=t"
218     fi
219     done
220     # eval 'echo "HAVE_PTR0'$ii' = $HAVE_PTR0'$ii'"'
221     done
222     }
223    
224 edhill 1.1 testoutput()
225     {
226 edhill 1.34 # testoutput directory subdir extension
227 edhill 1.1 #
228     # test output in "directory"
229 edhill 1.24 if test "x$ADM" = x ; then
230     if [ $debug -gt 0 ]; then
231     echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2
232     fi
233 edhill 1.34 testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2 $3; cg2dres=$?
234 edhill 1.24 if [ $debug -gt 0 ]; then
235     echo testoutput: cg2dres=$cg2dres 1>&2
236     fi
237 edhill 1.34 testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2 $3; tmin=$?
238     testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2 $3; tmax=$?
239     testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2 $3; tmean=$?
240     testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2 $3; tsd=$?
241     testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2 $3; smin=$?
242     testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2 $3; smax=$?
243     testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2 $3; smean=$?
244     testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2 $3; ssd=$?
245     testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2 $3; umin=$?
246     testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2 $3; umax=$?
247     testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2 $3; umean=$?
248     testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2 $3; usd=$?
249     testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2 $3; vmin=$?
250     testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2 $3; vmax=$?
251     testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2 $3; vmean=$?
252     testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2 $3; vsd=$?
253 edhill 1.49
254 edhill 1.50 # This is for PTRACERS
255     for ii in $PTRACERS_NUM ; do
256     eval `echo "p0"$ii"_min=99"`
257     eval `echo "p0"$ii"_max=99"`
258     eval `echo "p0"$ii"_mean=99"`
259     eval `echo "p0"$ii"_sd=99"`
260     tst=`eval 'echo "$HAVE_PTR0'$ii'"'`
261     #echo 'tst = '$tst
262     if test "x$tst" = xt ; then
263     a="trcstat_ptracer0"
264     testoutput_for_prop $1 "$a"$ii"_min" "p0"$ii"_min" $2 $3
265     RETVAL=$? ; eval `echo "p0"$ii"_min="$RETVAL`
266     testoutput_for_prop $1 "$a"$ii"_max" "p0"$ii"_max" $2 $3
267     RETVAL=$? ; eval `echo "p0"$ii"_max="$RETVAL`
268     testoutput_for_prop $1 "$a"$ii"_mean" "p0"$ii"_mean" $2 $3
269     RETVAL=$? ; eval `echo "p0"$ii"_mean="$RETVAL`
270     testoutput_for_prop $1 "$a"$ii"_sd" "p0"$ii"_sd" $2 $3
271     RETVAL=$? ; eval `echo "p0"$ii"_sd="$RETVAL`
272     fi
273 edhill 1.49 done
274    
275     allargs="$cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd"
276     allargs="$allargs $umin $umax $umean $usd $vmin $vmax $vmean $vsd"
277     allargs="$allargs $p01_min $p01_max $p01_mean $p01_sd"
278     allargs="$allargs $p02_min $p02_max $p02_mean $p02_sd"
279     allargs="$allargs $p03_min $p03_max $p03_mean $p03_sd"
280     allargs="$allargs $p04_min $p04_max $p04_mean $p04_sd"
281     allargs="$allargs $p05_min $p05_max $p05_mean $p05_sd"
282    
283     eval "dashnum $allargs"
284    
285 edhill 1.24 else
286     testoutput_ad $1 $2 "precision_grdchk_result"
287 edhill 1.1 fi
288     }
289    
290     genmakemodel()
291     {
292     # genmakemodel directory
293 edhill 1.10 if test "x$NOGENMAKE" = xt ; then
294     echo "genmake skipped!"
295     else
296 edhill 1.34 if test "x$BASH" = x ; then
297     GENMAKE2="../../../tools/genmake2"
298     else
299     GENMAKE2="$BASH ../../../tools/genmake2 -bash $BASH"
300     fi
301 edhill 1.10 (
302     cd $1;
303 edhill 1.24 command="$GENMAKE2 -ds -m $MAKE"
304     if test "x$ADM" = x ; then
305     command="$command --mods=../code"
306     else
307     command="$command --mods=../code_ad"
308     fi
309 edhill 1.10 if test "x$OPTFILE" != xNONE ; then
310     command="$command --optfile=$OPTFILE"
311     fi
312     if test "x$IEEE" != x ; then
313     command="$command -ieee"
314     fi
315 edhill 1.66 if test "x$MPI" = xt ; then
316     command="$command -mpi"
317     fi
318 edhill 1.10 printf 'genmake ... ' 1>&2
319     $command > make.log 2>&1
320     RETVAL=$?
321 edhill 1.44 # Reduce the size of the testing emails!
322 edhill 1.47 head -100 Makefile > $CDIR/Makefile_head
323 edhill 1.10 if test "x$RETVAL" != x0 ; then
324     tail make.log
325     echo "genmakemodel: genmake failed" 1>&2
326 edhill 1.21 cp genmake_* make.log $CDIR
327 edhill 1.10 return 1
328     else
329 edhill 1.20 echo "successful" 1>&2
330 edhill 1.1 fi
331 edhill 1.10 )
332     fi
333 edhill 1.1 }
334    
335     makeclean()
336     {
337     # makeclean directory
338 edhill 1.10 if test "x$NOCLEAN" = xt ; then
339 jmc 1.83 echo "make Clean skipped!"
340 edhill 1.10 else
341     (
342     cd $1;
343 jmc 1.83 #if test -e output.txt ; then rm -f output.txt ; fi
344 edhill 1.10 if test -r Makefile ; then
345 jmc 1.83 printf 'clean build-dir: make Clean ... ' 2>&1
346     $MAKE Clean >> make.log 2>&1
347 edhill 1.10 RETVAL=$?
348     if test "x$RETVAL" != x0 ; then
349     tail make.log
350 jmc 1.83 echo "makeclean: \"make Clean\" failed" 1>&2
351 edhill 1.10 cp make.log $CDIR"/make.log"
352     return 1
353     fi
354     fi
355 edhill 1.20 echo successful 1>&2
356 edhill 1.10 exit 0
357     )
358     fi
359     }
360    
361 jmc 1.83 run_clean()
362 edhill 1.68 {
363 jmc 1.83 # run_clean directory
364     if test "x$NOCLEAN" = xt ; then
365     echo "run_clean skipped!"
366     else
367 edhill 1.68 (
368     cd $1;
369 jmc 1.83 printf 'clean run-dir ... ' 2>&1
370     # part of what is done after "make clean" when doing "make CLEAN"
371     find . -name "*.meta" -exec rm {} \;
372     find . -name "*.data" -exec rm {} \;
373     find . -name "fort.*" -exec rm {} \;
374     find . -type l -exec rm {} \;
375     rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime
376     rm -rf mnc_test_*
377     echo successful 1>&2
378 edhill 1.68 exit 0
379     )
380     fi
381     }
382    
383 edhill 1.10 makedependmodel()
384     {
385     # makedependmodel directory
386     if test "x$NODEPEND" = xt ; then
387     echo "make depend skipped!"
388     else
389     (
390     cd $1;
391     printf 'make depend ... ' 1>&2
392     $MAKE depend >> make.log 2>&1
393 edhill 1.1 RETVAL=$?
394     if test "x$RETVAL" != x0 ; then
395     tail make.log
396 edhill 1.10 echo "makedependmodel: make depend failed" 1>&2
397 edhill 1.1 cp make.log $CDIR"/make.log"
398     return 1
399 edhill 1.10 else
400 edhill 1.20 echo successful 1>&2
401 edhill 1.1 fi
402 edhill 1.10 )
403     fi
404 edhill 1.1 }
405    
406     makemodel()
407     {
408     # makemodel directory
409     (
410     cd $1;
411     if test -r Makefile ; then
412     printf 'make ... ' 1>&2
413 edhill 1.24 if test "x$ADM" = x ; then
414 edhill 1.43 if test "x$JOBS" = x ; then
415     $MAKE >> make.log 2>&1
416     else
417     $MAKE -j $JOBS >> make.log 2>&1
418     fi
419 edhill 1.24 else
420     $MAKE adall >> make.log 2>&1
421     fi
422 edhill 1.1 RETVAL=$?
423     if test "x$RETVAL" != x0 ; then
424     tail make.log
425     echo failed 1>&2
426     cp make.log $CDIR"/make.log"
427     return 1
428     else
429 edhill 1.20 echo successful 1>&2
430 edhill 1.1 fi
431     fi
432     )
433     }
434    
435 edhill 1.27 symlink_mpifiles()
436     {
437     # Put special links so that MPI specific files are used
438     # This MUST be invoked between makeclean and makelinks because
439     # the Makefile will link to non-mpi files by default
440    
441     dir=$1
442     code_dir=$2
443     BUILD_DIR=$dir/$3
444     CODE_DIR=$dir/$code_dir
445 edhill 1.45
446 edhill 1.27 # These are files that should replace their counter-part when using -mpi
447     MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi")`
448    
449     # Is this an MPI run?
450     if test "x$MPI" = xt ; then
451     # YES: We symbolically link these files to the build
452     # dir so long as there is no real file in place
453     for ii in $MPI_FILES ; do
454     i=`echo $ii | sed 's:^\./::'`
455     name=`echo $i | sed 's:_mpi::' `
456     cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1
457     RETVAL=$?
458     if test "x$RETVAL" != x0 ; then
459     if ! test -f $BUILD_DIR/$i ; then
460 edhill 1.45 #echo Linking $name to $i
461 edhill 1.27 (cd $BUILD_DIR; ln -sf ../$code_dir/$i $name)
462     fi
463     fi
464     done
465     else
466 edhill 1.45 # NO: We undo any _mpi symbolically linked files
467 edhill 1.27 for ii in $MPI_FILES ; do
468     i=`echo $ii | sed 's:^\./::'`
469     name=`echo $i | sed 's:_mpi::' `
470     if test -L $BUILD_DIR/$name ; then
471 edhill 1.45 cmp $BUILD_DIR/$name "../$code_dir/$name"_mpi > /dev/null 2>&1
472     RETVAL=$?
473     if test "x$RETVAL" = x0 ; then
474     #echo Un-linking $name from $linktarg
475 edhill 1.27 rm -f $BUILD_DIR/$name
476     fi
477     fi
478     done
479     fi
480    
481     }
482    
483 edhill 1.1 linkdata()
484     {
485 jmc 1.83 # linkdata run_dir input_dir_1 input_dir_2 ...
486 edhill 1.1 #
487     # symbolically link data files to run directory
488 jmc 1.83 if test -d $1 ; then
489 edhill 1.12 (
490 jmc 1.83 cd $1 ; shift
491     if test -r "../"$1"/eedata.mth" ; then
492     # found eedata.mth in 1rst input dir and it is readable
493     if test "x$MULTI_THREAD" = "xt" ; then
494     # multi-threaded test: remove symbolic link & link eedata.mth
495     if test -h eedata ; then rm -f eedata ; fi
496     if test ! -r eedata ; then
497     ln -sf "../"$1"/eedata.mth" eedata ;
498     printf 'eedata.mth ' 1>&2
499 edhill 1.24 fi
500 jmc 1.83 else
501     # not multi-threaded test: remove eedata symbolic link
502     if test -h eedata ; then rm -f eedata ; fi
503     fi
504     fi
505     for ldir in $* ; do
506     if test -d "../"$ldir ; then
507     printf 'ldir='${ldir} 1>&2
508     files=`( cd "../"$ldir ; ls -1 | grep -v CVS )`
509     for i in $files ; do
510     if test ! -d "../"$ldir/$i ; then
511     if test ! -r $i ; then
512     printf ' '$i 1>&2
513     ln -sf "../"$ldir"/"$i $i
514     fi
515     fi
516     done
517     if test -x "../"$ldir"/"prepare_run ; then
518     "../"$ldir"/"prepare_run
519 edhill 1.24 fi
520 jmc 1.83 printf ' ; ' 1>&2
521 jmc 1.82 fi
522 jmc 1.83 done
523 edhill 1.12 )
524 edhill 1.1 fi
525     }
526    
527     runmodel()
528     {
529 edhill 1.6 # runmodel directory
530 edhill 1.1 #
531 edhill 1.24 # runs "$COMMAND in "directory"
532 edhill 1.6 # (where "$COMMAND" is relative to "directory")
533 edhill 1.1 (
534     cd $1
535 jmc 1.75 printf 'runmodel in %s ...' $1 1>&2
536 edhill 1.6 # make output.txt
537 edhill 1.38 echo
538 jmc 1.46 rm -f run.log
539 jmc 1.83 if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then
540     echo " link" $EXECUTABLE "from dir ../"$builddir > run.log
541     ln -sf "../"$builddir"/"$EXECUTABLE .
542     else
543     touch run.log
544     fi
545     if test ! -x $EXECUTABLE ; then
546     echo " no executable:" $EXECUTABLE >> run.log
547     RETVAL=8
548 jmc 1.75 else
549 jmc 1.83 if test $OUTPUTFILE -ot $EXECUTABLE ; then
550     ( eval $COMMAND ) >> run.log 2>&1
551     RETVAL=$?
552     else
553     echo " $OUTPUTFILE is up to date " >> run.log 2>&1
554     RETVAL=0
555     fi
556 jmc 1.75 fi
557 edhill 1.39 # echo "COMMAND='$COMMAND'"
558     # echo "pwd='"`pwd`"'"
559 edhill 1.6 if test "x$RETVAL" = x0 ; then
560 jmc 1.46 tail run.log
561 edhill 1.20 echo successful 1>&2
562 edhill 1.44 # === Reduce the size of the testing emails!
563     # if test "x$ADM" = x ; then
564     # cp output.txt $CDIR"/output.txt"
565     # else
566 jmc 1.78 # cp output_adm.txt $CDIR"/output_adm.txt"
567 edhill 1.44 # fi
568 jmc 1.48 if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
569 edhill 1.6 return 0
570     else
571 edhill 1.20 tail run.log
572     echo failed 1>&2
573     cp run.log $CDIR"/run.log"
574 jmc 1.48 if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
575 edhill 1.6 return 1
576 edhill 1.1 fi
577     )
578     }
579    
580     createcodelet()
581     {
582     # create codelet for comparing model output
583    
584 edhill 1.34 printf "creating the comparison code... "
585 edhill 1.22 cat > tmp_cmpnum.c <<EOF
586     #include <stdio.h>
587     #include <math.h>
588     int main( int argc, char** argv ) {
589 adcroft 1.33 int linnum,best,lncnt;
590 edhill 1.52 double a,b,abave,relerr;
591 jmc 1.57 best = -22;
592 adcroft 1.33 lncnt = 0;
593     while( 1 & (lncnt+=1) < 999 ) {
594 edhill 1.22 scanf("%d", &linnum);
595     if (linnum == -1) break;
596     scanf("%lf", &a); scanf("%lf", &b);
597 edhill 1.52 abave = 0.5*(fabs(a)+fabs(b));
598     if (abave > 0.0) {
599     relerr=fabs(a-b)/abave;
600 edhill 1.64 if (relerr > 0.0) { linnum = (int)rint(log10(relerr)); }
601 jmc 1.57 else { linnum = -16 ; }
602     best = (best > linnum) ? best : linnum;
603 edhill 1.22 }
604     }
605 adcroft 1.33 if (lncnt == 999) best=-29;
606 edhill 1.22 printf("%d\n", -best);
607     return 0;
608     }
609     EOF
610 edhill 1.58 $CC -o tmp_cmpnum tmp_cmpnum.c -lm
611 edhill 1.1
612 edhill 1.22 if [ -x ./tmp_cmpnum ]; then
613 edhill 1.1 echo "OK"
614     return 0
615     else
616     echo
617 edhill 1.58 echo "ERROR: failed to compile comparison code -- please specify"
618     echo " a C compiler using the CC environment variable."
619 edhill 1.1 exit 1
620     fi
621     }
622    
623     formatresults()
624     {
625     # formatresults expt genmake depend make run results*
626    
627     nm=$1
628     printf '%s %s %s %s' $2 $3 $4 $5
629     shift; shift; shift; shift; shift;
630     printf '%3s' $@
631    
632     if [ $1 = '--' ]; then
633     printf ' N/O '
634     else
635     if [ $1 -gt 12 ]; then
636     printf ' pass'
637     else
638     printf ' FAIL'
639     fi
640     fi
641     printf ' %s' $nm
642     printf '\n'
643    
644     }
645    
646     show_help()
647     {
648     cat - << EOF
649     $0 [-help] [-quick] [-verbose] dir1 [dir2] [...]
650 edhill 1.10
651     -help|-h Show this help message
652 edhill 1.1 -quiet Reduce the amount of output
653     -verbose Produce copious amounts of output
654     -debug Produce even more output which will mean nothing to most
655     -force Do "make CLEAN" before compiling. This forces a complete rebuild.
656     -clean Do "make CLEAN" after compiling and testing.
657     -cleanup Aggresively removes all model output, executables and object files
658     and then exits. Use with care.
659    
660     Normal usage:
661     $0 * Configure, compile, run and analyze in all experiment directories
662     EOF
663     }
664    
665     scandirs()
666     {
667 jmc 1.81 if [ $# -eq 1 ]; then
668     for arg in * ; do
669     test -d $arg/$1 && echo $arg
670     done
671 edhill 1.1 else
672 jmc 1.81 echo $*
673 edhill 1.1 fi
674     }
675    
676    
677     ###############################################################################
678    
679    
680     # Default properties
681     debug=0
682     verbose=1
683     clean=0
684     expts=''
685 edhill 1.6 # ieee=1
686 edhill 1.10
687 edhill 1.40 IEEE=true
688 edhill 1.10 if test "x$MITGCM_IEEE" != x ; then
689     IEEE=$MITGCM_IEEE
690     fi
691    
692    
693     CLEANUP=f
694     QUICK=f
695     NOGENMAKE=f
696     NOCLEAN=f
697     NODEPEND=f
698 edhill 1.68 POSTCLEAN=f
699 edhill 1.1
700 edhill 1.4 BASH=
701 edhill 1.10 OPTFILE=NONE
702     ADDRESSES=
703 edhill 1.1 TESTDIRS=
704     MPACKDIR="../tools/mpack-1.6"
705 edhill 1.20 HAVE_MPACK=
706 edhill 1.1 MPACK="$MPACKDIR/mpack"
707 edhill 1.24 COMMAND=
708 edhill 1.59 if test "x$MAKE" = x ; then
709     MAKE=make
710     fi
711     if test "x$CC" = x ; then
712     CC=cc
713     fi
714 edhill 1.43 JOBS=
715 edhill 1.7 MPI=f
716 jmc 1.83 MULTI_THREAD=f
717 jmc 1.70 OUTDIR=
718 edhill 1.40 DELDIR=
719 edhill 1.1
720 edhill 1.24 ADM=
721    
722 edhill 1.49 # Additional monitor types
723 edhill 1.50 PTRACERS_NUM="1 2 3 4 5"
724 edhill 1.49
725 edhill 1.34 printf "parsing options... "
726 edhill 1.1
727     ac_prev=
728     for ac_option ; do
729    
730     # If the previous option needs an argument, assign it.
731     if test -n "$ac_prev"; then
732     eval "$ac_prev=\$ac_option"
733     ac_prev=
734     continue
735     fi
736    
737     ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
738    
739     case $ac_option in
740    
741     -help | --help | -h | --h)
742     usage ;;
743    
744 edhill 1.2 -optfile | --optfile | -of | --of)
745 edhill 1.10 ac_prev=OPTFILE ;;
746 edhill 1.2 -optfile=* | --optfile=* | -of=* | --of=*)
747 edhill 1.10 OPTFILE=$ac_optarg ;;
748 edhill 1.1
749     -addr | --addr | -a | --a)
750     ac_prev=ADDRESSES ;;
751     -addr=* | --addr=*)
752     ADDRESSES=$ac_optarg ;;
753    
754     -tdir | --tdir | -t | --t)
755     ac_prev=TESTDIRS ;;
756     -tdir=* | --tdir=*)
757     TESTDIRS=$ac_optarg ;;
758 edhill 1.4
759     -bash | --bash | -b | --b)
760     ac_prev=BASH ;;
761     -bash=* | --bash=*)
762     BASH=$ac_optarg ;;
763 edhill 1.5
764 edhill 1.6 -command | --command | -c | --c)
765     ac_prev=COMMAND ;;
766     -command=* | --command=*)
767     COMMAND=$ac_optarg ;;
768 edhill 1.8
769     -make | --make | -m | --m)
770     ac_prev=MAKE ;;
771     -make=* | --make=*)
772     MAKE=$ac_optarg ;;
773 edhill 1.1
774 jmc 1.70 -odir | --odir)
775     ac_prev=OUTDIR ;;
776     -odir=* | --odir=*)
777     OUTDIR=$ac_optarg ;;
778    
779 edhill 1.50 -ptracers | --ptracers | -ptr | --ptr)
780     ac_prev=PTRACERS_NUM ;;
781     -ptracers=* | --ptracers=* | -ptr=* | --ptr=*)
782     PTRACERS_NUM=$ac_optarg ;;
783    
784 edhill 1.43 -j) ac_prev=JOBS ;;
785     -j=*) JOBS=$ac_optarg ;;
786    
787 edhill 1.10 -clean | --clean)
788 jmc 1.69 CLEANUP=t ; DELDIR=t ;;
789 edhill 1.10
790     -quick | --quick | -q | --q)
791     QUICK=t ;;
792     -nogenmake | --nogenmake | -ng | --ng)
793     NOGENMAKE=t ;;
794     -noclean | --noclean | -nc | --nc)
795     NOCLEAN=t ;;
796     -nodepend | --nodepend | -nd | --nd)
797     NODEPEND=t ;;
798    
799 edhill 1.68 -postclean | --postclean | -pc | --pc)
800     POSTCLEAN=t ;;
801    
802 edhill 1.18 -mpi) MPI=t ;;
803 edhill 1.10
804 jmc 1.83 -mth) MULTI_THREAD=t ;;
805    
806 edhill 1.24 -adm | -ad) ADM=t ;;
807    
808 edhill 1.10 -ieee) IEEE=true ;;
809     -noieee) IEEE= ;;
810    
811 edhill 1.1 -verbose) verbose=2 ;;
812     -debug) debug=1 ;;
813     -quiet) verbose=0 ;;
814    
815 edhill 1.40 -deldir | -dd) DELDIR=t ;;
816    
817 edhill 1.1 -*)
818     echo "Error: unrecognized option: "$ac_option
819     usage
820     ;;
821    
822     *)
823     echo "Error: unrecognized argument: "$ac_option
824     usage
825     ;;
826    
827     esac
828    
829     done
830    
831 edhill 1.10 if test "x$QUICK" = xt ; then
832     NOGENMAKE=t
833     NOCLEAN=t
834     NODEPEND=t
835     fi
836    
837 edhill 1.1 if test "x$TESTDIRS" = x ; then
838 jmc 1.81 if test "x$ADM" = xt ; then
839     TESTDIRS=`scandirs results_ad`
840     else
841     TESTDIRS=`scandirs results`
842     fi
843 edhill 1.1 fi
844    
845 edhill 1.10 if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then
846     OPTFILE=$MITGCM_OF
847     fi
848    
849 jmc 1.76 if test "x$ADM" = xt ; then
850     EXECUTABLE="mitgcmuv_ad"
851 jmc 1.78 OUTPUTFILE="output_adm.txt"
852 jmc 1.76 else
853     EXECUTABLE="mitgcmuv"
854     OUTPUTFILE="output.txt"
855     fi
856    
857 edhill 1.24 if test "x$ADM" = xt -a "x$COMMAND" = x ; then
858 jmc 1.77 COMMAND="./$EXECUTABLE > $OUTPUTFILE"
859 edhill 1.24 fi
860    
861     if test "x$COMMAND" = x ; then
862 jmc 1.76 COMMAND="./$EXECUTABLE > $OUTPUTFILE"
863 edhill 1.24 fi
864    
865 jmc 1.76 #echo "OK"
866     echo "OK (COMMAND= $COMMAND )"
867 edhill 1.1
868     # create the FORTRAN comparison code
869     createcodelet
870    
871     # build the mpack utility
872 edhill 1.31 if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
873 edhill 1.32 echo "skipping mpack build"
874     else
875 edhill 1.31 build_mpack
876     fi
877 edhill 1.1
878     # Create a uniquely named directory to store results
879     MACH=`hostname`
880 edhill 1.2 UNAMEA=`uname -a`
881 edhill 1.1 DATE=`date +%Y%m%d`
882 edhill 1.25 BASE="tr_"$MACH"_"$DATE"_"
883 jmc 1.70 if test "x$OUTDIR" != x ; then
884     BASE="tr_"$OUTDIR"_"$DATE"_"
885     fi
886 edhill 1.1 DNUM=0
887     DRESULTS="$BASE$DNUM"
888     while test -e $DRESULTS ; do
889     DNUM=$(( $DNUM + 1 ))
890     DRESULTS="$BASE$DNUM"
891     done
892     mkdir $DRESULTS
893     RETVAL=$?
894     if test "x$RETVAL" != x0 ; then
895 edhill 1.20 echo "ERROR: Can't create results directory \"./$DRESULTS\""
896 edhill 1.1 exit 1
897     fi
898     SUMMARY="$DRESULTS/summary.txt"
899 edhill 1.34 printf "Start time: " >> $SUMMARY
900 edhill 1.16 start_date=`date`
901 edhill 1.17 echo $start_date > $SUMMARY
902 edhill 1.1
903 edhill 1.11 of_path=
904 edhill 1.10 if test "x$OPTFILE" != xNONE ; then
905     if test -r $OPTFILE ; then
906 edhill 1.11 # get the path
907     path=${OPTFILE%/*}
908     if test "x$path" = x ; then
909     of_path=`pwd`
910     else
911     of_path=`( cd $path > /dev/null 2>&1 ; pwd )`
912     fi
913     file=${OPTFILE##*/}
914     OPTFILE=$of_path/$file
915 edhill 1.21 cp $OPTFILE $DRESULTS
916     echo >> $SUMMARY
917     echo " OPTFILE=$OPTFILE" >> $SUMMARY
918 edhill 1.11 else
919 edhill 1.21 echo | tee $SUMMARY
920     echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee $SUMMARY
921     exit 1
922 edhill 1.10 fi
923 edhill 1.21 else
924     echo >> $SUMMARY
925     echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY
926     echo " so the genmake default will be used." >> $SUMMARY
927 edhill 1.10 fi
928     echo
929     echo >> $SUMMARY
930 edhill 1.24 if test "x$ADM" = x ; then
931 edhill 1.49 line_0=" ----T----- ----S----- ----U----- ----V-----"
932     line_1="G D M c m s m s m s m s"
933     line_2="E p a R g m m e . m m e . m m e . m m e ."
934     line_3="N n k u 2 i a a d i a a d i a a d i a a d"
935     line_4="2 d e n d n x n . n x n . n x n . n x n ."
936 edhill 1.50 for ii in $PTRACERS_NUM ; do
937 edhill 1.49 # tst=`eval 'echo $HAVE_PTR0'$ii`
938     # if test "x$tst" = xt ; then
939     line_0="$line_0 --PTR 0"$ii"--"
940     line_1="$line_1 m s"
941     line_2="$line_2 m m e ."
942     line_3="$line_3 i a a d"
943     line_4="$line_4 n x n ."
944     # fi
945     done
946     echo "$line_0" | tee -a $SUMMARY
947     echo "$line_1" | tee -a $SUMMARY
948     echo "$line_2" | tee -a $SUMMARY
949     echo "$line_3" | tee -a $SUMMARY
950     echo "$line_4" | tee -a $SUMMARY
951     echo " " | tee -a $SUMMARY
952 edhill 1.24 else
953     echo "ADJOINT=true" >> $SUMMARY
954     echo >> $SUMMARY
955     cat << EOF | tee -a $SUMMARY
956     G D M C G
957     E p a R o r
958     N n k u s a
959     2 d e n t d
960    
961     EOF
962     fi
963 edhill 1.1
964 edhill 1.10 # ...and each test directory...
965     for dir in $TESTDIRS ; do
966    
967     # Cleanup only!
968     if test "x$CLEANUP" = xt ; then
969     if test -r $dir/build/Makefile ; then
970 jmc 1.83 echo ' ------ clean dir:' $dir/build
971 edhill 1.10 ( cd $dir/build ; make CLEAN )
972     fi
973 jmc 1.83 if test -d $dir/run/CVS ; then
974     echo ' ------ clean dir:' $dir/run
975     run_clean $dir/run
976 edhill 1.10 fi
977 edhill 1.62 (
978     cd $dir
979     rm -rf tr_run.*
980     )
981 edhill 1.10 continue
982 edhill 1.1 fi
983 edhill 1.3
984 edhill 1.10 # Verify that the testdir exists and contains previous
985     # results in the correct location--or skip this directory!
986 edhill 1.24 fout=
987     if test "x$ADM" = x ; then
988     fout=$dir"/results/output.txt"
989     else
990 jmc 1.78 fout=$dir"/results_ad/output_adm.txt"
991 edhill 1.24 fi
992     if test ! -r $fout ; then
993     echo "can't read \"$fout\" -- skipping $dir"
994 edhill 1.10 continue
995     fi
996 edhill 1.53 if test "x$ADM" = x ; then
997     check_for_add_mon_output $fout
998     fi
999 edhill 1.7
1000 edhill 1.49 # Check for additional types of monitor output
1001    
1002 jmc 1.83 builddir="build"
1003     if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi
1004     rundir="run"
1005     #rundir=$builddir
1006     if test ! -d $dir/$rundir ; then
1007     rundir=$builddir
1008 edhill 1.10 fi
1009    
1010 edhill 1.24 if test "x$ADM" = x ; then
1011 edhill 1.27 code_dir=code
1012 edhill 1.24 CODE_DIR=$dir/code
1013 jmc 1.83 input_dirs='input'
1014 edhill 1.24 else
1015 edhill 1.27 code_dir=code_ad
1016 edhill 1.24 CODE_DIR=$dir/code_ad
1017 jmc 1.83 input_dirs='input_ad input'
1018 edhill 1.24 fi
1019 edhill 1.10 BUILD_DIR=$dir/$builddir
1020 edhill 1.28
1021 edhill 1.30 if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then
1022 edhill 1.28 echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"
1023     continue
1024     fi
1025 jmc 1.83 if test ! -r $dir"/input/eedata.mth" -a "x$MULTI_THREAD" = "xt" ; then
1026     echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir"
1027     continue
1028     fi
1029    
1030     # Check whether there are "extra runs" for this testdir
1031     extra_runs=
1032     if test "x$ADM" = x ; then
1033     ex_run_dirs=`( cd $dir ; echo input.* )`
1034     #echo "ex_run_dirs='$ex_run_dirs'"
1035     for exd in $ex_run_dirs ; do
1036     name=`echo $exd | sed -e 's/input.//g'`
1037     outf="$dir/results/output.txt.$name"
1038     if test -f $outf -a -r $outf ; then
1039     if test "x$MULTI_THREAD" = "xt" ; then
1040     if test -r $dir"/"$exd"/eedata.mth" ; then
1041     extra_runs="$extra_runs $name"
1042     #else echo $dir"/"$exd"/eedata.mth: not found"
1043     fi
1044     else
1045     extra_runs="$extra_runs $name"
1046     fi
1047     fi
1048     done
1049     fi
1050 edhill 1.28
1051     echo "-------------------------------------------------------------------------------"
1052     echo
1053 jmc 1.83 if test "x$extra_runs" = "x" ; then
1054     echo "Experiment: $dir"
1055     else
1056     echo "Experiment: $dir ; extra_runs=$extra_runs"
1057     fi
1058 edhill 1.28 echo
1059     unset genmake makedepend make run
1060 jmc 1.73 results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
1061 edhill 1.10
1062     # Create an output dir for each OPTFILE/tdir combination
1063 edhill 1.20 rel_CDIR=$DRESULTS"/"$dir
1064     mkdir $rel_CDIR
1065     CDIR=`pwd`"/$rel_CDIR"
1066 edhill 1.10
1067     if test "x$CLEANUP" = xt ; then
1068 jmc 1.83 echo '====>>> this is to check that we never go through this part <<< ==='
1069     makeclean $dir/$builddir \
1070     && run_clean $dir/$rundir
1071 edhill 1.10 else
1072 edhill 1.1 genmakemodel $dir/$builddir && genmake=Y \
1073     && makeclean $dir/$builddir \
1074 jmc 1.83 && run_clean $dir/$rundir \
1075 edhill 1.27 && symlink_mpifiles $dir $code_dir $builddir \
1076 edhill 1.1 && makedependmodel $dir/$builddir && makedepend=Y \
1077     && makemodel $dir/$builddir && make=Y \
1078 jmc 1.83 && linkdata $dir/$rundir $input_dirs \
1079 edhill 1.12 && runmodel $dir/$rundir && run=Y \
1080 edhill 1.1 && results=`testoutput $dir $rundir`
1081 edhill 1.10 fi
1082    
1083     echo
1084 edhill 1.24 if test "x$ADM" = x ; then
1085     fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1086 edhill 1.34 echo
1087     echo "$fres" >> $SUMMARY
1088     echo "fresults='$fres'" > $CDIR"/summary.txt"
1089     echo "MACH='$MACH'" >> $CDIR"/summary.txt"
1090     echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
1091     echo "DATE='$DATE'" >> $CDIR"/summary.txt"
1092     echo "tdir='$dir'" >> $CDIR"/summary.txt"
1093    
1094     for ex in $extra_runs ; do
1095 jmc 1.73 unset run
1096     results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
1097     # Create an output dir for each OPTFILE/tdir.ex combination
1098     rel_CDIR=$DRESULTS"/"$dir"."$ex
1099     mkdir $rel_CDIR
1100     CDIR=`pwd`"/$rel_CDIR"
1101 edhill 1.61 test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex"
1102 jmc 1.83 run_clean $dir/tr_run.$ex
1103     linkdata $dir/tr_run.$ex input.$ex input
1104 jmc 1.42 runmodel $dir/tr_run.$ex && run=Y \
1105     && results=`testoutput $dir tr_run.$ex "."$ex`
1106 edhill 1.34 fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`
1107     fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1108     fres="$fres.$ex"
1109     echo
1110     echo "$fres" >> $SUMMARY
1111     echo "fresults='$fres'" > $CDIR"/summary.txt"
1112     echo "MACH='$MACH'" >> $CDIR"/summary.txt"
1113     echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
1114     echo "DATE='$DATE'" >> $CDIR"/summary.txt"
1115 jmc 1.73 echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt"
1116 jmc 1.83 if test "x$POSTCLEAN" = xt ; then
1117     run_clean $dir/tr_run.$ex
1118     fi
1119 edhill 1.34 done
1120 edhill 1.24 else
1121     fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`
1122     fres=$fres"$results $dir"
1123 edhill 1.34 echo
1124     echo "$fres" >> $SUMMARY
1125     echo "fresults='$fres'" > $CDIR"/summary.txt"
1126     echo "MACH='$MACH'" >> $CDIR"/summary.txt"
1127     echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
1128     echo "DATE='$DATE'" >> $CDIR"/summary.txt"
1129     echo "tdir='$dir'" >> $CDIR"/summary.txt"
1130 jmc 1.77 grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \
1131     >> $CDIR"/summary.txt"
1132 edhill 1.24 fi
1133 edhill 1.68
1134 jmc 1.83 #postclean $dir/$builddir
1135     if test "x$POSTCLEAN" = xt ; then
1136     makeclean $dir/$builddir \
1137     && run_clean $dir/$rundir
1138     fi
1139 edhill 1.10
1140     echo "-------------------------------------------------------------------------------"
1141    
1142 edhill 1.1 done
1143    
1144 edhill 1.34 printf "Start time: " >> $SUMMARY
1145 edhill 1.16 echo $start_date >> $SUMMARY
1146 edhill 1.34 printf "End time: " >> $SUMMARY
1147 edhill 1.13 date >> $SUMMARY
1148 edhill 1.20
1149     # If addresses were supplied and mpack built successfully, then try
1150     # to send email using mpack.
1151     if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
1152     echo "No results email was sent."
1153     else
1154     if test "x$HAVE_MPACK" = xt ; then
1155     tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \
1156     && gzip $DRESULTS".tar" \
1157 edhill 1.44 && $MPACK -s MITgcm-test -m 3555000 $DRESULTS".tar.gz" $ADDRESSES
1158 edhill 1.20 RETVAL=$?
1159     if test "x$RETVAL" != x0 ; then
1160     echo
1161     echo "Warning: The tar, gzip, & mpack step failed. Please send email"
1162     echo " to <MITgcm-support@mitgcm.org> for help. You may copy the "
1163     echo " summary of results from the directory \"$DRESULTS\"."
1164     echo
1165     else
1166     echo
1167     echo "An email containing results was sent to the following addresses:"
1168     echo " \"$ADDRESSES\""
1169     echo
1170     fi
1171     test -f $DRESULTS".tar" && rm -f $DRESULTS".tar"
1172     test -f $DRESULTS".tar.gz" && rm -f $DRESULTS".tar.gz"
1173     fi
1174     fi
1175 edhill 1.13
1176 edhill 1.22 # rm -f tmp_cmpnum.f a.out
1177     rm -f tmp_cmpnum.c tmp_cmpnum
1178 edhill 1.1
1179 edhill 1.12 if test "x$CLEANUP" != xt ; then
1180 jmc 1.65 cat $SUMMARY | sed 's/ -- -- -- --//g'
1181 edhill 1.25 if test -e tr_out.txt ; then
1182     mv tr_out.txt tr_out.txt.old
1183 edhill 1.14 fi
1184 jmc 1.65 cat $SUMMARY | sed 's/ -- -- -- --//g' > tr_out.txt
1185 edhill 1.12 fi
1186 edhill 1.1
1187 edhill 1.40 if test "x$DELDIR" = xt ; then
1188     rm -rf $DRESULTS
1189     fi
1190    

  ViewVC Help
Powered by ViewVC 1.1.22