/[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.48 by jmc, Wed Nov 17 21:38:35 2004 UTC revision 1.88 by jmc, Tue Aug 29 00:18:35 2006 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 "  (-mpi)                   compile and run using MPI"
16      echo "  (-ieee|-noieee)          if possible, use IEEE compiler flags"      echo "  (-ieee|-noieee)          if possible, use IEEE compiler flags"
17      echo "                             (DEF=\"-ieee\")"      echo "                             (DEF=\"-ieee\")"
18      echo "  (-optfile=|-of=)STRING   list of optfiles to use"      echo "  (-optfile=|-of=)STRING   list of optfiles to use"
19      echo "  (-a|-addr) STRING        list of email recipients"      echo "  (-a|-addr) STRING        list of email recipients"
20      echo "                             (DEF=\"edhill@mitgcm.org\")"      echo "                             (DEF=\"edhill@mitgcm.org\")"
21      echo "  (-t|-tdir) STRING        list of test dirs to use"      echo "  (-t|-tdir) STRING        list of group and/or exp. dirs to test"
22      echo "                             (DEF=\"\" which builds all)"      echo "                             (recognized groups: basic, tutorials)"
23        echo "                             (DEF=\"\" which test all)"
24      echo "  (-b|-bash) STRING        preferred location of a \"bash\" or"      echo "  (-b|-bash) STRING        preferred location of a \"bash\" or"
25      echo "                             Bourne-compatible \"sh\" shell"      echo "                             Bourne-compatible \"sh\" shell"
26      echo "                             (DEF=\"\" for \"bash\")"      echo "                             (DEF=\"\" for \"bash\")"
# Line 27  usage() Line 29  usage()
29      echo "                             (DEF=\"make output.txt\")"      echo "                             (DEF=\"make output.txt\")"
30      echo "  (-m|-make) STRING        command to use for \"make\""      echo "  (-m|-make) STRING        command to use for \"make\""
31      echo "                             (DEF=\"make\")"      echo "                             (DEF=\"make\")"
32        echo "  (-odir) STRING           used to build output directory name"
33        echo "                             (DEF=\"hostname\")"
34        echo "  (-ptracers|-ptr) STRING  specify which ptracers to test"
35        echo "                             (DEF=\"1 2 3 4 5\")"
36      echo "  (-j) JOBS                use \"make -j JOBS\" for parallel builds"      echo "  (-j) JOBS                use \"make -j JOBS\" for parallel builds"
37      echo "  (-clean)                 *ONLY* run \"make CLEAN\""      echo "  (-clean)                 *ONLY* run \"make CLEAN\""
38      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""      echo "  (-quick|-q)              same as \"-nogenmake -noclean -nodepend\""
# Line 35  usage() Line 41  usage()
41      echo "  (-nodepend|-nd)          skip the \"make depend\" stage"      echo "  (-nodepend|-nd)          skip the \"make depend\" stage"
42      echo "  (-deldir|-dd)            on success, delete the output directory"      echo "  (-deldir|-dd)            on success, delete the output directory"
43      echo      echo
44      echo "and where STRING follows a whitespace-delimited format"      echo "and where STRING can be a whitespace-delimited list"
45      echo "such as:"      echo "such as:"
46        echo
47      echo "  -t 'exp0 exp2 exp3' "      echo "  -t 'exp0 exp2 exp3' "
48      echo "  -addr='abc@123.com testing@home.org'"      echo "  -addr='abc@123.com testing@home.org'"
49      echo      echo
50        echo "provided that the expression is properly quoted within the current"
51        echo "shell (note the use of single quotes to protect white space)."
52        echo
53      exit 1      exit 1
54  }  }
55    
# Line 81  testoutput_for_prop() Line 91  testoutput_for_prop()
91  {  {
92      # testoutput_for_prop dir s1 label subdir extension      # testoutput_for_prop dir s1 label subdir extension
93      #      #
94      #  compares files in $dir/$subdir/output.txt and $dir/results/output.txt      #  compares files $dir/$subdir/$OUTPUTFILE and $dir/results/output.txt
95      #  using search strings s1 and text label      #  using search strings s1 and text label
96    
97      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
98          echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2          echo testoutput_for_prop: grep "$2" $1/$4/$OUTPUTFILE 1>&2
99      fi      fi
100      if [ -r $1/$4/output.txt ]; then      if [ -r $1/$4/$OUTPUTFILE ]; then
101          grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt          grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > tmp1.txt
102          lncnt=`wc -l tmp1.txt | awk '{print $1}' `          lncntA=`wc -l tmp1.txt | awk '{print $1}' `
103          if [ $lncnt -lt 3 ]; then          if [ $lncntA -lt 3 ]; then
104              if [ $verbose -gt 0 ]; then              if [ $verbose -gt 0 ]; then
105                  echo Not enough lines of output when searching for "$2" 1>&2                  echo Not enough lines of output when searching for "$2" 1>&2
106              fi              fi
107              return 99              return 99
108          fi          fi
109      else      else
110          echo testoutput_for_prop: output.txt from model run was not readable 1>&2          echo testoutput_for_prop: $OUTPUTFILE from model run was not readable 1>&2
111          return 99          return 99
112      fi      fi
113      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
114          echo testoutput_for_prop: grep "$2" $1/results/output.txt$5 1>&2          echo testoutput_for_prop: grep "$2" $1/results/output.$5 1>&2
115      fi      fi
116      grep "$2" $1/results/output.txt$5 | sed 's/.*=//' | cat -n > tmp2.txt      grep "$2" $1/results/output.$5 | sed 's/.*=//' | cat -n > tmp2.txt
117      lncnt=`wc -l tmp2.txt | awk '{print $1}' `      lncntB=`wc -l tmp2.txt | awk '{print $1}' `
118      if [ $lncnt -lt 3 ]; then      if [ $lncntB -lt 3 ]; then
119          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
120              echo Not enough lines of output when searching for "$2" 1>&2              echo Not enough lines of output when searching for "$2" 1>&2
121          fi          fi
122          return 99          return 99
123      fi      fi
124        if [ $lncntA -ne $lncntB ]; then
125            if [ $verbose -gt 0 ]; then
126                echo Not same Nb of lines when searching for "$2" ":" $lncntA $lncntB 1>&2
127            fi
128            return 99
129        fi
130        has_nan=`cat tmp1.txt | grep -i nan | wc -l`
131        if [ $has_nan -gt 0  ] ; then
132            echo testoutput_for_prop: $OUTPUTFILE contains $has_nan NaN values  1>&2
133            return 99
134        fi
135        has_inf=`cat tmp1.txt | grep -i inf | wc -l`
136        if [ $has_inf -gt 0  ] ; then
137            echo testoutput_for_prop: $OUTPUTFILE contains $has_inf Inf values  1>&2
138            return 99
139        fi
140      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
141          echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2          echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2
142      fi      fi
# Line 157  dashnum() Line 183  dashnum()
183    
184  testoutput_ad()  testoutput_ad()
185  {  {
186      grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $5}' > t05.txt      grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $5}' > t05.txt
187      grep $3 $1/$2/output.txt_adm | awk '{print NR " " $5}' > t15.txt      grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $5}' > t15.txt
188      grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $6}' > t06.txt      grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $6}' > t06.txt
189      grep $3 $1/$2/output.txt_adm | awk '{print NR " " $6}' > t16.txt      grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $6}' > t16.txt
190      join t05.txt t15.txt > t5.txt      join t05.txt t15.txt > t5.txt
191      join t06.txt t16.txt > t6.txt      join t06.txt t16.txt > t6.txt
192      echo "-1" >> t5.txt      echo "-1" >> t5.txt
# Line 171  testoutput_ad() Line 197  testoutput_ad()
197      rm -f t[01][56].txt t[56].txt      rm -f t[01][56].txt t[56].txt
198  }  }
199    
200    check_for_add_mon_output()
201    {
202        # Check for additional types of monitor output
203        if test "x$1" = x ; then
204            return
205        fi
206    
207        for ii in $PTRACERS_NUM ; do
208            eval "HAVE_PTR0"$ii"=f"
209        done
210    
211        ptr_add="trcstat_ptracerXX_min trcstat_ptracerXX_max"
212        ptr_add="$ptr_add trcstat_ptracerXX_mean trcstat_ptracerXX_sd"
213        for ii in $PTRACERS_NUM ; do
214            for jj in $ptr_add ; do
215                name=`eval "echo $jj | sed -e 's|XX|0"$ii"|g'"`
216                tst=`grep $name $1 | wc -l | awk '{print $1}'`
217                if test ! "x$tst" = x0 ; then
218                    eval "HAVE_PTR0"$ii"=t"
219                fi
220            done
221            #  eval 'echo "HAVE_PTR0'$ii' = $HAVE_PTR0'$ii'"'
222        done
223    }
224    
225  testoutput()  testoutput()
226  {  {
227      # testoutput directory subdir extension      # testoutput directory subdir extension
# Line 200  testoutput() Line 251  testoutput()
251          testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2 $3; vmax=$?          testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2 $3; vmax=$?
252          testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2 $3; vmean=$?          testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2 $3; vmean=$?
253          testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2 $3; vsd=$?          testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2 $3; vsd=$?
254          dashnum $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \  
255              $umin $umax $umean $usd $vmin $vmax $vmean $vsd          #  This is for PTRACERS
256            for ii in $PTRACERS_NUM ; do
257                eval `echo "p0"$ii"_min=99"`
258                eval `echo "p0"$ii"_max=99"`
259                eval `echo "p0"$ii"_mean=99"`
260                eval `echo "p0"$ii"_sd=99"`
261                tst=`eval 'echo "$HAVE_PTR0'$ii'"'`
262                #echo 'tst = '$tst
263                if test "x$tst" = xt ; then
264                    a="trcstat_ptracer0"
265                    testoutput_for_prop $1 "$a"$ii"_min"  "p0"$ii"_min"  $2 $3
266                    RETVAL=$? ; eval `echo "p0"$ii"_min="$RETVAL`
267                    testoutput_for_prop $1 "$a"$ii"_max"  "p0"$ii"_max"  $2 $3
268                    RETVAL=$? ; eval `echo "p0"$ii"_max="$RETVAL`
269                    testoutput_for_prop $1 "$a"$ii"_mean" "p0"$ii"_mean" $2 $3
270                    RETVAL=$? ; eval `echo "p0"$ii"_mean="$RETVAL`
271                    testoutput_for_prop $1 "$a"$ii"_sd"   "p0"$ii"_sd"   $2 $3
272                    RETVAL=$? ; eval `echo "p0"$ii"_sd="$RETVAL`
273                fi
274            done
275    
276            allargs="$cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd"
277            allargs="$allargs $umin $umax $umean $usd $vmin $vmax $vmean $vsd"
278            allargs="$allargs $p01_min $p01_max $p01_mean $p01_sd"
279            allargs="$allargs $p02_min $p02_max $p02_mean $p02_sd"
280            allargs="$allargs $p03_min $p03_max $p03_mean $p03_sd"
281            allargs="$allargs $p04_min $p04_max $p04_mean $p04_sd"
282            allargs="$allargs $p05_min $p05_max $p05_mean $p05_sd"
283    
284            eval "dashnum $allargs"
285    
286      else      else
287          testoutput_ad $1 $2 "precision_grdchk_result"          testoutput_ad $1 $2 "precision_grdchk_result"
288      fi      fi
# Line 225  genmakemodel() Line 306  genmakemodel()
306                  command="$command --mods=../code"                  command="$command --mods=../code"
307              else              else
308                  command="$command --mods=../code_ad"                  command="$command --mods=../code_ad"
                 command="$command -adof=../../../tools/adjoint_options/adjoint_staf"  
309              fi              fi
310              if test "x$OPTFILE" != xNONE ; then              if test "x$OPTFILE" != xNONE ; then
311                  command="$command --optfile=$OPTFILE"                  command="$command --optfile=$OPTFILE"
# Line 233  genmakemodel() Line 313  genmakemodel()
313              if test "x$IEEE" != x ; then              if test "x$IEEE" != x ; then
314                  command="$command -ieee"                  command="$command -ieee"
315              fi              fi
316                if test "x$MPI" = xt ; then
317                    command="$command -mpi"
318                fi
319              printf 'genmake ... ' 1>&2              printf 'genmake ... ' 1>&2
320              $command > make.log 2>&1              $command > make.log 2>&1
321              RETVAL=$?              RETVAL=$?
# Line 254  makeclean() Line 337  makeclean()
337  {  {
338      # makeclean directory      # makeclean directory
339      if test "x$NOCLEAN" = xt ; then      if test "x$NOCLEAN" = xt ; then
340          echo "make CLEAN skipped!"          echo "make Clean skipped!"
341      else      else
342          (          (
343              cd $1;              cd $1;
344              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  
345              if test -r Makefile ; then              if test -r Makefile ; then
346                  $MAKE CLEAN >> make.log 2>&1                  printf 'clean build-dir: make Clean ... ' 2>&1
347                    $MAKE Clean >> make.log 2>&1
348                  RETVAL=$?                  RETVAL=$?
349                  if test "x$RETVAL" != x0 ; then                  if test "x$RETVAL" != x0 ; then
350                      tail make.log                      tail make.log
351                      echo "makeclean: \"make CLEAN\" failed" 1>&2                      echo "makeclean: \"make Clean\" failed" 1>&2
352                      cp make.log $CDIR"/make.log"                      cp make.log $CDIR"/make.log"
353                      return 1                      return 1
354                  fi                  fi
# Line 278  makeclean() Line 359  makeclean()
359      fi      fi
360  }  }
361    
362    run_clean()
363    {
364        # run_clean directory
365        if test "x$NOCLEAN" = xt ; then
366            echo "run_clean skipped!"
367        else
368            (
369                cd $1;
370                printf 'clean run-dir ... ' 2>&1
371                # part of what is done after "make clean" when doing "make CLEAN"
372                find . -name "*.meta" -exec rm {} \;
373                find . -name "*.data" -exec rm {} \;
374                find . -name "fort.*" -exec rm {} \;
375                find . -type l -exec rm {} \;
376                rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime
377                rm -rf mnc_test_*
378                echo successful 1>&2
379                exit 0
380            )
381        fi
382    }
383    
384  makedependmodel()  makedependmodel()
385  {  {
386      # makedependmodel directory      # makedependmodel directory
# Line 380  symlink_mpifiles() Line 483  symlink_mpifiles()
483    
484  linkdata()  linkdata()
485  {  {
486      # linkdata flag      # linkdata run_dir input_dir_1 input_dir_2 ...
487      #      #
488      # symbolically link data files to run directory      # symbolically link data files to run directory
489      if test "x$1" = x1 ; then      if test -d $1 ; then
490          (          (
491              cd $2              cd $1 ; shift
492              if test "x$ADM" = x ; then              if test -r "../"$1"/eedata.mth" ; then
493                  files=`( cd ../input ; ls -1 | grep -v CVS )`              # found eedata.mth in 1rst input dir and it is readable
494                  for i in $files ; do                  if test "x$MULTI_THREAD" = "xt" ; then
495                      if test ! -d "../input/"$i ; then                  # multi-threaded test: remove symbolic link & link eedata.mth
496                          ln -sf "../input/"$i $i                      if test -h eedata ; then rm -f eedata ; fi
497                      fi                      if test ! -r eedata ; then
498                  done                          ln -sf "../"$1"/eedata.mth" eedata ;
499              else                          printf 'eedata.mth ' 1>&2
                 files=`( cd ../input ; ls -1 *.bin | grep -v CVS )`  
                 for i in $files ; do  
                     if test ! -d "../input/"$i ; then  
                         ln -sf "../input/"$i $i  
                     fi  
                 done  
                 files=`( cd ../input_ad ; ls -1 | grep -v CVS )`  
                 for i in $files ; do  
                     if test ! -d "../input_ad/"$i ; then  
                         ln -sf "../input_ad/"$i $i  
500                      fi                      fi
501                  done                  else
502                    # not multi-threaded test: remove eedata symbolic link
503                        if test -h eedata ; then rm -f eedata ; fi
504                    fi
505              fi              fi
506                for ldir in $* ; do
507                    if test -d "../"$ldir ; then
508                        printf 'ldir='${ldir} 1>&2
509                        files=`( cd "../"$ldir ; ls -1 | grep -v CVS )`
510                        for i in $files ; do
511                            if test ! -d "../"$ldir/$i ; then
512                                if test ! -r $i  ; then
513                                    printf ' '$i 1>&2
514                                    ln -sf "../"$ldir"/"$i $i
515                                fi
516                            fi
517                        done
518                        if test -x "../"$ldir"/"prepare_run ; then
519                            "../"$ldir"/"prepare_run
520                        fi
521                        printf ' ; ' 1>&2
522                    fi
523                done
524          )          )
525      fi      fi
526  }  }
# Line 419  runmodel() Line 533  runmodel()
533      #  (where "$COMMAND" is relative to "directory")      #  (where "$COMMAND" is relative to "directory")
534      (      (
535          cd $1          cd $1
536          printf 'runmodel ... ' 1>&2          printf 'runmodel in %s ...' $1 1>&2
537          # make output.txt          # make output.txt
538          echo          echo
539          rm -f run.log          if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then
540          # echo "COMMAND='$COMMAND'"              echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_00
541          # echo "pwd='"`pwd`"'"              ln -sf "../"$builddir"/"$EXECUTABLE .
542          ( eval $COMMAND ) > run.log 2>&1          fi
543          RETVAL=$?          if test ! -x $EXECUTABLE ; then
544          if test "x$RETVAL" = x0 ; then                  rm -f run.log ; touch run.log
545                    if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi
546                    echo " no executable:" $EXECUTABLE >> run.log
547                    RETVAL=8
548                    ENDVAL=-1
549            else
550                if test $OUTPUTFILE -ot $EXECUTABLE ; then
551                    rm -f run.log ; touch run.log
552                    if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi
553                    ( eval $COMMAND ) >> run.log 2>&1
554                    RETVAL=$?
555                else
556                    RETVAL=0
557                    if test -f run.log ; then
558                        if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi
559                        echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1
560                    else
561                        touch run.log
562                        if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi
563                        echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1
564                        echo " no previous run.log: assume NORMAL END" >> run.log 2>&1
565                    fi
566                fi
567                ENDVAL=`cat run.log | grep -v 'ABNORMAL END' | grep -c 'NORMAL END'`
568            fi
569            rm -f run.log_00
570            #if test "x$RETVAL" = x0 ; then
571            if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then
572              tail run.log              tail run.log
573              echo successful 1>&2              echo successful 1>&2
574              # === Reduce the size of the testing emails!              # === Reduce the size of the testing emails!
575              # if test "x$ADM" = x ; then              #cp $OUTPUTFILE $CDIR"/"$OUTPUTFILE
             #   cp output.txt $CDIR"/output.txt"  
             # else  
             #   cp output.txt_adm $CDIR"/output.txt_adm"  
             # fi  
576              if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi              if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
577              return 0              return 0
578          else          else
579              tail run.log              tail run.log
580              echo failed 1>&2              echo failed '(run:' $RETVAL ' end:' $ENDVAL ')' 1>&2
581              cp run.log $CDIR"/run.log"              cp run.log $CDIR"/run.log"
582              if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi              if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi
583              return 1              return 1
# Line 458  createcodelet() Line 595  createcodelet()
595  #include <math.h>  #include <math.h>
596  int main( int argc, char** argv )  {  int main( int argc, char** argv )  {
597    int linnum,best,lncnt;    int linnum,best,lncnt;
598    double a,b,diff;    double a,b,abave,relerr;
599    best = -16;    best = -22;
600    lncnt = 0;    lncnt = 0;
601    while( 1 & (lncnt+=1) < 999 )  {    while( 1 & (lncnt+=1) < 999 )  {
602      scanf("%d", &linnum);      scanf("%d", &linnum);
603      if (linnum == -1)  break;      if (linnum == -1)  break;
604      scanf("%lf", &a);  scanf("%lf", &b);      scanf("%lf", &a);  scanf("%lf", &b);
605      diff = 0.5*(fabs(a)+fabs(b));      abave = 0.5*(fabs(a)+fabs(b));
606      if (diff > 1.e-12) {      if (abave > 0.0) {
607        diff=fabs(a-b)/diff;        relerr=fabs(a-b)/abave;
608        if (diff > 0.0) {        if (relerr > 0.0) { linnum = (int)rint(log10(relerr)); }
609          linnum = (int)log10(diff);        else { linnum = -16 ; }
610          best = (best > linnum) ? best : linnum;        best = (best > linnum) ? best : linnum;
       }  
       else {  
         if (best == -16 && diff != 0)  best = -22;  
       }  
611      }      }
612    }    }
613    if (lncnt == 999) best=-29;    if (lncnt == 999) best=-29;
# Line 482  int main( int argc, char** argv )  { Line 615  int main( int argc, char** argv )  {
615    return 0;    return 0;
616  }  }
617  EOF  EOF
618      cc -o tmp_cmpnum tmp_cmpnum.c -lm      $CC -o tmp_cmpnum tmp_cmpnum.c -lm
619    
620      if [ -x ./tmp_cmpnum ]; then      if [ -x ./tmp_cmpnum ]; then
621          echo "OK"          echo "OK"
622          return 0          return 0
623      else      else
624          echo          echo
625          echo "ERROR: failed to compile comparison code"          echo "ERROR: failed to compile comparison code -- please specify"
626            echo "  a C compiler using the CC environment variable."
627          exit 1          exit 1
628      fi      fi
629  }  }
# Line 538  EOF Line 672  EOF
672    
673  scandirs()  scandirs()
674  {  {
675      if [ $# -eq 0 ]; then      if [ $# -eq 1 ]; then
676          for arg in * ; do          for arg in * ; do
677              test -d $arg/input && echo $arg              test -d $arg/$1 && echo $arg
678          done          done
679      else      else
680          echo $*          echo $*
681      fi      fi
682  }  }
683    
# Line 569  QUICK=f Line 703  QUICK=f
703  NOGENMAKE=f  NOGENMAKE=f
704  NOCLEAN=f  NOCLEAN=f
705  NODEPEND=f  NODEPEND=f
706    POSTCLEAN=f
707    
708  BASH=  BASH=
709  OPTFILE=NONE  OPTFILE=NONE
# Line 578  MPACKDIR="../tools/mpack-1.6" Line 713  MPACKDIR="../tools/mpack-1.6"
713  HAVE_MPACK=  HAVE_MPACK=
714  MPACK="$MPACKDIR/mpack"  MPACK="$MPACKDIR/mpack"
715  COMMAND=  COMMAND=
716  MAKE=make  if test "x$MAKE" = x ; then
717        MAKE=make
718    fi
719    if test "x$CC" = x ; then
720        CC=cc
721    fi
722  JOBS=  JOBS=
723  MPI=f  MPI=f
724    MULTI_THREAD=f
725    OUTDIR=
726  DELDIR=  DELDIR=
727    
728  ADM=  ADM=
729    
730    # Additional monitor types
731    PTRACERS_NUM="1 2 3 4 5"
732    
733  printf "parsing options...  "  printf "parsing options...  "
734    
735  ac_prev=  ac_prev=
# Line 634  for ac_option ; do Line 779  for ac_option ; do
779          -make=* | --make=*)          -make=* | --make=*)
780              MAKE=$ac_optarg ;;              MAKE=$ac_optarg ;;
781    
782            -odir | --odir)
783                ac_prev=OUTDIR ;;
784            -odir=* | --odir=*)
785                OUTDIR=$ac_optarg ;;
786    
787            -ptracers | --ptracers | -ptr | --ptr)
788                ac_prev=PTRACERS_NUM ;;
789            -ptracers=* | --ptracers=* | -ptr=* | --ptr=*)
790                PTRACERS_NUM=$ac_optarg ;;
791    
792          -j) ac_prev=JOBS ;;          -j) ac_prev=JOBS ;;
793          -j=*) JOBS=$ac_optarg ;;          -j=*) JOBS=$ac_optarg ;;
794    
795          -clean | --clean)          -clean | --clean)
796              CLEANUP=t ;;              CLEANUP=t ; DELDIR=t ;;
797    
798          -quick | --quick | -q | --q)          -quick | --quick | -q | --q)
799              QUICK=t ;;              QUICK=t ;;
# Line 649  for ac_option ; do Line 804  for ac_option ; do
804          -nodepend | --nodepend | -nd | --nd)          -nodepend | --nodepend | -nd | --nd)
805              NODEPEND=t ;;              NODEPEND=t ;;
806    
807            -postclean | --postclean | -pc | --pc)
808                POSTCLEAN=t ;;
809    
810          -mpi) MPI=t ;;          -mpi) MPI=t ;;
811    
812            -mth) MULTI_THREAD=t ;;
813    
814          -adm | -ad) ADM=t ;;          -adm | -ad) ADM=t ;;
815    
816          -ieee) IEEE=true ;;          -ieee) IEEE=true ;;
# Line 683  if test "x$QUICK" = xt ; then Line 843  if test "x$QUICK" = xt ; then
843  fi  fi
844    
845  if test "x$TESTDIRS" = x ; then  if test "x$TESTDIRS" = x ; then
846      TESTDIRS=`scandirs`      if test "x$ADM" = xt ; then
847            TESTDIRS=`scandirs results_ad`
848        else
849            TESTDIRS=`scandirs results`
850        fi
851    else
852        #- expand group of experiments:
853        LIST=" "
854        for xx in $TESTDIRS
855        do
856          case $xx in
857            'basic') LIST=${LIST}" aim.5l_cs hs94.128x64x5 ideal_2D_oce"
858                     LIST=${LIST}" lab_sea tutorial_baroclinic_gyre"
859                     LIST=${LIST}" tutorial_global_oce_latlon tutorial_plume_on_slope"
860                    ;;
861            'tutorials')
862                     LIST=${LIST}" "`ls | grep 'tutorial_'` ;;
863            *)       LIST=${LIST}" "$xx ;;
864          esac
865        done
866        #echo 'LIST='${LIST}'<'
867        #- remove duplicate and non-directory:
868        TESTDIRS=" "
869        for xx in $LIST
870        do
871            if test -d $xx ; then
872                yy=`echo $TESTDIRS | grep -c $xx`
873                if test $yy = 0 ; then TESTDIRS=${TESTDIRS}" "$xx ; fi
874            else
875                echo " -- skip \"$xx\" : not a directory !"
876            fi
877        done
878  fi  fi
879    #echo 'TESTDIRS='${TESTDIRS}'<'
880    
881  if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then  if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then
882      OPTFILE=$MITGCM_OF      OPTFILE=$MITGCM_OF
883  fi  fi
884    
885  if test "x$ADM" = xt -a "x$COMMAND" = x ; then  if test "x$ADM" = xt ; then
886      COMMAND="./mitgcmuv_ad > output.txt_adm 2>&1"      EXECUTABLE="mitgcmuv_ad"
887        OUTPUTFILE="output_adm.txt"
888    else
889        EXECUTABLE="mitgcmuv"
890        OUTPUTFILE="output.txt"
891  fi  fi
892    
893  if test "x$COMMAND" = x ; then  if test "x$COMMAND" = x ; then
894      COMMAND="$MAKE output.txt"      COMMAND="./$EXECUTABLE > $OUTPUTFILE"
895    fi
896    if test "x$MPI" = xt ; then
897        OUTPUTFILE="STDOUT.0000"
898  fi  fi
899    
900  echo "OK"  #echo "OK"
901    echo "OK (COMMAND= $COMMAND )"
902    
903  #  create the FORTRAN comparison code  #  create the FORTRAN comparison code
904  createcodelet  createcodelet
# Line 715  MACH=`hostname` Line 915  MACH=`hostname`
915  UNAMEA=`uname -a`  UNAMEA=`uname -a`
916  DATE=`date +%Y%m%d`  DATE=`date +%Y%m%d`
917  BASE="tr_"$MACH"_"$DATE"_"  BASE="tr_"$MACH"_"$DATE"_"
918    if test "x$OUTDIR" != x ; then
919        BASE="tr_"$OUTDIR"_"$DATE"_"
920    fi
921  DNUM=0  DNUM=0
922  DRESULTS="$BASE$DNUM"  DRESULTS="$BASE$DNUM"
923  while test -e $DRESULTS ; do  while test -e $DRESULTS ; do
# Line 760  fi Line 963  fi
963  echo  echo
964  echo >> $SUMMARY  echo >> $SUMMARY
965  if test "x$ADM" = x ; then  if test "x$ADM" = x ; then
966      cat << EOF | tee -a $SUMMARY      line_0="            ----T-----  ----S-----  ----U-----  ----V-----"
967                  T           S           U           V      line_1="G D M    c        m  s        m  s        m  s        m  s"
968  G D M    c        m  s        m  s        m  s        m  s      line_2="E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  ."
969  E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  .      line_3="N n k u  2  i  a  a  d  i  a  a  d  i  a  a  d  i  a  a  d"
970  N n k u  2  i  a  a  d  i  a  a  d  i  a  a  d  i  a  a  d      line_4="2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  ."
971  2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  .      for ii in $PTRACERS_NUM ; do
972            #  tst=`eval 'echo $HAVE_PTR0'$ii`
973  EOF          #  if test "x$tst" = xt ; then
974            line_0="$line_0  --PTR 0"$ii"--"
975            line_1="$line_1        m  s"
976            line_2="$line_2  m  m  e  ."
977            line_3="$line_3  i  a  a  d"
978            line_4="$line_4  n  x  n  ."
979            #  fi
980        done
981        echo "$line_0" | tee -a $SUMMARY
982        echo "$line_1" | tee -a $SUMMARY
983        echo "$line_2" | tee -a $SUMMARY
984        echo "$line_3" | tee -a $SUMMARY
985        echo "$line_4" | tee -a $SUMMARY
986        echo " "       | tee -a $SUMMARY
987  else  else
988      echo "ADJOINT=true" >> $SUMMARY      echo "ADJOINT=true" >> $SUMMARY
989      echo >> $SUMMARY      echo >> $SUMMARY
# Line 786  for dir in $TESTDIRS ; do Line 1002  for dir in $TESTDIRS ; do
1002      #  Cleanup only!      #  Cleanup only!
1003      if test "x$CLEANUP" = xt ; then      if test "x$CLEANUP" = xt ; then
1004          if test -r $dir/build/Makefile ; then          if test -r $dir/build/Makefile ; then
1005                echo '  ------  clean dir:' $dir/build
1006              ( cd $dir/build ; make CLEAN )              ( cd $dir/build ; make CLEAN )
1007          fi          fi
1008          if test -r $dir/input/Makefile ; then          if test -d $dir/run/CVS ; then
1009              ( cd $dir/input ; make CLEAN )              echo '  ------  clean dir:' $dir/run
1010                run_clean $dir/run
1011          fi          fi
1012            (
1013                cd $dir
1014                rm -rf tr_run.*
1015            )
1016          continue          continue
1017      fi      fi
1018    
# Line 800  for dir in $TESTDIRS ; do Line 1022  for dir in $TESTDIRS ; do
1022      if test "x$ADM" = x ; then      if test "x$ADM" = x ; then
1023          fout=$dir"/results/output.txt"          fout=$dir"/results/output.txt"
1024      else      else
1025          fout=$dir"/results_ad/output.txt_adm"          fout=$dir"/results_ad/output_adm.txt"
1026      fi      fi
1027      if test ! -r $fout ; then      if test ! -r $fout ; then
1028          echo "can't read \"$fout\" -- skipping $dir"          echo "can't read \"$fout\" -- skipping $dir"
1029          continue          continue
1030      fi      fi
1031        if test "x$ADM" = x ; then
1032            check_for_add_mon_output  $fout
1033        fi
1034    
1035        # Check for additional types of monitor output
1036    
1037      builddir="input"      builddir="build"
1038      rundir="input"      if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi
1039      use_seperate_build=0      rundir="run"
1040      if test -d $dir/build -a -r $dir/build ; then     #rundir=$builddir
1041          builddir="build"      if test ! -d $dir/$rundir ; then
1042          rundir="build"          rundir=$builddir
         use_seperate_build=1  
         linkdata $use_seperate_build $dir/$rundir  
