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

Contents of /MITgcm/verification/testscript

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


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

1 #!/bin/csh -f
2
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 set on_error_die
12 set passaccuracy=7
13 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
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 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:
43 echo Unknown argument given to $0
44 exit 1
45 endsw
46 end
47
48 # Need to make sure we don't meet non-model problems ...
49 unlimit
50
51 foreach dr ([a-zA-Z01-9]*)
52 if (! -d $dr/input ) continue
53 foreach skip ($SKIP)
54 if ( `echo $dr | sed s/$skip.'*'//` == '' ) continue;continue
55 end
56 set config=-
57 set makedepend=-
58 set compile=-
59 set execute=-
60 set exactmatch=-
61 set accuracy=-
62 set pass=FAIL
63 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 set makedepend=NO
78 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 echo The error during compilation occured in \"$dr\"
89 set compile=NO
90 if ($?on_error_die) exit 1
91 else
92 set compile=Yes
93 set execute=NO
94 endif
95 echo " done."
96 echo -n " running model ..."
97 if ($compile == 'Yes') then
98 # ./mitgcmuv | & grep "D iters" > output.txt
99 ./mitgcmuv > & output.txt
100 if ($status == 0) then
101 set execute=Yes
102 set exactmatch=NO
103 set accuracy=-
104 echo " done."
105 grep "D iters" output.txt | sed 's/.*D iters, err =//' \
106 | 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 set pass=FAIL
138 echo " ***** FAIL *****"
139 else
140 if (! $?passes) set passes
141 set passes=($passes $dr)
142 set pass=Pass
143 echo ""
144 echo " ***** PASS (grade $lvl) *****"
145 endif
146 set accuracy=$lvl
147 else
148 set exactmatch=Yes
149 set pass=Pass
150 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 echo " ***** An error occured running the model *****"
160 tail output.txt
161 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
167 cd ..
168 endif
169 echo ""
170 cd ..
171 # Pretty summary
172 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
175 echo ==============================================================================
176 echo ""
177
178 echo "Summary:"
179 echo ""
180 cat summary.txt

  ViewVC Help
Powered by ViewVC 1.1.22