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 " (-ptracers|-ptr) STRING specify which ptracers to test" |
31 |
|
echo " (DEF=\"1 2 3 4 5\")" |
32 |
echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" |
echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" |
33 |
echo " (-clean) *ONLY* run \"make CLEAN\"" |
echo " (-clean) *ONLY* run \"make CLEAN\"" |
34 |
echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\"" |
echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\"" |
37 |
echo " (-nodepend|-nd) skip the \"make depend\" stage" |
echo " (-nodepend|-nd) skip the \"make depend\" stage" |
38 |
echo " (-deldir|-dd) on success, delete the output directory" |
echo " (-deldir|-dd) on success, delete the output directory" |
39 |
echo |
echo |
40 |
echo "and where STRING follows a whitespace-delimited format" |
echo "and where STRING can be a whitespace-delimited list" |
41 |
echo "such as:" |
echo "such as:" |
42 |
|
echo |
43 |
echo " -t 'exp0 exp2 exp3' " |
echo " -t 'exp0 exp2 exp3' " |
44 |
echo " -addr='abc@123.com testing@home.org'" |
echo " -addr='abc@123.com testing@home.org'" |
45 |
echo |
echo |
46 |
|
echo "provided that the expression is properly quoted within the current" |
47 |
|
echo "shell (note the use of single quotes to protect white space)." |
48 |
|
echo |
49 |
exit 1 |
exit 1 |
50 |
} |
} |
51 |
|
|
95 |
fi |
fi |
96 |
if [ -r $1/$4/output.txt ]; then |
if [ -r $1/$4/output.txt ]; then |
97 |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt |
98 |
lncnt=`wc -l tmp1.txt | awk '{print $1}' ` |
lncntA=`wc -l tmp1.txt | awk '{print $1}' ` |
99 |
if [ $lncnt -lt 3 ]; then |
if [ $lncntA -lt 3 ]; then |
100 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
101 |
echo Not enough lines of output when searching for "$2" 1>&2 |
echo Not enough lines of output when searching for "$2" 1>&2 |
102 |
fi |
fi |
110 |
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 |
111 |
fi |
fi |
112 |
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 |
113 |
lncnt=`wc -l tmp2.txt | awk '{print $1}' ` |
lncntB=`wc -l tmp2.txt | awk '{print $1}' ` |
114 |
if [ $lncnt -lt 3 ]; then |
if [ $lncntB -lt 3 ]; then |
115 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
116 |
echo Not enough lines of output when searching for "$2" 1>&2 |
echo Not enough lines of output when searching for "$2" 1>&2 |
117 |
fi |
fi |
118 |
return 99 |
return 99 |
119 |
fi |
fi |
120 |
|
if [ $lncntA -ne $lncntB ]; then |
121 |
|
if [ $verbose -gt 0 ]; then |
122 |
|
echo Not same Nb of lines when searching for "$2" ":" $lncntA $lncntB 1>&2 |
123 |
|
fi |
124 |
|
return 99 |
125 |
|
fi |
126 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
127 |
echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2 |
echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2 |
128 |
fi |
fi |
190 |
return |
return |
191 |
fi |
fi |
192 |
|
|
193 |
|
for ii in $PTRACERS_NUM ; do |
194 |
|
eval "HAVE_PTR0"$ii"=f" |
195 |
|
done |
196 |
|
|
197 |
ptr_add="trcstat_ptracerXX_min trcstat_ptracerXX_max" |
ptr_add="trcstat_ptracerXX_min trcstat_ptracerXX_max" |
198 |
ptr_add="$ptr_add trcstat_ptracerXX_mean trcstat_ptracerXX_sd" |
ptr_add="$ptr_add trcstat_ptracerXX_mean trcstat_ptracerXX_sd" |
199 |
for ii in 1 2 3 4 5 ; do |
for ii in $PTRACERS_NUM ; do |
200 |
for jj in $ptr_add ; do |
for jj in $ptr_add ; do |
201 |
name=`eval "echo $jj | sed -e 's|XX|0"$ii"|g'"` |
name=`eval "echo $jj | sed -e 's|XX|0"$ii"|g'"` |
202 |
tst=`grep $name $1 | wc -l | awk '{print $1}'` |
tst=`grep $name $1 | wc -l | awk '{print $1}'` |
238 |
testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2 $3; vmean=$? |
testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2 $3; vmean=$? |
239 |
testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2 $3; vsd=$? |
testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2 $3; vsd=$? |
240 |
|
|
241 |
for ii in 1 2 3 4 5 ; do |
# This is for PTRACERS |
242 |
testoutput_for_prop $1 "trcstat_ptracer0"$ii"_min" "p0"$ii"_min" $2 $3 |
for ii in $PTRACERS_NUM ; do |
243 |
RETVAL=$? ; eval `echo "p0"$ii"_min="$RETVAL` |
eval `echo "p0"$ii"_min=99"` |
244 |
testoutput_for_prop $1 "trcstat_ptracer0"$ii"_max" "p0"$ii"_max" $2 $3 |
eval `echo "p0"$ii"_max=99"` |
245 |
RETVAL=$? ; eval `echo "p0"$ii"_max="$RETVAL` |
eval `echo "p0"$ii"_mean=99"` |
246 |
testoutput_for_prop $1 "trcstat_ptracer0"$ii"_mean" "p0"$ii"_mean" $2 $3 |
eval `echo "p0"$ii"_sd=99"` |
247 |
RETVAL=$? ; eval `echo "p0"$ii"_mean="$RETVAL` |
tst=`eval 'echo "$HAVE_PTR0'$ii'"'` |
248 |
testoutput_for_prop $1 "trcstat_ptracer0"$ii"_sd" "p0"$ii"_sd" $2 $3 |
#echo 'tst = '$tst |
249 |
RETVAL=$? ; eval `echo "p0"$ii"_sd="$RETVAL` |
if test "x$tst" = xt ; then |
250 |
|
a="trcstat_ptracer0" |
251 |
|
testoutput_for_prop $1 "$a"$ii"_min" "p0"$ii"_min" $2 $3 |
252 |
|
RETVAL=$? ; eval `echo "p0"$ii"_min="$RETVAL` |
253 |
|
testoutput_for_prop $1 "$a"$ii"_max" "p0"$ii"_max" $2 $3 |
254 |
|
RETVAL=$? ; eval `echo "p0"$ii"_max="$RETVAL` |
255 |
|
testoutput_for_prop $1 "$a"$ii"_mean" "p0"$ii"_mean" $2 $3 |
256 |
|
RETVAL=$? ; eval `echo "p0"$ii"_mean="$RETVAL` |
257 |
|
testoutput_for_prop $1 "$a"$ii"_sd" "p0"$ii"_sd" $2 $3 |
258 |
|
RETVAL=$? ; eval `echo "p0"$ii"_sd="$RETVAL` |
259 |
|
fi |
260 |
done |
done |
261 |
|
|
262 |
allargs="$cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd" |
allargs="$cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd" |
300 |
if test "x$IEEE" != x ; then |
if test "x$IEEE" != x ; then |
301 |
command="$command -ieee" |
command="$command -ieee" |
302 |
fi |
fi |
303 |
|
if test "x$MPI" = xt ; then |
304 |
|
command="$command -mpi" |
305 |
|
fi |
306 |
printf 'genmake ... ' 1>&2 |
printf 'genmake ... ' 1>&2 |
307 |
$command > make.log 2>&1 |
$command > make.log 2>&1 |
308 |
RETVAL=$? |
RETVAL=$? |
348 |
fi |
fi |
349 |
} |
} |
350 |
|
|
351 |
|
postclean() |
352 |
|
{ |
353 |
|
# postclean directory |
354 |
|
if test "x$POSTCLEAN" = xt ; then |
355 |
|
( |
356 |
|
cd $1; |
357 |
|
if test -r Makefile ; then |
358 |
|
$MAKE CLEAN >> /dev/null 2>&1 |
359 |
|
fi |
360 |
|
exit 0 |
361 |
|
) |
362 |
|
fi |
363 |
|
} |
364 |
|
|
365 |
makedependmodel() |
makedependmodel() |
366 |
{ |
{ |
367 |
# makedependmodel directory |
# makedependmodel directory |
473 |
if test "x$ADM" = x ; then |
if test "x$ADM" = x ; then |
474 |
files=`( cd ../input ; ls -1 | grep -v CVS )` |
files=`( cd ../input ; ls -1 | grep -v CVS )` |
475 |
for i in $files ; do |
for i in $files ; do |
476 |
if test ! -d "../input/"$i ; then |
if test ! -d "../input/"$i -a ! -f $i ; then |
477 |
ln -sf "../input/"$i $i |
ln -sf "../input/"$i $i |
478 |
fi |
fi |
479 |
done |
done |
542 |
#include <math.h> |
#include <math.h> |
543 |
int main( int argc, char** argv ) { |
int main( int argc, char** argv ) { |
544 |
int linnum,best,lncnt; |
int linnum,best,lncnt; |
545 |
double a,b,diff; |
double a,b,abave,relerr; |
546 |
best = -16; |
best = -22; |
547 |
lncnt = 0; |
lncnt = 0; |
548 |
while( 1 & (lncnt+=1) < 999 ) { |
while( 1 & (lncnt+=1) < 999 ) { |
549 |
scanf("%d", &linnum); |
scanf("%d", &linnum); |
550 |
if (linnum == -1) break; |
if (linnum == -1) break; |
551 |
scanf("%lf", &a); scanf("%lf", &b); |
scanf("%lf", &a); scanf("%lf", &b); |
552 |
diff = 0.5*(fabs(a)+fabs(b)); |
abave = 0.5*(fabs(a)+fabs(b)); |
553 |
if (diff > 1.e-12) { |
if (abave > 0.0) { |
554 |
diff=fabs(a-b)/diff; |
relerr=fabs(a-b)/abave; |
555 |
if (diff > 0.0) { |
if (relerr > 0.0) { linnum = (int)rint(log10(relerr)); } |
556 |
linnum = (int)log10(diff); |
else { linnum = -16 ; } |
557 |
best = (best > linnum) ? best : linnum; |
best = (best > linnum) ? best : linnum; |
|
} |
|
|
else { |
|
|
if (best == -16 && diff != 0) best = -22; |
|
|
} |
|
558 |
} |
} |
559 |
} |
} |
560 |
if (lncnt == 999) best=-29; |
if (lncnt == 999) best=-29; |
562 |
return 0; |
return 0; |
563 |
} |
} |
564 |
EOF |
EOF |
565 |
cc -o tmp_cmpnum tmp_cmpnum.c -lm |
$CC -o tmp_cmpnum tmp_cmpnum.c -lm |
566 |
|
|
567 |
if [ -x ./tmp_cmpnum ]; then |
if [ -x ./tmp_cmpnum ]; then |
568 |
echo "OK" |
echo "OK" |
569 |
return 0 |
return 0 |
570 |
else |
else |
571 |
echo |
echo |
572 |
echo "ERROR: failed to compile comparison code" |
echo "ERROR: failed to compile comparison code -- please specify" |
573 |
|
echo " a C compiler using the CC environment variable." |
574 |
exit 1 |
exit 1 |
575 |
fi |
fi |
576 |
} |
} |
650 |
NOGENMAKE=f |
NOGENMAKE=f |
651 |
NOCLEAN=f |
NOCLEAN=f |
652 |
NODEPEND=f |
NODEPEND=f |
653 |
|
POSTCLEAN=f |
654 |
|
|
655 |
BASH= |
BASH= |
656 |
OPTFILE=NONE |
OPTFILE=NONE |
660 |
HAVE_MPACK= |
HAVE_MPACK= |
661 |
MPACK="$MPACKDIR/mpack" |
MPACK="$MPACKDIR/mpack" |
662 |
COMMAND= |
COMMAND= |
663 |
MAKE=make |
if test "x$MAKE" = x ; then |
664 |
|
MAKE=make |
665 |
|
fi |
666 |
|
if test "x$CC" = x ; then |
667 |
|
CC=cc |
668 |
|
fi |
669 |
JOBS= |
JOBS= |
670 |
MPI=f |
MPI=f |
671 |
DELDIR= |
DELDIR= |
673 |
ADM= |
ADM= |
674 |
|
|
675 |
# Additional monitor types |
# Additional monitor types |
676 |
# HAVE_PTR01= |
PTRACERS_NUM="1 2 3 4 5" |
|
# HAVE_PTR02= |
|
|
# HAVE_PTR03= |
|
|
# HAVE_PTR04= |
|
|
# HAVE_PTR05= |
|
677 |
|
|
678 |
printf "parsing options... " |
printf "parsing options... " |
679 |
|
|
724 |
-make=* | --make=*) |
-make=* | --make=*) |
725 |
MAKE=$ac_optarg ;; |
MAKE=$ac_optarg ;; |
726 |
|
|
727 |
|
-ptracers | --ptracers | -ptr | --ptr) |
728 |
|
ac_prev=PTRACERS_NUM ;; |
729 |
|
-ptracers=* | --ptracers=* | -ptr=* | --ptr=*) |
730 |
|
PTRACERS_NUM=$ac_optarg ;; |
731 |
|
|
732 |
-j) ac_prev=JOBS ;; |
-j) ac_prev=JOBS ;; |
733 |
-j=*) JOBS=$ac_optarg ;; |
-j=*) JOBS=$ac_optarg ;; |
734 |
|
|
744 |
-nodepend | --nodepend | -nd | --nd) |
-nodepend | --nodepend | -nd | --nd) |
745 |
NODEPEND=t ;; |
NODEPEND=t ;; |
746 |
|
|
747 |
|
-postclean | --postclean | -pc | --pc) |
748 |
|
POSTCLEAN=t ;; |
749 |
|
|
750 |
-mpi) MPI=t ;; |
-mpi) MPI=t ;; |
751 |
|
|
752 |
-adm | -ad) ADM=t ;; |
-adm | -ad) ADM=t ;; |
863 |
line_2="E p a R g m m e . m m e . m m e . m m e ." |
line_2="E p a R g m m e . m m e . m m e . m m e ." |
864 |
line_3="N n k u 2 i a a d i a a d i a a d i a a d" |
line_3="N n k u 2 i a a d i a a d i a a d i a a d" |
865 |
line_4="2 d e n d n x n . n x n . n x n . n x n ." |
line_4="2 d e n d n x n . n x n . n x n . n x n ." |
866 |
for ii in 1 2 3 4 5 ; do |
for ii in $PTRACERS_NUM ; do |
867 |
# tst=`eval 'echo $HAVE_PTR0'$ii` |
# tst=`eval 'echo $HAVE_PTR0'$ii` |
868 |
# if test "x$tst" = xt ; then |
# if test "x$tst" = xt ; then |
869 |
line_0="$line_0 --PTR 0"$ii"--" |
line_0="$line_0 --PTR 0"$ii"--" |
902 |
if test -r $dir/input/Makefile ; then |
if test -r $dir/input/Makefile ; then |
903 |
( cd $dir/input ; make CLEAN ) |
( cd $dir/input ; make CLEAN ) |
904 |
fi |
fi |
905 |
|
( |
906 |
|
cd $dir |
907 |
|
rm -rf tr_run.* |
908 |
|
) |
909 |
continue |
continue |
910 |
fi |
fi |
911 |
|
|
921 |
echo "can't read \"$fout\" -- skipping $dir" |
echo "can't read \"$fout\" -- skipping $dir" |
922 |
continue |
continue |
923 |
fi |
fi |
924 |
|
if test "x$ADM" = x ; then |
925 |
|
check_for_add_mon_output $fout |
926 |
|
fi |
927 |
|
|
928 |
# Check for additional types of monitor output |
# Check for additional types of monitor output |
|
check_for_add_mon_output $fout |
|
929 |
|
|
930 |
builddir="input" |
builddir="input" |
931 |
rundir="input" |
rundir="input" |
1001 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
1002 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
1003 |
|
|
|
OLD_COMMAND=$COMMAND |
|
|
COMMAND="./mitgcmuv > output.txt" |
|
1004 |
for ex in $extra_runs ; do |
for ex in $extra_runs ; do |
1005 |
test -e "$dir/tr_run.$ex" && rm -rf "$dir/tr_run.$ex" |
test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" |
1006 |
mkdir "$dir/tr_run.$ex" |
for ldir in input.$ex input ; do |
1007 |
links=`( cd "$dir/input" > /dev/null 2>&1 ; ls -1 | grep -v CVS )` |
( |
1008 |
|
cd "$dir/$ldir" > /dev/null 2>&1 |
1009 |
|
ls -1 2>/dev/null \ |
1010 |
|
| sed -e 's|^CVS$||g' | sed -e 's|^output.txt$||g' |
1011 |
|
) > tr_exrun_links |
1012 |
|
( |
1013 |
|
cd "$dir/tr_run.$ex" |
1014 |
|
cat ../../tr_exrun_links | while read i ; do |
1015 |
|
if test ! "x$i" = x ; then |
1016 |
|
test ! -r $i && ln -s "../"$ldir"/"$i $i |
1017 |
|
fi |
1018 |
|
done |
1019 |
|
) |
1020 |
|
test -e tr_exrun_links && rm -f tr_exrun_links |
1021 |
|
done |
1022 |
|
ldir=build |
1023 |
|
( |
1024 |
|
cd "$dir/$ldir" > /dev/null 2>&1 |
1025 |
|
ls -1 Makefile *.[fFhco] mitgcmuv 2>/dev/null \ |
1026 |
|
| sed -e 's|^CVS$||g' | sed -e 's|^output.txt$||g' |
1027 |
|
) > tr_exrun_links |
1028 |
( |
( |
1029 |
cd "$dir/tr_run.$ex" |
cd "$dir/tr_run.$ex" |
1030 |
for i in $links; do |
cat ../../tr_exrun_links | while read i ; do |
1031 |
ln -s ../input/$i $i |
if test ! "x$i" = x ; then |
1032 |
done |
test ! -r $i && ln -s "../"$ldir"/"$i $i |
1033 |
) |
fi |
1034 |
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 |
|
1035 |
) |
) |
1036 |
|
test -e tr_exrun_links && rm -f tr_exrun_links |
1037 |
runmodel $dir/tr_run.$ex && run=Y \ |
runmodel $dir/tr_run.$ex && run=Y \ |
1038 |
&& results=`testoutput $dir tr_run.$ex "."$ex` |
&& results=`testoutput $dir tr_run.$ex "."$ex` |
1039 |
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}` |
1047 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
1048 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
1049 |
done |
done |
|
COMMAND=$OLD_COMMAND |
|
1050 |
else |
else |
1051 |
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}` |
1052 |
fres=$fres"$results $dir" |
fres=$fres"$results $dir" |
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 |
fi |
fi |
1061 |
|
|
1062 |
|
postclean $dir/$builddir |
1063 |
|
|
1064 |
echo "-------------------------------------------------------------------------------" |
echo "-------------------------------------------------------------------------------" |
1065 |
|
|
1101 |
rm -f tmp_cmpnum.c tmp_cmpnum |
rm -f tmp_cmpnum.c tmp_cmpnum |
1102 |
|
|
1103 |
if test "x$CLEANUP" != xt ; then |
if test "x$CLEANUP" != xt ; then |
1104 |
cat $SUMMARY |
cat $SUMMARY | sed 's/ -- -- -- --//g' |
1105 |
if test -e tr_out.txt ; then |
if test -e tr_out.txt ; then |
1106 |
mv tr_out.txt tr_out.txt.old |
mv tr_out.txt tr_out.txt.old |
1107 |
fi |
fi |
1108 |
cat $SUMMARY > tr_out.txt |
cat $SUMMARY | sed 's/ -- -- -- --//g' > tr_out.txt |
1109 |
fi |
fi |
1110 |
|
|
1111 |
if test "x$DELDIR" = xt ; then |
if test "x$DELDIR" = xt ; then |