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

Diff of /MITgcm/verification/testreport

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

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

Legend:
Removed from v.1.52  
changed lines
  Added in v.1.158

  ViewVC Help
Powered by ViewVC 1.1.22