1043      fi      fi
1044            
     #  Check whether there are "extra runs" for this testdir  
     extra_runs=  
     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  
     fi  
   
1045      if test "x$ADM" = x ; then      if test "x$ADM" = x ; then
1046          code_dir=code          code_dir=code
1047          CODE_DIR=$dir/code          CODE_DIR=$dir/code
1048            input_dirs='input'
1049      else      else
1050          code_dir=code_ad          code_dir=code_ad
1051          CODE_DIR=$dir/code_ad          CODE_DIR=$dir/code_ad
1052            input_dirs='input_ad input'
1053      fi      fi
1054      BUILD_DIR=$dir/$builddir      BUILD_DIR=$dir/$builddir
1055    
# Line 844  for dir in $TESTDIRS ; do Line 1057  for dir in $TESTDIRS ; do
1057          echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"          echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir"
1058          continue          continue
1059      fi      fi
1060        if test ! -r $dir"/input/eedata.mth" -a "x$MULTI_THREAD" = "xt" ; then
1061            echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir"
1062            continue
1063        fi
1064    
1065        #  Check whether there are "extra runs" for this testdir
1066        extra_runs=
1067        if test "x$ADM" = x ; then
1068            ex_run_dirs=`( cd $dir ; echo input.* )`
1069            #echo "ex_run_dirs='$ex_run_dirs'"
1070            for exd in $ex_run_dirs ; do
1071                name=`echo $exd | sed -e 's/input.//g'`
1072                outf="$dir/results/output.$name.txt"
1073                if test -f $outf -a -r $outf ; then
1074                    if test "x$MULTI_THREAD" = "xt" ; then
1075                        if test -r $dir"/"$exd"/eedata.mth" ; then
1076                            extra_runs="$extra_runs $name"
1077                        #else echo $dir"/"$exd"/eedata.mth: not found"
1078                        fi
1079                    else
1080                        extra_runs="$extra_runs $name"
1081                    fi
1082                fi
1083            done
1084        fi
1085    
1086      echo "-------------------------------------------------------------------------------"      echo "-------------------------------------------------------------------------------"
1087      echo      echo
1088      echo "Experiment:  $dir"      if test "x$extra_runs" = "x" ; then
1089           echo "Experiment:  $dir"
1090        else
1091           echo "Experiment:  $dir ; extra_runs=$extra_runs"
1092        fi
1093      echo      echo
1094      unset genmake makedepend make run      unset genmake makedepend make run
1095      results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'      results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
1096    
1097      #  Create an output dir for each OPTFILE/tdir combination      #  Create an output dir for each OPTFILE/tdir combination
1098      rel_CDIR=$DRESULTS"/"$dir      rel_CDIR=$DRESULTS"/"$dir
# Line 858  for dir in $TESTDIRS ; do Line 1100  for dir in $TESTDIRS ; do
1100      CDIR=`pwd`"/$rel_CDIR"      CDIR=`pwd`"/$rel_CDIR"
1101            
1102      if test "x$CLEANUP" = xt ; then      if test "x$CLEANUP" = xt ; then
1103          makeclean $dir/$builddir          echo '====>>> this is to check that we never go through this part <<< ==='
1104            makeclean $dir/$builddir \
1105                && run_clean $dir/$rundir
1106      else      else
1107          genmakemodel $dir/$builddir && genmake=Y \          genmakemodel $dir/$builddir && genmake=Y \
1108              && makeclean $dir/$builddir \              && makeclean $dir/$builddir \
1109                && run_clean $dir/$rundir \
1110              && symlink_mpifiles $dir $code_dir $builddir \              && symlink_mpifiles $dir $code_dir $builddir \
1111              && makedependmodel $dir/$builddir && makedepend=Y \              && makedependmodel $dir/$builddir && makedepend=Y \
1112              && makemodel $dir/$builddir && make=Y \              && makemodel $dir/$builddir && make=Y \
1113              && linkdata $use_seperate_build $dir/$rundir \              && linkdata $dir/$rundir $input_dirs \
1114              && runmodel $dir/$rundir && run=Y \              && runmodel $dir/$rundir && run=Y \
1115              && results=`testoutput $dir $rundir`              && results=`testoutput $dir $rundir "txt"`
1116      fi      fi
1117            
1118      echo      echo
# Line 881  for dir in $TESTDIRS ; do Line 1126  for dir in $TESTDIRS ; do
1126          echo "DATE='$DATE'" >> $CDIR"/summary.txt"          echo "DATE='$DATE'" >> $CDIR"/summary.txt"
1127          echo "tdir='$dir'" >> $CDIR"/summary.txt"          echo "tdir='$dir'" >> $CDIR"/summary.txt"
1128    
         OLD_COMMAND=$COMMAND  
         COMMAND="./mitgcmuv > output.txt"  
