/[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.3 - (hide annotations) (download)
Tue May 29 14:01:41 2001 UTC (22 years, 10 months ago) by adcroft
Branch: MAIN
Changes since 1.2: +19 -5 lines
Merge from branch pre38:
 o essential mods for cubed sphere
 o debugged atmosphere, dynamcis + physics (aim)
 o new packages (mom_vecinv, mom_fluxform, ...)

1 adcroft 1.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 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     foreach dr ([a-zA-Z01-9]*)
49     if (! -d $dr/input ) continue
50 adcroft 1.3 foreach skip ($SKIP)
51     if ($skip == $dr) continue;continue
52     end
53 adcroft 1.1 set config=-
54     set makedepend=-
55     set compile=-
56     set execute=-
57     set exactmatch=-
58     set accuracy=-
59 adcroft 1.3 set pass=FAIL
60 adcroft 1.1 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 adcroft 1.2 set makedepend=NO
75 adcroft 1.1 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 adcroft 1.2 echo The error during compilation occured in \"$dr\"
86     set compile=NO
87     if ($?on_error_die) exit 1
88 adcroft 1.1 else
89     set compile=Yes
90 adcroft 1.2 set execute=NO
91 adcroft 1.1 endif
92     echo " done."
93     echo -n " running model ..."
94 adcroft 1.2 if ($compile == 'Yes') then
95 adcroft 1.3 # ./mitgcmuv | & grep "D iters" > output.txt
96     ./mitgcmuv > & output.txt
97 adcroft 1.1 if ($status == 0) then
98     set execute=Yes
99 adcroft 1.2 set exactmatch=NO
100     set accuracy=-
101 adcroft 1.1 echo " done."
102 adcroft 1.3 grep "D iters" output.txt | sed 's/.*D iters, err =//' \
103 adcroft 1.1 | 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 adcroft 1.3 set pass=FAIL
135 adcroft 1.1 echo " ***** FAIL *****"
136     else
137     if (! $?passes) set passes
138     set passes=($passes $dr)
139 adcroft 1.3 set pass=Pass
140 adcroft 1.1 echo ""
141     echo " ***** PASS (grade $lvl) *****"
142     endif
143     set accuracy=$lvl
144     else
145     set exactmatch=Yes
146 adcroft 1.3 set pass=Pass
147 adcroft 1.1 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 adcroft 1.2 echo " ***** An error occured running the model *****"
157 adcroft 1.1 tail output.txt
158 adcroft 1.2 echo The runtime error occured in \"$dr\"
159     if ($?on_error_die) exit 1
160 adcroft 1.3 set pass=-
161 adcroft 1.2 endif
162 adcroft 1.3 rm -f high.txt oldhigh.txt low.txt oldlow.txt output.txt make.log
163 adcroft 1.1 endif
164     cd ..
165     endif
166     echo ""
167     cd ..
168     # Pretty summary
169 adcroft 1.2 printresults:
170 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
171 adcroft 1.1 end
172     echo ==============================================================================
173     echo ""
174    
175     echo "Summary:"
176     echo ""
177     cat summary.txt

  ViewVC Help
Powered by ViewVC 1.1.22