/[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.153 - (hide annotations) (download)
Wed Dec 29 22:35:50 2010 UTC (13 years, 3 months ago) by jmc
Branch: MAIN
Changes since 1.152: +3 -2 lines
check for normal end of execution from (standard) output file instead of
run-log file (not expected to be cut in pieces when different procs print
at the same time into single run-log file).

1 edhill 1.19 #! /usr/bin/env bash
2 edhill 1.1 #
3 jmc 1.153 # $Header: /u/gcmpack/MITgcm/verification/testreport,v 1.152 2010/12/17 17:32:24 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.122 echo " (-mth) run multi-threaded (using eedata.mth)"
15 jmc 1.83 echo " (-mpi) compile and run using MPI"
16 jmc 1.136 echo " (-ieee/-noieee) if possible, use IEEE compiler flags"
17 edhill 1.41 echo " (DEF=\"-ieee\")"
18 jmc 1.109 echo " (-gsl) compile with \"-gsl\" flag"
19 jmc 1.136 echo " (-use_r4|-ur4) if allowed, use real*4 type for '_RS' variable"
20     echo " (-optfile|-of) STRING list of optfiles to use"
21     echo " (-addr|-a) STRING list of email recipients"
22 jmc 1.108 echo " (DEF=\"\" no email is sent)"
23 jmc 1.136 echo " (-mpackdir|-mpd) DIR location of the mpack utility"
24 jmc 1.113 echo " (DEF=\"../tools/mpack-1.6\")"
25 jmc 1.136 echo " (-tdir|-t) STRING list of group and/or exp. dirs to test"
26 jmc 1.84 echo " (recognized groups: basic, tutorials)"
27     echo " (DEF=\"\" which test all)"
28 jmc 1.149 echo " (if list= 'start_from THIS_EXP' then"
29     echo " test THIS_EXP + all the following)"
30 jmc 1.136 echo " (-skipdir|-skd) STRING list of exp. dirs to skip"
31 jmc 1.89 echo " (DEF=\"\" which test all)"
32 jmc 1.136 echo " (-bash|-b) STRING preferred location of a \"bash\" or"
33 edhill 1.20 echo " Bourne-compatible \"sh\" shell"
34     echo " (DEF=\"\" for \"bash\")"
35 edhill 1.24 echo " (-adm|-ad) perform an adjoint run"
36 utke 1.120 echo " (-oad) perform an OpenAD adjoint run"
37 jmc 1.136 echo " (-command|-c) STRING command to run"
38 jmc 1.141 echo " (-makedepend|-md) STRING command to use for \"makedepend\""
39 jmc 1.136 echo " (-make|-m) STRING command to use for \"make\""
40 edhill 1.8 echo " (DEF=\"make\")"
41 jmc 1.70 echo " (-odir) STRING used to build output directory name"
42     echo " (DEF=\"hostname\")"
43 jmc 1.136 echo " (-ptracers|-ptr) STRING specify which ptracers to test"
44 edhill 1.50 echo " (DEF=\"1 2 3 4 5\")"
45 jmc 1.92 echo " (-match) NUMBER Matching Criteria (number of digits)"
46 jmc 1.141 echo " (DEF=\"$MATCH_CRIT\")"
47 edhill 1.43 echo " (-j) JOBS use \"make -j JOBS\" for parallel builds"
48 edhill 1.10 echo " (-clean) *ONLY* run \"make CLEAN\""
49 jmc 1.133 echo " (-norun|-nr) skip the \"runmodel\" stage (stop after make)"
50 jmc 1.136 echo " (-runonly|-ro) *ONLY* run stage (=\"-quick\" without make)"
51 ce107 1.90 echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\""
52     echo " (-nogenmake|-ng) skip the genmake stage"
53     echo " (-noclean|-nc) skip the \"make clean\" stage"
54     echo " (-nodepend|-nd) skip the \"make depend\" stage"
55     echo " (-deldir|-dd) on success, delete the output directory"
56     echo " (-ts) provide timing information per timestep"
57     echo " (-papis) provide MFlop/s per timestep using PAPI"
58     echo " (-pcls) provide MFlop/s per timestep using PCL"
59 edhill 1.6 echo
60 edhill 1.50 echo "and where STRING can be a whitespace-delimited list"
61 edhill 1.6 echo "such as:"
62 edhill 1.50 echo
63 edhill 1.6 echo " -t 'exp0 exp2 exp3' "
64     echo " -addr='abc@123.com testing@home.org'"
65 edhill 1.1 echo
66 edhill 1.50 echo "provided that the expression is properly quoted within the current"
67     echo "shell (note the use of single quotes to protect white space)."
68     echo
69 edhill 1.1 exit 1
70     }
71    
72     # build the mpack utility
73     build_mpack()
74     {
75 edhill 1.34 printf "building the mpack utility... "
76 jmc 1.113 MPACK="$MPACKDIR/mpack"
77     if test ! -x $MPACK ; then
78 edhill 1.1 if test ! -d $MPACKDIR ; then
79 edhill 1.20 echo
80 edhill 1.1 echo "Error: can't find \"$MPACKDIR\""
81     echo " are you sure this program is being run in the correct "
82     echo " (that is, \"MITGCM_ROOT\verification\") directory?"
83 edhill 1.20 echo
84     HAVE_MPACK=f
85 edhill 1.1 fi
86 edhill 1.26 if test "x$CC" = x ; then
87     export CC=cc
88     fi
89 jmc 1.112 printf "building mpack (using CC=$CC)... "
90 edhill 1.25 ( cd $MPACKDIR && ./configure && $MAKE ) > tr_build_mpack.out 2>&1
91 edhill 1.1 RETVAL=$?
92     if test "x$RETVAL" != x0 ; then
93     echo
94     echo "Error building the mpack tools at: $MPACK_DIR"
95 edhill 1.20 echo
96     HAVE_MPACK=f
97     else
98 edhill 1.25 rm -f tr_build_mpack.out
99 edhill 1.20 HAVE_MPACK=t
100 jmc 1.113 echo "done"
101 edhill 1.1 fi
102 edhill 1.20 else
103     HAVE_MPACK=t
104 jmc 1.113 echo "already exist"
105 edhill 1.1 fi
106     }
107    
108 jmc 1.93 testoutput_var()
109 edhill 1.1 {
110 jmc 1.99 # testoutput_var dir s1 label subdir reference_output
111 edhill 1.1 #
112 jmc 1.135 # compares 1 variable output selected from file $dir/$subdir/$OUTPUTFILE
113 jmc 1.99 # with same output from reference file $dir/results/$reference_output
114 jmc 1.93 # using search strings s1 and text label
115 edhill 1.1
116     if [ $debug -gt 0 ]; then
117 jmc 1.93 echo testoutput_var: grep "$2" $1/$4/$OUTPUTFILE 1>&2
118 edhill 1.1 fi
119 jmc 1.87 if [ -r $1/$4/$OUTPUTFILE ]; then
120     grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > tmp1.txt
121 jmc 1.67 lncntA=`wc -l tmp1.txt | awk '{print $1}' `
122 jmc 1.100 if [ $lncntA -lt 2 ]; then
123 edhill 1.1 if [ $verbose -gt 0 ]; then
124     echo Not enough lines of output when searching for "$2" 1>&2
125     fi
126     return 99
127     fi
128     else
129 jmc 1.93 echo testoutput_var: $OUTPUTFILE from model run was not readable 1>&2
130 edhill 1.1 return 99
131     fi
132     if [ $debug -gt 0 ]; then
133 jmc 1.99 echo testoutput_var: grep "$2" $1/results/$5 1>&2
134 edhill 1.1 fi
135 jmc 1.99 grep "$2" $1/results/$5 | sed 's/.*=//' | cat -n > tmp2.txt
136 jmc 1.67 lncntB=`wc -l tmp2.txt | awk '{print $1}' `
137 jmc 1.100 if [ $lncntB -lt 2 ]; then
138 edhill 1.1 if [ $verbose -gt 0 ]; then
139     echo Not enough lines of output when searching for "$2" 1>&2
140     fi
141     return 99
142     fi
143 jmc 1.67 if [ $lncntA -ne $lncntB ]; then
144     if [ $verbose -gt 0 ]; then
145     echo Not same Nb of lines when searching for "$2" ":" $lncntA $lncntB 1>&2
146     fi
147     return 99
148     fi
149 edhill 1.72 has_nan=`cat tmp1.txt | grep -i nan | wc -l`
150     if [ $has_nan -gt 0 ] ; then
151 jmc 1.93 echo testoutput_var: $OUTPUTFILE contains $has_nan NaN values 1>&2
152 edhill 1.72 return 99
153     fi
154     has_inf=`cat tmp1.txt | grep -i inf | wc -l`
155     if [ $has_inf -gt 0 ] ; then
156 jmc 1.93 echo testoutput_var: $OUTPUTFILE contains $has_inf Inf values 1>&2
157 jmc 1.71 return 99
158     fi
159 edhill 1.1 if [ $debug -gt 0 ]; then
160 jmc 1.93 echo testoutput_var: join tmp1.txt tmp2.txt 1>&2
161 edhill 1.1 fi
162     join tmp1.txt tmp2.txt | awk '{print $1 " " $2 " " $3}' > tmp3.txt
163     if [ $debug -gt 0 ]; then
164 jmc 1.93 echo testoutput_var: compare_lines 1>&2
165 edhill 1.1 fi
166 edhill 1.22 if [ $verbose -gt 1 ]; then
167     cat tmp3.txt 1>&2
168     fi
169     echo "-1" >> tmp3.txt
170 edhill 1.23 # On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number
171     cat tmp3.txt | sed -e 's|:||g' > tmp4.txt
172 jmc 1.91 digits_of_similarity=`./tr_cmpnum < tmp4.txt`
173 edhill 1.1 if [ $digits_of_similarity -eq 99 ]; then
174     if [ $verbose -gt 0 ]; then
175 jmc 1.99 echo testoutput_var: No comparison was available for \"$3\" 1>&2
176 edhill 1.1 fi
177     digits_of_similarity=99
178     else
179     if [ $verbose -gt 0 ]; then
180 jmc 1.99 echo There were $digits_of_similarity decimal places of similarity for \"$3\" 1>&2
181 edhill 1.1 fi
182     fi
183 edhill 1.23 rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt
184 jmc 1.135
185 edhill 1.1 return $digits_of_similarity
186     }
187    
188 jmc 1.93 testoutput_run()
189 edhill 1.1 {
190 jmc 1.99 # testoutput_run directory subdir reference_output
191 edhill 1.1 #
192 jmc 1.93 # test output from 1 run in "directory"
193 jmc 1.103 # --> same processing for adjoint & forward test
194 jmc 1.94 # default list of output variables to be checked:
195     # 1rst : main variable used to decide if it pass or FAIL
196     # others : number of matching digits to be printed in summary.txt
197     listChk=$DEF_CHECK_LIST
198     # load experiment-specific list from file "tr_checklist" (if it exist)
199     if test -r $1/$2/tr_checklist ; then listChk=`cat $1/$2/tr_checklist` ; fi
200     sVar=`echo $listChk | awk '{print $1}'`
201     # remove 1rst var and expand the list: + => min max mean s.d
202 jmc 1.97 listVar=`echo $listChk | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' \
203     | sed 's/+//g' | sed "s/^$sVar//"`
204 jmc 1.94 if [ $debug -gt 0 ]; then echo "testoutput_run: listVar(I)='$listVar'" 1>&2 ; fi
205 jmc 1.117 # check for ptracer output in reference_output file :
206     outpref=$1/results/$3
207     ptr_mon="trcstat_ptracerXX_min trcstat_ptracerXX_max"
208     ptr_mon="$ptr_mon trcstat_ptracerXX_mean trcstat_ptracerXX_sd"
209     for ii in $PTRACERS_NUM ; do
210     ptrfound=0
211     for jj in $ptr_mon ; do
212     name=`eval "echo $jj | sed -e 's|XX|0"$ii"|g'"`
213     tst=`grep $name $outpref | wc -l | awk '{print $1}'`
214     if test ! "x$tst" = x0 ; then ptrfound=1 ; fi
215     done
216     if test $ptrfound = '1' ; then
217     eval "HAVE_PTR0"$ii"=t"
218     else
219     eval "HAVE_PTR0"$ii"=f"
220 utke 1.120 if test "x$ADM" = x -a "x$OADM" = x; then
221 jmc 1.117 # remove this ptr from the list of output variable to check
222     # echo "-- ptr test=" $tst "number of var=" `echo $listVar | awk '{print NF}'` 1>&2
223     listVar=`echo "$listVar" | sed "s/ pt$ii..//g"`
224     fi
225     fi
226     # eval 'echo "HAVE_PTR0'$ii' = $HAVE_PTR0'$ii'"' 1>&2
227     done
228 mlosch 1.116 tst=`echo $sVar $listVar | awk '{ for(i=2;i<=NF;i++){if($i==$1)t+=1}; print t }'`
229 jmc 1.94 if test $tst != 1 ; then
230     if test $tst = 0 ; then echo "==> WARNING: selected var >$sVar< not found" 1>&2
231     else echo "==> WARNING: found selected var >$sVar< $tst times" 1>&2 ; fi
232     echo "==> WARNING: in checked list:" $listVar 1>&2
233     #- put it back once:
234     listVar=" $sVar "`echo "$listVar " | sed "s/ $sVar / /g"`
235     fi
236     if [ $debug -gt 0 ]; then echo "testoutput_run: listVar(M)='$listVar'" 1>&2 ; fi
237 jmc 1.138 echo "listVar='$listVar'" > $locDIR"/summary.txt"
238 jmc 1.94 allargs=""
239     for xx in $listVar
240     do
241     case $xx in
242     'PS') if [ $debug -gt 0 ]
243     then echo testoutput_run: testoutput_var $1 cg2d_init_res 1>&2 ; fi
244 jmc 1.99 testoutput_var $1 "cg2d_init_res" "Press. Solver (cg2d)" $2 $3; yy=$?
245 jmc 1.94 if [ $debug -gt 0 ] ; then echo testoutput_run: cg2dres=$yy 1>&2 ; fi ;;
246 jmc 1.101 'Cost') testoutput_var $1 "ADM precision_derivative_cost" "ADM Cost" $2 $3; yy=$? ;;
247     'Grad') testoutput_var $1 "ADM precision_derivative_grad" "ADM Grad" $2 $3; yy=$? ;;
248 jmc 1.99 'Tmn') testoutput_var $1 "dynstat_theta_min" "Theta minimum" $2 $3; yy=$? ;;
249     'Tmx') testoutput_var $1 "dynstat_theta_max" "Theta maximum" $2 $3; yy=$? ;;
250     'Tav') testoutput_var $1 "dynstat_theta_mean" "Theta mean" $2 $3; yy=$? ;;
251     'Tsd') testoutput_var $1 "dynstat_theta_sd" "Theta Std.Dev" $2 $3; yy=$? ;;
252     'Smn') testoutput_var $1 "dynstat_salt_min" "Salt minimum" $2 $3; yy=$? ;;
253     'Smx') testoutput_var $1 "dynstat_salt_max" "Salt maximum" $2 $3; yy=$? ;;
254     'Sav') testoutput_var $1 "dynstat_salt_mean" "Salt mean" $2 $3; yy=$? ;;
255     'Ssd') testoutput_var $1 "dynstat_salt_sd" "Salt Std.Dev" $2 $3; yy=$? ;;
256 jmc 1.94 'Umn') testoutput_var $1 "dynstat_uvel_min" "U minimum" $2 $3; yy=$? ;;
257     'Umx') testoutput_var $1 "dynstat_uvel_max" "U maximum" $2 $3; yy=$? ;;
258     'Uav') testoutput_var $1 "dynstat_uvel_mean" "U mean" $2 $3; yy=$? ;;
259 jmc 1.99 'Usd') testoutput_var $1 "dynstat_uvel_sd" "U Std.Dev" $2 $3; yy=$? ;;
260 jmc 1.94 'Vmn') testoutput_var $1 "dynstat_vvel_min" "V minimum" $2 $3; yy=$? ;;
261     'Vmx') testoutput_var $1 "dynstat_vvel_max" "V maximum" $2 $3; yy=$? ;;
262     'Vav') testoutput_var $1 "dynstat_vvel_mean" "V mean" $2 $3; yy=$? ;;
263 jmc 1.99 'Vsd') testoutput_var $1 "dynstat_vvel_sd" "V Std.Dev" $2 $3; yy=$? ;;
264 jmc 1.94 'pt1mn'|'pt2mn'|'pt3mn'|'pt4mn'|'pt5mn') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'`
265     testoutput_var $1 "trcstat_ptracer0"$ii"_min" "p0"$ii"_min" $2 $3; yy=$? ;;
266     'pt1mx'|'pt2mx'|'pt3mx'|'pt4mx'|'pt5mx') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'`
267     testoutput_var $1 "trcstat_ptracer0"$ii"_max" "p0"$ii"_max" $2 $3; yy=$? ;;
268     'pt1av'|'pt2av'|'pt3av'|'pt4av'|'pt5av') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'`
269     testoutput_var $1 "trcstat_ptracer0"$ii"_mean" "p0"$ii"_mean" $2 $3; yy=$? ;;
270     'pt1sd'|'pt2sd'|'pt3sd'|'pt4sd'|'pt5sd') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'`
271 jmc 1.99 testoutput_var $1 "trcstat_ptracer0"$ii"_sd" "p0"$ii"_StDv" $2 $3; yy=$? ;;
272 jmc 1.130 'Qntmn') testoutput_var $1 "forcing_qnet_min" "Qnet minimum" $2 $3; yy=$? ;;
273     'Qntmx') testoutput_var $1 "forcing_qnet_max" "Qnet maximum" $2 $3; yy=$? ;;
274     'Qntav') testoutput_var $1 "forcing_qnet_mean" "Qnet mean" $2 $3; yy=$? ;;
275     'Qntsd') testoutput_var $1 "forcing_qnet_sd" "Qnet Std.Dev" $2 $3; yy=$? ;;
276 jmc 1.101 'aSImn') testoutput_var $1 "seaice_area_min" "SIce Area min" $2 $3; yy=$? ;;
277     'aSImx') testoutput_var $1 "seaice_area_max" "SIce Area max" $2 $3; yy=$? ;;
278     'aSIav') testoutput_var $1 "seaice_area_mean" "SIce Area mean" $2 $3; yy=$? ;;
279     'aSIsd') testoutput_var $1 "seaice_area_sd" "SIce Area StDv" $2 $3; yy=$? ;;
280     'hSImn') testoutput_var $1 "seaice_heff_min" "SIce Heff min" $2 $3; yy=$? ;;
281 jmc 1.126 'hSImx') testoutput_var $1 "seaice_heff_max" "SIce Heff max" $2 $3; yy=$? ;;
282     'hSIav') testoutput_var $1 "seaice_heff_mean" "SIce Heff mean" $2 $3; yy=$? ;;
283     'hSIsd') testoutput_var $1 "seaice_heff_sd" "SIce Heff StDv" $2 $3; yy=$? ;;
284 jmc 1.101 'AthSiG') testoutput_var $1 "thSI_Ice_Area_G" "thSIc Area Global" $2 $3; yy=$? ;;
285     'AthSiS') testoutput_var $1 "thSI_Ice_Area_S" "thSIc Area South" $2 $3; yy=$? ;;
286     'AthSiN') testoutput_var $1 "thSI_Ice_Area_N" "thSIc Area North" $2 $3; yy=$? ;;
287     'HthSiG') testoutput_var $1 "thSI_IceH_ave_G" "thSIc H Global" $2 $3; yy=$? ;;
288     'HthSiS') testoutput_var $1 "thSI_IceH_ave_S" "thSIc H South" $2 $3; yy=$? ;;
289     'HthSiN') testoutput_var $1 "thSI_IceH_ave_N" "thSIc H North" $2 $3; yy=$? ;;
290 jmc 1.94 *) yy=99; echo "WARNING: asking for var=$xx : not recognized !" 1>&2 ;;
291     esac
292     if test $xx = $sVar
293     then allargs="$allargs > $yy <"
294     else allargs="$allargs $yy"
295     fi
296     done
297    
298     nbVar=`echo $listVar | awk '{print NF}'`
299 jmc 1.135 if [ $nbVar -lt $LEN_CHECK_LIST ] ; then
300 jmc 1.94 #-- fill line (up to standard length) with dot:
301 jmc 1.97 adNul=`expr $LEN_CHECK_LIST - $nbVar | awk '{for(i=1;i<=$1;i++){print "."}}'`
302 jmc 1.94 echo $allargs $adNul
303     else
304     echo $allargs
305 jmc 1.135 fi
306 jmc 1.103 # <-- same processing for adjoint & forward test
307 edhill 1.1 }
308    
309     genmakemodel()
310     {
311     # genmakemodel directory
312 edhill 1.10 if test "x$NOGENMAKE" = xt ; then
313     echo "genmake skipped!"
314     else
315 edhill 1.34 if test "x$BASH" = x ; then
316     GENMAKE2="../../../tools/genmake2"
317     else
318     GENMAKE2="$BASH ../../../tools/genmake2 -bash $BASH"
319     fi
320 edhill 1.10 (
321     cd $1;
322 edhill 1.24 command="$GENMAKE2 -ds -m $MAKE"
323 jmc 1.141 if test "x$MKDEPEND" != x ; then
324     command="$command -makedepend=$MKDEPEND"
325     fi
326 utke 1.120 if test "x$ADM" = xt ; then
327     command="$command --mods=../code_ad"
328     elif test "x$OADM" = xt ; then
329     command="$command -adof ../../../tools/adjoint_options/adjoint_oad -mods '../code_oad ../../OpenAD/code_oad_all'"
330     else
331 jmc 1.124 command="$command -mods=../code"
332 edhill 1.24 fi
333 edhill 1.10 if test "x$OPTFILE" != xNONE ; then
334 jmc 1.124 command="$command -optfile=$OPTFILE"
335 edhill 1.10 fi
336     if test "x$IEEE" != x ; then
337     command="$command -ieee"
338     fi
339 jmc 1.109 if test "x$GSL" = xt ; then
340     command="$command -gsl"
341     fi
342 edhill 1.66 if test "x$MPI" = xt ; then
343     command="$command -mpi"
344     fi
345 jmc 1.122 if test "x$MULTI_THREAD" = xt ; then
346     #- run multi-threaded using OpenMP:
347     command="$command -omp"
348     fi
349 jmc 1.135 if test "x$USE_R4" = xt ; then
350     command="$command -use_r4"
351     fi
352 ce107 1.90 if test "x$TS" = xt ; then
353     command="$command -ts"
354     fi
355     if test "x$PAPIS" = xt ; then
356     command="$command -papis"
357 jmc 1.135 else
358 ce107 1.90 if test "x$PCLS" = xt ; then
359     command="$command -pcls"
360     fi
361     fi
362 jmc 1.139 printf 'genmake ... '
363 jmc 1.146 eval $command > genmake.tr_log 2>&1
364 edhill 1.10 RETVAL=$?
365 edhill 1.44 # Reduce the size of the testing emails!
366 edhill 1.47 head -100 Makefile > $CDIR/Makefile_head
367 edhill 1.10 if test "x$RETVAL" != x0 ; then
368 jmc 1.146 tail genmake.tr_log
369 jmc 1.139 echo "genmakemodel: genmake failed"
370 jmc 1.148 cp genmake.log genmake_* genmake.tr_log $CDIR
371 edhill 1.10 return 1
372     else
373 jmc 1.139 echo "successful"
374 edhill 1.1 fi
375 edhill 1.10 )
376     fi
377 edhill 1.1 }
378    
379     makeclean()
380     {
381     # makeclean directory
382 jmc 1.146 if test "x$NODEPEND" = xf ; then rm -f $1/make.tr_log ; fi
383 edhill 1.10 if test "x$NOCLEAN" = xt ; then
384 jmc 1.83 echo "make Clean skipped!"
385 edhill 1.10 else
386     (
387     cd $1;
388 jmc 1.87 #if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi
389 edhill 1.10 if test -r Makefile ; then
390 jmc 1.139 printf 'clean build-dir: make Clean ... '
391 jmc 1.145 rm -f Makefile.old
392 jmc 1.146 $MAKE Clean >> make.tr_log 2>&1
393 edhill 1.10 RETVAL=$?
394     if test "x$RETVAL" != x0 ; then
395 jmc 1.146 tail make.tr_log
396 jmc 1.139 echo "makeclean: \"make Clean\" failed"
397 jmc 1.148 cp make.tr_log genmake.log genmake.tr_log $CDIR
398 edhill 1.10 return 1
399     fi
400 jmc 1.139 echo successful
401 jmc 1.127 else
402     echo ''
403 edhill 1.10 fi
404     exit 0
405     )
406     fi
407     }
408    
409 jmc 1.83 run_clean()
410 edhill 1.68 {
411 jmc 1.83 # run_clean directory
412     if test "x$NOCLEAN" = xt ; then
413     echo "run_clean skipped!"
414     else
415 edhill 1.68 (
416     cd $1;
417 jmc 1.139 printf 'clean run-dir ... '
418 jmc 1.83 # part of what is done after "make clean" when doing "make CLEAN"
419     find . -name "*.meta" -exec rm {} \;
420     find . -name "*.data" -exec rm {} \;
421     find . -name "fort.*" -exec rm {} \;
422     find . -type l -exec rm {} \;
423 jmc 1.145 rm -f $EXECUTABLE $RUNLOG *.txt STD* *diagnostics.log datetime
424 jmc 1.83 rm -rf mnc_test_*
425 jmc 1.107 rm -f *_MIT_CE_000.opt0000 costfunction*0000
426 jmc 1.139 echo successful
427 edhill 1.68 exit 0
428     )
429     fi
430     }
431    
432 edhill 1.10 makedependmodel()
433     {
434     # makedependmodel directory
435     if test "x$NODEPEND" = xt ; then
436     echo "make depend skipped!"
437     else
438     (
439     cd $1;
440 jmc 1.139 printf 'make depend ... '
441 jmc 1.146 $MAKE depend >> make.tr_log 2>&1
442 edhill 1.1 RETVAL=$?
443     if test "x$RETVAL" != x0 ; then
444 jmc 1.146 tail make.tr_log
445 jmc 1.139 echo "makedependmodel: make depend failed"
446 jmc 1.148 cp make.tr_log genmake.log genmake.tr_log $CDIR
447 edhill 1.1 return 1
448 edhill 1.10 else
449 jmc 1.139 echo successful
450 edhill 1.1 fi
451 edhill 1.10 )
452     fi
453 edhill 1.1 }
454    
455     makemodel()
456     {
457     # makemodel directory
458     (
459 jmc 1.136 if test "x$NOMAKE" = xt ; then
460     cd $1;
461     if test -x $EXECUTABLE ; then
462     echo "make skipped!"
463     else
464     echo "no executable!"
465     return 2
466     fi
467     else
468 edhill 1.1 cd $1;
469     if test -r Makefile ; then
470 jmc 1.139 printf 'make ... '
471 utke 1.120 if test "x$ADM" = xt ; then
472 jmc 1.146 $MAKE adall >> make.tr_log 2>&1
473 utke 1.120 elif test "x$OADM" = xt ; then
474 jmc 1.146 $MAKE adAll >> make.tr_log 2>&1
475 utke 1.120 else
476 edhill 1.43 if test "x$JOBS" = x ; then
477 jmc 1.146 $MAKE >> make.tr_log 2>&1
478 edhill 1.43 else
479 jmc 1.146 $MAKE -j $JOBS >> make.tr_log 2>&1
480 edhill 1.43 fi
481 edhill 1.24 fi
482 edhill 1.1 RETVAL=$?
483     if test "x$RETVAL" != x0 ; then
484 jmc 1.146 tail make.tr_log
485 jmc 1.139 echo failed
486 jmc 1.148 cp make.tr_log genmake.log genmake.tr_log $CDIR
487 jmc 1.131 rm -f $EXECUTABLE
488 edhill 1.1 return 1
489     else
490 jmc 1.139 echo successful
491 edhill 1.1 fi
492     fi
493 jmc 1.136 fi
494 edhill 1.1 )
495     }
496    
497 edhill 1.27 symlink_mpifiles()
498     {
499     # Put special links so that MPI specific files are used
500     # This MUST be invoked between makeclean and makelinks because
501     # the Makefile will link to non-mpi files by default
502    
503     dir=$1
504     code_dir=$2
505     BUILD_DIR=$dir/$3
506     CODE_DIR=$dir/$code_dir
507 jmc 1.135
508 edhill 1.27 # These are files that should replace their counter-part when using -mpi
509 mlosch 1.111 MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi" -print)`
510 edhill 1.27
511     # Is this an MPI run?
512     if test "x$MPI" = xt ; then
513     # YES: We symbolically link these files to the build
514     # dir so long as there is no real file in place
515     for ii in $MPI_FILES ; do
516     i=`echo $ii | sed 's:^\./::'`
517     name=`echo $i | sed 's:_mpi::' `
518     cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1
519     RETVAL=$?
520     if test "x$RETVAL" != x0 ; then
521     if ! test -f $BUILD_DIR/$i ; then
522 edhill 1.45 #echo Linking $name to $i
523 edhill 1.27 (cd $BUILD_DIR; ln -sf ../$code_dir/$i $name)
524     fi
525     fi
526     done
527     else
528 edhill 1.45 # NO: We undo any _mpi symbolically linked files
529 edhill 1.27 for ii in $MPI_FILES ; do
530     i=`echo $ii | sed 's:^\./::'`
531     name=`echo $i | sed 's:_mpi::' `
532     if test -L $BUILD_DIR/$name ; then
533 edhill 1.45 cmp $BUILD_DIR/$name "../$code_dir/$name"_mpi > /dev/null 2>&1
534     RETVAL=$?
535     if test "x$RETVAL" = x0 ; then
536     #echo Un-linking $name from $linktarg
537 edhill 1.27 rm -f $BUILD_DIR/$name
538     fi
539     fi
540     done
541     fi
542 jmc 1.135
543 edhill 1.27 }
544    
545 edhill 1.1 linkdata()
546     {
547 jmc 1.83 # linkdata run_dir input_dir_1 input_dir_2 ...
548 edhill 1.1 #
549     # symbolically link data files to run directory
550 jmc 1.83 if test -d $1 ; then
551 edhill 1.12 (
552 jmc 1.83 cd $1 ; shift
553 jmc 1.139 echo 'linkdata from dirs:' $*
554 jmc 1.125 inpMPI=`(cd ../$1 ; find . -name "*.mpi" -print | sed 's:^\./::')`
555     for xx in $inpMPI ; do
556     if test -r "../"$1"/"$xx ; then
557     # found 1 _mpi sfx file in 1rst input dir and it is readable
558     yy=`echo $xx | sed 's:\.mpi$::'`
559     if test "x$MPI" = "xt" ; then
560     # mpi test: remove symbolic link & link _mpi sfx file
561     if test -h $yy ; then rm -f $yy ; fi
562 jmc 1.135 if test ! -r $yy ; then
563 jmc 1.125 ln -sf "../"$1"/"$xx $yy ;
564 jmc 1.139 printf " $xx" 1>&2
565 jmc 1.125 fi
566     else
567     # not mpi test: remove symbolic link
568     if test -h $yy ; then rm -f $yy ; fi
569     fi
570     fi
571     done
572 jmc 1.83 if test -r "../"$1"/eedata.mth" ; then
573     # found eedata.mth in 1rst input dir and it is readable
574     if test "x$MULTI_THREAD" = "xt" ; then
575     # multi-threaded test: remove symbolic link & link eedata.mth
576     if test -h eedata ; then rm -f eedata ; fi
577 jmc 1.135 if test ! -r eedata ; then
578 jmc 1.83 ln -sf "../"$1"/eedata.mth" eedata ;
579 jmc 1.139 printf ' eedata.mth' 1>&2
580 edhill 1.24 fi
581 jmc 1.83 else
582     # not multi-threaded test: remove eedata symbolic link
583     if test -h eedata ; then rm -f eedata ; fi
584     fi
585     fi
586 jmc 1.108 prevDir='NONE'
587 jmc 1.83 for ldir in $* ; do
588 jmc 1.108 if test -d "../"$ldir -a $ldir != $prevDir ; then
589 jmc 1.139 printf " ldir=${ldir}:" 1>&2
590 jmc 1.83 files=`( cd "../"$ldir ; ls -1 | grep -v CVS )`
591     for i in $files ; do
592     if test ! -d "../"$ldir/$i ; then
593     if test ! -r $i ; then
594     printf ' '$i 1>&2
595     ln -sf "../"$ldir"/"$i $i
596     fi
597     fi
598     done
599 jmc 1.139 printf ' ;' 1>&2
600 jmc 1.83 if test -x "../"$ldir"/"prepare_run ; then
601 jmc 1.139 "../"$ldir"/"prepare_run 1>&2
602     else
603     echo '' 1>&2
604 edhill 1.24 fi
605 jmc 1.82 fi
606 jmc 1.108 prevDir=$ldir
607 jmc 1.83 done
608 edhill 1.12 )
609 edhill 1.1 fi
610     }
611    
612     runmodel()
613     {
614 edhill 1.6 # runmodel directory
615 edhill 1.1 #
616 jmc 1.135 # runs "$COMMAND in "directory"
617 edhill 1.6 # (where "$COMMAND" is relative to "directory")
618 edhill 1.1 (
619     cd $1
620 jmc 1.139 printf 'runmodel in %s ... ' $1
621 jmc 1.134 if test -L $EXECUTABLE ; then
622     if test -x "../"$builddir"/"$EXECUTABLE ; then
623 jmc 1.106 diff -q $EXECUTABLE "../"$builddir"/"$EXECUTABLE > /dev/null 2>&1
624 jmc 1.119 outD=$? ; if test $outD != 0 ; then rm -f $EXECUTABLE ; fi
625 jmc 1.134 else rm -f $EXECUTABLE
626     fi
627 jmc 1.106 fi
628 jmc 1.83 if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then
629 jmc 1.119 echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_tmp
630 jmc 1.83 ln -sf "../"$builddir"/"$EXECUTABLE .
631     fi
632     if test ! -x $EXECUTABLE ; then
633 jmc 1.119 rm -f $RUNLOG ; touch $RUNLOG
634     if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi
635     echo " no executable:" $EXECUTABLE >> $RUNLOG
636 jmc 1.83 RETVAL=8
637 jmc 1.88 ENDVAL=-1
638 jmc 1.75 else
639 jmc 1.98 if test ! -f $OUTPUTFILE -o $OUTPUTFILE -ot $EXECUTABLE ; then
640     # output do not exist or is older than executable:
641 jmc 1.119 rm -f $RUNLOG ; touch $RUNLOG
642     if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi
643     ( eval $COMMAND ) >> $RUNLOG 2>&1
644 jmc 1.83 RETVAL=$?
645     else
646     RETVAL=0
647 jmc 1.119 if test -f $RUNLOG ; then
648     if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi
649     echo "---------->> $OUTPUTFILE is up to date " >> $RUNLOG 2>&1
650 jmc 1.135 else
651 jmc 1.119 touch $RUNLOG
652     if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi
653     echo "---------->> $OUTPUTFILE is up to date " >> $RUNLOG 2>&1
654     echo " no previous $RUNLOG: assume NORMAL END" >> $RUNLOG 2>&1
655 jmc 1.88 fi
656 jmc 1.83 fi
657 jmc 1.153 #ENDVAL=`cat $RUNLOG | grep -v 'ABNORMAL END' | grep -c 'NORMAL END'`
658     ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'`
659 jmc 1.75 fi
660 jmc 1.119 rm -f run.log_tmp
661 jmc 1.88 if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then
662 jmc 1.139 echo successful
663     printf '=> output from running in %s :\n' $1 1>&2
664     tail $RUNLOG | sed 's/^.*/> &/g' 1>&2
665 edhill 1.44 # === Reduce the size of the testing emails!
666 jmc 1.87 #cp $OUTPUTFILE $CDIR"/"$OUTPUTFILE
667 jmc 1.48 if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
668 edhill 1.6 return 0
669 jmc 1.132 elif [ $RETVAL -ne 0 -a $ENDVAL -gt 0 ] ; then
670     #-- for some weird cases (run is finihed but with error code)
671 jmc 1.139 echo 'finished with error (run:' $RETVAL ' end:' $ENDVAL ')'
672     printf '=> output from running in %s :\n' $1 1>&2
673     tail $RUNLOG | sed 's/^.*/> &/g' 1>&2
674 jmc 1.132 return 0
675 edhill 1.6 else
676 jmc 1.139 echo 'failed (run:' $RETVAL ' end:' $ENDVAL ')'
677     printf '=> output from running in %s :\n' $1 1>&2
678     tail $RUNLOG | sed 's/^.*/> &/g' 1>&2
679 jmc 1.119 cp $RUNLOG $CDIR"/"$RUNLOG
680 jmc 1.48 if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
681 edhill 1.6 return 1
682 edhill 1.1 fi
683     )
684     }
685    
686     createcodelet()
687     {
688     # create codelet for comparing model output
689    
690 jmc 1.112 printf "creating the comparison code (using CC=$CC)... "
691 jmc 1.91 cat > tr_cmpnum.c <<EOF
692 edhill 1.22 #include <stdio.h>
693     #include <math.h>
694     int main( int argc, char** argv ) {
695 jmc 1.91 int linnum,cmplin,best,lncnt;
696 edhill 1.52 double a,b,abave,relerr;
697 jmc 1.57 best = -22;
698 adcroft 1.33 lncnt = 0;
699 jmc 1.96 while( 1 & ( (lncnt+=1) < 999 ) ) {
700 edhill 1.22 scanf("%d", &linnum);
701     if (linnum == -1) break;
702     scanf("%lf", &a); scanf("%lf", &b);
703 edhill 1.52 abave = 0.5*(fabs(a)+fabs(b));
704 jmc 1.91 if ( abave == abave ) {
705     if (abave > 0.0) {
706     relerr=fabs(a-b)/abave;
707     if (relerr > 0.0) { cmplin = (int)rint(log10(relerr)); }
708     else { cmplin = -16 ; }
709     best = (best > cmplin) ? best : cmplin; }
710     else { cmplin = -22 ; }
711     /* printf("%d ; %lf ; %lf\n",cmplin,a,b); */
712     }
713     else {
714     /* printf("%lf ; %lf ; %lf\n",abave,a,b); */
715     break; }
716 edhill 1.22 }
717 adcroft 1.33 if (lncnt == 999) best=-29;
718 jmc 1.91 if (linnum != -1) best=-99;
719 edhill 1.22 printf("%d\n", -best);
720     return 0;
721     }
722     EOF
723 jmc 1.91 $CC -o tr_cmpnum tr_cmpnum.c -lm
724 edhill 1.1
725 jmc 1.91 if [ -x ./tr_cmpnum ]; then
726 edhill 1.1 echo "OK"
727     return 0
728     else
729     echo
730 jmc 1.135 echo "ERROR: failed to compile comparison code -- please specify"
731 edhill 1.58 echo " a C compiler using the CC environment variable."
732 edhill 1.1 exit 1
733     fi
734     }
735    
736     formatresults()
737     {
738     # formatresults expt genmake depend make run results*
739    
740     nm=$1
741     printf '%s %s %s %s' $2 $3 $4 $5
742     shift; shift; shift; shift; shift;
743 jmc 1.94 listPrt=$@
744     listRes=`echo $listPrt | sed 's/>//' | sed 's/<//'`
745     xx=`echo $listPrt | sed 's/.*>//' | sed 's/<.*//' | awk '{print $1}'`
746 jmc 1.97 printf '%3s' $listPrt
747 jmc 1.98 # line below does not work on hp-ux_ia64 : do those substitutions later on
748 jmc 1.95 # printf '%3s' $listPrt | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</'
749 jmc 1.135
750 jmc 1.94 if [ $xx = '..' ]; then
751     printf ' N/O '
752     elif [ $xx = '--' ]; then
753     printf ' N/O '
754     elif [ $xx = 99 ]; then
755 edhill 1.1 printf ' N/O '
756     else
757 jmc 1.94 if [ $xx -ge $MATCH_CRIT ]; then
758 edhill 1.1 printf ' pass'
759     else
760     printf ' FAIL'
761     fi
762     fi
763     printf ' %s' $nm
764     printf '\n'
765 jmc 1.135
766 edhill 1.1 }
767    
768     scandirs()
769     {
770 jmc 1.81 if [ $# -eq 1 ]; then
771     for arg in * ; do
772 jmc 1.99 test -f $arg/$1 && echo $arg
773 jmc 1.81 done
774 edhill 1.1 else
775 jmc 1.81 echo $*
776 edhill 1.1 fi
777     }
778    
779    
780 jmc 1.123 check_eedata()
781     {
782     # check_eedata size.h eedata
783     if [ $# -eq 2 ] ; then
784     if test -f $1 -a -f $2 ; then
785     sx=`grep "^ & *nSx *=" $1 | sed "s/^ & *nSx *=//" | sed 's/, *$//'`
786     nx=`grep "^ *nTx *=" $2 | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"`
787     if test "x$nx" = x ; then
788     rx=10
789     else
790     rx=`expr $sx % $nx`
791     fi
792     sy=`grep "^ & *nSy *=" $1 | sed "s/^ & *nSy *=//" | sed 's/, *$//'`
793     ny=`grep "^ *nTy *=" $2 | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"`
794     if test "x$ny" = x ; then
795     ry=20
796     else
797     ry=`expr $sy % $ny`
798     fi
799     echo `expr $rx + $ry`
800     else
801     echo '-1'
802     fi
803     else
804     echo '-2'
805     fi
806    
807     }
808    
809 edhill 1.1 ###############################################################################
810    
811    
812     # Default properties
813     debug=0
814     verbose=1
815     clean=0
816 edhill 1.10
817 edhill 1.40 IEEE=true
818 edhill 1.10 if test "x$MITGCM_IEEE" != x ; then
819     IEEE=$MITGCM_IEEE
820     fi
821 jmc 1.109 GSL=f
822 edhill 1.10
823     CLEANUP=f
824 jmc 1.133 NORUN=f
825 edhill 1.10 QUICK=f
826 jmc 1.136 NOMAKE=f
827 edhill 1.10 NOGENMAKE=f
828     NOCLEAN=f
829     NODEPEND=f
830 edhill 1.68 POSTCLEAN=f
831 edhill 1.1
832 edhill 1.4 BASH=
833 edhill 1.10 OPTFILE=NONE
834     ADDRESSES=
835 edhill 1.1 TESTDIRS=
836 jmc 1.89 SKIPDIRS=
837 edhill 1.1 MPACKDIR="../tools/mpack-1.6"
838 edhill 1.20 HAVE_MPACK=
839 jmc 1.113 MPACK=
840 edhill 1.24 COMMAND=
841 jmc 1.141 MKDEPEND=
842 edhill 1.59 if test "x$MAKE" = x ; then
843     MAKE=make
844     fi
845     if test "x$CC" = x ; then
846     CC=cc
847     fi
848 edhill 1.43 JOBS=
849 edhill 1.7 MPI=f
850 jmc 1.83 MULTI_THREAD=f
851 jmc 1.70 OUTDIR=
852 edhill 1.40 DELDIR=
853 jmc 1.135 USE_R4=
854 edhill 1.1
855 edhill 1.24 ADM=
856 utke 1.120 OADM=
857 edhill 1.24
858 jmc 1.117 # list of pTracers to check for monitor output
859 edhill 1.50 PTRACERS_NUM="1 2 3 4 5"
860 edhill 1.49
861 jmc 1.147 MATCH_CRIT=10
862 jmc 1.92
863 edhill 1.34 printf "parsing options... "
864 edhill 1.1
865     ac_prev=
866     for ac_option ; do
867    
868     # If the previous option needs an argument, assign it.
869     if test -n "$ac_prev"; then
870     eval "$ac_prev=\$ac_option"
871     ac_prev=
872     continue
873     fi
874    
875     ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
876 jmc 1.135
877 edhill 1.1 case $ac_option in
878    
879     -help | --help | -h | --h)
880     usage ;;
881    
882 edhill 1.2 -optfile | --optfile | -of | --of)
883 edhill 1.10 ac_prev=OPTFILE ;;
884 edhill 1.2 -optfile=* | --optfile=* | -of=* | --of=*)
885 edhill 1.10 OPTFILE=$ac_optarg ;;
886 edhill 1.1
887     -addr | --addr | -a | --a)
888     ac_prev=ADDRESSES ;;
889 jmc 1.136 -addr=* | --addr=* | -a=* | --a=*)
890 edhill 1.1 ADDRESSES=$ac_optarg ;;
891 jmc 1.113 -mpackdir | --mpackdir | -mpd | --mpd)
892     ac_prev=MPACKDIR ;;
893     -mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*)
894     MPACKDIR=$ac_optarg ;;
895 edhill 1.1
896     -tdir | --tdir | -t | --t)
897     ac_prev=TESTDIRS ;;
898 jmc 1.136 -tdir=* | --tdir=* | -t=* | --t=*)
899 edhill 1.1 TESTDIRS=$ac_optarg ;;
900 edhill 1.4
901 jmc 1.89 -skipdir | --skipdir | -skd | --skd)
902     ac_prev=SKIPDIRS ;;
903 jmc 1.136 -skipdir=* | --skipdir=* | -skd=* | --skd=*)
904 jmc 1.89 SKIPDIRS=$ac_optarg ;;
905    
906 edhill 1.4 -bash | --bash | -b | --b)
907     ac_prev=BASH ;;
908 jmc 1.136 -bash=* | --bash=* | -b=* | --b=*)
909 edhill 1.4 BASH=$ac_optarg ;;
910 edhill 1.5
911 edhill 1.6 -command | --command | -c | --c)
912     ac_prev=COMMAND ;;
913 jmc 1.136 -command=* | --command=* | -c=* | --c=*)
914 edhill 1.6 COMMAND=$ac_optarg ;;
915 edhill 1.8
916 jmc 1.141 -makedepend | --makedepend | -md | --md)
917     ac_prev=MKDEPEND ;;
918     -makedepend=* | --makedepend=* | -md=* | --md=*)
919     MKDEPEND=$ac_optarg ;;
920    
921 edhill 1.8 -make | --make | -m | --m)
922     ac_prev=MAKE ;;
923 jmc 1.136 -make=* | --make=* | -m=* | --m=*)
924 edhill 1.8 MAKE=$ac_optarg ;;
925 edhill 1.1
926 jmc 1.70 -odir | --odir)
927     ac_prev=OUTDIR ;;
928     -odir=* | --odir=*)
929     OUTDIR=$ac_optarg ;;
930    
931 edhill 1.50 -ptracers | --ptracers | -ptr | --ptr)
932     ac_prev=PTRACERS_NUM ;;
933     -ptracers=* | --ptracers=* | -ptr=* | --ptr=*)
934     PTRACERS_NUM=$ac_optarg ;;
935    
936 jmc 1.92 -match | --match ) ac_prev=MATCH_CRIT ;;
937     -match=* | --match=* ) MATCH_CRIT=$ac_optarg ;;
938    
939 jmc 1.136 -j | --j) ac_prev=JOBS ;;
940     -j=* | --j=*) JOBS=$ac_optarg ;;
941 edhill 1.43
942 edhill 1.10 -clean | --clean)
943 jmc 1.69 CLEANUP=t ; DELDIR=t ;;
944 edhill 1.10
945 jmc 1.133 -norun | --norun | -nr | --nr)
946     NORUN=t ;;
947 jmc 1.136 -runonly | --runonly | -ro | --ro)
948     QUICK=t ; NOMAKE=t ;;
949 edhill 1.10 -quick | --quick | -q | --q)
950     QUICK=t ;;
951     -nogenmake | --nogenmake | -ng | --ng)
952     NOGENMAKE=t ;;
953     -noclean | --noclean | -nc | --nc)
954     NOCLEAN=t ;;
955     -nodepend | --nodepend | -nd | --nd)
956     NODEPEND=t ;;
957    
958 edhill 1.68 -postclean | --postclean | -pc | --pc)
959     POSTCLEAN=t ;;
960    
961 edhill 1.18 -mpi) MPI=t ;;
962 edhill 1.10
963 jmc 1.83 -mth) MULTI_THREAD=t ;;
964    
965 edhill 1.24 -adm | -ad) ADM=t ;;
966    
967 utke 1.120 -oad) OADM=t; NODEPEND=t ;;
968    
969 edhill 1.10 -ieee) IEEE=true ;;
970     -noieee) IEEE= ;;
971 jmc 1.109 -gsl) GSL=t ;;
972 edhill 1.10
973 edhill 1.1 -verbose) verbose=2 ;;
974     -debug) debug=1 ;;
975     -quiet) verbose=0 ;;
976    
977 edhill 1.40 -deldir | -dd) DELDIR=t ;;
978    
979 jmc 1.136 -use_r4|-ur4) USE_R4=t ;;
980 jmc 1.135
981 ce107 1.90 -ts) TS=t;;
982     -papis) PAPIS=t;;
983     -pcls) PCL=t;;
984    
985 edhill 1.1 -*)
986     echo "Error: unrecognized option: "$ac_option
987     usage
988     ;;
989 jmc 1.135
990 edhill 1.1 *)
991     echo "Error: unrecognized argument: "$ac_option
992     usage
993     ;;
994 jmc 1.135
995 edhill 1.1 esac
996 jmc 1.135
997 edhill 1.1 done
998    
999 edhill 1.10 if test "x$QUICK" = xt ; then
1000     NOGENMAKE=t
1001     NOCLEAN=t
1002     NODEPEND=t
1003     fi
1004    
1005 jmc 1.99 #- setting for forward or ADM testing
1006     if test "x$ADM" = xt ; then
1007     code_dir=code_ad
1008 jmc 1.108 inputdir=input_ad
1009 jmc 1.99 ref_outp="output_adm.txt"
1010     EXECUTABLE="mitgcmuv_ad"
1011 utke 1.120 elif test "x$OADM" = xt ; then
1012     code_dir=code_oad
1013     inputdir=input_oad
1014     ref_outp="output_oadm.txt"
1015     EXECUTABLE="mitgcmuv_ad"
1016 jmc 1.99 else
1017     code_dir=code
1018 jmc 1.108 inputdir=input
1019 jmc 1.99 ref_outp="output.txt"
1020     EXECUTABLE="mitgcmuv"
1021     fi
1022    
1023 jmc 1.142 xx=`echo $TESTDIRS | awk '{print $1}'`
1024 edhill 1.1 if test "x$TESTDIRS" = x ; then
1025 jmc 1.103 LIST=`scandirs results/$ref_outp`
1026 jmc 1.142 elif test $xx = 'start_from' ; then
1027     xx=`echo $TESTDIRS | awk '{print $2}'`
1028     LIST=`scandirs results/$ref_outp | sed -n "/$xx/,$ p"`
1029 jmc 1.84 else
1030     #- expand group of experiments:
1031     LIST=" "
1032     for xx in $TESTDIRS
1033     do
1034     case $xx in
1035 jmc 1.86 'basic') LIST=${LIST}" aim.5l_cs hs94.128x64x5 ideal_2D_oce"
1036     LIST=${LIST}" lab_sea tutorial_baroclinic_gyre"
1037     LIST=${LIST}" tutorial_global_oce_latlon tutorial_plume_on_slope"
1038 jmc 1.84 ;;
1039     'tutorials')
1040     LIST=${LIST}" "`ls | grep 'tutorial_'` ;;
1041     *) LIST=${LIST}" "$xx ;;
1042     esac
1043 jmc 1.135 done
1044 jmc 1.89 fi
1045     #echo 'LIST='${LIST}'<'
1046     #- skip dirs, remove duplicate and non-directory:
1047     TESTDIRS=" "
1048     count=0
1049     for xx in $LIST
1050     do
1051     yy=`echo $SKIPDIRS | grep -c $xx`
1052     if test $yy = 0 ; then
1053 jmc 1.84 if test -d $xx ; then
1054     yy=`echo $TESTDIRS | grep -c $xx`
1055     if test $yy = 0 ; then TESTDIRS=${TESTDIRS}" "$xx ; fi
1056 jmc 1.89 else count=1 ;
1057     echo ""; echo -n " -- skip \"$xx\" (not a directory !)"
1058     fi
1059     else
1060     if test $count = 1 ; then echo -n ", \"$xx\""
1061     else count=1 ; echo "" ; echo -n " skip: \"$xx\""
1062 jmc 1.84 fi
1063 jmc 1.89 fi
1064 jmc 1.135 done
1065 jmc 1.89 if test $count = 1 ; then echo "" ; echo -n " ... " ; fi
1066 jmc 1.84 #echo 'TESTDIRS='${TESTDIRS}'<'
1067 edhill 1.1
1068 edhill 1.10 if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then
1069     OPTFILE=$MITGCM_OF
1070     fi
1071    
1072 jmc 1.146 RUNLOG="run.tr_log"
1073 jmc 1.99 OUTPUTFILE=$ref_outp
1074 jmc 1.87 if test "x$COMMAND" = x ; then
1075 jmc 1.77 COMMAND="./$EXECUTABLE > $OUTPUTFILE"
1076 edhill 1.24 fi
1077 jmc 1.87 if test "x$MPI" = xt ; then
1078     OUTPUTFILE="STDOUT.0000"
1079 edhill 1.24 fi
1080    
1081 jmc 1.76 echo "OK (COMMAND= $COMMAND )"
1082 edhill 1.1
1083 jmc 1.94 # set the Default List of output variables to be checked:
1084     # (use default or load experiment-specific list from file "tr_checklist")
1085     # content : 1rst = main variable used to decide if it pass or FAIL
1086     # others = number of matching digits to be printed in summary.txt
1087 utke 1.120 if test "x$ADM" = x -a "x$OADM" = x; then
1088 jmc 1.94 DEF_CHECK_LIST='PS PS T+ S+ U+ V+ pt1+ pt2+ pt3+ pt4+ pt5+'
1089     EMPTY_RESULTS='.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..'
1090 jmc 1.97 LEN_CHECK_LIST=`echo $DEF_CHECK_LIST | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' | awk '{print NF-1}'`
1091 jmc 1.94 ii=`echo $EMPTY_RESULTS | awk '{print NF}'`
1092 jmc 1.97 EMPTY_RESULTS=$EMPTY_RESULTS`expr $LEN_CHECK_LIST - $ii | awk 'BEGIN{FS=":"}{for(i=1;i<=$1;i++){printf " ."}}'`
1093 jmc 1.99 else
1094 jmc 1.103 DEF_CHECK_LIST='Grad Cost Grad'
1095 jmc 1.99 EMPTY_RESULTS='.. ..'
1096     LEN_CHECK_LIST=`echo $DEF_CHECK_LIST | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' | awk '{print NF-1}'`
1097 jmc 1.94 fi
1098    
1099 edhill 1.1 # create the FORTRAN comparison code
1100 jmc 1.133 if test -x tr_cmpnum ; then
1101     echo "skipping comparison code build"
1102     else
1103     createcodelet
1104     fi
1105 edhill 1.1
1106 jmc 1.112 # build the mpack utility (if ADDRESSES = NONE, do it to test the build)
1107     if test "x$ADDRESSES" = x ; then
1108 edhill 1.32 echo "skipping mpack build"
1109     else
1110 edhill 1.31 build_mpack
1111     fi
1112 edhill 1.1
1113     # Create a uniquely named directory to store results
1114 jmc 1.110 CMDLINE=$0
1115 jmc 1.118 for xx in "$@" ; do nw=`echo $xx | wc -w`
1116     if test $nw = '1' ; then CMDLINE="$CMDLINE $xx"
1117     else CMDLINE="$CMDLINE '$xx'" ; fi
1118     done
1119     #for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done
1120 edhill 1.1 MACH=`hostname`
1121 edhill 1.2 UNAMEA=`uname -a`
1122 edhill 1.1 DATE=`date +%Y%m%d`
1123 edhill 1.25 BASE="tr_"$MACH"_"$DATE"_"
1124 jmc 1.70 if test "x$OUTDIR" != x ; then
1125     BASE="tr_"$OUTDIR"_"$DATE"_"
1126 jmc 1.121 else
1127     short_name=`hostname | sed 's/\..*$//'`
1128     BASE="tr_"$short_name"_"$DATE"_"
1129 jmc 1.70 fi
1130 edhill 1.1 DNUM=0
1131     DRESULTS="$BASE$DNUM"
1132     while test -e $DRESULTS ; do
1133     DNUM=$(( $DNUM + 1 ))
1134     DRESULTS="$BASE$DNUM"
1135     done
1136     mkdir $DRESULTS
1137     RETVAL=$?
1138     if test "x$RETVAL" != x0 ; then
1139 edhill 1.20 echo "ERROR: Can't create results directory \"./$DRESULTS\""
1140 edhill 1.1 exit 1
1141     fi
1142     SUMMARY="$DRESULTS/summary.txt"
1143 edhill 1.16 start_date=`date`
1144 edhill 1.17 echo $start_date > $SUMMARY
1145 jmc 1.110 echo 'run:' $CMDLINE >> $SUMMARY
1146     echo 'on :' $UNAMEA >> $SUMMARY
1147 edhill 1.1
1148 edhill 1.11 of_path=
1149 edhill 1.10 if test "x$OPTFILE" != xNONE ; then
1150     if test -r $OPTFILE ; then
1151 edhill 1.11 # get the path
1152     path=${OPTFILE%/*}
1153     if test "x$path" = x ; then
1154     of_path=`pwd`
1155     else
1156     of_path=`( cd $path > /dev/null 2>&1 ; pwd )`
1157     fi
1158     file=${OPTFILE##*/}
1159     OPTFILE=$of_path/$file
1160 edhill 1.21 cp $OPTFILE $DRESULTS
1161     echo >> $SUMMARY
1162     echo " OPTFILE=$OPTFILE" >> $SUMMARY
1163 edhill 1.11 else
1164 edhill 1.21 echo | tee $SUMMARY
1165     echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee $SUMMARY
1166     exit 1
1167 edhill 1.10 fi
1168 edhill 1.21 else
1169     echo >> $SUMMARY
1170 jmc 1.152 echo "No \"OPTFILE\" was specified ; genmake2 found and uses:" >> $SUMMARY
1171     #-note: to be filled later after 1rst run
1172 edhill 1.10 fi
1173     echo
1174     echo >> $SUMMARY
1175 utke 1.120 if test "x$ADM" = x -a "x$OADM" = x; then
1176 jmc 1.135 if [ $MATCH_CRIT -lt 10 ] ;
1177     then line_0="default "$MATCH_CRIT ;
1178 jmc 1.94 else line_0="default "$MATCH_CRIT ; fi
1179     line_0="$line_0 ----T----- ----S----- ----U----- ----V-----"
1180 edhill 1.49 line_1="G D M c m s m s m s m s"
1181     line_2="E p a R g m m e . m m e . m m e . m m e ."
1182     line_3="N n k u 2 i a a d i a a d i a a d i a a d"
1183     line_4="2 d e n d n x n . n x n . n x n . n x n ."
1184 edhill 1.50 for ii in $PTRACERS_NUM ; do
1185 edhill 1.49 line_0="$line_0 --PTR 0"$ii"--"
1186     line_1="$line_1 m s"
1187     line_2="$line_2 m m e ."
1188     line_3="$line_3 i a a d"
1189     line_4="$line_4 n x n ."
1190     done
1191     echo "$line_0" | tee -a $SUMMARY
1192     echo "$line_1" | tee -a $SUMMARY
1193     echo "$line_2" | tee -a $SUMMARY
1194     echo "$line_3" | tee -a $SUMMARY
1195     echo "$line_4" | tee -a $SUMMARY
1196     echo " " | tee -a $SUMMARY
1197 edhill 1.24 else
1198     echo "ADJOINT=true" >> $SUMMARY
1199     echo >> $SUMMARY
1200 jmc 1.135 if [ $MATCH_CRIT -lt 10 ] ;
1201     then line_0="default "$MATCH_CRIT ;
1202 jmc 1.103 else line_0="default "$MATCH_CRIT ; fi
1203 jmc 1.100 echo "$line_0" | tee -a $SUMMARY
1204 edhill 1.24 cat << EOF | tee -a $SUMMARY
1205     G D M C G
1206     E p a R o r
1207     N n k u s a
1208     2 d e n t d
1209    
1210     EOF
1211     fi
1212 jmc 1.139 echo "-------------------------------------------------------------------------------"
1213 edhill 1.1
1214 edhill 1.10 # ...and each test directory...
1215     for dir in $TESTDIRS ; do
1216 jmc 1.135
1217 jmc 1.106 # set builddir & rundir:
1218     builddir="build"
1219     if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi
1220     rundir="run"
1221 jmc 1.143 pfxdir="tr_$rundir"
1222 jmc 1.106 if test ! -d $dir/$rundir ; then
1223     rundir=$builddir
1224     fi
1225     CODE_DIR=$dir/$code_dir
1226     BUILD_DIR=$dir/$builddir
1227    
1228 edhill 1.10 # Cleanup only!
1229     if test "x$CLEANUP" = xt ; then
1230 jmc 1.127 echo -n ' --- dir:' $BUILD_DIR ': '
1231     makeclean $BUILD_DIR
1232 jmc 1.145 ( cd $BUILD_DIR
1233     rm -f $EXECUTABLE *.bak
1234 jmc 1.146 rm -f genmake_state genmake_*optfile genmake.log
1235     rm -f genmake.tr_log make.tr_log
1236 jmc 1.145 )
1237 jmc 1.106 if test -d $dir/$rundir/CVS ; then
1238 jmc 1.127 echo -n ' --- dir:' $dir/$rundir ': '
1239 jmc 1.106 run_clean $dir/$rundir
1240 edhill 1.10 fi
1241 jmc 1.143 trdir=`( cd $dir ; find . -type d -name "$pfxdir.*" -print | sed 's/^.\///')`
1242 jmc 1.127 ttd=`echo $trdir | wc -w`
1243     if test $ttd != 0 ; then
1244     echo ' --- rm dir:' $trdir
1245     ( cd $dir ; rm -rf $trdir )
1246     fi
1247 edhill 1.10 continue
1248 edhill 1.1 fi
1249 edhill 1.3
1250 jmc 1.135 # Verify that the testdir exists and contains previous
1251 edhill 1.10 # results in the correct location--or skip this directory!
1252 jmc 1.104 fout=$dir"/results/"$ref_outp
1253 edhill 1.24 if test ! -r $fout ; then
1254     echo "can't read \"$fout\" -- skipping $dir"
1255 edhill 1.10 continue
1256     fi
1257 edhill 1.7
1258 jmc 1.117 # Check for specific files for particular type of run
1259 edhill 1.49
1260 edhill 1.30 if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then
1261 edhill 1.28 echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"
1262     continue
1263     fi
1264 jmc 1.83 if test ! -r $dir"/input/eedata.mth" -a "x$MULTI_THREAD" = "xt" ; then
1265     echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir"
1266     continue
1267     fi
1268 jmc 1.123 if test "x$MPI" = "xt" -a "x$MULTI_THREAD" = "xt" ; then
1269     retv=`check_eedata $CODE_DIR"/SIZE.h_mpi" $dir"/input/eedata.mth"`
1270     if test $retv != 0 ; then
1271     echo "input/eedata.mth tiling misfit -- skipping $dir"
1272     continue
1273     fi
1274     fi
1275 jmc 1.83
1276     # Check whether there are "extra runs" for this testdir
1277     extra_runs=
1278 jmc 1.133 if test "x$NORUN" = xf ; then
1279     ex_run_dirs=`( cd $dir ; echo $inputdir.* )`
1280     fi
1281 jmc 1.108 #echo "ex_run_dirs='$ex_run_dirs'"
1282     for exd in $ex_run_dirs ; do
1283     name=`echo $exd | sed -e "s/$inputdir\.//"`
1284     refExOut=`echo $ref_outp | sed "s/\./.${name}./"`
1285     outf="$dir/results/$refExOut"
1286     if test -f $outf -a -r $outf ; then
1287 jmc 1.135 if test "x$MULTI_THREAD" = "xt" ; then
1288 jmc 1.123 if test -r $dir"/"$exd"/eedata.mth" ; then
1289     if test "x$MPI" = "xt" ; then
1290     retv=`check_eedata $CODE_DIR"/SIZE.h_mpi" $dir"/"$exd"/eedata.mth"`
1291     if test $retv = 0 ; then
1292 jmc 1.83 extra_runs="$extra_runs $name"
1293 jmc 1.123 else
1294     echo $exd"/eedata.mth tiling misfit -- skipping $dir"
1295 jmc 1.83 fi
1296 jmc 1.123 else
1297 jmc 1.108 extra_runs="$extra_runs $name"
1298 jmc 1.123 fi
1299     #else echo $dir"/"$exd"/eedata.mth: not found"
1300 jmc 1.83 fi
1301 jmc 1.123 else
1302     extra_runs="$extra_runs $name"
1303     fi
1304 jmc 1.108 fi
1305     done
1306 edhill 1.28
1307     echo
1308 jmc 1.135 if test "x$extra_runs" = "x" ; then
1309 jmc 1.83 echo "Experiment: $dir"
1310     else
1311     echo "Experiment: $dir ; extra_runs=$extra_runs"
1312     fi
1313 edhill 1.28 echo
1314     unset genmake makedepend make run
1315 jmc 1.94 results=$EMPTY_RESULTS
1316 edhill 1.10
1317     # Create an output dir for each OPTFILE/tdir combination
1318 jmc 1.138 locDIR=$DRESULTS"/"$dir
1319     mkdir $locDIR
1320     CDIR=`pwd`"/$locDIR"
1321 jmc 1.135
1322 jmc 1.133 if test "x$NORUN" = xt ; then
1323     run=N
1324     genmakemodel $dir/$builddir && genmake=Y \
1325     && makeclean $dir/$builddir \
1326     && symlink_mpifiles $dir $code_dir $builddir \
1327     && makedependmodel $dir/$builddir && makedepend=Y \
1328     && makemodel $dir/$builddir && make=Y
1329 edhill 1.10 else
1330 edhill 1.1 genmakemodel $dir/$builddir && genmake=Y \
1331     && makeclean $dir/$builddir \
1332 edhill 1.27 && symlink_mpifiles $dir $code_dir $builddir \
1333 edhill 1.1 && makedependmodel $dir/$builddir && makedepend=Y \
1334     && makemodel $dir/$builddir && make=Y \
1335 jmc 1.139 && run_clean $dir/$rundir \
1336 jmc 1.140 && linkdata $dir/$rundir $inputdir \
1337 edhill 1.12 && runmodel $dir/$rundir && run=Y \
1338 jmc 1.99 && results=`testoutput_run $dir $rundir $ref_outp`
1339 edhill 1.10 fi
1340 jmc 1.139 #echo "results='$results'"
1341 jmc 1.135
1342 edhill 1.24 fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1343 jmc 1.139 echo 1>&2
1344 jmc 1.98 echo "$fres" | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</' >> $SUMMARY
1345 jmc 1.138 touch $locDIR"/summary.txt"
1346     echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt"
1347     echo "MACH='$MACH'" >> $locDIR"/summary.txt"
1348     echo "UNAMEA='$UNAMEA'" >> $locDIR"/summary.txt"
1349     echo "DATE='$DATE'" >> $locDIR"/summary.txt"
1350     echo "tdir='$dir'" >> $locDIR"/summary.txt"
1351 jmc 1.108 if test "x$ADM" = xt ; then
1352 jmc 1.138 head -1 $dir/$builddir/taf_ad.log >> $locDIR"/summary.txt"
1353 jmc 1.108 grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \
1354 jmc 1.138 >> $locDIR"/summary.txt"
1355 jmc 1.108 fi
1356 edhill 1.34
1357     for ex in $extra_runs ; do
1358 jmc 1.73 unset run
1359 jmc 1.94 results=$EMPTY_RESULTS
1360 jmc 1.106 # reference output file
1361     refExOut=`echo $ref_outp | sed "s/\./.${ex}./g"`
1362 jmc 1.73 # Create an output dir for each OPTFILE/tdir.ex combination
1363 jmc 1.138 locDIR=$DRESULTS"/"$dir"."$ex
1364     mkdir $locDIR
1365     CDIR=`pwd`"/$locDIR"
1366 jmc 1.143 test ! -e "$dir/$pfxdir.$ex" && mkdir "$dir/$pfxdir.$ex"
1367     run_clean $dir/$pfxdir.$ex
1368     linkdata $dir/$pfxdir.$ex $inputdir.$ex $inputdir
1369     runmodel $dir/$pfxdir.$ex && run=Y \
1370     && results=`testoutput_run $dir $pfxdir.$ex $refExOut`
1371 edhill 1.34 fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1372     fres="$fres.$ex"
1373 jmc 1.139 echo 1>&2
1374 jmc 1.100 echo "$fres" | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</' >> $SUMMARY
1375 jmc 1.138 touch $locDIR"/summary.txt"
1376     echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt"
1377     echo "MACH='$MACH'" >> $locDIR"/summary.txt"
1378     echo "UNAMEA='$UNAMEA'" >> $locDIR"/summary.txt"
1379     echo "DATE='$DATE'" >> $locDIR"/summary.txt"
1380     echo "tdir='$dir.$ex'" >> $locDIR"/summary.txt"
1381 jmc 1.108 if test "x$ADM" = xt ; then
1382 jmc 1.138 head -1 $dir/$builddir/taf_ad.log >> $locDIR"/summary.txt"
1383 jmc 1.143 grep -A3 'Seconds in section "ALL' $dir/$pfxdir.$ex/$OUTPUTFILE \
1384 jmc 1.138 >> $locDIR"/summary.txt"
1385 jmc 1.108 fi
1386 jmc 1.83 if test "x$POSTCLEAN" = xt ; then
1387 jmc 1.143 run_clean $dir/$pfxdir.$ex
1388 jmc 1.83 fi
1389 edhill 1.34 done
1390 edhill 1.68
1391 jmc 1.139 if test -f $DRESULTS"/"genmake_state ; then : ; else
1392 jmc 1.137 if test -f $dir/$builddir/Makefile ; then
1393     mkOpt=`grep '^# OPTFILE=' $dir/$builddir/Makefile 2>/dev/null | head -1 | sed 's/^# //'`
1394     echo "from '$dir/$builddir/Makefile', extract:" > $DRESULTS/genmake_state
1395     sed -n '/^# executed by:/,+1 p' $dir/$builddir/Makefile >> $DRESULTS/genmake_state
1396 jmc 1.151 echo " $mkOpt" >> $DRESULTS/genmake_state
1397 jmc 1.152 if test "x$OPTFILE" = xNONE ; then
1398     eval $mkOpt
1399     sed "/^No \"OPTFILE\" was specified ; genmake2/a\ OPTFILE=${OPTFILE}"\
1400     $SUMMARY > tr_0.tmp_log
1401     RETVAL=$?
1402     if test "x$RETVAL" = x0 ; then rm -f $SUMMARY
1403     cp tr_0.tmp_log $SUMMARY
1404     else rm -f tr_0.tmp_log
1405     fi
1406     fi
1407 jmc 1.150 gmkLog=$dir/$builddir/genmake.log
1408     grep '^Get compiler version using:' $gmkLog > /dev/null 2>&1
1409     RETVAL=$?
1410     if test "x$RETVAL" = x0 ; then
1411     echo "from '$gmkLog', extract compiler version:" >> $DRESULTS/genmake_state
1412 jmc 1.151 sed -n '/Get compiler version/,/<-- compiler version/p' $gmkLog \
1413 jmc 1.152 | grep -v '^... compiler version ' > tr_1.tmp_log
1414     sed -n '1,/^$/p' tr_1.tmp_log | sed '/^$/d' | sed 's/^./ &/' \
1415 jmc 1.151 >> $DRESULTS/genmake_state
1416 jmc 1.152 rm -f tr_1.tmp_log
1417 jmc 1.150 fi
1418 jmc 1.137 fi
1419     fi
1420 jmc 1.83 #postclean $dir/$builddir
1421     if test "x$POSTCLEAN" = xt ; then
1422     makeclean $dir/$builddir \
1423     && run_clean $dir/$rundir
1424     fi
1425 jmc 1.135
1426 edhill 1.10 echo "-------------------------------------------------------------------------------"
1427 jmc 1.135
1428 edhill 1.1 done
1429    
1430 edhill 1.34 printf "Start time: " >> $SUMMARY
1431 jmc 1.114 echo "$start_date" >> $SUMMARY
1432 edhill 1.34 printf "End time: " >> $SUMMARY
1433 edhill 1.13 date >> $SUMMARY
1434 edhill 1.20
1435     # If addresses were supplied and mpack built successfully, then try
1436     # to send email using mpack.
1437     if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then
1438     echo "No results email was sent."
1439     else
1440     if test "x$HAVE_MPACK" = xt ; then
1441     tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \
1442     && gzip $DRESULTS".tar" \
1443 edhill 1.44 && $MPACK -s MITgcm-test -m 3555000 $DRESULTS".tar.gz" $ADDRESSES
1444 edhill 1.20 RETVAL=$?
1445     if test "x$RETVAL" != x0 ; then
1446     echo
1447     echo "Warning: The tar, gzip, & mpack step failed. Please send email"
1448     echo " to <MITgcm-support@mitgcm.org> for help. You may copy the "
1449     echo " summary of results from the directory \"$DRESULTS\"."
1450     echo
1451     else
1452     echo
1453     echo "An email containing results was sent to the following addresses:"
1454     echo " \"$ADDRESSES\""
1455     echo
1456 jmc 1.129 test -f $DRESULTS".tar" && rm -f $DRESULTS".tar"
1457     test -f $DRESULTS".tar.gz" && rm -f $DRESULTS".tar.gz"
1458 edhill 1.20 fi
1459     fi
1460     fi
1461 edhill 1.13
1462 jmc 1.133 if test "x$QUICK" = xf -a "x$NORUN" = xf ; then
1463     rm -f tr_cmpnum.c tr_cmpnum
1464     fi
1465 edhill 1.1
1466 edhill 1.12 if test "x$CLEANUP" != xt ; then
1467 jmc 1.102 cat $SUMMARY | sed 's/ \. \. \. \. \. \. \. \. \. \. \. \. //'
1468 edhill 1.25 if test -e tr_out.txt ; then
1469     mv tr_out.txt tr_out.txt.old
1470 edhill 1.14 fi
1471 jmc 1.103 cat $SUMMARY | sed '/^[YN] [YN] [YN] [YN]/ s/ \. //g' > tr_out.txt
1472 edhill 1.12 fi
1473 edhill 1.1
1474 edhill 1.40 if test "x$DELDIR" = xt ; then
1475     rm -rf $DRESULTS
1476     fi
1477    

  ViewVC Help
Powered by ViewVC 1.1.22