1 |
#!/bin/bash |
#! /usr/bin/env bash |
2 |
# |
# |
3 |
# $Header$ |
# $Header$ |
4 |
|
# $Name$ |
5 |
# |
# |
6 |
|
|
7 |
usage() |
usage() |
11 |
echo |
echo |
12 |
echo "where possible OPTIONS are:" |
echo "where possible OPTIONS are:" |
13 |
echo " (-help|-h) print usage" |
echo " (-help|-h) print usage" |
14 |
echo " (-optfile=|-of=)STRING list of genmake2 \"optfiles\"" |
echo " (-mpi) use MPI input files" |
15 |
|
echo " (-ieee|-noieee) if possible, use IEEE compiler flags" |
16 |
|
echo " (-optfile=|-of=)STRING list of optfiles to use" |
17 |
echo " (-a|-addr)STRING list of email recipients" |
echo " (-a|-addr)STRING list of email recipients" |
18 |
echo " (-t|-tdir)STRING list of \"test\" dirs" |
echo " (DEF=\"edhill@mitgcm.org\")" |
19 |
|
echo " (-t|-tdir)STRING list of test dirs to use" |
20 |
|
echo " (DEF=\"\" which builds all)" |
21 |
|
echo " (-b|-bash)STRING location of \"bash\" executable" |
22 |
|
echo " (DEF=\"\" for \"/bin/bash\")" |
23 |
|
echo " (-command)STRING command to run" |
24 |
|
echo " (DEF=\"make output.txt\")" |
25 |
|
echo " (-m|-make)STRING command to use for \"make\"" |
26 |
|
echo " (DEF=\"make\")" |
27 |
|
echo " (-clean) *ONLY* run \"make CLEAN\"" |
28 |
|
echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\"" |
29 |
|
echo " (-nogenmake|-ng) skip the genmake stage" |
30 |
|
echo " (-noclean|-nc) skip the \"make clean\" stage" |
31 |
|
echo " (-nodepend|-nd) skip the \"make depend\" stage" |
32 |
|
echo |
33 |
|
echo "and where STRING follows a whitespace-delimited format" |
34 |
|
echo "such as:" |
35 |
|
echo " -t 'exp0 exp2 exp3' " |
36 |
|
echo " -addr='abc@123.com testing@home.org'" |
37 |
echo |
echo |
38 |
exit 1 |
exit 1 |
39 |
} |
} |
50 |
exit 1 |
exit 1 |
51 |
fi |
fi |
52 |
echo -n "building mpack... " |
echo -n "building mpack... " |
53 |
( cd $MPACKDIR && ./configure && make ) > build_mpack.out 2>&1 |
( cd $MPACKDIR && ./configure && $MAKE ) > build_mpack.out 2>&1 |
54 |
RETVAL=$? |
RETVAL=$? |
55 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
56 |
echo |
echo |
81 |
echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 |
echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 |
82 |
fi |
fi |
83 |
if [ -r $1/$4/output.txt ]; then |
if [ -r $1/$4/output.txt ]; then |
84 |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | nl > tmp1.txt |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt |
85 |
lncnt=`wc -l tmp1.txt | awk '{print $1}' ` |
lncnt=`wc -l tmp1.txt | awk '{print $1}' ` |
86 |
if [ $lncnt -lt 3 ]; then |
if [ $lncnt -lt 3 ]; then |
87 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
96 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
97 |
echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2 |
echo testoutput_for_prop: grep "$2" $1/results/output.txt 1>&2 |
98 |
fi |
fi |
99 |
grep "$2" $1/results/output.txt | sed 's/.*=//' | nl > tmp2.txt |
grep "$2" $1/results/output.txt | sed 's/.*=//' | cat -n > tmp2.txt |
100 |
lncnt=`wc -l tmp2.txt | awk '{print $1}' ` |
lncnt=`wc -l tmp2.txt | awk '{print $1}' ` |
101 |
if [ $lncnt -lt 3 ]; then |
if [ $lncnt -lt 3 ]; then |
102 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
156 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
157 |
echo testoutput: cg2dres=$cg2dres 1>&2 |
echo testoutput: cg2dres=$cg2dres 1>&2 |
158 |
fi |
fi |
|
|
|
159 |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$? |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$? |
160 |
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$? |
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$? |
161 |
testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$? |
testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$? |
180 |
genmakemodel() |
genmakemodel() |
181 |
{ |
{ |
182 |
# genmakemodel directory |
# genmakemodel directory |
183 |
GENMAKE2="../../../tools/genmake2" |
if test "x$NOGENMAKE" = xt ; then |
184 |
( |
echo "genmake skipped!" |
185 |
cd $1; |
else |
186 |
printf 'genmake ... ' 1>&2 |
GENMAKE2="$BASH ../../../tools/genmake2" |
187 |
# ../../../tools/genmake -ieee -mods=../code > make.log 2>&1 |
( |
188 |
$GENMAKE2 -ds --mods=../code "--optfile="$OPTFILE > make.log 2>&1 |
cd $1; |
189 |
RETVAL=$? |
command="$GENMAKE2 -ds -m $MAKE --mods=../code" |
190 |
for i in gm_state gm_optfile gm_local Makefile ; do |
if test "x$OPTFILE" != xNONE ; then |
191 |
if test -r $i ; then |
command="$command --optfile=$OPTFILE" |
192 |
cp $i $CDIR |
# echo " command=\"$command\"" |
193 |
fi |
fi |
194 |
done |
if test "x$IEEE" != x ; then |
195 |
if test "x$RETVAL" != x0 ; then |
command="$command -ieee" |
196 |
tail make.log |
fi |
197 |
echo "genmakemodel: genmake failed" 1>&2 |
# echo "command: \"$command\"" |
198 |
cp make.log $CDIR |
printf 'genmake ... ' 1>&2 |
199 |
return 1 |
$command > make.log 2>&1 |
200 |
else |
RETVAL=$? |
201 |
echo "succesful" 1>&2 |
for i in genmake_state genmake_optfile genmake_local Makefile ; do |
202 |
fi |
if test -r $i ; then |
203 |
) |
cp $i $CDIR |
204 |
|
fi |
205 |
|
done |
206 |
|
if test "x$RETVAL" != x0 ; then |
207 |
|
tail make.log |
208 |
|
echo "genmakemodel: genmake failed" 1>&2 |
209 |
|
cp make.log $CDIR |
210 |
|
return 1 |
211 |
|
else |
212 |
|
echo "succesful" 1>&2 |
213 |
|
fi |
214 |
|
) |
215 |
|
fi |
216 |
} |
} |
217 |
|
|
218 |
makeclean() |
makeclean() |
219 |
{ |
{ |
220 |
# makeclean directory |
# makeclean directory |
221 |
( |
if test "x$NOCLEAN" = xt ; then |
222 |
cd $1; |
echo "make CLEAN skipped!" |
223 |
rm -f output.txt |
else |
224 |
printf 'make CLEAN ... ' 2>&1 |
( |
225 |
if test -r Makefile ; then |
cd $1; |
226 |
make CLEAN >> make.log 2>&1 |
if test -e output.txt ; then |
227 |
RETVAL=$? |
rm -f output.txt |
|
if test "x$RETVAL" != x0 ; then |
|
|
tail make.log |
|
|
echo "makeclean: \"make CLEAN\" failed" 1>&2 |
|
|
cp make.log $CDIR"/make.log" |
|
|
return 1 |
|
228 |
fi |
fi |
229 |
fi |
printf 'make CLEAN ... ' 2>&1 |
230 |
echo succesful 1>&2 |
if test -r Makefile ; then |
231 |
exit 0 |
$MAKE CLEAN >> make.log 2>&1 |
232 |
) |
RETVAL=$? |
233 |
|
if test "x$RETVAL" != x0 ; then |
234 |
|
tail make.log |
235 |
|
echo "makeclean: \"make CLEAN\" failed" 1>&2 |
236 |
|
cp make.log $CDIR"/make.log" |
237 |
|
return 1 |
238 |
|
fi |
239 |
|
fi |
240 |
|
echo succesful 1>&2 |
241 |
|
exit 0 |
242 |
|
) |
243 |
|
fi |
244 |
} |
} |
245 |
|
|
246 |
makedependmodel() |
makedependmodel() |
247 |
{ |
{ |
248 |
# makedependmodel directory |
# makedependmodel directory |
249 |
( |
if test "x$NODEPEND" = xt ; then |
250 |
cd $1; |
echo "make depend skipped!" |
251 |
printf 'make depend ... ' 1>&2 |
else |
252 |
make depend >> make.log 2>&1 |
( |
253 |
RETVAL=$? |
cd $1; |
254 |
if test "x$RETVAL" != x0 ; then |
printf 'make depend ... ' 1>&2 |
255 |
tail make.log |
$MAKE depend >> make.log 2>&1 |
256 |
echo "makedependmodel: make depend failed" 1>&2 |
RETVAL=$? |
257 |
cp make.log $CDIR"/make.log" |
if test "x$RETVAL" != x0 ; then |
258 |
return 1 |
tail make.log |
259 |
else |
echo "makedependmodel: make depend failed" 1>&2 |
260 |
echo succesful 1>&2 |
cp make.log $CDIR"/make.log" |
261 |
fi |
return 1 |
262 |
) |
else |
263 |
|
echo succesful 1>&2 |
264 |
|
fi |
265 |
|
) |
266 |
|
fi |
267 |
} |
} |
268 |
|
|
269 |
makemodel() |
makemodel() |
273 |
cd $1; |
cd $1; |
274 |
if test -r Makefile ; then |
if test -r Makefile ; then |
275 |
printf 'make ... ' 1>&2 |
printf 'make ... ' 1>&2 |
276 |
make >> make.log 2>&1 |
$MAKE >> make.log 2>&1 |
277 |
RETVAL=$? |
RETVAL=$? |
278 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
279 |
tail make.log |
tail make.log |
292 |
# linkdata flag |
# linkdata flag |
293 |
# |
# |
294 |
# symbolically link data files to run directory |
# symbolically link data files to run directory |
295 |
if [ $1 -ne 0 ]; then |
if test "x$1" = x1 ; then |
296 |
( cd $2 ; ln -sf ../input/* . ) |
( |
297 |
|
cd $2 |
298 |
|
files=`( cd ../input ; ls -1 | grep -v CVS )` |
299 |
|
for i in $files ; do |
300 |
|
if test ! -d "../input/"$i ; then |
301 |
|
ln -sf "../input/"$i $i |
302 |
|
fi |
303 |
|
done |
304 |
|
) |
305 |
fi |
fi |
306 |
} |
} |
307 |
|
|
308 |
runmodel() |
runmodel() |
309 |
{ |
{ |
310 |
# runmodel directory exe |
# runmodel directory |
311 |
# |
# |
312 |
# runs the model "exe" in "directory" (exe is relative to directory) |
# runs "$COMMAND" in "directory" |
313 |
|
# (where "$COMMAND" is relative to "directory") |
314 |
( |
( |
315 |
cd $1 |
cd $1 |
316 |
if [ -x $2 ]; then |
printf 'runmodel: ' 1>&2 |
317 |
if [ $quick -eq 0 ]; then |
# make output.txt |
318 |
rm -f output.txt |
$COMMAND |
319 |
fi |
RETVAL=$? |
320 |
printf 'runmodel: ' 1>&2 |
if test "x$RETVAL" = x0 ; then |
321 |
make output.txt |
cp output.txt $CDIR"/output.txt" |
322 |
RETVAL=$? |
return 0 |
323 |
if test "x$RETVAL" = x0 ; then |
else |
324 |
cp output.txt $CDIR"/output.txt" |
return 1 |
|
return 0 |
|
|
else |
|
|
return 1 |
|
|
fi |
|
325 |
fi |
fi |
326 |
) |
) |
327 |
} |
} |
362 |
return 0 |
return 0 |
363 |
else |
else |
364 |
echo |
echo |
365 |
echo "createcodelet: failed to compile codelet" | tee |
echo "createcodelet: failed to compile codelet" |
366 |
exit 1 |
exit 1 |
367 |
fi |
fi |
368 |
} |
} |
394 |
{ |
{ |
395 |
cat - << EOF |
cat - << EOF |
396 |
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
397 |
-help Show this help message |
|
398 |
-quick Skip "genmake" and "make depend" if the Makefile exists |
-help|-h Show this help message |
399 |
-quiet Reduce the amount of output |
-quiet Reduce the amount of output |
400 |
-verbose Produce copious amounts of output |
-verbose Produce copious amounts of output |
401 |
-debug Produce even more output which will mean nothing to most |
-debug Produce even more output which will mean nothing to most |
402 |
-force Do "make CLEAN" before compiling. This forces a complete rebuild. |
-force Do "make CLEAN" before compiling. This forces a complete rebuild. |
403 |
-clean Do "make CLEAN" after compiling and testing. |
-clean Do "make CLEAN" after compiling and testing. |
|
-noieee By default, $0 uses the -ieee option for genmake. This turns it off. |
|
404 |
-cleanup Aggresively removes all model output, executables and object files |
-cleanup Aggresively removes all model output, executables and object files |
405 |
and then exits. Use with care. |
and then exits. Use with care. |
406 |
|
|
429 |
# Default properties |
# Default properties |
430 |
debug=0 |
debug=0 |
431 |
verbose=1 |
verbose=1 |
|
quick=0 |
|
432 |
clean=0 |
clean=0 |
|
ieee=1 |
|
433 |
expts='' |
expts='' |
434 |
|
# ieee=1 |
435 |
|
|
436 |
OPTFILES= |
IEEE= |
437 |
ADDRESSES=edhill@mitgcm.org |
if test "x$MITGCM_IEEE" != x ; then |
438 |
|
IEEE=$MITGCM_IEEE |
439 |
|
fi |
440 |
|
|
441 |
|
|
442 |
|
CLEANUP=f |
443 |
|
QUICK=f |
444 |
|
NOGENMAKE=f |
445 |
|
NOCLEAN=f |
446 |
|
NODEPEND=f |
447 |
|
|
448 |
|
BASH= |
449 |
|
OPTFILE=NONE |
450 |
|
ADDRESSES= |
451 |
TESTDIRS= |
TESTDIRS= |
452 |
MPACKDIR="../tools/mpack-1.6" |
MPACKDIR="../tools/mpack-1.6" |
453 |
MPACK="$MPACKDIR/mpack" |
MPACK="$MPACKDIR/mpack" |
454 |
|
COMMAND="make output.txt" |
455 |
|
MAKE=make |
456 |
|
MPI=f |
457 |
|
|
458 |
echo -n "parsing options... " |
echo -n "parsing options... " |
459 |
|
|
475 |
usage ;; |
usage ;; |
476 |
|
|
477 |
-optfile | --optfile | -of | --of) |
-optfile | --optfile | -of | --of) |
478 |
ac_prev=OPTFILES ;; |
ac_prev=OPTFILE ;; |
479 |
-optfile=* | --optfile=* | -of=* | --of=*) |
-optfile=* | --optfile=* | -of=* | --of=*) |
480 |
OPTFILES=$ac_optarg ;; |
OPTFILE=$ac_optarg ;; |
481 |
|
|
482 |
-addr | --addr | -a | --a) |
-addr | --addr | -a | --a) |
483 |
ac_prev=ADDRESSES ;; |
ac_prev=ADDRESSES ;; |
489 |
-tdir=* | --tdir=*) |
-tdir=* | --tdir=*) |
490 |
TESTDIRS=$ac_optarg ;; |
TESTDIRS=$ac_optarg ;; |
491 |
|
|
492 |
-quick) quick=1 ;; |
-bash | --bash | -b | --b) |
493 |
|
ac_prev=BASH ;; |
494 |
|
-bash=* | --bash=*) |
495 |
|
BASH=$ac_optarg ;; |
496 |
|
|
497 |
|
-command | --command | -c | --c) |
498 |
|
ac_prev=COMMAND ;; |
499 |
|
-command=* | --command=*) |
500 |
|
COMMAND=$ac_optarg ;; |
501 |
|
|
502 |
|
-make | --make | -m | --m) |
503 |
|
ac_prev=MAKE ;; |
504 |
|
-make=* | --make=*) |
505 |
|
MAKE=$ac_optarg ;; |
506 |
|
|
507 |
|
-clean | --clean) |
508 |
|
CLEANUP=t ;; |
509 |
|
|
510 |
|
-quick | --quick | -q | --q) |
511 |
|
QUICK=t ;; |
512 |
|
-nogenmake | --nogenmake | -ng | --ng) |
513 |
|
NOGENMAKE=t ;; |
514 |
|
-noclean | --noclean | -nc | --nc) |
515 |
|
NOCLEAN=t ;; |
516 |
|
-nodepend | --nodepend | -nd | --nd) |
517 |
|
NODEPEND=t ;; |
518 |
|
|
519 |
|
-mpi) MPI=t ;; |
520 |
|
|
521 |
|
-ieee) IEEE=true ;; |
522 |
|
-noieee) IEEE= ;; |
523 |
|
|
524 |
-verbose) verbose=2 ;; |
-verbose) verbose=2 ;; |
525 |
-debug) debug=1 ;; |
-debug) debug=1 ;; |
|
-clean) clean=1 ;; |
|
|
-noieee) ieee=0 ;; |
|
526 |
-quiet) verbose=0 ;; |
-quiet) verbose=0 ;; |
527 |
|
|
528 |
-*) |
-*) |
539 |
|
|
540 |
done |
done |
541 |
|
|
542 |
|
if test "x$QUICK" = xt ; then |
543 |
|
NOGENMAKE=t |
544 |
|
NOCLEAN=t |
545 |
|
NODEPEND=t |
546 |
|
fi |
547 |
|
|
548 |
if test "x$TESTDIRS" = x ; then |
if test "x$TESTDIRS" = x ; then |
549 |
TESTDIRS=`scandirs` |
TESTDIRS=`scandirs` |
550 |
fi |
fi |
551 |
|
|
552 |
|
if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then |
553 |
|
OPTFILE=$MITGCM_OF |
554 |
|
fi |
555 |
|
|
556 |
echo "OK" |
echo "OK" |
557 |
|
|
558 |
# create the FORTRAN comparison code |
# create the FORTRAN comparison code |
579 |
exit 1 |
exit 1 |
580 |
fi |
fi |
581 |
SUMMARY="$DRESULTS/summary.txt" |
SUMMARY="$DRESULTS/summary.txt" |
582 |
date > $SUMMARY |
echo -n "Start time: " >> $SUMMARY |
583 |
|
start_date=`date` |
584 |
|
echo $start_date > $SUMMARY |
585 |
cat << EOF >> $SUMMARY |
cat << EOF >> $SUMMARY |
586 |
T S U V |
T S U V |
587 |
G D M c m s m s m s m s |
G D M c m s m s m s m s |
593 |
|
|
594 |
NDIR=0 |
NDIR=0 |
595 |
|
|
596 |
# For each optfile... |
of_path= |
597 |
for OPTFILE in $OPTFILES ; do |
if test "x$OPTFILE" != xNONE ; then |
598 |
|
if test -r $OPTFILE ; then |
599 |
OPTFILE=`pwd`"/$OPTFILE" |
# get the path |
600 |
if test ! -r $OPTFILE ; then |
path=${OPTFILE%/*} |
601 |
echo "Error: can't read optfile \"$OPTFILE\"" |
if test "x$path" = x ; then |
602 |
exit 1 |
of_path=`pwd` |
|
fi |
|
|
echo |
|
|
echo "OPTFILE=$OPTFILE" >> $SUMMARY |
|
|
echo >> $SUMMARY |
|
|
|
|
|
# ...and each test directory... |
|
|
for dir in $TESTDIRS ; do |
|
|
|
|
|
# Create an output dir for each OPTFILE/tdir combination |
|
|
CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR |
|
|
mkdir $CDIR |
|
|
CDIR=`pwd`"/$CDIR" |
|
|
|
|
|
# ...configue, make, run, and compare the output. |
|
|
echo "-------------------------------------------------------------------------------" |
|
|
echo |
|
|
echo "Experiment: $dir" |
|
|
echo |
|
|
unset genmake makedepend make run |
|
|
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
|
|
( cd $dir/input; rm -f *.{o,f,c,F} *.[f,F]90 work* output.txt Make* make.log; ) |
|
|
if [ -r $dir/build ]; then |
|
|
seperatebuilddir=1 |
|
|
builddir=build |
|
|
rundir=build |
|
|
( cd $dir/build; ln -sf ../input/* . ) |
|
603 |
else |
else |
604 |
seperatebuilddir=0 |
of_path=`( cd $path > /dev/null 2>&1 ; pwd )` |
|
builddir=input |
|
|
rundir=input |
|
605 |
fi |
fi |
606 |
|
file=${OPTFILE##*/} |
607 |
|
OPTFILE=$of_path/$file |
608 |
|
else |
609 |
|
echo |
610 |
|
echo "WARNING: can't read OPTFILE=\"$OPTFILE\" but will try to use it..." |
611 |
|
fi |
612 |
|
fi |
613 |
|
echo |
614 |
|
echo "OPTFILE=$OPTFILE" >> $SUMMARY |
615 |
|
echo >> $SUMMARY |
616 |
|
|
617 |
# Verify that the testdir exists and contains previous |
# ...and each test directory... |
618 |
# results in the correct location--or skip this directory! |
for dir in $TESTDIRS ; do |
619 |
if test ! -r $dir"/results/output.txt" ; then |
|
620 |
echo | tee $SUMMARY |
# Cleanup only! |
621 |
echo "can't read \"$dir/results/output.txt\" -- skipping $dir" \ |
if test "x$CLEANUP" = xt ; then |
622 |
| tee $SUMMARY |
if test -r $dir/build/Makefile ; then |
623 |
continue |
( cd $dir/build ; make CLEAN ) |
624 |
|
fi |
625 |
|
if test -r $dir/input/Makefile ; then |
626 |
|
( cd $dir/input ; make CLEAN ) |
627 |
fi |
fi |
628 |
|
continue |
629 |
|
fi |
630 |
|
|
631 |
|
# Verify that the testdir exists and contains previous |
632 |
|
# results in the correct location--or skip this directory! |
633 |
|
if test ! -r $dir"/results/output.txt" ; then |
634 |
|
echo "can't read \"$dir/results/output.txt\" -- skipping $dir" |
635 |
|
continue |
636 |
|
fi |
637 |
|
|
638 |
|
echo "-------------------------------------------------------------------------------" |
639 |
|
echo |
640 |
|
echo "Experiment: $dir" |
641 |
|
echo |
642 |
|
unset genmake makedepend make run |
643 |
|
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
644 |
|
|
645 |
|
builddir="input" |
646 |
|
rundir="input" |
647 |
|
use_seperate_build=0 |
648 |
|
if test -d $dir/build -a -r $dir/build ; then |
649 |
|
builddir="build" |
650 |
|
rundir="build" |
651 |
|
use_seperate_build=1 |
652 |
|
linkdata $use_seperate_build $dir/$rundir |
653 |
|
fi |
654 |
|
|
655 |
|
CODE_DIR=$dir/code |
656 |
|
BUILD_DIR=$dir/$builddir |
657 |
|
MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi" |
658 |
|
NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi" |
659 |
|
|
660 |
|
# Is this an MPI run? |
661 |
|
if test "x$MPI" = xt ; then |
662 |
|
FILES=$MPI_FILES |
663 |
|
endings="_mpi" |
664 |
|
else |
665 |
|
FILES=$NOMPI_FILES |
666 |
|
endings="_nompi" |
667 |
|
fi |
668 |
|
|
669 |
|
# Check to see that we have the files |
670 |
|
have_files=t |
671 |
|
for i in $FILES ; do |
672 |
|
if test ! -r $CODE_DIR/$i ; then |
673 |
|
echo "Warning: can't read file $CODE_DIR/$i" |
674 |
|
have_files=f |
675 |
|
fi |
676 |
|
done |
677 |
|
if test "x$have_files" != xt -a "x$MPI" = xt ; then |
678 |
|
echo "Skipping $dir due to lack of input files (see above warning)" |
679 |
|
continue |
680 |
|
fi |
681 |
|
|
682 |
|
# If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR |
683 |
|
if test "x$have_files" = xt ; then |
684 |
|
for i in $FILES ; do |
685 |
|
sstr="s|$endings||" |
686 |
|
name=`echo $i | sed -e $sstr ` |
687 |
|
cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1 |
688 |
|
RETVAL=$? |
689 |
|
if test "x$RETVAL" != x0 ; then |
690 |
|
cp $CODE_DIR/$i $BUILD_DIR/$name |
691 |
|
fi |
692 |
|
done |
693 |
|
fi |
694 |
|
|
695 |
|
# Create an output dir for each OPTFILE/tdir combination |
696 |
|
CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR |
697 |
|
mkdir $CDIR |
698 |
|
CDIR=`pwd`"/$CDIR" |
699 |
|
|
700 |
|
if test "x$CLEANUP" = xt ; then |
701 |
|
makeclean $dir/$builddir |
702 |
|
else |
703 |
genmakemodel $dir/$builddir && genmake=Y \ |
genmakemodel $dir/$builddir && genmake=Y \ |
704 |
&& makeclean $dir/$builddir \ |
&& makeclean $dir/$builddir \ |
705 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
706 |
&& makemodel $dir/$builddir && make=Y \ |
&& makemodel $dir/$builddir && make=Y \ |
707 |
&& linkdata $seperatebuilddir $dir/$rundir \ |
&& linkdata $use_seperate_build $dir/$rundir \ |
708 |
&& runmodel $dir/$builddir mitgcmuv && run=Y \ |
&& runmodel $dir/$rundir && run=Y \ |
709 |
&& results=`testoutput $dir $rundir` |
&& results=`testoutput $dir $rundir` |
710 |
echo |
fi |
711 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
|
712 |
${run:-N} $results |
echo |
713 |
echo |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
714 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
${run:-N} $results |
715 |
${run:-N} $results >> $SUMMARY |
echo |
716 |
echo "fresults='" > $CDIR"/summary.txt" |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
717 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
${run:-N} $results >> $SUMMARY |
718 |
${run:-N} $results >> $CDIR"/summary.txt" |
echo "fresults='" > $CDIR"/summary.txt" |
719 |
echo "'" >> $CDIR"/summary.txt" |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
720 |
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
${run:-N} $results >> $CDIR"/summary.txt" |
721 |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
echo "'" >> $CDIR"/summary.txt" |
722 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
723 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
724 |
|
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
725 |
( |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
726 |
cd $DRESULTS |
|
727 |
tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1 |
( |
728 |
gzip $NDIR".tar" |
cd $DRESULTS |
729 |
) |
tar -cf $NDIR".tar" $DRESULTS"_"$NDIR > /dev/null 2>&1 |
730 |
|
gzip $NDIR".tar" |
731 |
|
) |
732 |
|
|
733 |
|
if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then |
734 |
|
echo "No mail sent" |
735 |
|
else |
736 |
$MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES |
$MPACK -s MITgcm-test -m 1000000 $DRESULTS"/"$NDIR".tar.gz" $ADDRESSES |
737 |
RETVAL=$? |
RETVAL=$? |
738 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
740 |
else |
else |
741 |
rm -f $DRESULTS"/"$NDIR".tar*" |
rm -f $DRESULTS"/"$NDIR".tar*" |
742 |
fi |
fi |
743 |
|
fi |
744 |
|
|
745 |
NDIR=$(( $NDIR + 1 )) |
echo "-------------------------------------------------------------------------------" |
746 |
|
|
747 |
done |
NDIR=$(( $NDIR + 1 )) |
748 |
|
|
749 |
done |
done |
750 |
|
|
751 |
|
echo -n "Start time: " >> $SUMMARY |
752 |
|
echo $start_date >> $SUMMARY |
753 |
|
echo -n "End time: " >> $SUMMARY |
754 |
|
date >> $SUMMARY |
755 |
|
|
756 |
rm tmp_cmpnum.f a.out |
rm tmp_cmpnum.f a.out |
757 |
|
|
758 |
cat $SUMMARY |
if test "x$CLEANUP" != xt ; then |
759 |
|
cat $SUMMARY |
760 |
|
if test -e tr.out ; then |
761 |
|
mv tr.out tr.out.old |
762 |
|
fi |
763 |
|
cat $SUMMARY > tr.out |
764 |
|
fi |
765 |
|
|