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

Annotation of /MITgcm/verification/testscript

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


Revision 1.6 - (hide annotations) (download)
Wed Jun 6 12:24:19 2001 UTC (22 years, 10 months ago) by adcroft
Branch: MAIN
Changes since 1.5: +3 -0 lines
Problems on new SUNs - need to unlimit everything.

1 adcroft 1.5 #!/bin/csh -f
2 adcroft 1.1
3     # Run this script from the verification directory
4     # It will automatically configure, compile, run and verify all experiments
5     # in the verification directory for whcih there is an results/output.txt
6     # file.
7    
8     # This is the number of least-significant digits allows to be
9     # in error before the test is classified as a "fail".
10    
11 adcroft 1.2 set on_error_die
12 adcroft 1.1 set passaccuracy=7
13 adcroft 1.3 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 adcroft 1.1
17     # Pass any arguments
18     foreach arg ($argv)
19     switch ($arg)
20     case -clean:
21     echo Cleaning ...
22     foreach dr ([a-zA-Z01-9]*)
23     if (-d $dr/input) then
24     echo Entering $dr
25     cd $dr/input
26     echo ""
27     make CLEAN
28     \rm -f {*output,*high,*low}.txt *.log
29     \rm -f ?ake*
30     cd ../..
31     endif
32     end
33     rm -f summary.txt
34     exit 0
35 adcroft 1.2 breaksw
36     case -nodie:
37     unset on_error_die
38     breaksw
39 adcroft 1.3 case -skip=*:
40     set SKIP = ( $SKIP `echo $arg | sed 's/-skip=//' | sed 's/,/ /g' `)
41     breaksw
42 adcroft 1.1 default:
43     echo Unknown argument given to $0
44     exit 1
45     endsw
46     end
47    
48 adcroft 1.6 # Need to make sure we don't meet non-model problems ...
49     unlimit
50    
51 adcroft 1.1 foreach dr ([a-zA-Z01-9]*)
52     if (! -d $dr/input ) continue
53 adcroft 1.3 foreach skip ($SKIP)
54 adcroft 1.4 if ( `echo $dr | sed s/$skip.'*'//` == '' ) continue;continue
55 adcroft 1.3 end
56 adcroft 1.1 set config=-
57     set makedepend=-
58     set compile=-
59     set execute=-
60     set exactmatch=-
61     set accuracy=-
62 adcroft 1.3 set pass=FAIL
63 adcroft 1.1 echo ==============================================================================
64     echo Entering $dr
65     cd $dr
66     echo ""
67     if (! -r results/output.txt) then
68     echo " ***** No results to compare with *****"
69     if (! $?untested) set untested
70     set untested=($untested $dr)
71     else
72     set config=NO
73     cd input
74     echo -n " generating Makefile ..."
75     ../../../tools/genmake -mods=../code >&! make.log
76     if ($status == 0) set config=Yes
77 adcroft 1.2 set makedepend=NO
78 adcroft 1.1 echo " done."
79     echo -n " make depend ..."
80     make cleanlinks depend >>& make.log
81     if ($status == 0) set makedepend=Yes
82     echo " done."
83     echo -n " make ..."
84     make >>& make.log
85     if ($status) then
86     echo " ***** An error occurred during make *****"
87     cat make.log
88 adcroft 1.2 echo The error during compilation occured in \"$dr\"
89     set compile=NO
90     if ($?on_error_die) exit 1
91 adcroft 1.1 else
92     set compile=Yes
93 adcroft 1.2 set execute=NO
94 adcroft 1.1 endif
95     echo " done."
96     echo -n " running model ..."
97 adcroft 1.2 if ($compile == 'Yes') then
98 adcroft 1.3 # ./mitgcmuv | & grep "D iters" > output.txt
99     ./mitgcmuv > & output.txt
100 adcroft 1.1 if ($status == 0) then
101     set execute=Yes
102 adcroft 1.2 set exactmatch=NO
103     set accuracy=-
104 adcroft 1.1 echo " done."
105 adcroft 1.3 grep "D iters" output.txt | sed 's/.*D iters, err =//' \
106 adcroft 1.1 | grep " 0 " \
107     > high.txt
108     grep "D iters" ../results/output.txt \
109     | sed 's/.*D iters, err =//' \
110     | grep " 0 " \
111     > oldhigh.txt
112     diff oldhigh.txt high.txt > /dev/null
113     if ($status) then
114     echo " output differs:"
115     diff oldhigh.txt high.txt
116     echo ""
117     @ lvl=0
118     set accuracy='.'
119     set fail
120     echo -n Trying reduced accuracy
121     while ($lvl <= $passaccuracy)
122     @ lvl+=1
123     echo -n " " $lvl
124     sed s/{$accuracy}E/E/ high.txt > low.txt
125     sed s/{$accuracy}E/E/ oldhigh.txt > oldlow.txt
126     diff oldlow.txt low.txt > /dev/null
127     if ($status == 0) then
128     unset fail
129     break
130     endif
131     set accuracy=`echo $accuracy | sed 's/\./../'`
132     end
133     echo ""
134     if ($?fail ) then
135     if (! $?fails) set fails
136     set fails=($fails $dr)
137 adcroft 1.3 set pass=FAIL
138 adcroft 1.1 echo " ***** FAIL *****"
139     else
140     if (! $?passes) set passes
141     set passes=($passes $dr)
142 adcroft 1.3 set pass=Pass
143 adcroft 1.1 echo ""
144     echo " ***** PASS (grade $lvl) *****"
145     endif
146     set accuracy=$lvl
147     else
148     set exactmatch=Yes
149 adcroft 1.3 set pass=Pass
150 adcroft 1.1 echo ""
151     echo Model passed at highest accuracy.
152     echo ""
153     echo " ***** PASS *****"
154     if (! $?passes) set passes
155     set passes=($passes $dr)
156     endif
157     else
158     echo " error"
159 adcroft 1.2 echo " ***** An error occured running the model *****"
160 adcroft 1.1 tail output.txt
161 adcroft 1.2 echo The runtime error occured in \"$dr\"
162     if ($?on_error_die) exit 1
163 adcroft 1.3 set pass=-
164 adcroft 1.2 endif
165 adcroft 1.3 rm -f high.txt oldhigh.txt low.txt oldlow.txt output.txt make.log
166 adcroft 1.1 endif
167     cd ..
168     endif
169     echo ""
170     cd ..
171     # Pretty summary
172 adcroft 1.2 printresults:
173 adcroft 1.3 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 adcroft 1.1 end
175     echo ==============================================================================
176     echo ""
177    
178     echo "Summary:"
179     echo ""
180     cat summary.txt

  ViewVC Help
Powered by ViewVC 1.1.22