82 |
echo testoutput: cg2dres=$cg2dres 1>&2 |
echo testoutput: cg2dres=$cg2dres 1>&2 |
83 |
fi |
fi |
84 |
|
|
85 |
if [ $testmore -gt 0 ]; then |
if [ $longtest -gt 0 ]; then |
86 |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum"; tmin=$? |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum"; tmin=$? |
87 |
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum"; tmax=$? |
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum"; tmax=$? |
88 |
testoutput_for_prop $1 "dynstat_theta_mean" "theta mean"; tmean=$? |
testoutput_for_prop $1 "dynstat_theta_mean" "theta mean"; tmean=$? |
122 |
( cd $1; |
( cd $1; |
123 |
if [ $quick -eq 0 -o ! -r Makefile ]; then |
if [ $quick -eq 0 -o ! -r Makefile ]; then |
124 |
printf 'genmake ... ' 1>&2 |
printf 'genmake ... ' 1>&2 |
125 |
../../../tools/genmake -ieee -mods=../code > make.log 2>&1 |
if [ $ieee -eq 0 ]; then |
126 |
|
../../../tools/genmake -mods=../code > make.log 2>&1 |
127 |
|
else |
128 |
|
../../../tools/genmake -ieee -mods=../code > make.log 2>&1 |
129 |
|
fi |
130 |
if [ $? -ne 0 ]; then |
if [ $? -ne 0 ]; then |
131 |
tail make.log |
tail make.log |
132 |
echo makemodel: genmake failed 1>&2 |
echo genmakemodel: genmake failed 1>&2 |
133 |
return 1 |
return 1 |
134 |
else |
else |
135 |
echo succesful 1>&2 |
echo succesful 1>&2 |
138 |
) |
) |
139 |
} |
} |
140 |
|
|
141 |
|
makecleancompile() |
142 |
|
{ |
143 |
|
# makecleancompile directory |
144 |
|
( cd $1; |
145 |
|
if [ $force -gt 0 ]; then |
146 |
|
rm -f output.txt |
147 |
|
printf 'make clean ... ' 2>&1 |
148 |
|
make CLEAN >> make.log 2>&1 |
149 |
|
if [ $? -ne 0 ]; then |
150 |
|
tail make.log |
151 |
|
echo makecleancompile: make clean failed 1>&2 |
152 |
|
return 1 |
153 |
|
else |
154 |
|
echo succesful 1>&2 |
155 |
|
fi |
156 |
|
fi |
157 |
|
) |
158 |
|
} |
159 |
|
|
160 |
|
makecleanupafter() |
161 |
|
{ |
162 |
|
# makeupafter directory |
163 |
|
( cd $1; |
164 |
|
if [ $clean -gt 0 ]; then |
165 |
|
rm -f output.txt |
166 |
|
printf 'make clean ... ' 2>&1 |
167 |
|
make CLEAN >> make.log 2>&1 |
168 |
|
if [ $? -ne 0 ]; then |
169 |
|
tail make.log |
170 |
|
echo makeupafter: make clean failed 1>&2 |
171 |
|
return 1 |
172 |
|
else |
173 |
|
echo succesful 1>&2 |
174 |
|
fi |
175 |
|
fi |
176 |
|
) |
177 |
|
} |
178 |
|
|
179 |
makedependmodel() |
makedependmodel() |
180 |
{ |
{ |
181 |
# makedependmodel directory |
# makedependmodel directory |
221 |
|
|
222 |
( cd $1 |
( cd $1 |
223 |
if [ -x $2 ]; then |
if [ -x $2 ]; then |
224 |
if [ ! -r output.txt -o $quick -eq 0 ]; then |
if [ $quick -eq 0 ]; then |
225 |
echo runmodel: running... 1>&2 |
rm -f output.txt |
|
( ./$2 > output.txt 2>&1 ) && return 0 |
|
|
return 1 |
|
|
else |
|
|
echo runmodel: output.txt is newer than executable 1>&2 |
|
|
return 0 |
|
226 |
fi |
fi |
227 |
else |
printf 'runmodel: ' 1>&2 |
228 |
echo runmodel: executable \"$1/$2\" is missing 1>&2 |
make output.txt && return 0 |
229 |
return 1 |
# if [ ! -r output.txt -o $quick -eq 0 ]; then |
230 |
|
# echo runmodel: running... 1>&2 |
231 |
|
# ( ./$2 > output.txt 2>&1 ) && return 0 |
232 |
|
# rm -f output.txt |
233 |
|
# ( make output.txt ) && return 0 |
234 |
|
# return 1 |
235 |
|
# else |
236 |
|
# echo runmodel: output.txt is newer than executable 1>&2 |
237 |
|
# ( make output.txt ) && return 0 |
238 |
|
# return 0 |
239 |
|
# fi |
240 |
|
# else |
241 |
|
# echo runmodel: executable \"$1/$2\" is missing 1>&2 |
242 |
|
# return 1 |
243 |
fi |
fi |
244 |
) |
) |
245 |
} |
} |
311 |
-quick Skip "genmake" and "make depend" if the Makefile exists |
-quick Skip "genmake" and "make depend" if the Makefile exists |
312 |
-quiet Reduce the amount of output |
-quiet Reduce the amount of output |
313 |
-verbose Produce copious amounts of output |
-verbose Produce copious amounts of output |
314 |
|
-debug Produce even more output which will mean nothing to most |
315 |
|
-force Do "make CLEAN" before compiling. This forces a complete rebuild. |
316 |
|
-clean Do "make CLEAN" after compiling and testing. |
317 |
|
-shorttest Don't compare numeric output for mean and s.d. of variables. |
318 |
|
-noieee By default, $0 uses the -ieee option for genmake. This turns it off. |
319 |
|
-cleanup Aggresively removes all model output, executables and object files |
320 |
|
and then exits. Use with care. |
321 |
|
|
322 |
Normal usage: |
Normal usage: |
323 |
$0 * Configure, compile, run and analyze in all experiment directories |
$0 * Configure, compile, run and analyze in all experiment directories |
324 |
EOF |
EOF |
325 |
} |
} |
326 |
|
|
327 |
|
scandirs() |
328 |
|
{ |
329 |
|
if [ $# -eq 0 ]; then |
330 |
|
for arg in * |
331 |
|
do |
332 |
|
test -d $arg/input && echo $arg |
333 |
|
done |
334 |
|
else |
335 |
|
echo $* |
336 |
|
fi |
337 |
|
} |
338 |
|
|
339 |
|
clean_up() |
340 |
|
{ |
341 |
|
# Find all executables, object files, CPP'd source and model output |
342 |
|
# and DELETE it. |
343 |
|
for opt in '-name mitgcmuv*' '-name *.o' '-name *.f' '-name *.c' '-path *results -prune -o -name *.meta' '-path *results -prune -o -name *.data' '-type l' |
344 |
|
do |
345 |
|
echo Cleaning: find . $opt -exec rm {} \; |
346 |
|
find . $opt -exec rm {} \; |
347 |
|
done |
348 |
|
} |
349 |
|
|
350 |
############################################################################### |
############################################################################### |
351 |
|
|
352 |
# Main function |
# Main function |
355 |
debug=0 |
debug=0 |
356 |
verbose=1 |
verbose=1 |
357 |
quick=0 |
quick=0 |
358 |
testmore=0 |
force=0 |
359 |
|
clean=0 |
360 |
|
ieee=1 |
361 |
|
longtest=1 |
362 |
expts='' |
expts='' |
363 |
|
|
364 |
# Process arguments |
# Process arguments |
365 |
for arg in $@ |
for arg in $@ |
366 |
do |
do |
367 |
case $arg in |
case $arg in |
368 |
|
-cleanup) clean_up; exit 0;; |
369 |
-quick) quick=1;; |
-quick) quick=1;; |
370 |
-verbose) verbose=2;; |
-verbose) verbose=2;; |
371 |
-debug) debug=1;; |
-debug) debug=1;; |
372 |
-testmore) testmore=1;; |
-force) force=1;; |
373 |
|
-clean) clean=1;; |
374 |
|
-noieee) ieee=0;; |
375 |
|
-shorttest) longtest=0;; |
376 |
-quiet) verbose=0;; |
-quiet) verbose=0;; |
377 |
-help) show_help; exit 0;; |
-help) show_help; exit 0;; |
378 |
|
-*) echo Unrecognized option:$arg; exit 9;; |
379 |
*) test -d $arg && expts=`echo $expts $arg`;; |
*) test -d $arg && expts=`echo $expts $arg`;; |
380 |
esac |
esac |
381 |
done |
done |
382 |
|
|
383 |
if [ ${#expts} -eq 0 ]; then |
if [ $force -gt 0 -a $quick -gt 0 ]; then |
384 |
echo Scanning all directories |
echo You specified -quick and -force together which conflict. |
385 |
for arg in * |
echo Please specify either -quick or -force or neither but not both. |
386 |
do |
exit 1 |
|
test -d $arg && expts=`echo $expts $arg` |
|
|
done |
|
387 |
fi |
fi |
388 |
|
|
389 |
|
#if [ ${#expts} -eq 0 ]; then |
390 |
|
# echo Scanning all directories |
391 |
|
# for arg in * |
392 |
|
# do |
393 |
|
# test -d $arg && expts=`echo $expts $arg` |
394 |
|
# done |
395 |
|
#fi |
396 |
|
expts=`scandirs $expts` |
397 |
|
|
398 |
createcodelet |
createcodelet |
399 |
|
|
400 |
if [ $testmore -gt 0 ]; then |
if [ $longtest -gt 0 ]; then |
401 |
cat << EOF > summary.txt |
cat << EOF > summary.txt |
402 |
T S U V |
T S U V |
403 |
C D M c m s m s m s m s |
C D M c m s m s m s m s |
426 |
echo Experiment: $dir |
echo Experiment: $dir |
427 |
echo |
echo |
428 |
unset genmake makedepend make run |
unset genmake makedepend make run |
429 |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
if [ $longtest -gt 0 ]; then |
430 |
results='-- -- -- -- -- -- -- -- --' |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
431 |
|
else |
432 |
|
results='-- -- -- -- -- -- -- -- --' |
433 |
|
fi |
434 |
genmakemodel $dir/input && genmake=Y \ |
genmakemodel $dir/input && genmake=Y \ |
435 |
|
&& makecleancompile $dir/input \ |
436 |
&& makedependmodel $dir/input && makedepend=Y \ |
&& makedependmodel $dir/input && makedepend=Y \ |
437 |
&& makemodel $dir/input && make=Y \ |
&& makemodel $dir/input && make=Y \ |
438 |
&& runmodel $dir/input mitgcmuv && run=Y \ |
&& runmodel $dir/input mitgcmuv && run=Y \ |
439 |
&& results=`testoutput $dir` |
&& results=`testoutput $dir` \ |
440 |
|
&& makecleanupafter $dir/input |
441 |
echo |
echo |
442 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results |
443 |
echo |
echo |