/[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.2 - (show annotations) (download)
Fri Mar 9 19:05:26 2001 UTC (20 years, 6 months ago) by adcroft
Branch: MAIN
CVS Tags: c37_adj, checkpoint37, checkpoint39, checkpoint38
Branch point for: pre38
Changes since 1.1: +19 -9 lines
Beautified summary even more...

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 printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\n' " " Make " " " " Exact "# of" " " > summary.txt
14 printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\n' Config Depend Compile Execute Match Digits Experiment >> summary.txt
15
16 # Pass any arguments
17 foreach arg ($argv)
18 switch ($arg)
19 case -clean:
20 echo Cleaning ...
21 foreach dr ([a-zA-Z01-9]*)
22 if (-d $dr/input) then
23 echo Entering $dr
24 cd $dr/input
25 echo ""
26 make CLEAN
27 \rm -f {*output,*high,*low}.txt *.log
28 \rm -f ?ake*
29 cd ../..
30 endif
31 end
32 rm -f summary.txt
33 exit 0
34 breaksw
35 case -nodie:
36 unset on_error_die
37 breaksw
38 default:
39 echo Unknown argument given to $0
40 exit 1
41 endsw
42 end
43
44 foreach dr ([a-zA-Z01-9]*)
45 if (! -d $dr/input ) continue
46 set config=-
47 set makedepend=-
48 set compile=-
49 set execute=-
50 set exactmatch=-
51 set accuracy=-
52 echo ==============================================================================
53 echo Entering $dr
54 cd $dr
55 echo ""
56 if (! -r results/output.txt) then
57 echo " ***** No results to compare with *****"
58 if (! $?untested) set untested
59 set untested=($untested $dr)
60 else
61 set config=NO
62 cd input
63 echo -n " generating Makefile ..."
64 ../../../tools/genmake -mods=../code >&! make.log
65 if ($status == 0) set config=Yes
66 set makedepend=NO
67 echo " done."
68 echo -n " make depend ..."
69 make cleanlinks depend >>& make.log
70 if ($status == 0) set makedepend=Yes
71 echo " done."
72 echo -n " make ..."
73 make >>& make.log
74 if ($status) then
75 echo " ***** An error occurred during make *****"
76 cat make.log
77 echo The error during compilation occured in \"$dr\"
78 set compile=NO
79 if ($?on_error_die) exit 1
80 else
81 set compile=Yes
82 set execute=NO
83 endif
84 echo " done."
85 echo -n " running model ..."
86 if ($compile == 'Yes') then
87 ./mitgcmuv | & grep "D iters" > output.txt
88 if ($status == 0) then
89 set execute=Yes
90 set exactmatch=NO
91 set accuracy=-
92 echo " done."
93 sed 's/.*D iters, err =//' output.txt \
94 | grep " 0 " \
95 > high.txt
96 grep "D iters" ../results/output.txt \
97 | sed 's/.*D iters, err =//' \
98 | grep " 0 " \
99 > oldhigh.txt
100 diff oldhigh.txt high.txt > /dev/null
101 if ($status) then
102 echo " output differs:"
103 diff oldhigh.txt high.txt
104 echo ""
105 @ lvl=0
106 set accuracy='.'
107 set fail
108 echo -n Trying reduced accuracy
109 while ($lvl <= $passaccuracy)
110 @ lvl+=1
111 echo -n " " $lvl
112 sed s/{$accuracy}E/E/ high.txt > low.txt
113 sed s/{$accuracy}E/E/ oldhigh.txt > oldlow.txt
114 diff oldlow.txt low.txt > /dev/null
115 if ($status == 0) then
116 unset fail
117 break
118 endif
119 set accuracy=`echo $accuracy | sed 's/\./../'`
120 end
121 echo ""
122 if ($?fail ) then
123 if (! $?fails) set fails
124 set fails=($fails $dr)
125 echo " ***** FAIL *****"
126 else
127 if (! $?passes) set passes
128 set passes=($passes $dr)
129 echo ""
130 echo " ***** PASS (grade $lvl) *****"
131 endif
132 set accuracy=$lvl
133 else
134 set exactmatch=Yes
135 echo ""
136 echo Model passed at highest accuracy.
137 echo ""
138 echo " ***** PASS *****"
139 if (! $?passes) set passes
140 set passes=($passes $dr)
141 endif
142 else
143 echo " error"
144 echo " ***** An error occured running the model *****"
145 tail output.txt
146 echo The runtime error occured in \"$dr\"
147 if ($?on_error_die) exit 1
148 endif
149 endif
150 cd ..
151 endif
152 echo ""
153 cd ..
154 # Pretty summary
155 printresults:
156 printf ' %s\t %s\t %s\t %s\t %s\t %s\t%s\n' $config $makedepend $compile $execute $exactmatch $accuracy $dr >> summary.txt
157 end
158 echo ==============================================================================
159 echo ""
160
161 echo "Summary:"
162 echo ""
163 cat summary.txt

  ViewVC Help
Powered by ViewVC 1.1.22