1129          for ex in $extra_runs ; do          for ex in $extra_runs ; do
1130              test -e "$dir/tr_run.$ex" && rm -rf "$dir/tr_run.$ex"              unset run
1131              mkdir "$dir/tr_run.$ex"              results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'
1132              links=`( cd "$dir/input" > /dev/null 2>&1 ; ls -1 | grep -v CVS )`              #  Create an output dir for each OPTFILE/tdir.ex combination
1133              (              rel_CDIR=$DRESULTS"/"$dir"."$ex
1134                  cd "$dir/tr_run.$ex"              mkdir $rel_CDIR
1135                  for i in $links; do              CDIR=`pwd`"/$rel_CDIR"
1136                      ln -s ../input/$i $i              test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex"
1137                  done              run_clean $dir/tr_run.$ex
1138              )              linkdata $dir/tr_run.$ex input.$ex input
             links=`( cd "$dir/input.$ex" > /dev/null 2>&1 ; ls -1 | grep -v CVS )`  
             (  
                 cd "$dir/tr_run.$ex"  
                 for i in $links; do  
                     test -e $i  &&  rm -f $i  
                     ln -s ../input.$ex/$i $i  
                 done  
                 ln -s ../$builddir/mitgcmuv mitgcmuv  
             )  
1139              runmodel $dir/tr_run.$ex && run=Y \              runmodel $dir/tr_run.$ex && run=Y \
1140                  && results=`testoutput $dir tr_run.$ex "."$ex`                  && results=`testoutput $dir tr_run.$ex ${ex}".txt"`
1141              fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`              fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`
1142              fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`              fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results`
1143              fres="$fres.$ex"              fres="$fres.$ex"
# Line 913  for dir in $TESTDIRS ; do Line 1147  for dir in $TESTDIRS ; do
1147              echo "MACH='$MACH'" >> $CDIR"/summary.txt"              echo "MACH='$MACH'" >> $CDIR"/summary.txt"
1148              echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"              echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
1149              echo "DATE='$DATE'" >> $CDIR"/summary.txt"              echo "DATE='$DATE'" >> $CDIR"/summary.txt"
1150              echo "tdir='$dir'" >> $CDIR"/summary.txt"              echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt"
1151                if test "x$POSTCLEAN" = xt ; then
1152                    run_clean $dir/tr_run.$ex
1153                fi
1154          done          done
         COMMAND=$OLD_COMMAND  
