1 |
#!/bin/csh -f |
#!/bin/sh |
2 |
|
|
3 |
# Run this script from the verification directory |
compare_lines() |
4 |
# It will automatically configure, compile, run and verify all experiments |
{ |
5 |
# in the verification directory for whcih there is an results/output.txt |
# use codelet to compare lines |
6 |
# file. |
if [ $verbose -gt 1 ]; then |
7 |
|
cat tmp3.txt 1>&2 |
8 |
# This is the number of least-significant digits allows to be |
fi |
9 |
# in error before the test is classified as a "fail". |
return `./a.out < tmp3.txt` |
10 |
|
} |
11 |
set on_error_die |
|
12 |
set passaccuracy=7 |
testoutput_for_prop() |
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 |
# testoutput_for_prop dir s1 label subdir |
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 |
|
# compares files in $dir/$subdir/output.txt and $dir/results/output.txt |
17 |
# Pass any arguments |
# using search strings s1 and text label |
18 |
foreach arg ($argv) |
|
19 |
switch ($arg) |
if [ $debug -gt 0 ]; then |
20 |
case -clean: |
echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 |
21 |
echo Cleaning ... |
fi |
22 |
foreach dr ([a-zA-Z01-9]*) |
if [ -r $1/$4/output.txt ]; then |
23 |
if (-d $dr/input) then |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | nl > tmp1.txt |
24 |
echo Entering $dr |
lncnt=`wc -l tmp1.txt | awk '{print $1}' ` |
25 |
cd $dr/input |
if [ $lncnt -lt 3 ]; then |
26 |
echo "" |
if [ $verbose -gt 0 ]; then |
27 |
make CLEAN |
echo Not enough lines of output when searching for "$2" 1>&2 |
28 |
\rm -f {*output,*high,*low}.txt *.log |
fi |
29 |
\rm -f ?ake* |
return 99 |
30 |
cd ../.. |
fi |
31 |
endif |
else |
32 |
end |
echo testoutput_for_prop: output.txt from model run was not readable 1>&2 |
33 |
rm -f summary.txt |
return 99 |
34 |
exit 0 |
fi |
35 |
breaksw |
if [ $debug -gt 0 ]; then |
36 |
case -nodie: |
echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2 |
37 |
unset on_error_die |
fi |
38 |
breaksw |
grep "$2" $1/results/output.txt | sed 's/.*=//' | nl > tmp2.txt |
39 |
case -skip=*: |
lncnt=`wc -l tmp2.txt | awk '{print $1}' ` |
40 |
set SKIP = ( $SKIP `echo $arg | sed 's/-skip=//' | sed 's/,/ /g' `) |
if [ $lncnt -lt 3 ]; then |
41 |
breaksw |
if [ $verbose -gt 0 ]; then |
42 |
default: |
echo Not enough lines of output when searching for "$2" 1>&2 |
43 |
echo Unknown argument given to $0 |
fi |
44 |
exit 1 |
return 99 |
45 |
endsw |
fi |
46 |
end |
if [ $debug -gt 0 ]; then |
47 |
|
echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2 |
48 |
foreach dr ([a-zA-Z01-9]*) |
fi |
49 |
if (! -d $dr/input ) continue |
join tmp1.txt tmp2.txt | awk '{print $1 " " $2 " " $3}' > tmp3.txt |
50 |
foreach skip ($SKIP) |
if [ $debug -gt 0 ]; then |
51 |
if ( `echo $dr | sed s/$skip.'*'//` == '' ) continue;continue |
echo testoutput_for_prop: compare_lines 1>&2 |
52 |
end |
fi |
53 |
set config=- |
compare_lines |
54 |
set makedepend=- |
digits_of_similarity=$? |
55 |
set compile=- |
if [ $digits_of_similarity -eq 99 ]; then |
56 |
set execute=- |
if [ $verbose -gt 0 ]; then |
57 |
set exactmatch=- |
echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2 |
58 |
set accuracy=- |
fi |
59 |
set pass=FAIL |
digits_of_similarity=99 |
60 |
echo ============================================================================== |
else |
61 |
echo Entering $dr |
if [ $verbose -gt 0 ]; then |
62 |
cd $dr |
echo There were $digits_of_similarity decimal places of similarity for \"$2\" 1>&2 |
63 |
echo "" |
fi |
64 |
if (! -r results/output.txt) then |
fi |
65 |
echo " ***** No results to compare with *****" |
rm tmp1.txt tmp2.txt tmp3.txt |
66 |
if (! $?untested) set untested |
|
67 |
set untested=($untested $dr) |
return $digits_of_similarity |
68 |
else |
} |
69 |
set config=NO |
|
70 |
cd input |
dashnum() |
71 |
echo -n " generating Makefile ..." |
{ |
72 |
../../../tools/genmake -mods=../code >&! make.log |
# dashnum n1 n2 n3 ... |
73 |
if ($status == 0) set config=Yes |
# |
74 |
set makedepend=NO |
# print numbers using %3i format or "--" if number = 99 |
75 |
echo " done." |
for num in $@ |
76 |
echo -n " make depend ..." |
do |
77 |
make cleanlinks depend >>& make.log |
if [ $num = 99 ]; then |
78 |
if ($status == 0) set makedepend=Yes |
printf ' --' |
79 |
echo " done." |
else |
80 |
echo -n " make ..." |
printf '%3i' $num |
81 |
make >>& make.log |
fi |
82 |
if ($status) then |
done |
83 |
echo " ***** An error occurred during make *****" |
} |
84 |
cat make.log |
|
85 |
echo The error during compilation occured in \"$dr\" |
testoutput() |
86 |
set compile=NO |
{ |
87 |
if ($?on_error_die) exit 1 |
# testoutput diretory subdir |
88 |
else |
# |
89 |
set compile=Yes |
# test output in "directory" |
90 |
set execute=NO |
|
91 |
endif |
if [ $debug -gt 0 ]; then |
92 |
echo " done." |
echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2 |
93 |
echo -n " running model ..." |
fi |
94 |
if ($compile == 'Yes') then |
testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2; cg2dres=$? |
95 |
# ./mitgcmuv | & grep "D iters" > output.txt |
if [ $debug -gt 0 ]; then |
96 |
./mitgcmuv > & output.txt |
echo testoutput: cg2dres=$cg2dres 1>&2 |
97 |
if ($status == 0) then |
fi |
98 |
set execute=Yes |
|
99 |
set exactmatch=NO |
if [ $longtest -gt 0 ]; then |
100 |
set accuracy=- |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$? |
101 |
echo " done." |
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$? |
102 |
grep "D iters" output.txt | sed 's/.*D iters, err =//' \ |
testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$? |
103 |
| grep " 0 " \ |
testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2; tsd=$? |
104 |
> high.txt |
testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2; smin=$? |
105 |
grep "D iters" ../results/output.txt \ |
testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2; smax=$? |
106 |
| sed 's/.*D iters, err =//' \ |
testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2; smean=$? |
107 |
| grep " 0 " \ |
testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2; ssd=$? |
108 |
> oldhigh.txt |
testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2; umin=$? |
109 |
diff oldhigh.txt high.txt > /dev/null |
testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2; umax=$? |
110 |
if ($status) then |
testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2; umean=$? |
111 |
echo " output differs:" |
testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2; usd=$? |
112 |
diff oldhigh.txt high.txt |
testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2; vmin=$? |
113 |
echo "" |
testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2; vmax=$? |
114 |
@ lvl=0 |
testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2; vmean=$? |
115 |
set accuracy='.' |
testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2; vsd=$? |
116 |
set fail |
else |
117 |
echo -n Trying reduced accuracy |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$? |
118 |
while ($lvl <= $passaccuracy) |
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$? |
119 |
@ lvl+=1 |
testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2; smin=$? |
120 |
echo -n " " $lvl |
testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2; smax=$? |
121 |
sed s/{$accuracy}E/E/ high.txt > low.txt |
testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2; umin=$? |
122 |
sed s/{$accuracy}E/E/ oldhigh.txt > oldlow.txt |
testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2; umax=$? |
123 |
diff oldlow.txt low.txt > /dev/null |
testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2; vmin=$? |
124 |
if ($status == 0) then |
testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2; vmax=$? |
125 |
unset fail |
fi |
126 |
break |
|
127 |
|
dashnum $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \ |
128 |
|
$umin $umax $umean $usd $vmin $vmax $vmean $vsd |
129 |
|
#printf '%3i' $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \ |
130 |
|
# $umin $umax $umean $usd $vmin $vmax $vmean $vsd |
131 |
|
} |
132 |
|
|
133 |
|
genmakemodel() |
134 |
|
{ |
135 |
|
# genmakemodel directory |
136 |
|
( cd $1; |
137 |
|
if [ $quick -eq 0 -o ! -r Makefile ]; then |
138 |
|
printf 'genmake ... ' 1>&2 |
139 |
|
find . -type l -exec rm {} \; |
140 |
|
if [ $ieee -eq 0 ]; then |
141 |
|
../../../tools/genmake2 -mods=../code > make.log 2>&1 |
142 |
|
else |
143 |
|
../../../tools/genmake2 -ieee -mods=../code > make.log 2>&1 |
144 |
|
fi |
145 |
|
if [ $? -ne 0 ]; then |
146 |
|
tail make.log |
147 |
|
echo genmakemodel: $genmake failed 1>&2 |
148 |
|
return 1 |
149 |
|
else |
150 |
|
echo succesful 1>&2 |
151 |
|
fi |
152 |
|
fi |
153 |
|
) |
154 |
|
} |
155 |
|
|
156 |
|
makecleancompile() |
157 |
|
{ |
158 |
|
# makecleancompile directory |
159 |
|
( cd $1; |
160 |
|
if [ $force -gt 0 ]; then |
161 |
|
rm -f output.txt |
162 |
|
printf 'make clean ... ' 2>&1 |
163 |
|
make CLEAN >> make.log 2>&1 |
164 |
|
if [ $? -ne 0 ]; then |
165 |
|
tail make.log |
166 |
|
echo makecleancompile: make clean failed 1>&2 |
167 |
|
return 1 |
168 |
|
else |
169 |
|
echo succesful 1>&2 |
170 |
|
fi |
171 |
|
fi |
172 |
|
) |
173 |
|
} |
174 |
|
|
175 |
|
makecleanupafter() |
176 |
|
{ |
177 |
|
# makeupafter directory |
178 |
|
( cd $1; |
179 |
|
if [ $clean -gt 0 ]; then |
180 |
|
rm -f output.txt |
181 |
|
printf 'make clean ... ' 2>&1 |
182 |
|
make CLEAN >> make.log 2>&1 |
183 |
|
if [ $? -ne 0 ]; then |
184 |
|
tail make.log |
185 |
|
echo makeupafter: make clean failed 1>&2 |
186 |
|
return 1 |
187 |
|
else |
188 |
|
echo succesful 1>&2 |
189 |
|
fi |
190 |
|
fi |
191 |
|
) |
192 |
|
} |
193 |
|
|
194 |
|
makedependmodel() |
195 |
|
{ |
196 |
|
# makedependmodel directory |
197 |
|
( cd $1; |
198 |
|
if [ $quick -eq 0 -o ! -r Makefile ]; then |
199 |
|
printf 'make depend ... ' 1>&2 |
200 |
|
make cleanlinks >> make.log 2>&1 |
201 |
|
make depend >> make.log 2>&1 |
202 |
|
if [ $? -ne 0 ]; then |
203 |
|
tail make.log |
204 |
|
echo makemodel: make depend failed 1>&2 |
205 |
|
return 1 |
206 |
|
else |
207 |
|
echo succesful 1>&2 |
208 |
|
fi |
209 |
|
fi |
210 |
|
) |
211 |
|
} |
212 |
|
|
213 |
|
makemodel() |
214 |
|
{ |
215 |
|
# makemodel directory |
216 |
|
( cd $1; |
217 |
|
if [ -r Makefile ]; then |
218 |
|
printf 'make ... ' 1>&2 |
219 |
|
make >> make.log 2>&1 |
220 |
|
if [ $? -ne 0 ]; then |
221 |
|
tail make.log |
222 |
|
echo failed 1>&2 |
223 |
|
return 1 |
224 |
|
else |
225 |
|
echo succesful 1>&2 |
226 |
|
fi |
227 |
|
fi |
228 |
|
) |
229 |
|
} |
230 |
|
|
231 |
|
linkdata() |
232 |
|
{ |
233 |
|
# linkdata flag |
234 |
|
# |
235 |
|
# symbolically link data files to run directory |
236 |
|
if test "x$1" = x1 ; then |
237 |
|
( |
238 |
|
cd $2 |
239 |
|
if test "x$ADM" = x ; then |
240 |
|
files=`( cd ../input ; ls -1 | grep -v CVS )` |
241 |
|
for i in $files ; do |
242 |
|
if test ! -d "../input/"$i ; then |
243 |
|
ln -sf "../input/"$i $i |
244 |
|
fi |
245 |
|
done |
246 |
|
else |
247 |
|
files=`( cd ../input ; ls -1 *.bin | grep -v CVS )` |
248 |
|
for i in $files ; do |
249 |
|
if test ! -d "../input/"$i ; then |
250 |
|
ln -sf "../input/"$i $i |
251 |
|
fi |
252 |
|
done |
253 |
|
files=`( cd ../input_ad ; ls -1 | grep -v CVS )` |
254 |
|
for i in $files ; do |
255 |
|
if test ! -d "../input_ad/"$i ; then |
256 |
|
ln -sf "../input_ad/"$i $i |
257 |
|
fi |
258 |
|
done |
259 |
|
fi |
260 |
|
) |
261 |
|
fi |
262 |
|
} |
263 |
|
|
264 |
|
runmodel() |
265 |
|
{ |
266 |
|
# runmodel directory exe |
267 |
|
# |
268 |
|
# runs the model "exe" in "directory" (exe is relative to directory) |
269 |
|
|
270 |
|
( cd $1 |
271 |
|
if [ -x $2 ]; then |
272 |
|
if [ $quick -eq 0 ]; then |
273 |
|
rm -f output.txt |
274 |
|
fi |
275 |
|
if [ $debug -gt 0 ]; then |
276 |
|
echo -n runmodel: pwd= 1>&2 |
277 |
|
pwd 1>&2 |
278 |
|
fi |
279 |
|
printf 'runmodel: ' 1>&2 |
280 |
|
make output.txt && return 0 |
281 |
|
return 1 |
282 |
|
fi |
283 |
|
) |
284 |
|
} |
285 |
|
|
286 |
|
copynewresults() |
287 |
|
{ |
288 |
|
# copynewresults directory |
289 |
|
# |
290 |
|
# runs the model "exe" in "directory" (exe is relative to directory) |
291 |
|
|
292 |
|
( cd $1 |
293 |
|
if [ $newresults -eq 1 ]; then |
294 |
|
if [ -r output.txt ]; then |
295 |
|
cp -f output.txt ../results/ |
296 |
|
return 0 |
297 |
|
fi |
298 |
|
fi |
299 |
|
) |
300 |
|
} |
301 |
|
|
302 |
|
createcodelet() |
303 |
|
{ |
304 |
|
# create codelet for comparing model output |
305 |
|
cat > tmp_cmpnum.f <<EOFA |
306 |
|
program cmpnum |
307 |
|
implicit none |
308 |
|
real*8 a,b,diff |
309 |
|
integer linnum,best |
310 |
|
best=-16 |
311 |
|
99 read(*,*,end=70,err=60) linnum,a,b |
312 |
|
diff=0.5*(abs(a)+abs(b)) |
313 |
|
c print *,a,b,diff,abs(a-b)/diff |
314 |
|
if (diff.gt.1.e-12) then |
315 |
|
diff=abs(a-b)/diff |
316 |
|
if (diff.gt.0.) then |
317 |
|
c print *,int(log10(diff)),diff |
318 |
|
linnum=int(log10(diff)) |
319 |
|
best=max(best,linnum) |
320 |
endif |
endif |
|
set accuracy=`echo $accuracy | sed 's/\./../'` |
|
|
end |
|
|
echo "" |
|
|
if ($?fail ) then |
|
|
if (! $?fails) set fails |
|
|
set fails=($fails $dr) |
|
|
set pass=FAIL |
|
|
echo " ***** FAIL *****" |
|
321 |
else |
else |
322 |
if (! $?passes) set passes |
if (best.eq.-16.and.diff.ne.0.) best=-22 |
|
set passes=($passes $dr) |
|
|
set pass=Pass |
|
|
echo "" |
|
|
echo " ***** PASS (grade $lvl) *****" |
|
323 |
endif |
endif |
324 |
set accuracy=$lvl |
goto 99 |
325 |
else |
60 stop 'cmpnum: An error occured reading a,b' |
326 |
set exactmatch=Yes |
70 print *,-best |
327 |
set pass=Pass |
end |
328 |
echo "" |
EOFA |
329 |
echo Model passed at highest accuracy. |
f77 tmp_cmpnum.f |
330 |
echo "" |
if [ -x ./a.out ]; then |
331 |
echo " ***** PASS *****" |
return 0 |
332 |
if (! $?passes) set passes |
else |
333 |
set passes=($passes $dr) |
echo createcodelet: failed to compile codelet 1>&2 |
334 |
endif |
exit 1 |
335 |
|
fi |
336 |
|
} |
337 |
|
|
338 |
|
formatresults() |
339 |
|
{ |
340 |
|
# formatresults expt genmake depend make run results* |
341 |
|
|
342 |
|
nm=$1 |
343 |
|
printf '%s %s %s %s' $2 $3 $4 $5 |
344 |
|
shift; shift; shift; shift; shift; |
345 |
|
printf '%3s' $@ |
346 |
|
|
347 |
|
if [ $1 = '--' ]; then |
348 |
|
printf ' N/O ' |
349 |
|
else |
350 |
|
if [ $1 -gt 12 ]; then |
351 |
|
printf ' pass' |
352 |
else |
else |
353 |
echo " error" |
printf ' FAIL' |
354 |
echo " ***** An error occured running the model *****" |
fi |
355 |
tail output.txt |
fi |
356 |
echo The runtime error occured in \"$dr\" |
printf ' %s' $nm |
357 |
if ($?on_error_die) exit 1 |
printf '\n' |
358 |
set pass=- |
|
359 |
endif |
} |
360 |
rm -f high.txt oldhigh.txt low.txt oldlow.txt output.txt make.log |
|
361 |
endif |
show_help() |
362 |
cd .. |
{ |
363 |
endif |
cat - << EOF |
364 |
echo "" |
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
365 |
cd .. |
-help Show this help message |
366 |
# Pretty summary |
-quick Skip "genmake" and "make depend" if the Makefile exists |
367 |
printresults: |
-newresults Copy the output.txt into results/ |
368 |
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 |
-quiet Reduce the amount of output |
369 |
end |
-verbose Produce copious amounts of output |
370 |
echo ============================================================================== |
-debug Produce even more output which will mean nothing to most |
371 |
echo "" |
-force Do "make CLEAN" before compiling. This forces a complete rebuild. |
372 |
|
-clean Do "make CLEAN" after compiling and testing. |
373 |
|
-shorttest Don't compare numeric output for mean and s.d. of variables. |
374 |
|
-noieee By default, $0 uses the -ieee option for genmake. This turns it off. |
375 |
|
-cleanup Aggresively removes all model output, executables and object files |
376 |
|
and then exits. Use with care. |
377 |
|
|
378 |
|
Normal usage: |
379 |
|
$0 * Configure, compile, run and analyze in all experiment directories |
380 |
|
EOF |
381 |
|
} |
382 |
|
|
383 |
|
scandirs() |
384 |
|
{ |
385 |
|
if [ $# -eq 0 ]; then |
386 |
|
for arg in * |
387 |
|
do |
388 |
|
test -d $arg/input && echo $arg |
389 |
|
done |
390 |
|
else |
391 |
|
echo $* |
392 |
|
fi |
393 |
|
} |
394 |
|
|
395 |
|
clean_up() |
396 |
|
{ |
397 |
|
# Find all executables, object files, CPP'd source and model output |
398 |
|
# and DELETE it. |
399 |
|
for opt in '-name "mitgcmuv*"' '-name "*.o"' '-name "*.f"' '-name "*.c"' '-name "fort.*"' '-name "make.log"' '-path *results -prune -o -name "*.meta"' '-path *results -prune -o -name "*.data"' '-type l' |
400 |
|
do |
401 |
|
echo Cleaning: find . $opt -exec rm {} \; |
402 |
|
find . $opt -exec rm {} \; |
403 |
|
done |
404 |
|
} |
405 |
|
|
406 |
|
############################################################################### |
407 |
|
############################################################################### |
408 |
|
############################################################################### |
409 |
|
|
410 |
|
# Main function |
411 |
|
|
412 |
|
# Default properties |
413 |
|
debug=0 |
414 |
|
verbose=1 |
415 |
|
quick=0 |
416 |
|
newresults=0 |
417 |
|
force=0 |
418 |
|
clean=0 |
419 |
|
ieee=1 |
420 |
|
longtest=1 |
421 |
|
expts='' |
422 |
|
genmake=genmake |
423 |
|
|
424 |
|
# Process arguments |
425 |
|
for arg in $@ |
426 |
|
do |
427 |
|
case $arg in |
428 |
|
-cleanup) clean_up; exit 0;; |
429 |
|
-quick) quick=1;; |
430 |
|
-newresults) newresults=1;; |
431 |
|
-verbose) verbose=2;; |
432 |
|
-debug) debug=1;; |
433 |
|
-force) force=1;; |
434 |
|
-clean) clean=1;; |
435 |
|
-noieee) ieee=0;; |
436 |
|
-shorttest) longtest=0;; |
437 |
|
-quiet) verbose=0;; |
438 |
|
-help) show_help; exit 0;; |
439 |
|
-*) echo Unrecognized option:$arg; exit 9;; |
440 |
|
*) test -d $arg && expts=`echo $expts $arg`;; |
441 |
|
esac |
442 |
|
done |
443 |
|
|
444 |
|
if [ $force -gt 0 -a $quick -gt 0 ]; then |
445 |
|
echo You specified -quick and -force together which conflict. |
446 |
|
echo Please specify either -quick or -force or neither but not both. |
447 |
|
exit 1 |
448 |
|
fi |
449 |
|
|
450 |
|
#if [ ${#expts} -eq 0 ]; then |
451 |
|
# echo Scanning all directories |
452 |
|
# for arg in * |
453 |
|
# do |
454 |
|
# test -d $arg && expts=`echo $expts $arg` |
455 |
|
# done |
456 |
|
#fi |
457 |
|
expts=`scandirs $expts` |
458 |
|
|
459 |
|
createcodelet |
460 |
|
|
461 |
|
date > summary.txt |
462 |
|
if [ $longtest -gt 0 ]; then |
463 |
|
cat << EOF >> summary.txt |
464 |
|
T S U V |
465 |
|
C D M c m s m s m s m s |
466 |
|
n p a R g m m e . m m e . m m e . m m e . |
467 |
|
f n k u 2 i a a d i a a d i a a d i a a d |
468 |
|
g d e n d n x n . n x n . n x n . n x n . |
469 |
|
|
470 |
|
EOF |
471 |
|
else |
472 |
|
cat << EOF >> summary.txt |
473 |
|
T S U V |
474 |
|
C D M c |
475 |
|
n p a R g m m m m m m m m |
476 |
|
f n k u 2 i a i a i a i a |
477 |
|
g d e n d n x n x n x n x |
478 |
|
|
479 |
|
EOF |
480 |
|
fi |
481 |
|
|
482 |
|
# Now configue, make, run and test in each directory |
483 |
|
for dir in $expts |
484 |
|
do |
485 |
|
if [ -r $dir/results/output.txt ]; then |
486 |
|
echo ------------------------------------------------------------------------------- |
487 |
|
echo |
488 |
|
echo Experiment: $dir |
489 |
|
echo |
490 |
|
unset genmakepass makedepend make run |
491 |
|
if [ $longtest -gt 0 ]; then |
492 |
|
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
493 |
|
else |
494 |
|
results='-- -- -- -- -- -- -- -- --' |
495 |
|
fi |
496 |
|
if [ -r $dir/build ]; then |
497 |
|
seperatebuilddir=1 |
498 |
|
builddir=build |
499 |
|
rundir=build |
500 |
|
(cd $dir/input; rm -f *.{o,f,c,F,h} work* output.txt Make* make.log; ) |
501 |
|
else |
502 |
|
seperatebuilddir=0 |
503 |
|
builddir=input |
504 |
|
rundir=input |
505 |
|
fi |
506 |
|
genmakemodel $dir/$builddir && genmakepass=Y \ |
507 |
|
&& makecleancompile $dir/$builddir \ |
508 |
|
&& makedependmodel $dir/$builddir && makedepend=Y \ |
509 |
|
&& makemodel $dir/$builddir && make=Y \ |
510 |
|
&& linkdata $seperatebuilddir $dir/$rundir \ |
511 |
|
&& runmodel $dir/$builddir mitgcmuv && run=Y \ |
512 |
|
&& results=`testoutput $dir $rundir` \ |
513 |
|
&& copynewresults $dir/$rundir \ |
514 |
|
&& makecleanupafter $dir/$builddir |
515 |
|
echo |
516 |
|
formatresults $dir ${genmakepass:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results |
517 |
|
echo |
518 |
|
formatresults $dir ${genmakepass:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results >> summary.txt |
519 |
|
fi |
520 |
|
done |
521 |
|
|
522 |
|
rm tmp_cmpnum.f a.out |
523 |
|
|
524 |
echo "Summary:" |
echo ------------------------------------------------------------------------------- |
525 |
echo "" |
echo |
526 |
|
date >> summary.txt |
527 |
cat summary.txt |
cat summary.txt |