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

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

  ViewVC Help
Powered by ViewVC 1.1.22