27 |
echo " (DEF=\"make output.txt\")" |
echo " (DEF=\"make output.txt\")" |
28 |
echo " (-m|-make) STRING command to use for \"make\"" |
echo " (-m|-make) STRING command to use for \"make\"" |
29 |
echo " (DEF=\"make\")" |
echo " (DEF=\"make\")" |
30 |
|
echo " (-odir) STRING used to build output directory name" |
31 |
|
echo " (DEF=\"hostname\")" |
32 |
echo " (-ptracers|-ptr) STRING specify which ptracers to test" |
echo " (-ptracers|-ptr) STRING specify which ptracers to test" |
33 |
echo " (DEF=\"1 2 3 4 5\")" |
echo " (DEF=\"1 2 3 4 5\")" |
34 |
echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" |
echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" |
97 |
fi |
fi |
98 |
if [ -r $1/$4/output.txt ]; then |
if [ -r $1/$4/output.txt ]; then |
99 |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt |
100 |
lncnt=`wc -l tmp1.txt | awk '{print $1}' ` |
lncntA=`wc -l tmp1.txt | awk '{print $1}' ` |
101 |
if [ $lncnt -lt 3 ]; then |
if [ $lncntA -lt 3 ]; then |
102 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
103 |
echo Not enough lines of output when searching for "$2" 1>&2 |
echo Not enough lines of output when searching for "$2" 1>&2 |
104 |
fi |
fi |
112 |
echo testoutput_for_prop: grep "$2" $1/results/output.txt$5 1>&2 |
echo testoutput_for_prop: grep "$2" $1/results/output.txt$5 1>&2 |
113 |
fi |
fi |
114 |
grep "$2" $1/results/output.txt$5 | sed 's/.*=//' | cat -n > tmp2.txt |
grep "$2" $1/results/output.txt$5 | sed 's/.*=//' | cat -n > tmp2.txt |
115 |
lncnt=`wc -l tmp2.txt | awk '{print $1}' ` |
lncntB=`wc -l tmp2.txt | awk '{print $1}' ` |
116 |
if [ $lncnt -lt 3 ]; then |
if [ $lncntB -lt 3 ]; then |
117 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
118 |
echo Not enough lines of output when searching for "$2" 1>&2 |
echo Not enough lines of output when searching for "$2" 1>&2 |
119 |
fi |
fi |
120 |
return 99 |
return 99 |
121 |
fi |
fi |
122 |
|
if [ $lncntA -ne $lncntB ]; then |
123 |
|
if [ $verbose -gt 0 ]; then |
124 |
|
echo Not same Nb of lines when searching for "$2" ":" $lncntA $lncntB 1>&2 |
125 |
|
fi |
126 |
|
return 99 |
127 |
|
fi |
128 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
129 |
echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2 |
echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2 |
130 |
fi |
fi |
302 |
if test "x$IEEE" != x ; then |
if test "x$IEEE" != x ; then |
303 |
command="$command -ieee" |
command="$command -ieee" |
304 |
fi |
fi |
305 |
|
if test "x$MPI" = xt ; then |
306 |
|
command="$command -mpi" |
307 |
|
fi |
308 |
printf 'genmake ... ' 1>&2 |
printf 'genmake ... ' 1>&2 |
309 |
$command > make.log 2>&1 |
$command > make.log 2>&1 |
310 |
RETVAL=$? |
RETVAL=$? |
350 |
fi |
fi |
351 |
} |
} |
352 |
|
|
353 |
|
postclean() |
354 |
|
{ |
355 |
|
# postclean directory |
356 |
|
if test "x$POSTCLEAN" = xt ; then |
357 |
|
( |
358 |
|
cd $1; |
359 |
|
if test -r Makefile ; then |
360 |
|
$MAKE CLEAN >> /dev/null 2>&1 |
361 |
|
fi |
362 |
|
exit 0 |
363 |
|
) |
364 |
|
fi |
365 |
|
} |
366 |
|
|
367 |
makedependmodel() |
makedependmodel() |
368 |
{ |
{ |
369 |
# makedependmodel directory |
# makedependmodel directory |
475 |
if test "x$ADM" = x ; then |
if test "x$ADM" = x ; then |
476 |
files=`( cd ../input ; ls -1 | grep -v CVS )` |
files=`( cd ../input ; ls -1 | grep -v CVS )` |
477 |
for i in $files ; do |
for i in $files ; do |
478 |
if test ! -d "../input/"$i ; then |
if test ! -d "../input/"$i -a ! -f $i ; then |
479 |
ln -sf "../input/"$i $i |
ln -sf "../input/"$i $i |
480 |
fi |
fi |
481 |
done |
done |
544 |
#include <math.h> |
#include <math.h> |
545 |
int main( int argc, char** argv ) { |
int main( int argc, char** argv ) { |
546 |
int linnum,best,lncnt; |
int linnum,best,lncnt; |
547 |
double a,b,diff; |
double a,b,abave,relerr; |
548 |
best = -16; |
best = -22; |
549 |
lncnt = 0; |
lncnt = 0; |
550 |
while( 1 & (lncnt+=1) < 999 ) { |
while( 1 & (lncnt+=1) < 999 ) { |
551 |
scanf("%d", &linnum); |
scanf("%d", &linnum); |
552 |
if (linnum == -1) break; |
if (linnum == -1) break; |
553 |
scanf("%lf", &a); scanf("%lf", &b); |
scanf("%lf", &a); scanf("%lf", &b); |
554 |
diff = 0.5*(fabs(a)+fabs(b)); |
abave = 0.5*(fabs(a)+fabs(b)); |
555 |
if (diff > 1.e-12) { |
if (abave > 0.0) { |
556 |
diff=fabs(a-b)/diff; |
relerr=fabs(a-b)/abave; |
557 |
if (diff > 0.0) { |
if (relerr > 0.0) { linnum = (int)rint(log10(relerr)); } |
558 |
linnum = (int)log10(diff); |
else { linnum = -16 ; } |
559 |
best = (best > linnum) ? best : linnum; |
best = (best > linnum) ? best : linnum; |
|
} |
|
|
else { |
|
|
if (best == -16 && diff != 0) best = -22; |
|
|
} |
|
560 |
} |
} |
561 |
} |
} |
562 |
if (lncnt == 999) best=-29; |
if (lncnt == 999) best=-29; |
564 |
return 0; |
return 0; |
565 |
} |
} |
566 |
EOF |
EOF |
567 |
cc -o tmp_cmpnum tmp_cmpnum.c -lm |
$CC -o tmp_cmpnum tmp_cmpnum.c -lm |
568 |
|
|
569 |
if [ -x ./tmp_cmpnum ]; then |
if [ -x ./tmp_cmpnum ]; then |
570 |
echo "OK" |
echo "OK" |
571 |
return 0 |
return 0 |
572 |
else |
else |
573 |
echo |
echo |
574 |
echo "ERROR: failed to compile comparison code" |
echo "ERROR: failed to compile comparison code -- please specify" |
575 |
|
echo " a C compiler using the CC environment variable." |
576 |
exit 1 |
exit 1 |
577 |
fi |
fi |
578 |
} |
} |
652 |
NOGENMAKE=f |
NOGENMAKE=f |
653 |
NOCLEAN=f |
NOCLEAN=f |
654 |
NODEPEND=f |
NODEPEND=f |
655 |
|
POSTCLEAN=f |
656 |
|
|
657 |
BASH= |
BASH= |
658 |
OPTFILE=NONE |
OPTFILE=NONE |
662 |
HAVE_MPACK= |
HAVE_MPACK= |
663 |
MPACK="$MPACKDIR/mpack" |
MPACK="$MPACKDIR/mpack" |
664 |
COMMAND= |
COMMAND= |
665 |
MAKE=make |
if test "x$MAKE" = x ; then |
666 |
|
MAKE=make |
667 |
|
fi |
668 |
|
if test "x$CC" = x ; then |
669 |
|
CC=cc |
670 |
|
fi |
671 |
JOBS= |
JOBS= |
672 |
MPI=f |
MPI=f |
673 |
|
OUTDIR= |
674 |
DELDIR= |
DELDIR= |
675 |
|
|
676 |
ADM= |
ADM= |
727 |
-make=* | --make=*) |
-make=* | --make=*) |
728 |
MAKE=$ac_optarg ;; |
MAKE=$ac_optarg ;; |
729 |
|
|
730 |
|
-odir | --odir) |
731 |
|
ac_prev=OUTDIR ;; |
732 |
|
-odir=* | --odir=*) |
733 |
|
OUTDIR=$ac_optarg ;; |
734 |
|
|
735 |
-ptracers | --ptracers | -ptr | --ptr) |
-ptracers | --ptracers | -ptr | --ptr) |
736 |
ac_prev=PTRACERS_NUM ;; |
ac_prev=PTRACERS_NUM ;; |
737 |
-ptracers=* | --ptracers=* | -ptr=* | --ptr=*) |
-ptracers=* | --ptracers=* | -ptr=* | --ptr=*) |
741 |
-j=*) JOBS=$ac_optarg ;; |
-j=*) JOBS=$ac_optarg ;; |
742 |
|
|
743 |
-clean | --clean) |
-clean | --clean) |
744 |
CLEANUP=t ;; |
CLEANUP=t ; DELDIR=t ;; |
745 |
|
|
746 |
-quick | --quick | -q | --q) |
-quick | --quick | -q | --q) |
747 |
QUICK=t ;; |
QUICK=t ;; |
752 |
-nodepend | --nodepend | -nd | --nd) |
-nodepend | --nodepend | -nd | --nd) |
753 |
NODEPEND=t ;; |
NODEPEND=t ;; |
754 |
|
|
755 |
|
-postclean | --postclean | -pc | --pc) |
756 |
|
POSTCLEAN=t ;; |
757 |
|
|
758 |
-mpi) MPI=t ;; |
-mpi) MPI=t ;; |
759 |
|
|
760 |
-adm | -ad) ADM=t ;; |
-adm | -ad) ADM=t ;; |
821 |
UNAMEA=`uname -a` |
UNAMEA=`uname -a` |
822 |
DATE=`date +%Y%m%d` |
DATE=`date +%Y%m%d` |
823 |
BASE="tr_"$MACH"_"$DATE"_" |
BASE="tr_"$MACH"_"$DATE"_" |
824 |
|
if test "x$OUTDIR" != x ; then |
825 |
|
BASE="tr_"$OUTDIR"_"$DATE"_" |
826 |
|
fi |
827 |
DNUM=0 |
DNUM=0 |
828 |
DRESULTS="$BASE$DNUM" |
DRESULTS="$BASE$DNUM" |
829 |
while test -e $DRESULTS ; do |
while test -e $DRESULTS ; do |
913 |
if test -r $dir/input/Makefile ; then |
if test -r $dir/input/Makefile ; then |
914 |
( cd $dir/input ; make CLEAN ) |
( cd $dir/input ; make CLEAN ) |
915 |
fi |
fi |
916 |
|
( |
917 |
|
cd $dir |
918 |
|
rm -rf tr_run.* |
919 |
|
) |
920 |
continue |
continue |
921 |
fi |
fi |
922 |
|
|
925 |
fout= |
fout= |
926 |
if test "x$ADM" = x ; then |
if test "x$ADM" = x ; then |
927 |
fout=$dir"/results/output.txt" |
fout=$dir"/results/output.txt" |
|
check_for_add_mon_output $fout |
|
928 |
else |
else |
929 |
fout=$dir"/results_ad/output.txt_adm" |
fout=$dir"/results_ad/output.txt_adm" |
930 |
fi |
fi |
932 |
echo "can't read \"$fout\" -- skipping $dir" |
echo "can't read \"$fout\" -- skipping $dir" |
933 |
continue |
continue |
934 |
fi |
fi |
935 |
|
if test "x$ADM" = x ; then |
936 |
|
check_for_add_mon_output $fout |
937 |
|
fi |
938 |
|
|
939 |
# Check for additional types of monitor output |
# Check for additional types of monitor output |
940 |
|
|
1012 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
1013 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
1014 |
|
|
|
OLD_COMMAND=$COMMAND |
|
|
COMMAND="./mitgcmuv > output.txt" |
|
1015 |
for ex in $extra_runs ; do |
for ex in $extra_runs ; do |
1016 |
test -e "$dir/tr_run.$ex" && rm -rf "$dir/tr_run.$ex" |
test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" |
1017 |
mkdir "$dir/tr_run.$ex" |
for ldir in input.$ex input ; do |
1018 |
links=`( cd "$dir/input" > /dev/null 2>&1 ; ls -1 | grep -v CVS )` |
( |
1019 |
|
cd "$dir/$ldir" > /dev/null 2>&1 |
1020 |
|
ls -1 2>/dev/null \ |
1021 |
|
| sed -e 's|^CVS$||g' | sed -e 's|^output.txt$||g' |
1022 |
|
) > tr_exrun_links |
1023 |
|
( |
1024 |
|
cd "$dir/tr_run.$ex" |
1025 |
|
cat ../../tr_exrun_links | while read i ; do |
1026 |
|
if test ! "x$i" = x ; then |
1027 |
|
test ! -r $i && ln -s "../"$ldir"/"$i $i |
1028 |
|
fi |
1029 |
|
done |
1030 |
|
) |
1031 |
|
test -e tr_exrun_links && rm -f tr_exrun_links |
1032 |
|
done |
1033 |
|
ldir=build |
1034 |
|
( |
1035 |
|
cd "$dir/$ldir" > /dev/null 2>&1 |
1036 |
|
ls -1 Makefile *.[fFhco] mitgcmuv 2>/dev/null \ |
1037 |
|
| sed -e 's|^CVS$||g' | sed -e 's|^output.txt$||g' |
1038 |
|
) > tr_exrun_links |
1039 |
( |
( |
1040 |
cd "$dir/tr_run.$ex" |
cd "$dir/tr_run.$ex" |
1041 |
for i in $links; do |
cat ../../tr_exrun_links | while read i ; do |
1042 |
ln -s ../input/$i $i |
if test ! "x$i" = x ; then |
1043 |
done |
test ! -r $i && ln -s "../"$ldir"/"$i $i |
1044 |
) |
fi |
1045 |
links=`( cd "$dir/input.$ex" > /dev/null 2>&1 ; ls -1 | grep -v CVS )` |
done |
|
( |
|
|
cd "$dir/tr_run.$ex" |
|
|
for i in $links; do |
|
|
test -e $i && rm -f $i |
|
|
ln -s ../input.$ex/$i $i |
|
|
done |
|
|
ln -s ../$builddir/mitgcmuv mitgcmuv |
|
1046 |
) |
) |
1047 |
|
test -e tr_exrun_links && rm -f tr_exrun_links |
1048 |
runmodel $dir/tr_run.$ex && run=Y \ |
runmodel $dir/tr_run.$ex && run=Y \ |
1049 |
&& results=`testoutput $dir tr_run.$ex "."$ex` |
&& results=`testoutput $dir tr_run.$ex "."$ex` |
1050 |
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}` |
1058 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
1059 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
1060 |
done |
done |
|
COMMAND=$OLD_COMMAND |
|
1061 |
else |
else |
1062 |
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}` |
1063 |
fres=$fres"$results $dir" |
fres=$fres"$results $dir" |
1069 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
1070 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
1071 |
fi |
fi |
1072 |
|
|
1073 |
|
postclean $dir/$builddir |
1074 |
|
|
1075 |
echo "-------------------------------------------------------------------------------" |
echo "-------------------------------------------------------------------------------" |
1076 |
|
|
1112 |
rm -f tmp_cmpnum.c tmp_cmpnum |
rm -f tmp_cmpnum.c tmp_cmpnum |
1113 |
|
|
1114 |
if test "x$CLEANUP" != xt ; then |
if test "x$CLEANUP" != xt ; then |
1115 |
cat $SUMMARY |
cat $SUMMARY | sed 's/ -- -- -- --//g' |
1116 |
if test -e tr_out.txt ; then |
if test -e tr_out.txt ; then |
1117 |
mv tr_out.txt tr_out.txt.old |
mv tr_out.txt tr_out.txt.old |
1118 |
fi |
fi |
1119 |
cat $SUMMARY > tr_out.txt |
cat $SUMMARY | sed 's/ -- -- -- --//g' > tr_out.txt |
1120 |
fi |
fi |
1121 |
|
|
1122 |
if test "x$DELDIR" = xt ; then |
if test "x$DELDIR" = xt ; then |