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/genmake2 -mods=../code > make.log 2>&1 |
../../../tools/genmake2 -mods=../code > make.log 2>&1 |
142 |
else |
else |
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/{eedata,data*,*.bin,POLY3*,pickup*} .) |
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 |
|
rm -f *.nc |
281 |
make output.txt && return 0 |
make output.txt && return 0 |
282 |
return 1 |
return 1 |
283 |
fi |
fi |
284 |
) |
) |
285 |
} |
} |
286 |
|
|
287 |
|
copynewresults() |
288 |
|
{ |
289 |
|
# copynewresults directory |
290 |
|
# |
291 |
|
# runs the model "exe" in "directory" (exe is relative to directory) |
292 |
|
|
293 |
|
( cd $1 |
294 |
|
if [ $newresults -eq 1 ]; then |
295 |
|
if [ -r output.txt ]; then |
296 |
|
cp -f output.txt ../results/ |
297 |
|
return 0 |
298 |
|
fi |
299 |
|
fi |
300 |
|
) |
301 |
|
} |
302 |
|
|
303 |
createcodelet() |
createcodelet() |
304 |
{ |
{ |
305 |
# create codelet for comparing model output |
# create codelet for comparing model output |
365 |
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
366 |
-help Show this help message |
-help Show this help message |
367 |
-quick Skip "genmake" and "make depend" if the Makefile exists |
-quick Skip "genmake" and "make depend" if the Makefile exists |
368 |
|
-newresults Copy the output.txt into results/ |
369 |
-quiet Reduce the amount of output |
-quiet Reduce the amount of output |
370 |
-verbose Produce copious amounts of output |
-verbose Produce copious amounts of output |
371 |
-debug Produce even more output which will mean nothing to most |
-debug Produce even more output which will mean nothing to most |
414 |
debug=0 |
debug=0 |
415 |
verbose=1 |
verbose=1 |
416 |
quick=0 |
quick=0 |
417 |
|
newresults=0 |
418 |
force=0 |
force=0 |
419 |
clean=0 |
clean=0 |
420 |
ieee=1 |
ieee=1 |
428 |
case $arg in |
case $arg in |
429 |
-cleanup) clean_up; exit 0;; |
-cleanup) clean_up; exit 0;; |
430 |
-quick) quick=1;; |
-quick) quick=1;; |
431 |
|
-newresults) newresults=1;; |
432 |
-verbose) verbose=2;; |
-verbose) verbose=2;; |
433 |
-debug) debug=1;; |
-debug) debug=1;; |
434 |
-force) force=1;; |
-force) force=1;; |
498 |
seperatebuilddir=1 |
seperatebuilddir=1 |
499 |
builddir=build |
builddir=build |
500 |
rundir=build |
rundir=build |
501 |
(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/* .) |
|
502 |
else |
else |
503 |
seperatebuilddir=0 |
seperatebuilddir=0 |
504 |
builddir=input |
builddir=input |
511 |
&& linkdata $seperatebuilddir $dir/$rundir \ |
&& linkdata $seperatebuilddir $dir/$rundir \ |
512 |
&& runmodel $dir/$builddir mitgcmuv && run=Y \ |
&& runmodel $dir/$builddir mitgcmuv && run=Y \ |
513 |
&& results=`testoutput $dir $rundir` \ |
&& results=`testoutput $dir $rundir` \ |
514 |
|
&& copynewresults $dir/$rundir \ |
515 |
&& makecleanupafter $dir/$builddir |
&& makecleanupafter $dir/$builddir |
516 |
echo |
echo |
517 |
formatresults $dir ${genmakepass:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results |
formatresults $dir ${genmakepass:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results |