136 |
( cd $1; |
( cd $1; |
137 |
if [ $quick -eq 0 -o ! -r Makefile ]; then |
if [ $quick -eq 0 -o ! -r Makefile ]; then |
138 |
printf 'genmake ... ' 1>&2 |
printf 'genmake ... ' 1>&2 |
139 |
|
find . -type l -exec rm {} \; |
140 |
if [ $ieee -eq 0 ]; then |
if [ $ieee -eq 0 ]; then |
141 |
../../../tools/genmake -mods=../code > make.log 2>&1 |
../../../tools/genmake2 -mods=../code > make.log 2>&1 |
142 |
else |
else |
143 |
../../../tools/genmake -ieee -mods=../code > make.log 2>&1 |
../../../tools/genmake2 -ieee -mods=../code > make.log 2>&1 |
144 |
fi |
fi |
145 |
if [ $? -ne 0 ]; then |
if [ $? -ne 0 ]; then |
146 |
tail make.log |
tail make.log |
147 |
echo genmakemodel: genmake failed 1>&2 |
echo genmakemodel: $genmake failed 1>&2 |
148 |
return 1 |
return 1 |
149 |
else |
else |
150 |
echo succesful 1>&2 |
echo succesful 1>&2 |
230 |
|
|
231 |
linkdata() |
linkdata() |
232 |
{ |
{ |
233 |
# linkdata flag |
# linkdata flag |
234 |
# symbolically link data files to run directory |
# |
235 |
if [ $1 -ne 0 ]; then |
# symbolically link data files to run directory |
236 |
# if [ ! -r $2 ]; then |
if test "x$1" = x1 ; then |
237 |
# mkdir $2 |
( |
238 |
# fi |
cd $2 |
239 |
( cd $2; ln -sf ../input/* .) |
if test "x$ADM" = x ; then |
240 |
fi |
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() |
runmodel() |
272 |
if [ $quick -eq 0 ]; then |
if [ $quick -eq 0 ]; then |
273 |
rm -f output.txt |
rm -f output.txt |
274 |
fi |
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 |
printf 'runmodel: ' 1>&2 |
280 |
make output.txt && return 0 |
make output.txt && return 0 |
281 |
return 1 |
return 1 |
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() |
createcodelet() |
303 |
{ |
{ |
304 |
# create codelet for comparing model output |
# create codelet for comparing model output |
364 |
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
365 |
-help Show this help message |
-help Show this help message |
366 |
-quick Skip "genmake" and "make depend" if the Makefile exists |
-quick Skip "genmake" and "make depend" if the Makefile exists |
367 |
|
-newresults Copy the output.txt into results/ |
368 |
-quiet Reduce the amount of output |
-quiet Reduce the amount of output |
369 |
-verbose Produce copious amounts of output |
-verbose Produce copious amounts of output |
370 |
-debug Produce even more output which will mean nothing to most |
-debug Produce even more output which will mean nothing to most |
413 |
debug=0 |
debug=0 |
414 |
verbose=1 |
verbose=1 |
415 |
quick=0 |
quick=0 |
416 |
|
newresults=0 |
417 |
force=0 |
force=0 |
418 |
clean=0 |
clean=0 |
419 |
ieee=1 |
ieee=1 |
420 |
longtest=1 |
longtest=1 |
421 |
expts='' |
expts='' |
422 |
|
genmake=genmake |
423 |
|
|
424 |
# Process arguments |
# Process arguments |
425 |
for arg in $@ |
for arg in $@ |
427 |
case $arg in |
case $arg in |
428 |
-cleanup) clean_up; exit 0;; |
-cleanup) clean_up; exit 0;; |
429 |
-quick) quick=1;; |
-quick) quick=1;; |
430 |
|
-newresults) newresults=1;; |
431 |
-verbose) verbose=2;; |
-verbose) verbose=2;; |
432 |
-debug) debug=1;; |
-debug) debug=1;; |
433 |
-force) force=1;; |
-force) force=1;; |
487 |
echo |
echo |
488 |
echo Experiment: $dir |
echo Experiment: $dir |
489 |
echo |
echo |
490 |
unset genmake makedepend make run |
unset genmakepass makedepend make run |
491 |
if [ $longtest -gt 0 ]; then |
if [ $longtest -gt 0 ]; then |
492 |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
493 |
else |
else |
497 |
seperatebuilddir=1 |
seperatebuilddir=1 |
498 |
builddir=build |
builddir=build |
499 |
rundir=build |
rundir=build |
500 |
(cd $dir/input; rm -f *.{o,f,c,F} work* output.txt Make* make.log; ) |
(cd $dir/input; rm -f *.{o,f,c,F,h} work* output.txt Make* make.log; ) |
|
(cd $dir/build; ln -sf ../input/* .) |
|
501 |
else |
else |
502 |
seperatebuilddir=0 |
seperatebuilddir=0 |
503 |
builddir=input |
builddir=input |
504 |
rundir=input |
rundir=input |
505 |
fi |
fi |
506 |
genmakemodel $dir/$builddir && genmake=Y \ |
genmakemodel $dir/$builddir && genmakepass=Y \ |
507 |
&& makecleancompile $dir/$builddir \ |
&& makecleancompile $dir/$builddir \ |
508 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
509 |
&& makemodel $dir/$builddir && make=Y \ |
&& makemodel $dir/$builddir && make=Y \ |
510 |
&& linkdata $seperatebuilddir $dir/$rundir \ |
&& linkdata $seperatebuilddir $dir/$rundir \ |
511 |
&& runmodel $dir/$builddir mitgcmuv && run=Y \ |
&& runmodel $dir/$builddir mitgcmuv && run=Y \ |
512 |
&& results=`testoutput $dir $rundir` \ |
&& results=`testoutput $dir $rundir` \ |
513 |
|
&& copynewresults $dir/$rundir \ |
514 |
&& makecleanupafter $dir/$builddir |
&& makecleanupafter $dir/$builddir |
515 |
echo |
echo |
516 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results |
formatresults $dir ${genmakepass:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results |
517 |
echo |
echo |
518 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results >> summary.txt |
formatresults $dir ${genmakepass:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results >> summary.txt |
519 |
fi |
fi |
520 |
done |
done |
521 |
|
|