/[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.4 - (show annotations) (download)
Wed May 30 19:29:37 2001 UTC (22 years, 10 months ago) by adcroft
Branch: MAIN
Changes since 1.3: +1 -1 lines
Minor mod to testscript to facilitate avoiding *all* AIM expts
since they've been fucked up entirely. -skip=aim

1 #!/bin/csh
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 foreach dr ([a-zA-Z01-9]*)
49 if (! -d $dr/input ) continue
50 foreach skip ($SKIP)
51 if ( `echo $dr | sed s/$skip.'*'//` == '' ) continue;continue
52 end
53 set config=-
54 set makedepend=-
55 set compile=-
56 set execute=-
57 set exactmatch=-
58 set accuracy=-
59 set pass=FAIL
60 echo ==============================================================================
61 echo Entering $dr
62 cd $dr
63 echo ""
64 if (! -r results/output.txt) then
65 echo " ***** No results to compare with *****"
66 if (! $?untested) set untested
67 set untested=($untested $dr)
68 else
69 set config=NO
70 cd input
71 echo -n " generating Makefile ..."
72 ../../../tools/genmake -mods=../code >&! make.log
73 if ($status == 0) set config=Yes
74 set makedepend=NO
75 echo " done."
76 echo -n " make depend ..."
77 make cleanlinks depend >>& make.log
78 if ($status == 0) set makedepend=Yes
79 echo " done."
80 echo -n " make ..."
81 make >>& make.log
82 if ($status) then
83 echo " ***** An error occurred during make *****"
84 cat make.log
85 echo The error during compilation occured in \"$dr\"
86 set compile=NO
87 if ($?on_error_die) exit 1
88 else
89 set compile=Yes
90 set execute=NO
91 endif
92 echo " done."
93 echo -n " running model ..."
94 if ($compile == 'Yes') then
95 # ./mitgcmuv | & grep "D iters" > output.txt
96 ./mitgcmuv > & output.txt
97 if ($status == 0) then
98 set execute=Yes
99 set exactmatch=NO
100 set accuracy=-
101 echo " done."
102 grep "D iters" output.txt | sed 's/.*D iters, err =//' \
103 | grep " 0 " \
104 > high.txt
105 grep "D iters" ../results/output.txt \
106 | sed 's/.*D iters, err =//' \
107 | grep " 0 " \
108 > oldhigh.txt
109 diff oldhigh.txt high.txt > /dev/null
110 if ($status) then
111 echo " output differs:"
112 diff oldhigh.txt high.txt
113 echo ""
114 @ lvl=0
115 set accuracy='.'
116 set fail
117 echo -n Trying reduced accuracy
118 while ($lvl <= $passaccuracy)
119 @ lvl+=1
120 echo -n " " $lvl
121 sed s/{$accuracy}E/E/ high.txt > low.txt
122 sed s/{$accuracy}E/E/ oldhigh.txt > oldlow.txt
123 diff oldlow.txt low.txt > /dev/null
124 if ($status == 0) then
125 unset fail
126 break
127 endif
128 set accuracy=`echo $accuracy | sed 's/\./../'`
129 end
130 echo ""
131 if ($?fail ) then
132 if (! $?fails) set fails
133 set fails=($fails $dr)
134 set pass=FAIL
135 echo " ***** FAIL *****"
136 else
137 if (! $?passes) set passes
138 set passes=($passes $dr)
139 set pass=Pass
140 echo ""
141 echo " ***** PASS (grade $lvl) *****"
142 endif
143 set accuracy=$lvl
144 else
145 set exactmatch=Yes
146 set pass=Pass
147 echo ""
148 echo Model passed at highest accuracy.
149 echo ""
150 echo " ***** PASS *****"
151 if (! $?passes) set passes
152 set passes=($passes $dr)
153 endif
154 else
155 echo " error"
156 echo " ***** An error occured running the model *****"
157 tail output.txt
158 echo The runtime error occured in \"$dr\"
159 if ($?on_error_die) exit 1
160 set pass=-
161 endif
162 rm -f high.txt oldhigh.txt low.txt oldlow.txt output.txt make.log
163 endif
164 cd ..
165 endif
166 echo ""
167 cd ..
168 # Pretty summary
169 printresults:
170 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
171 end
172 echo ==============================================================================
173 echo ""
174
175 echo "Summary:"
176 echo ""
177 cat summary.txt

  ViewVC Help
Powered by ViewVC 1.1.22