/[MITgcm]/MITgcm/verification/testscript
ViewVC logotype

Diff of /MITgcm/verification/testscript

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

revision 1.1 by adcroft, Fri Mar 9 17:56:37 2001 UTC revision 1.7 by adcroft, Fri Jun 29 18:28:44 2001 UTC
# Line 1  Line 1 
1  #!/bin/csh  #!/bin/csh -f
2    
3  # Run this script from the verification directory  # Run this script from the verification directory
4  # It will automatically configure, compile, run and verify all experiments  # It will automatically configure, compile, run and verify all experiments
# Line 8  Line 8 
8  # This is the number of least-significant digits allows to be  # This is the number of least-significant digits allows to be
9  # in error before the test is classified as a "fail".  # in error before the test is classified as a "fail".
10    
11  set passaccuracy=7  set on_error_die
12  printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\n' " " Make " " " " Exact "# of" " " > summary.txt  set digitsOfAccuracy=8
13  printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\n' Config Depend Compile Execute Match Digits experiment >> summary.txt  set SKIP=( )
14    printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' " " Make " " " " Exact "# of" " " " " > summary.txt
15    printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' Config Depend Compile Execute Match Digits Status Experiment >> summary.txt
16    
17  # Pass any arguments  # Pass any arguments
18  foreach arg ($argv)  foreach arg ($argv)
# Line 30  foreach arg ($argv) Line 32  foreach arg ($argv)
32     end     end
33     rm -f summary.txt     rm -f summary.txt
34     exit 0     exit 0
35       breaksw
36      case -nodie:
37       unset on_error_die
38       breaksw
39      case -skip=*:
40       set SKIP = ( $SKIP `echo $arg | sed 's/-skip=//' | sed 's/,/ /g' `)
41       breaksw
42    default:    default:
43     echo Unknown argument given to $0     echo Unknown argument given to $0
44     exit 1     exit 1
45   endsw   endsw
46  end  end
47    
48    # Need to make sure we don't meet non-model problems ...
49    unlimit
50    
51  foreach dr ([a-zA-Z01-9]*)  foreach dr ([a-zA-Z01-9]*)
52    
53   if (! -d $dr/input ) continue   if (! -d $dr/input ) continue
54     foreach skip ($SKIP)
55      if ( `echo $dr | sed s/$skip.'*'//` == '' ) continue;continue
56     end
57   set config=-   set config=-
58   set makedepend=-   set makedepend=-
59   set compile=-   set compile=-
60   set execute=-   set execute=-
61   set exactmatch=-   set exactmatch=-
62   set accuracy=-   set accuracy=-
63     set pass=FAIL
64   echo ==============================================================================   echo ==============================================================================
65   echo Entering $dr   echo Entering $dr
66   cd $dr   cd $dr
# Line 54  foreach dr ([a-zA-Z01-9]*) Line 71  foreach dr ([a-zA-Z01-9]*)
71    set untested=($untested $dr)    set untested=($untested $dr)
72   else   else
73    set config=NO    set config=NO
   set makedepend=NO  
   set compile=NO  
   set execute=NO  
   set exactmatch=NO  
   set accuracy=-  
