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 " (-mpi) use MPI input files" |
echo " (-mth) run multi threaded (using eedata.mth)" |
15 |
|
echo " (-mpi) compile and run using MPI" |
16 |
echo " (-ieee|-noieee) if possible, use IEEE compiler flags" |
echo " (-ieee|-noieee) if possible, use IEEE compiler flags" |
17 |
echo " (DEF=\"-ieee\")" |
echo " (DEF=\"-ieee\")" |
18 |
echo " (-optfile=|-of=)STRING list of optfiles to use" |
echo " (-optfile=|-of=)STRING list of optfiles to use" |
336 |
{ |
{ |
337 |
# makeclean directory |
# makeclean directory |
338 |
if test "x$NOCLEAN" = xt ; then |
if test "x$NOCLEAN" = xt ; then |
339 |
echo "make CLEAN skipped!" |
echo "make Clean skipped!" |
340 |
else |
else |
341 |
( |
( |
342 |
cd $1; |
cd $1; |
343 |
if test -e output.txt ; then |
#if test -e output.txt ; then rm -f output.txt ; fi |
|
rm -f output.txt |
|
|
fi |
|
|
printf 'make CLEAN ... ' 2>&1 |
|
344 |
if test -r Makefile ; then |
if test -r Makefile ; then |
345 |
$MAKE CLEAN >> make.log 2>&1 |
printf 'clean build-dir: make Clean ... ' 2>&1 |
346 |
|
$MAKE Clean >> make.log 2>&1 |
347 |
RETVAL=$? |
RETVAL=$? |
348 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
349 |
tail make.log |
tail make.log |
350 |
echo "makeclean: \"make CLEAN\" failed" 1>&2 |
echo "makeclean: \"make Clean\" failed" 1>&2 |
351 |
cp make.log $CDIR"/make.log" |
cp make.log $CDIR"/make.log" |
352 |
return 1 |
return 1 |
353 |
fi |
fi |
358 |
fi |
fi |
359 |
} |
} |
360 |
|
|
361 |
postclean() |
run_clean() |
362 |
{ |
{ |
363 |
# postclean directory |
# run_clean directory |
364 |
if test "x$POSTCLEAN" = xt ; then |
if test "x$NOCLEAN" = xt ; then |
365 |
|
echo "run_clean skipped!" |
366 |
|
else |
367 |
( |
( |
368 |
cd $1; |
cd $1; |
369 |
if test -r Makefile ; then |
printf 'clean run-dir ... ' 2>&1 |
370 |
$MAKE CLEAN >> /dev/null 2>&1 |
# part of what is done after "make clean" when doing "make CLEAN" |
371 |
fi |
find . -name "*.meta" -exec rm {} \; |
372 |
|
find . -name "*.data" -exec rm {} \; |
373 |
|
find . -name "fort.*" -exec rm {} \; |
374 |
|
find . -type l -exec rm {} \; |
375 |
|
rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime |
376 |
|
rm -rf mnc_test_* |
377 |
|
echo successful 1>&2 |
378 |
exit 0 |
exit 0 |
379 |
) |
) |
380 |
fi |
fi |
482 |
|
|
483 |
linkdata() |
linkdata() |
484 |
{ |
{ |
485 |
# linkdata flag |
# linkdata run_dir input_dir_1 input_dir_2 ... |
486 |
# |
# |
487 |
# symbolically link data files to run directory |
# symbolically link data files to run directory |
488 |
if test "x$1" = x1 ; then |
if test -d $1 ; then |
489 |
( |
( |
490 |
cd $2 |
cd $1 ; shift |
491 |
if test "x$ADM" = x ; then |
if test -r "../"$1"/eedata.mth" ; then |
492 |
files=`( cd ../input ; ls -1 | grep -v CVS )` |
# found eedata.mth in 1rst input dir and it is readable |
493 |
for i in $files ; do |
if test "x$MULTI_THREAD" = "xt" ; then |
494 |
if test ! -d "../input/"$i -a ! -f $i ; then |
# multi-threaded test: remove symbolic link & link eedata.mth |
495 |
ln -sf "../input/"$i $i |
if test -h eedata ; then rm -f eedata ; fi |
496 |
|
if test ! -r eedata ; then |
497 |
|
ln -sf "../"$1"/eedata.mth" eedata ; |
498 |
|
printf 'eedata.mth ' 1>&2 |
499 |
fi |
fi |
500 |
done |
else |
501 |
else |
# not multi-threaded test: remove eedata symbolic link |
502 |
files=`( cd ../input_ad ; ls -1 | grep -v CVS )` |
if test -h eedata ; then rm -f eedata ; fi |
503 |
for i in $files ; do |
fi |
|
if test ! -d "../input_ad/"$i ; then |
|
|
ln -sf "../input_ad/"$i $i |
|
|
fi |
|
|
done |
|
|
files=`( cd ../input ; ls -1 | grep -v CVS )` |
|
|
for i in $files ; do |
|
|
if test ! -d "../input/"$i ; then |
|
|
if test ! -r $i ; then |
|
|
ln -sf "../input/"$i $i |
|
|
fi |
|
|
fi |
|
|
done |
|
504 |
fi |
fi |
505 |
|
for ldir in $* ; do |
506 |
|
if test -d "../"$ldir ; then |
507 |
|
printf 'ldir='${ldir} 1>&2 |
508 |
|
files=`( cd "../"$ldir ; ls -1 | grep -v CVS )` |
509 |
|
for i in $files ; do |
510 |
|
if test ! -d "../"$ldir/$i ; then |
511 |
|
if test ! -r $i ; then |
512 |
|
printf ' '$i 1>&2 |
513 |
|
ln -sf "../"$ldir"/"$i $i |
514 |
|
fi |
515 |
|
fi |
516 |
|
done |
517 |
|
if test -x "../"$ldir"/"prepare_run ; then |
518 |
|
"../"$ldir"/"prepare_run |
519 |
|
fi |
520 |
|
printf ' ; ' 1>&2 |
521 |
|
fi |
522 |
|
done |
523 |
) |
) |
524 |
fi |
fi |
525 |
} |
} |
536 |
# make output.txt |
# make output.txt |
537 |
echo |
echo |
538 |
rm -f run.log |
rm -f run.log |
539 |
if test $OUTPUTFILE -ot $EXECUTABLE ; then |
if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then |
540 |
( eval $COMMAND ) > run.log 2>&1 |
echo " link" $EXECUTABLE "from dir ../"$builddir > run.log |
541 |
RETVAL=$? |
ln -sf "../"$builddir"/"$EXECUTABLE . |
542 |
else |
else |
543 |
echo " $OUTPUTFILE is up to date " > run.log 2>&1 |
touch run.log |
544 |
RETVAL=0 |
fi |
545 |
|
if test ! -x $EXECUTABLE ; then |
546 |
|
echo " no executable:" $EXECUTABLE >> run.log |
547 |
|
RETVAL=8 |
548 |
|
else |
549 |
|
if test $OUTPUTFILE -ot $EXECUTABLE ; then |
550 |
|
( eval $COMMAND ) >> run.log 2>&1 |
551 |
|
RETVAL=$? |
552 |
|
else |
553 |
|
echo " $OUTPUTFILE is up to date " >> run.log 2>&1 |
554 |
|
RETVAL=0 |
555 |
|
fi |
556 |
fi |
fi |
557 |
# echo "COMMAND='$COMMAND'" |
# echo "COMMAND='$COMMAND'" |
558 |
# echo "pwd='"`pwd`"'" |
# echo "pwd='"`pwd`"'" |
713 |
fi |
fi |
714 |
JOBS= |
JOBS= |
715 |
MPI=f |
MPI=f |
716 |
|
MULTI_THREAD=f |
717 |
OUTDIR= |
OUTDIR= |
718 |
DELDIR= |
DELDIR= |
719 |
|
|
801 |
|
|
802 |
-mpi) MPI=t ;; |
-mpi) MPI=t ;; |
803 |
|
|
804 |
|
-mth) MULTI_THREAD=t ;; |
805 |
|
|
806 |
-adm | -ad) ADM=t ;; |
-adm | -ad) ADM=t ;; |
807 |
|
|
808 |
-ieee) IEEE=true ;; |
-ieee) IEEE=true ;; |
967 |
# Cleanup only! |
# Cleanup only! |
968 |
if test "x$CLEANUP" = xt ; then |
if test "x$CLEANUP" = xt ; then |
969 |
if test -r $dir/build/Makefile ; then |
if test -r $dir/build/Makefile ; then |
970 |
|
echo ' ------ clean dir:' $dir/build |
971 |
( cd $dir/build ; make CLEAN ) |
( cd $dir/build ; make CLEAN ) |
972 |
fi |
fi |
973 |
if test -r $dir/input/Makefile ; then |
if test -d $dir/run/CVS ; then |
974 |
( cd $dir/input ; make CLEAN ) |
echo ' ------ clean dir:' $dir/run |
975 |
|
run_clean $dir/run |
976 |
fi |
fi |
977 |
( |
( |
978 |
cd $dir |
cd $dir |
999 |
|
|
1000 |
# Check for additional types of monitor output |
# Check for additional types of monitor output |
1001 |
|
|
1002 |
builddir="input" |
builddir="build" |
1003 |
rundir="input" |
if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi |
1004 |
use_seperate_build=0 |
rundir="run" |
1005 |
if test -d $dir/build -a -r $dir/build ; then |
#rundir=$builddir |
1006 |
builddir="build" |
if test ! -d $dir/$rundir ; then |
1007 |
rundir="build" |
rundir=$builddir |
|
use_seperate_build=1 |
|
|
linkdata $use_seperate_build $dir/$rundir |
|
1008 |
fi |
fi |
1009 |
|
|
|
# Check whether there are "extra runs" for this testdir |
|
|
extra_runs= |
|
|
if test "x$ADM" = x -a "x$use_seperate_build" = x1 ; then |
|
|
ex_run_dirs=`( cd $dir ; echo input.* )` |
|
|
echo "ex_run_dirs='$ex_run_dirs'" |
|
|
for exd in $ex_run_dirs ; do |
|
|
name=`echo $exd | sed -e 's/input.//g'` |
|
|
outf="$dir/results/output.txt.$name" |
|
|
if test -f $outf -a -r $outf ; then |
|
|
extra_runs="$extra_runs $name" |
|
|
fi |
|
|
done |
|
|
fi |
|
|
|
|
1010 |
if test "x$ADM" = x ; then |
if test "x$ADM" = x ; then |
1011 |
code_dir=code |
code_dir=code |
1012 |
CODE_DIR=$dir/code |
CODE_DIR=$dir/code |
1013 |
|
input_dirs='input' |
1014 |
else |
else |
1015 |
code_dir=code_ad |
code_dir=code_ad |
1016 |
CODE_DIR=$dir/code_ad |
CODE_DIR=$dir/code_ad |
1017 |
|
input_dirs='input_ad input' |
1018 |
fi |
fi |
1019 |
BUILD_DIR=$dir/$builddir |
BUILD_DIR=$dir/$builddir |
1020 |
|
|
1022 |
echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir" |
echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir" |
1023 |
continue |
continue |
1024 |
fi |
fi |
1025 |
|
if test ! -r $dir"/input/eedata.mth" -a "x$MULTI_THREAD" = "xt" ; then |
1026 |
|
echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir" |
1027 |
|
continue |
1028 |
|
fi |
1029 |
|
|
1030 |
|
# Check whether there are "extra runs" for this testdir |
1031 |
|
extra_runs= |
1032 |
|
if test "x$ADM" = x ; then |
1033 |
|
ex_run_dirs=`( cd $dir ; echo input.* )` |
1034 |
|
#echo "ex_run_dirs='$ex_run_dirs'" |
1035 |
|
for exd in $ex_run_dirs ; do |
1036 |
|
name=`echo $exd | sed -e 's/input.//g'` |
1037 |
|
outf="$dir/results/output.txt.$name" |
1038 |
|
if test -f $outf -a -r $outf ; then |
1039 |
|
if test "x$MULTI_THREAD" = "xt" ; then |
1040 |
|
if test -r $dir"/"$exd"/eedata.mth" ; then |
1041 |
|
extra_runs="$extra_runs $name" |
1042 |
|
#else echo $dir"/"$exd"/eedata.mth: not found" |
1043 |
|
fi |
1044 |
|
else |
1045 |
|
extra_runs="$extra_runs $name" |
1046 |
|
fi |
1047 |
|
fi |
1048 |
|
done |
1049 |
|
fi |
1050 |
|
|
1051 |
echo "-------------------------------------------------------------------------------" |
echo "-------------------------------------------------------------------------------" |
1052 |
echo |
echo |
1053 |
echo "Experiment: $dir" |
if test "x$extra_runs" = "x" ; then |
1054 |
|
echo "Experiment: $dir" |
1055 |
|
else |
1056 |
|
echo "Experiment: $dir ; extra_runs=$extra_runs" |
1057 |
|
fi |
1058 |
echo |
echo |
1059 |
unset genmake makedepend make run |
unset genmake makedepend make run |
1060 |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
1065 |
CDIR=`pwd`"/$rel_CDIR" |
CDIR=`pwd`"/$rel_CDIR" |
1066 |
|
|
1067 |
if test "x$CLEANUP" = xt ; then |
if test "x$CLEANUP" = xt ; then |
1068 |
makeclean $dir/$builddir |
echo '====>>> this is to check that we never go through this part <<< ===' |
1069 |
|
makeclean $dir/$builddir \ |
1070 |
|
&& run_clean $dir/$rundir |
1071 |
else |
else |
1072 |
genmakemodel $dir/$builddir && genmake=Y \ |
genmakemodel $dir/$builddir && genmake=Y \ |
1073 |
&& makeclean $dir/$builddir \ |
&& makeclean $dir/$builddir \ |
1074 |
|
&& run_clean $dir/$rundir \ |
1075 |
&& symlink_mpifiles $dir $code_dir $builddir \ |
&& symlink_mpifiles $dir $code_dir $builddir \ |
1076 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
1077 |
&& makemodel $dir/$builddir && make=Y \ |
&& makemodel $dir/$builddir && make=Y \ |
1078 |
&& linkdata $use_seperate_build $dir/$rundir \ |
&& linkdata $dir/$rundir $input_dirs \ |
1079 |
&& runmodel $dir/$rundir && run=Y \ |
&& runmodel $dir/$rundir && run=Y \ |
1080 |
&& results=`testoutput $dir $rundir` |
&& results=`testoutput $dir $rundir` |
1081 |
fi |
fi |
1099 |
mkdir $rel_CDIR |
mkdir $rel_CDIR |
1100 |
CDIR=`pwd`"/$rel_CDIR" |
CDIR=`pwd`"/$rel_CDIR" |
1101 |
test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" |
test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" |
1102 |
for ldir in input.$ex input ; do |
run_clean $dir/tr_run.$ex |
1103 |
( |
linkdata $dir/tr_run.$ex input.$ex input |
|
cd "$dir/$ldir" > /dev/null 2>&1 |
|
|
ls -1 2>/dev/null \ |
|
|
| sed -e 's|^CVS$||g' | sed -e 's|^output.txt$||g' |
|
|
) > tr_exrun_links |
|
|
( |
|
|
cd "$dir/tr_run.$ex" |
|
|
cat ../../tr_exrun_links | while read i ; do |
|
|
if test ! "x$i" = x ; then |
|
|
test ! -r $i && ln -s "../"$ldir"/"$i $i |
|
|
fi |
|
|
done |
|
|
) |
|
|
test -e tr_exrun_links && rm -f tr_exrun_links |
|
|
done |
|
|
ldir=build |
|
|
( |
|
|
cd $dir/tr_run.$ex |
|
|
test ! -e mitgcmuv && ln -s "../"$ldir"/"mitgcmuv . |
|
|
) |
|
1104 |
runmodel $dir/tr_run.$ex && run=Y \ |
runmodel $dir/tr_run.$ex && run=Y \ |
1105 |
&& results=`testoutput $dir tr_run.$ex "."$ex` |
&& results=`testoutput $dir tr_run.$ex "."$ex` |
1106 |
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
1113 |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
1114 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
1115 |
echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt" |
echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt" |
1116 |
|
if test "x$POSTCLEAN" = xt ; then |
1117 |
|
run_clean $dir/tr_run.$ex |
1118 |
|
fi |
1119 |
done |
done |
1120 |
else |
else |
1121 |
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
1131 |
>> $CDIR"/summary.txt" |
>> $CDIR"/summary.txt" |
1132 |
fi |
fi |
1133 |
|
|
1134 |
postclean $dir/$builddir |
#postclean $dir/$builddir |
1135 |
|
if test "x$POSTCLEAN" = xt ; then |
1136 |
|
makeclean $dir/$builddir \ |
1137 |
|
&& run_clean $dir/$rundir |
1138 |
|
fi |
1139 |
|
|
1140 |
echo "-------------------------------------------------------------------------------" |
echo "-------------------------------------------------------------------------------" |
1141 |
|
|