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 |
|
|
177 |
rm -f t[01][56].txt t[56].txt |
rm -f t[01][56].txt t[56].txt |
178 |
} |
} |
179 |
|
|
180 |
|
check_for_add_mon_output() |
181 |
|
{ |
182 |
|
# Check for additional types of monitor output |
183 |
|
if test "x$1" = x ; then |
184 |
|
return |
185 |
|
fi |
186 |
|
|
187 |
|
for ii in $PTRACERS_NUM ; do |
188 |
|
eval "HAVE_PTR0"$ii"=f" |
189 |
|
done |
190 |
|
|
191 |
|
ptr_add="trcstat_ptracerXX_min trcstat_ptracerXX_max" |
192 |
|
ptr_add="$ptr_add trcstat_ptracerXX_mean trcstat_ptracerXX_sd" |
193 |
|
for ii in $PTRACERS_NUM ; do |
194 |
|
for jj in $ptr_add ; do |
195 |
|
name=`eval "echo $jj | sed -e 's|XX|0"$ii"|g'"` |
196 |
|
tst=`grep $name $1 | wc -l | awk '{print $1}'` |
197 |
|
if test ! "x$tst" = x0 ; then |
198 |
|
eval "HAVE_PTR0"$ii"=t" |
199 |
|
fi |
200 |
|
done |
201 |
|
# eval 'echo "HAVE_PTR0'$ii' = $HAVE_PTR0'$ii'"' |
202 |
|
done |
203 |
|
} |
204 |
|
|
205 |
testoutput() |
testoutput() |
206 |
{ |
{ |
207 |
# testoutput directory subdir extension |
# testoutput directory subdir extension |
231 |
testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2 $3; vmax=$? |
testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2 $3; vmax=$? |
232 |
testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2 $3; vmean=$? |
testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2 $3; vmean=$? |
233 |
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=$? |
234 |
dashnum $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \ |
|
235 |
$umin $umax $umean $usd $vmin $vmax $vmean $vsd |
# This is for PTRACERS |
236 |
|
for ii in $PTRACERS_NUM ; do |
237 |
|
eval `echo "p0"$ii"_min=99"` |
238 |
|
eval `echo "p0"$ii"_max=99"` |
239 |
|
eval `echo "p0"$ii"_mean=99"` |
240 |
|
eval `echo "p0"$ii"_sd=99"` |
241 |
|
tst=`eval 'echo "$HAVE_PTR0'$ii'"'` |
242 |
|
#echo 'tst = '$tst |
243 |
|
if test "x$tst" = xt ; then |
244 |
|
a="trcstat_ptracer0" |
245 |
|
testoutput_for_prop $1 "$a"$ii"_min" "p0"$ii"_min" $2 $3 |
246 |
|
RETVAL=$? ; eval `echo "p0"$ii"_min="$RETVAL` |
247 |
|
testoutput_for_prop $1 "$a"$ii"_max" "p0"$ii"_max" $2 $3 |
248 |
|
RETVAL=$? ; eval `echo "p0"$ii"_max="$RETVAL` |
249 |
|
testoutput_for_prop $1 "$a"$ii"_mean" "p0"$ii"_mean" $2 $3 |
250 |
|
RETVAL=$? ; eval `echo "p0"$ii"_mean="$RETVAL` |
251 |
|
testoutput_for_prop $1 "$a"$ii"_sd" "p0"$ii"_sd" $2 $3 |
252 |
|
RETVAL=$? ; eval `echo "p0"$ii"_sd="$RETVAL` |
253 |
|
fi |
254 |
|
done |
255 |
|
|
256 |
|
allargs="$cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd" |
257 |
|
allargs="$allargs $umin $umax $umean $usd $vmin $vmax $vmean $vsd" |
258 |
|
allargs="$allargs $p01_min $p01_max $p01_mean $p01_sd" |
259 |
|
allargs="$allargs $p02_min $p02_max $p02_mean $p02_sd" |
260 |
|
allargs="$allargs $p03_min $p03_max $p03_mean $p03_sd" |
261 |
|
allargs="$allargs $p04_min $p04_max $p04_mean $p04_sd" |
262 |
|
allargs="$allargs $p05_min $p05_max $p05_mean $p05_sd" |
263 |
|
|
264 |
|
eval "dashnum $allargs" |
265 |
|
|
266 |
else |
else |
267 |
testoutput_ad $1 $2 "precision_grdchk_result" |
testoutput_ad $1 $2 "precision_grdchk_result" |
268 |
fi |
fi |
450 |
if test "x$ADM" = x ; then |
if test "x$ADM" = x ; then |
451 |
files=`( cd ../input ; ls -1 | grep -v CVS )` |
files=`( cd ../input ; ls -1 | grep -v CVS )` |
452 |
for i in $files ; do |
for i in $files ; do |
453 |
if test ! -d "../input/"$i ; then |
if test ! -d "../input/"$i -a ! -f $i ; then |
454 |
ln -sf "../input/"$i $i |
ln -sf "../input/"$i $i |
455 |
fi |
fi |
456 |
done |
done |
519 |
#include <math.h> |
#include <math.h> |
520 |
int main( int argc, char** argv ) { |
int main( int argc, char** argv ) { |
521 |
int linnum,best,lncnt; |
int linnum,best,lncnt; |
522 |
double a,b,diff; |
double a,b,abave,relerr; |
523 |
best = -16; |
best = -22; |
524 |
lncnt = 0; |
lncnt = 0; |
525 |
while( 1 & (lncnt+=1) < 999 ) { |
while( 1 & (lncnt+=1) < 999 ) { |
526 |
scanf("%d", &linnum); |
scanf("%d", &linnum); |
527 |
if (linnum == -1) break; |
if (linnum == -1) break; |
528 |
scanf("%lf", &a); scanf("%lf", &b); |
scanf("%lf", &a); scanf("%lf", &b); |
529 |
diff = 0.5*(fabs(a)+fabs(b)); |
abave = 0.5*(fabs(a)+fabs(b)); |
530 |
if (diff > 1.e-12) { |
if (abave > 0.0) { |
531 |
diff=fabs(a-b)/diff; |
relerr=fabs(a-b)/abave; |
532 |
if (diff > 0.0) { |
if (relerr > 0.0) { linnum = (int)rint(log10(relerr)); } |
533 |
linnum = (int)log10(diff); |
else { linnum = -16 ; } |
534 |
best = (best > linnum) ? best : linnum; |
best = (best > linnum) ? best : linnum; |
|
} |
|
|
else { |
|
|
if (best == -16 && diff != 0) best = -22; |
|
|
} |
|
535 |
} |
} |
536 |
} |
} |
537 |
if (lncnt == 999) best=-29; |
if (lncnt == 999) best=-29; |
539 |
return 0; |
return 0; |
540 |
} |
} |
541 |
EOF |
EOF |
542 |
cc -o tmp_cmpnum tmp_cmpnum.c -lm |
$CC -o tmp_cmpnum tmp_cmpnum.c -lm |
543 |
|
|
544 |
if [ -x ./tmp_cmpnum ]; then |
if [ -x ./tmp_cmpnum ]; then |
545 |
echo "OK" |
echo "OK" |
546 |
return 0 |
return 0 |
547 |
else |
else |
548 |
echo |
echo |
549 |
echo "ERROR: failed to compile comparison code" |
echo "ERROR: failed to compile comparison code -- please specify" |
550 |
|
echo " a C compiler using the CC environment variable." |
551 |
exit 1 |
exit 1 |
552 |
fi |
fi |
553 |
} |
} |
636 |
HAVE_MPACK= |
HAVE_MPACK= |
637 |
MPACK="$MPACKDIR/mpack" |
MPACK="$MPACKDIR/mpack" |
638 |
COMMAND= |
COMMAND= |
639 |
MAKE=make |
if test "x$MAKE" = x ; then |
640 |
|
MAKE=make |
641 |
|
fi |
642 |
|
if test "x$CC" = x ; then |
643 |
|
CC=cc |
644 |
|
fi |
645 |
JOBS= |
JOBS= |
646 |
MPI=f |
MPI=f |
647 |
DELDIR= |
DELDIR= |
648 |
|
|
649 |
ADM= |
ADM= |
650 |
|
|
651 |
|
# Additional monitor types |
652 |
|
PTRACERS_NUM="1 2 3 4 5" |
653 |
|
|
654 |
printf "parsing options... " |
printf "parsing options... " |
655 |
|
|
656 |
ac_prev= |
ac_prev= |
700 |
-make=* | --make=*) |
-make=* | --make=*) |
701 |
MAKE=$ac_optarg ;; |
MAKE=$ac_optarg ;; |
702 |
|
|
703 |
|
-ptracers | --ptracers | -ptr | --ptr) |
704 |
|
ac_prev=PTRACERS_NUM ;; |
705 |
|
-ptracers=* | --ptracers=* | -ptr=* | --ptr=*) |
706 |
|
PTRACERS_NUM=$ac_optarg ;; |
707 |
|
|
708 |
-j) ac_prev=JOBS ;; |
-j) ac_prev=JOBS ;; |
709 |
-j=*) JOBS=$ac_optarg ;; |
-j=*) JOBS=$ac_optarg ;; |
710 |
|
|
831 |
echo |
echo |
832 |
echo >> $SUMMARY |
echo >> $SUMMARY |
833 |
if test "x$ADM" = x ; then |
if test "x$ADM" = x ; then |
834 |
cat << EOF | tee -a $SUMMARY |
line_0=" ----T----- ----S----- ----U----- ----V-----" |
835 |
T S U V |
line_1="G D M c m s m s m s m s" |
836 |
G D M c m s m s m s m s |
line_2="E p a R g m m e . m m e . m m e . m m e ." |
837 |
E p a R g m m e . m m e . m m e . m m e . |
line_3="N n k u 2 i a a d i a a d i a a d i a a d" |
838 |
N n k u 2 i a a d i a a d i a a d i a a d |
line_4="2 d e n d n x n . n x n . n x n . n x n ." |
839 |
2 d e n d n x n . n x n . n x n . n x n . |
for ii in $PTRACERS_NUM ; do |
840 |
|
# tst=`eval 'echo $HAVE_PTR0'$ii` |
841 |
EOF |
# if test "x$tst" = xt ; then |
842 |
|
line_0="$line_0 --PTR 0"$ii"--" |
843 |
|
line_1="$line_1 m s" |
844 |
|
line_2="$line_2 m m e ." |
845 |
|
line_3="$line_3 i a a d" |
846 |
|
line_4="$line_4 n x n ." |
847 |
|
# fi |
848 |
|
done |
849 |
|
echo "$line_0" | tee -a $SUMMARY |
850 |
|
echo "$line_1" | tee -a $SUMMARY |
851 |
|
echo "$line_2" | tee -a $SUMMARY |
852 |
|
echo "$line_3" | tee -a $SUMMARY |
853 |
|
echo "$line_4" | tee -a $SUMMARY |
854 |
|
echo " " | tee -a $SUMMARY |
855 |
else |
else |
856 |
echo "ADJOINT=true" >> $SUMMARY |
echo "ADJOINT=true" >> $SUMMARY |
857 |
echo >> $SUMMARY |
echo >> $SUMMARY |
875 |
if test -r $dir/input/Makefile ; then |
if test -r $dir/input/Makefile ; then |
876 |
( cd $dir/input ; make CLEAN ) |
( cd $dir/input ; make CLEAN ) |
877 |
fi |
fi |
878 |
|
( |
879 |
|
cd $dir |
880 |
|
rm -rf tr_run.* |
881 |
|
) |
882 |
continue |
continue |
883 |
fi |
fi |
884 |
|
|
894 |
echo "can't read \"$fout\" -- skipping $dir" |
echo "can't read \"$fout\" -- skipping $dir" |
895 |
continue |
continue |
896 |
fi |
fi |
897 |
|
if test "x$ADM" = x ; then |
898 |
|
check_for_add_mon_output $fout |
899 |
|
fi |
900 |
|
|
901 |
|
# Check for additional types of monitor output |
902 |
|
|
903 |
builddir="input" |
builddir="input" |
904 |
rundir="input" |
rundir="input" |
974 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
975 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
976 |
|
|
|
OLD_COMMAND=$COMMAND |
|
|
COMMAND="./mitgcmuv > output.txt" |
|
977 |
for ex in $extra_runs ; do |
for ex in $extra_runs ; do |
978 |
test -e "$dir/tr_run.$ex" && rm -rf "$dir/tr_run.$ex" |
test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" |
979 |
mkdir "$dir/tr_run.$ex" |
for ldir in input.$ex input ; do |
980 |
links=`( cd "$dir/input" > /dev/null 2>&1 ; ls -1 | grep -v CVS )` |
( |
981 |
|
cd "$dir/$ldir" > /dev/null 2>&1 |
982 |
|
ls -1 2>/dev/null \ |
983 |
|
| sed -e 's|^CVS$||g' | sed -e 's|^output.txt$||g' |
984 |
|
) > tr_exrun_links |
985 |
|
( |
986 |
|
cd "$dir/tr_run.$ex" |
987 |
|
cat ../../tr_exrun_links | while read i ; do |
988 |
|
if test ! "x$i" = x ; then |
989 |
|
test ! -r $i && ln -s "../"$ldir"/"$i $i |
990 |
|
fi |
991 |
|
done |
992 |
|
) |
993 |
|
test -e tr_exrun_links && rm -f tr_exrun_links |
994 |
|
done |
995 |
|
ldir=build |
996 |
|
( |
997 |
|
cd "$dir/$ldir" > /dev/null 2>&1 |
998 |
|
ls -1 Makefile *.[fFhco] mitgcmuv 2>/dev/null \ |
999 |
|
| sed -e 's|^CVS$||g' | sed -e 's|^output.txt$||g' |
1000 |
|
) > tr_exrun_links |
1001 |
( |
( |
1002 |
cd "$dir/tr_run.$ex" |
cd "$dir/tr_run.$ex" |
1003 |
for i in $links; do |
cat ../../tr_exrun_links | while read i ; do |
1004 |
ln -s ../input/$i $i |
if test ! "x$i" = x ; then |
1005 |
done |
test ! -r $i && ln -s "../"$ldir"/"$i $i |
1006 |
) |
fi |
1007 |
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 |
|
1008 |
) |
) |
1009 |
|
test -e tr_exrun_links && rm -f tr_exrun_links |
1010 |
runmodel $dir/tr_run.$ex && run=Y \ |
runmodel $dir/tr_run.$ex && run=Y \ |
1011 |
&& results=`testoutput $dir tr_run.$ex "."$ex` |
&& results=`testoutput $dir tr_run.$ex "."$ex` |
1012 |
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}` |
1020 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
1021 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
1022 |
done |
done |
|
COMMAND=$OLD_COMMAND |
|
1023 |
else |
else |
1024 |
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}` |
1025 |
fres=$fres"$results $dir" |
fres=$fres"$results $dir" |
1072 |
rm -f tmp_cmpnum.c tmp_cmpnum |
rm -f tmp_cmpnum.c tmp_cmpnum |
1073 |
|
|
1074 |
if test "x$CLEANUP" != xt ; then |
if test "x$CLEANUP" != xt ; then |
1075 |
cat $SUMMARY |
cat $SUMMARY | sed 's/ -- -- -- --//g' |
1076 |
if test -e tr_out.txt ; then |
if test -e tr_out.txt ; then |
1077 |
mv tr_out.txt tr_out.txt.old |
mv tr_out.txt tr_out.txt.old |
1078 |
fi |
fi |
1079 |
cat $SUMMARY > tr_out.txt |
cat $SUMMARY | sed 's/ -- -- -- --//g' > tr_out.txt |
1080 |
fi |
fi |
1081 |
|
|
1082 |
if test "x$DELDIR" = xt ; then |
if test "x$DELDIR" = xt ; then |