74    cd input    cd input
75    echo -n "  generating Makefile ..."    echo -n "  generating Makefile ..."
76    ../../../tools/genmake -mods=../code >&! make.log    ../../../tools/genmake -mods=../code >&! make.log
77    if ($status == 0) set config=Yes    if ($status == 0) set config=Yes
78      set makedepend=NO
79    echo " done."    echo " done."
80    echo -n "  make depend ..."    echo -n "  make depend ..."
81    make cleanlinks depend >>& make.log    make cleanlinks depend >>& make.log
# Line 73  foreach dr ([a-zA-Z01-9]*) Line 86  foreach dr ([a-zA-Z01-9]*)
86    if ($status) then    if ($status) then
87     echo "               ***** An error occurred during make *****"     echo "               ***** An error occurred during make *****"
88     cat make.log     cat make.log
89     exit 1     echo The error during compilation occured in \"$dr\"
90       set compile=NO
91       if ($?on_error_die) exit 1
92    else    else
93     set compile=Yes     set compile=Yes
94       set execute=NO
95    endif    endif
96    echo " done."    echo " done."
97    echo -n "  running model ..."    echo -n "  running model ..."
98    ./mitgcmuv | & grep "D iters" > output.txt    if ($compile == 'Yes') then
99      ./mitgcmuv > & output.txt
100    if ($status == 0) then    if ($status == 0) then
101      set execute=Yes      set execute=Yes
102        set exactmatch=NO
103        set accuracy=-
104      echo " done."      echo " done."
105      sed 's/.*D iters, err =//' output.txt \  
106      | grep "   0    " \  # Compare output based on cg2d residual
107      > high.txt      grep "cg2d_init_res" output.txt | sed 's/.*=//' | nl > high.txt
108      grep "D iters" ../results/output.txt \      grep "cg2d_init_res" ../results/output.txt | sed 's/.*=//' | nl > oldhigh.txt
109       | sed 's/.*D iters, err =//' \      join high.txt oldhigh.txt > low.txt
110       | grep "   0    " \      set nlines=`wc -l low.txt | awk '{print $1}'`
111       > oldhigh.txt      echo "  comparing $nlines lines of output"
112      diff oldhigh.txt high.txt > /dev/null      @ line = 1
113      if ($status) then      set bestacc=99;
114        echo "  output differs:"      set worstline='Exact match'
115        diff oldhigh.txt high.txt      while ($line <= $nlines)
116        echo ""       set vals=(`grep "^$line" low.txt | awk '{print $2,$3}'`)
117        @ lvl=0       @ line += 1
118        set accuracy='.'       unset acc
119        set fail       foreach dp (14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)
120        echo -n Trying reduced accuracy        set cmp=(`printf '%23.'$dp'e %23.'$dp'e\n' $vals[1] $vals[2]`)
121        while ($lvl <= $passaccuracy)        if ($cmp[1] =~ $cmp[2]) then
122          @ lvl+=1         if (! $?acc) then
123          echo -n " " $lvl          set acc=$dp
124          sed s/{$accuracy}E/E/ high.txt > low.txt          break
125          sed s/{$accuracy}E/E/ oldhigh.txt > oldlow.txt         endif
         diff oldlow.txt low.txt > /dev/null  
         if ($status == 0) then  
           unset fail  
           break  
         endif  
         set accuracy=`echo $accuracy | sed 's/\./../'`  
       end  
       echo ""  
       if ($?fail ) then  
         if (! $?fails) set fails  
         set fails=($fails $dr)  
         echo "                        ***** FAIL *****"  
       else  
         if (! $?passes) set passes  
         set passes=($passes $dr)  
         echo ""  
         echo "                   ***** PASS (grade $lvl) *****"  
126        endif        endif
127        set accuracy=$lvl       end
128         if (! $?acc) set acc=0
129         if ($acc < $bestacc) then
130           set worstline=($line $vals[1] $vals[2] `printf '%23.'$acc'e' $vals[1]` $acc)
131           set bestacc=$acc
132         endif
133    #    echo $line $vals[1] $vals[2] `printf '%23.'$acc'e' $vals[1]` $acc
134        end
135        if ($nlines == 0) then
136         set bestacc=0
137         set worstline="Could find no lines in output.txt to compare"
138        endif
139        if ($bestacc == 14 & $?exactmatch) then
140         set exactmatch=Yes
141         echo " "
142         echo "                        ***** EXACT MATCH *****"
143        endif
144        if ($bestacc > $digitsOfAccuracy) then
145         set pass=Pass
146         echo " "
147         echo "                      ***** PASS (digits=$bestacc) *****"
148         echo " "
149         echo " worstline: " $worstline
150      else      else
151        set exactmatch=Yes       echo " "
152        echo ""       echo "                      ***** FAIL (digits=$bestacc) *****"
153        echo Model passed at highest accuracy.       echo " "
154        echo ""       echo " worstline: " $worstline
       echo "                        ***** PASS *****"  
       if (! $?passes) set passes  
       set passes=($passes $dr)  
155      endif      endif
156        set accuracy=$bestacc
157    else    else
158      echo " error"      echo " error"
159      echo "               ***** An error occured running the mode *****"      echo "               ***** An error occured running the model *****"
160      tail output.txt      tail output.txt
161      exit 1      echo The runtime error occured in \"$dr\"
162        if ($?on_error_die) exit 1
163        set pass=-
164      endif
165      rm -f high.txt oldhigh.txt low.txt oldlow.txt output.txt make.log
166    endif    endif
167    cd ..    cd ..
168   endif   endif
169   echo ""   echo ""
170   cd ..   cd ..
171  # Pretty summary  # Pretty summary
172   printf '  %s\t  %s\t  %s\t  %s\t  %s\t  %s\t%s\n' $config $makedepend $compile $execute $exactmatch $accuracy $dr >> summary.txt   printresults:
173     printf '  %s\t  %s\t  %s\t  %s\t  %s\t %s\t %s\t%s\n' $config $makedepend $compile $execute $exactmatch $accuracy $pass $dr >> summary.txt
174  end  end
175  echo ==============================================================================  echo ==============================================================================
176  echo ""  echo ""

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.22