1155      else      else
1156          fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`          fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}`
1157          fres=$fres"$results   $dir"          fres=$fres"$results   $dir"
# Line 926  for dir in $TESTDIRS ; do Line 1162  for dir in $TESTDIRS ; do
1162          echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"          echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt"
1163          echo "DATE='$DATE'" >> $CDIR"/summary.txt"          echo "DATE='$DATE'" >> $CDIR"/summary.txt"
1164          echo "tdir='$dir'" >> $CDIR"/summary.txt"          echo "tdir='$dir'" >> $CDIR"/summary.txt"
1165            grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \
1166                               >> $CDIR"/summary.txt"
1167        fi
1168    
1169        #postclean $dir/$builddir
1170        if test "x$POSTCLEAN" = xt ; then
1171            makeclean $dir/$builddir \
1172                && run_clean $dir/$rundir
1173      fi      fi
1174            
1175      echo "-------------------------------------------------------------------------------"      echo "-------------------------------------------------------------------------------"
# Line 968  fi Line 1212  fi
1212  rm -f tmp_cmpnum.c tmp_cmpnum  rm -f tmp_cmpnum.c tmp_cmpnum
1213    
1214  if test "x$CLEANUP" != xt ; then  if test "x$CLEANUP" != xt ; then
1215      cat $SUMMARY      cat $SUMMARY | sed 's/ -- -- -- --//g'
1216      if test -e tr_out.txt ; then      if test -e tr_out.txt ; then
1217          mv tr_out.txt tr_out.txt.old          mv tr_out.txt tr_out.txt.old
1218      fi      fi
1219      cat $SUMMARY > tr_out.txt      cat $SUMMARY | sed 's/ -- -- -- --//g' > tr_out.txt
1220  fi  fi
1221    
1222  if test "x$DELDIR" = xt ; then  if test "x$DELDIR" = xt ; then

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.88

  ViewVC Help
Powered by ViewVC 1.1.22