229 |
|
|
230 |
linkdata() |
linkdata() |
231 |
{ |
{ |
232 |
# linkdata flag |
# linkdata flag |
233 |
# symbolically link data files to run directory |
# |
234 |
if [ $1 -ne 0 ]; then |
# symbolically link data files to run directory |
235 |
# if [ ! -r $2 ]; then |
if test "x$1" = x1 ; then |
236 |
# mkdir $2 |
( |
237 |
# fi |
cd $2 |
238 |
( cd $2; ln -sf ../input/{eedata,data*,*.bin,POLY3*,pickup*} .) |
if test "x$ADM" = x ; then |
239 |
fi |
files=`( cd ../input ; ls -1 | grep -v CVS )` |
240 |
|
for i in $files ; do |
241 |
|
if test ! -d "../input/"$i ; then |
242 |
|
ln -sf "../input/"$i $i |
243 |
|
fi |
244 |
|
done |
245 |
|
else |
246 |
|
files=`( cd ../input ; ls -1 *.bin | grep -v CVS )` |
247 |
|
for i in $files ; do |
248 |
|
if test ! -d "../input/"$i ; then |
249 |
|
ln -sf "../input/"$i $i |
250 |
|
fi |
251 |
|
done |
252 |
|
files=`( cd ../input_ad ; ls -1 | grep -v CVS )` |
253 |
|
for i in $files ; do |
254 |
|
if test ! -d "../input_ad/"$i ; then |
255 |
|
ln -sf "../input_ad/"$i $i |
256 |
|
fi |
257 |
|
done |
258 |
|
fi |
259 |
|
) |
260 |
|
fi |
261 |
} |
} |
262 |
|
|
263 |
runmodel() |
runmodel() |
271 |
if [ $quick -eq 0 ]; then |
if [ $quick -eq 0 ]; then |
272 |
rm -f output.txt |
rm -f output.txt |
273 |
fi |
fi |
274 |
|
if [ $debug -gt 0 ]; then |
275 |
|
echo -n runmodel: pwd= 1>&2 |
276 |
|
pwd 1>&2 |
277 |
|
fi |
278 |
printf 'runmodel: ' 1>&2 |
printf 'runmodel: ' 1>&2 |
279 |
make output.txt && return 0 |
make output.txt && return 0 |
280 |
return 1 |
return 1 |
282 |
) |
) |
283 |
} |
} |
284 |
|
|
285 |
|
copynewresults() |
286 |
|
{ |
287 |
|
# copynewresults directory |
288 |
|
# |
289 |
|
# runs the model "exe" in "directory" (exe is relative to directory) |
290 |
|
|
291 |
|
( cd $1 |
292 |
|
if [ $newresults -eq 1 ]; then |
293 |
|
if [ -r output.txt ]; then |
294 |
|
cp -f output.txt ../results/ |
295 |
|
return 0 |
296 |
|
fi |
297 |
|
fi |
298 |
|
) |
299 |
|
} |
300 |
|
|
301 |
createcodelet() |
createcodelet() |
302 |
{ |
{ |
303 |
# create codelet for comparing model output |
# create codelet for comparing model output |
363 |
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
364 |
-help Show this help message |
-help Show this help message |
365 |
-quick Skip "genmake" and "make depend" if the Makefile exists |
-quick Skip "genmake" and "make depend" if the Makefile exists |
366 |
|
-newresults Copy the output.txt into results/ |
367 |
-quiet Reduce the amount of output |
-quiet Reduce the amount of output |
368 |
-verbose Produce copious amounts of output |
-verbose Produce copious amounts of output |
369 |
-debug Produce even more output which will mean nothing to most |
-debug Produce even more output which will mean nothing to most |
412 |
debug=0 |
debug=0 |
413 |
verbose=1 |
verbose=1 |
414 |
quick=0 |
quick=0 |
415 |
|
newresults=0 |
416 |
force=0 |
force=0 |
417 |
clean=0 |
clean=0 |
418 |
ieee=1 |
ieee=1 |
426 |
case $arg in |
case $arg in |
427 |
-cleanup) clean_up; exit 0;; |
-cleanup) clean_up; exit 0;; |
428 |
-quick) quick=1;; |
-quick) quick=1;; |
429 |
|
-newresults) newresults=1;; |
430 |
-verbose) verbose=2;; |
-verbose) verbose=2;; |
431 |
-debug) debug=1;; |
-debug) debug=1;; |
432 |
-force) force=1;; |
-force) force=1;; |
496 |
seperatebuilddir=1 |
seperatebuilddir=1 |
497 |
builddir=build |
builddir=build |
498 |
rundir=build |
rundir=build |
499 |
(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/* .) |
|
500 |
else |
else |
501 |
seperatebuilddir=0 |
seperatebuilddir=0 |
502 |
builddir=input |
builddir=input |
509 |
&& linkdata $seperatebuilddir $dir/$rundir \ |
&& linkdata $seperatebuilddir $dir/$rundir \ |
510 |
&& runmodel $dir/$builddir mitgcmuv && run=Y \ |
&& runmodel $dir/$builddir mitgcmuv && run=Y \ |
511 |
&& results=`testoutput $dir $rundir` \ |
&& results=`testoutput $dir $rundir` \ |
512 |
|
&& copynewresults $dir/$rundir \ |
513 |
&& makecleanupafter $dir/$builddir |
&& makecleanupafter $dir/$builddir |
514 |
echo |
echo |
515 |
formatresults $dir ${genmakepass:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results |
formatresults $dir ${genmakepass:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results |