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=\"noieee\")" |
echo " (DEF=\"-ieee\")" |
18 |
echo " (-optfile=|-of=)STRING list of optfiles to use" |
echo " (-of=|-optfile=)STRING list of optfiles to use" |
19 |
echo " (-a|-addr) STRING list of email recipients" |
echo " (-a|-addr) STRING list of email recipients" |
20 |
echo " (DEF=\"edhill@mitgcm.org\")" |
echo " (DEF=\"edhill@mitgcm.org\")" |
21 |
echo " (-t|-tdir) STRING list of test dirs to use" |
echo " (-t|-tdir) STRING list of group and/or exp. dirs to test" |
22 |
echo " (DEF=\"\" which builds all)" |
echo " (recognized groups: basic, tutorials)" |
23 |
|
echo " (DEF=\"\" which test all)" |
24 |
|
echo " (-skd|-skipdir) STRING list of exp. dirs to skip" |
25 |
|
echo " (DEF=\"\" which test all)" |
26 |
echo " (-b|-bash) STRING preferred location of a \"bash\" or" |
echo " (-b|-bash) STRING preferred location of a \"bash\" or" |
27 |
echo " Bourne-compatible \"sh\" shell" |
echo " Bourne-compatible \"sh\" shell" |
28 |
echo " (DEF=\"\" for \"bash\")" |
echo " (DEF=\"\" for \"bash\")" |
31 |
echo " (DEF=\"make output.txt\")" |
echo " (DEF=\"make output.txt\")" |
32 |
echo " (-m|-make) STRING command to use for \"make\"" |
echo " (-m|-make) STRING command to use for \"make\"" |
33 |
echo " (DEF=\"make\")" |
echo " (DEF=\"make\")" |
34 |
|
echo " (-odir) STRING used to build output directory name" |
35 |
|
echo " (DEF=\"hostname\")" |
36 |
|
echo " (-ptr|-ptracers) STRING specify which ptracers to test" |
37 |
|
echo " (DEF=\"1 2 3 4 5\")" |
38 |
|
echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" |
39 |
echo " (-clean) *ONLY* run \"make CLEAN\"" |
echo " (-clean) *ONLY* run \"make CLEAN\"" |
40 |
echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\"" |
echo " (-q|-quick) same as \"-nogenmake -noclean -nodepend\"" |
41 |
echo " (-nogenmake|-ng) skip the genmake stage" |
echo " (-ng|-nogenmake) skip the genmake stage" |
42 |
echo " (-noclean|-nc) skip the \"make clean\" stage" |
echo " (-nc|-noclean) skip the \"make clean\" stage" |
43 |
echo " (-nodepend|-nd) skip the \"make depend\" stage" |
echo " (-nd|-nodepend) skip the \"make depend\" stage" |
44 |
|
echo " (-dd|-deldir) on success, delete the output directory" |
45 |
echo |
echo |
46 |
echo "and where STRING follows a whitespace-delimited format" |
echo "and where STRING can be a whitespace-delimited list" |
47 |
echo "such as:" |
echo "such as:" |
48 |
|
echo |
49 |
echo " -t 'exp0 exp2 exp3' " |
echo " -t 'exp0 exp2 exp3' " |
50 |
echo " -addr='abc@123.com testing@home.org'" |
echo " -addr='abc@123.com testing@home.org'" |
51 |
echo |
echo |
52 |
|
echo "provided that the expression is properly quoted within the current" |
53 |
|
echo "shell (note the use of single quotes to protect white space)." |
54 |
|
echo |
55 |
exit 1 |
exit 1 |
56 |
} |
} |
57 |
|
|
93 |
{ |
{ |
94 |
# testoutput_for_prop dir s1 label subdir extension |
# testoutput_for_prop dir s1 label subdir extension |
95 |
# |
# |
96 |
# compares files in $dir/$subdir/output.txt and $dir/results/output.txt |
# compares files $dir/$subdir/$OUTPUTFILE and $dir/results/output.txt |
97 |
# using search strings s1 and text label |
# using search strings s1 and text label |
98 |
|
|
99 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
100 |
echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 |
echo testoutput_for_prop: grep "$2" $1/$4/$OUTPUTFILE 1>&2 |
101 |
fi |
fi |
102 |
if [ -r $1/$4/output.txt ]; then |
if [ -r $1/$4/$OUTPUTFILE ]; then |
103 |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt |
grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > tmp1.txt |
104 |
lncnt=`wc -l tmp1.txt | awk '{print $1}' ` |
lncntA=`wc -l tmp1.txt | awk '{print $1}' ` |
105 |
if [ $lncnt -lt 3 ]; then |
if [ $lncntA -lt 3 ]; then |
106 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
107 |
echo Not enough lines of output when searching for "$2" 1>&2 |
echo Not enough lines of output when searching for "$2" 1>&2 |
108 |
fi |
fi |
109 |
return 99 |
return 99 |
110 |
fi |
fi |
111 |
else |
else |
112 |
echo testoutput_for_prop: output.txt from model run was not readable 1>&2 |
echo testoutput_for_prop: $OUTPUTFILE from model run was not readable 1>&2 |
113 |
return 99 |
return 99 |
114 |
fi |
fi |
115 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
116 |
echo testoutput_for_prop: grep "$2" $1/results/output.txt$5 1>&2 |
echo testoutput_for_prop: grep "$2" $1/results/output.$5 1>&2 |
117 |
fi |
fi |
118 |
grep "$2" $1/results/output.txt$5 | sed 's/.*=//' | cat -n > tmp2.txt |
grep "$2" $1/results/output.$5 | sed 's/.*=//' | cat -n > tmp2.txt |
119 |
lncnt=`wc -l tmp2.txt | awk '{print $1}' ` |
lncntB=`wc -l tmp2.txt | awk '{print $1}' ` |
120 |
if [ $lncnt -lt 3 ]; then |
if [ $lncntB -lt 3 ]; then |
121 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
122 |
echo Not enough lines of output when searching for "$2" 1>&2 |
echo Not enough lines of output when searching for "$2" 1>&2 |
123 |
fi |
fi |
124 |
return 99 |
return 99 |
125 |
fi |
fi |
126 |
|
if [ $lncntA -ne $lncntB ]; then |
127 |
|
if [ $verbose -gt 0 ]; then |
128 |
|
echo Not same Nb of lines when searching for "$2" ":" $lncntA $lncntB 1>&2 |
129 |
|
fi |
130 |
|
return 99 |
131 |
|
fi |
132 |
|
has_nan=`cat tmp1.txt | grep -i nan | wc -l` |
133 |
|
if [ $has_nan -gt 0 ] ; then |
134 |
|
echo testoutput_for_prop: $OUTPUTFILE contains $has_nan NaN values 1>&2 |
135 |
|
return 99 |
136 |
|
fi |
137 |
|
has_inf=`cat tmp1.txt | grep -i inf | wc -l` |
138 |
|
if [ $has_inf -gt 0 ] ; then |
139 |
|
echo testoutput_for_prop: $OUTPUTFILE contains $has_inf Inf values 1>&2 |
140 |
|
return 99 |
141 |
|
fi |
142 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
143 |
echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2 |
echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2 |
144 |
fi |
fi |
185 |
|
|
186 |
testoutput_ad() |
testoutput_ad() |
187 |
{ |
{ |
188 |
grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $5}' > t05.txt |
grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $5}' > t05.txt |
189 |
grep $3 $1/$2/output.txt_adm | awk '{print NR " " $5}' > t15.txt |
grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $5}' > t15.txt |
190 |
grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $6}' > t06.txt |
grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $6}' > t06.txt |
191 |
grep $3 $1/$2/output.txt_adm | awk '{print NR " " $6}' > t16.txt |
grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $6}' > t16.txt |
192 |
join t05.txt t15.txt > t5.txt |
join t05.txt t15.txt > t5.txt |
193 |
join t06.txt t16.txt > t6.txt |
join t06.txt t16.txt > t6.txt |
194 |
echo "-1" >> t5.txt |
echo "-1" >> t5.txt |
199 |
rm -f t[01][56].txt t[56].txt |
rm -f t[01][56].txt t[56].txt |
200 |
} |
} |
201 |
|
|
202 |
|
check_for_add_mon_output() |
203 |
|
{ |
204 |
|
# Check for additional types of monitor output |
205 |
|
if test "x$1" = x ; then |
206 |
|
return |
207 |
|
fi |
208 |
|
|
209 |
|
for ii in $PTRACERS_NUM ; do |
210 |
|
eval "HAVE_PTR0"$ii"=f" |
211 |
|
done |
212 |
|
|
213 |
|
ptr_add="trcstat_ptracerXX_min trcstat_ptracerXX_max" |
214 |
|
ptr_add="$ptr_add trcstat_ptracerXX_mean trcstat_ptracerXX_sd" |
215 |
|
for ii in $PTRACERS_NUM ; do |
216 |
|
for jj in $ptr_add ; do |
217 |
|
name=`eval "echo $jj | sed -e 's|XX|0"$ii"|g'"` |
218 |
|
tst=`grep $name $1 | wc -l | awk '{print $1}'` |
219 |
|
if test ! "x$tst" = x0 ; then |
220 |
|
eval "HAVE_PTR0"$ii"=t" |
221 |
|
fi |
222 |
|
done |
223 |
|
# eval 'echo "HAVE_PTR0'$ii' = $HAVE_PTR0'$ii'"' |
224 |
|
done |
225 |
|
} |
226 |
|
|
227 |
testoutput() |
testoutput() |
228 |
{ |
{ |
229 |
# testoutput directory subdir extension |
# testoutput directory subdir extension |
253 |
testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2 $3; vmax=$? |
testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2 $3; vmax=$? |
254 |
testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2 $3; vmean=$? |
testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2 $3; vmean=$? |
255 |
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=$? |
256 |
dashnum $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \ |
|
257 |
$umin $umax $umean $usd $vmin $vmax $vmean $vsd |
# This is for PTRACERS |
258 |
|
for ii in $PTRACERS_NUM ; do |
259 |
|
eval `echo "p0"$ii"_min=99"` |
260 |
|
eval `echo "p0"$ii"_max=99"` |
261 |
|
eval `echo "p0"$ii"_mean=99"` |
262 |
|
eval `echo "p0"$ii"_sd=99"` |
263 |
|
tst=`eval 'echo "$HAVE_PTR0'$ii'"'` |
264 |
|
#echo 'tst = '$tst |
265 |
|
if test "x$tst" = xt ; then |
266 |
|
a="trcstat_ptracer0" |
267 |
|
testoutput_for_prop $1 "$a"$ii"_min" "p0"$ii"_min" $2 $3 |
268 |
|
RETVAL=$? ; eval `echo "p0"$ii"_min="$RETVAL` |
269 |
|
testoutput_for_prop $1 "$a"$ii"_max" "p0"$ii"_max" $2 $3 |
270 |
|
RETVAL=$? ; eval `echo "p0"$ii"_max="$RETVAL` |
271 |
|
testoutput_for_prop $1 "$a"$ii"_mean" "p0"$ii"_mean" $2 $3 |
272 |
|
RETVAL=$? ; eval `echo "p0"$ii"_mean="$RETVAL` |
273 |
|
testoutput_for_prop $1 "$a"$ii"_sd" "p0"$ii"_sd" $2 $3 |
274 |
|
RETVAL=$? ; eval `echo "p0"$ii"_sd="$RETVAL` |
275 |
|
fi |
276 |
|
done |
277 |
|
|
278 |
|
allargs="$cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd" |
279 |
|
allargs="$allargs $umin $umax $umean $usd $vmin $vmax $vmean $vsd" |
280 |
|
allargs="$allargs $p01_min $p01_max $p01_mean $p01_sd" |
281 |
|
allargs="$allargs $p02_min $p02_max $p02_mean $p02_sd" |
282 |
|
allargs="$allargs $p03_min $p03_max $p03_mean $p03_sd" |
283 |
|
allargs="$allargs $p04_min $p04_max $p04_mean $p04_sd" |
284 |
|
allargs="$allargs $p05_min $p05_max $p05_mean $p05_sd" |
285 |
|
|
286 |
|
eval "dashnum $allargs" |
287 |
|
|
288 |
else |
else |
289 |
testoutput_ad $1 $2 "precision_grdchk_result" |
testoutput_ad $1 $2 "precision_grdchk_result" |
290 |
fi |
fi |
308 |
command="$command --mods=../code" |
command="$command --mods=../code" |
309 |
else |
else |
310 |
command="$command --mods=../code_ad" |
command="$command --mods=../code_ad" |
|
command="$command -adof=../../../tools/adjoint_options/adjoint_staf" |
|
311 |
fi |
fi |
312 |
if test "x$OPTFILE" != xNONE ; then |
if test "x$OPTFILE" != xNONE ; then |
313 |
command="$command --optfile=$OPTFILE" |
command="$command --optfile=$OPTFILE" |
315 |
if test "x$IEEE" != x ; then |
if test "x$IEEE" != x ; then |
316 |
command="$command -ieee" |
command="$command -ieee" |
317 |
fi |
fi |
318 |
|
if test "x$MPI" = xt ; then |
319 |
|
command="$command -mpi" |
320 |
|
fi |
321 |
printf 'genmake ... ' 1>&2 |
printf 'genmake ... ' 1>&2 |
322 |
$command > make.log 2>&1 |
$command > make.log 2>&1 |
323 |
RETVAL=$? |
RETVAL=$? |
324 |
cp Makefile $CDIR |
# Reduce the size of the testing emails! |
325 |
|
head -100 Makefile > $CDIR/Makefile_head |
326 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
327 |
tail make.log |
tail make.log |
328 |
echo "genmakemodel: genmake failed" 1>&2 |
echo "genmakemodel: genmake failed" 1>&2 |
339 |
{ |
{ |
340 |
# makeclean directory |
# makeclean directory |
341 |
if test "x$NOCLEAN" = xt ; then |
if test "x$NOCLEAN" = xt ; then |
342 |
echo "make CLEAN skipped!" |
echo "make Clean skipped!" |
343 |
else |
else |
344 |
( |
( |
345 |
cd $1; |
cd $1; |
346 |
if test -e output.txt ; then |
#if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi |
|
rm -f output.txt |
|
|
fi |
|
|
printf 'make CLEAN ... ' 2>&1 |
|
347 |
if test -r Makefile ; then |
if test -r Makefile ; then |
348 |
$MAKE CLEAN >> make.log 2>&1 |
printf 'clean build-dir: make Clean ... ' 2>&1 |
349 |
|
$MAKE Clean >> make.log 2>&1 |
350 |
RETVAL=$? |
RETVAL=$? |
351 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
352 |
tail make.log |
tail make.log |
353 |
echo "makeclean: \"make CLEAN\" failed" 1>&2 |
echo "makeclean: \"make Clean\" failed" 1>&2 |
354 |
cp make.log $CDIR"/make.log" |
cp make.log $CDIR"/make.log" |
355 |
return 1 |
return 1 |
356 |
fi |
fi |
361 |
fi |
fi |
362 |
} |
} |
363 |
|
|
364 |
|
run_clean() |
365 |
|
{ |
366 |
|
# run_clean directory |
367 |
|
if test "x$NOCLEAN" = xt ; then |
368 |
|
echo "run_clean skipped!" |
369 |
|
else |
370 |
|
( |
371 |
|
cd $1; |
372 |
|
printf 'clean run-dir ... ' 2>&1 |
373 |
|
# part of what is done after "make clean" when doing "make CLEAN" |
374 |
|
find . -name "*.meta" -exec rm {} \; |
375 |
|
find . -name "*.data" -exec rm {} \; |
376 |
|
find . -name "fort.*" -exec rm {} \; |
377 |
|
find . -type l -exec rm {} \; |
378 |
|
rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime |
379 |
|
rm -rf mnc_test_* |
380 |
|
echo successful 1>&2 |
381 |
|
exit 0 |
382 |
|
) |
383 |
|
fi |
384 |
|
} |
385 |
|
|
386 |
makedependmodel() |
makedependmodel() |
387 |
{ |
{ |
388 |
# makedependmodel directory |
# makedependmodel directory |
414 |
if test -r Makefile ; then |
if test -r Makefile ; then |
415 |
printf 'make ... ' 1>&2 |
printf 'make ... ' 1>&2 |
416 |
if test "x$ADM" = x ; then |
if test "x$ADM" = x ; then |
417 |
$MAKE >> make.log 2>&1 |
if test "x$JOBS" = x ; then |
418 |
|
$MAKE >> make.log 2>&1 |
419 |
|
else |
420 |
|
$MAKE -j $JOBS >> make.log 2>&1 |
421 |
|
fi |
422 |
else |
else |
423 |
$MAKE adall >> make.log 2>&1 |
$MAKE adall >> make.log 2>&1 |
424 |
fi |
fi |
445 |
code_dir=$2 |
code_dir=$2 |
446 |
BUILD_DIR=$dir/$3 |
BUILD_DIR=$dir/$3 |
447 |
CODE_DIR=$dir/$code_dir |
CODE_DIR=$dir/$code_dir |
448 |
|
|
449 |
# These are files that should replace their counter-part when using -mpi |
# These are files that should replace their counter-part when using -mpi |
450 |
MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi")` |
MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi")` |
451 |
|
|
460 |
RETVAL=$? |
RETVAL=$? |
461 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
462 |
if ! test -f $BUILD_DIR/$i ; then |
if ! test -f $BUILD_DIR/$i ; then |
463 |
#echo Linking $name to $i |
#echo Linking $name to $i |
464 |
(cd $BUILD_DIR; ln -sf ../$code_dir/$i $name) |
(cd $BUILD_DIR; ln -sf ../$code_dir/$i $name) |
465 |
fi |
fi |
466 |
fi |
fi |
467 |
done |
done |
468 |
else |
else |
469 |
# NO: We undo any _mpi symbolically linked files |
# NO: We undo any _mpi symbolically linked files |
470 |
for ii in $MPI_FILES ; do |
for ii in $MPI_FILES ; do |
471 |
i=`echo $ii | sed 's:^\./::'` |
i=`echo $ii | sed 's:^\./::'` |
472 |
name=`echo $i | sed 's:_mpi::' ` |
name=`echo $i | sed 's:_mpi::' ` |
473 |
if test -L $BUILD_DIR/$name ; then |
if test -L $BUILD_DIR/$name ; then |
474 |
linktarg=`(cd $BUILD_DIR; readlink $name)` |
cmp $BUILD_DIR/$name "../$code_dir/$name"_mpi > /dev/null 2>&1 |
475 |
if test $linktarg = "../$code_dir/$name"_mpi ; then |
RETVAL=$? |
476 |
#echo Un-linking $name from $linktarg |
if test "x$RETVAL" = x0 ; then |
477 |
|
#echo Un-linking $name from $linktarg |
478 |
rm -f $BUILD_DIR/$name |
rm -f $BUILD_DIR/$name |
479 |
fi |
fi |
480 |
fi |
fi |
485 |
|
|
486 |
linkdata() |
linkdata() |
487 |
{ |
{ |
488 |
# linkdata flag |
# linkdata run_dir input_dir_1 input_dir_2 ... |
489 |
# |
# |
490 |
# symbolically link data files to run directory |
# symbolically link data files to run directory |
491 |
if test "x$1" = x1 ; then |
if test -d $1 ; then |
492 |
( |
( |
493 |
cd $2 |
cd $1 ; shift |
494 |
if test "x$ADM" = x ; then |
if test -r "../"$1"/eedata.mth" ; then |
495 |
files=`( cd ../input ; ls -1 | grep -v CVS )` |
# found eedata.mth in 1rst input dir and it is readable |
496 |
for i in $files ; do |
if test "x$MULTI_THREAD" = "xt" ; then |
497 |
if test ! -d "../input/"$i ; then |
# multi-threaded test: remove symbolic link & link eedata.mth |
498 |
ln -sf "../input/"$i $i |
if test -h eedata ; then rm -f eedata ; fi |
499 |
fi |
if test ! -r eedata ; then |
500 |
done |
ln -sf "../"$1"/eedata.mth" eedata ; |
501 |
else |
printf 'eedata.mth ' 1>&2 |
|
files=`( cd ../input ; ls -1 *.bin | grep -v CVS )` |
|
|
for i in $files ; do |
|
|
if test ! -d "../input/"$i ; then |
|
|
ln -sf "../input/"$i $i |
|
|
fi |
|
|
done |
|
|
files=`( cd ../input_ad ; ls -1 | grep -v CVS )` |
|
|
for i in $files ; do |
|
|
if test ! -d "../input_ad/"$i ; then |
|
|
ln -sf "../input_ad/"$i $i |
|
502 |
fi |
fi |
503 |
done |
else |
504 |
|
# not multi-threaded test: remove eedata symbolic link |
505 |
|
if test -h eedata ; then rm -f eedata ; fi |
506 |
|
fi |
507 |
fi |
fi |
508 |
|
for ldir in $* ; do |
509 |
|
if test -d "../"$ldir ; then |
510 |
|
printf 'ldir='${ldir} 1>&2 |
511 |
|
files=`( cd "../"$ldir ; ls -1 | grep -v CVS )` |
512 |
|
for i in $files ; do |
513 |
|
if test ! -d "../"$ldir/$i ; then |
514 |
|
if test ! -r $i ; then |
515 |
|
printf ' '$i 1>&2 |
516 |
|
ln -sf "../"$ldir"/"$i $i |
517 |
|
fi |
518 |
|
fi |
519 |
|
done |
520 |
|
if test -x "../"$ldir"/"prepare_run ; then |
521 |
|
"../"$ldir"/"prepare_run |
522 |
|
fi |
523 |
|
printf ' ; ' 1>&2 |
524 |
|
fi |
525 |
|
done |
526 |
) |
) |
527 |
fi |
fi |
528 |
} |
} |
535 |
# (where "$COMMAND" is relative to "directory") |
# (where "$COMMAND" is relative to "directory") |
536 |
( |
( |
537 |
cd $1 |
cd $1 |
538 |
printf 'runmodel ... ' 1>&2 |
printf 'runmodel in %s ...' $1 1>&2 |
539 |
# make output.txt |
# make output.txt |
540 |
$COMMAND >> run.log 2>&1 |
echo |
541 |
RETVAL=$? |
if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then |
542 |
if test "x$RETVAL" = x0 ; then |
echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_00 |
543 |
echo successful 1>&2 |
ln -sf "../"$builddir"/"$EXECUTABLE . |
544 |
if test "x$ADM" = x ; then |
fi |
545 |
cp output.txt $CDIR"/output.txt" |
if test ! -x $EXECUTABLE ; then |
546 |
|
rm -f run.log ; touch run.log |
547 |
|
if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi |
548 |
|
echo " no executable:" $EXECUTABLE >> run.log |
549 |
|
RETVAL=8 |
550 |
|
ENDVAL=-1 |
551 |
|
else |
552 |
|
if test $OUTPUTFILE -ot $EXECUTABLE ; then |
553 |
|
rm -f run.log ; touch run.log |
554 |
|
if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi |
555 |
|
( eval $COMMAND ) >> run.log 2>&1 |
556 |
|
RETVAL=$? |
557 |
else |
else |
558 |
cp output.txt_adm $CDIR"/output.txt_adm" |
RETVAL=0 |
559 |
|
if test -f run.log ; then |
560 |
|
if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi |
561 |
|
echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1 |
562 |
|
else |
563 |
|
touch run.log |
564 |
|
if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi |
565 |
|
echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1 |
566 |
|
echo " no previous run.log: assume NORMAL END" >> run.log 2>&1 |
567 |
|
fi |
568 |
fi |
fi |
569 |
|
ENDVAL=`cat run.log | grep -v 'ABNORMAL END' | grep -c 'NORMAL END'` |
570 |
|
fi |
571 |
|
rm -f run.log_00 |
572 |
|
#if test "x$RETVAL" = x0 ; then |
573 |
|
if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then |
574 |
|
tail run.log |
575 |
|
echo successful 1>&2 |
576 |
|
# === Reduce the size of the testing emails! |
577 |
|
#cp $OUTPUTFILE $CDIR"/"$OUTPUTFILE |
578 |
|
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
579 |
return 0 |
return 0 |
580 |
else |
else |
581 |
tail run.log |
tail run.log |
582 |
echo failed 1>&2 |
echo failed '(run:' $RETVAL ' end:' $ENDVAL ')' 1>&2 |
583 |
cp run.log $CDIR"/run.log" |
cp run.log $CDIR"/run.log" |
584 |
|
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
585 |
return 1 |
return 1 |
586 |
fi |
fi |
587 |
) |
) |
597 |
#include <math.h> |
#include <math.h> |
598 |
int main( int argc, char** argv ) { |
int main( int argc, char** argv ) { |
599 |
int linnum,best,lncnt; |
int linnum,best,lncnt; |
600 |
double a,b,diff; |
double a,b,abave,relerr; |
601 |
best = -16; |
best = -22; |
602 |
lncnt = 0; |
lncnt = 0; |
603 |
while( 1 & (lncnt+=1) < 999 ) { |
while( 1 & (lncnt+=1) < 999 ) { |
604 |
scanf("%d", &linnum); |
scanf("%d", &linnum); |
605 |
if (linnum == -1) break; |
if (linnum == -1) break; |
606 |
scanf("%lf", &a); scanf("%lf", &b); |
scanf("%lf", &a); scanf("%lf", &b); |
607 |
diff = 0.5*(fabs(a)+fabs(b)); |
abave = 0.5*(fabs(a)+fabs(b)); |
608 |
if (diff > 1.e-12) { |
if (abave > 0.0) { |
609 |
diff=fabs(a-b)/diff; |
relerr=fabs(a-b)/abave; |
610 |
if (diff > 0.0) { |
if (relerr > 0.0) { linnum = (int)rint(log10(relerr)); } |
611 |
linnum = (int)log10(diff); |
else { linnum = -16 ; } |
612 |
best = (best > linnum) ? best : linnum; |
best = (best > linnum) ? best : linnum; |
|
} |
|
|
else { |
|
|
if (best == -16 && diff != 0) best = -22; |
|
|
} |
|
613 |
} |
} |
614 |
} |
} |
615 |
if (lncnt == 999) best=-29; |
if (lncnt == 999) best=-29; |
617 |
return 0; |
return 0; |
618 |
} |
} |
619 |
EOF |
EOF |
620 |
cc -o tmp_cmpnum tmp_cmpnum.c -lm |
$CC -o tmp_cmpnum tmp_cmpnum.c -lm |
621 |
|
|
622 |
if [ -x ./tmp_cmpnum ]; then |
if [ -x ./tmp_cmpnum ]; then |
623 |
echo "OK" |
echo "OK" |
624 |
return 0 |
return 0 |
625 |
else |
else |
626 |
echo |
echo |
627 |
echo "ERROR: failed to compile comparison code" |
echo "ERROR: failed to compile comparison code -- please specify" |
628 |
|
echo " a C compiler using the CC environment variable." |
629 |
exit 1 |
exit 1 |
630 |
fi |
fi |
631 |
} |
} |
653 |
|
|
654 |
} |
} |
655 |
|
|
|
show_help() |
|
|
{ |
|
|
cat - << EOF |
|
|
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
|
|
|
|
|
-help|-h Show this help message |
|
|
-quiet Reduce the amount of output |
|
|
-verbose Produce copious amounts of output |
|
|
-debug Produce even more output which will mean nothing to most |
|
|
-force Do "make CLEAN" before compiling. This forces a complete rebuild. |
|
|
-clean Do "make CLEAN" after compiling and testing. |
|
|
-cleanup Aggresively removes all model output, executables and object files |
|
|
and then exits. Use with care. |
|
|
|
|
|
Normal usage: |
|
|
$0 * Configure, compile, run and analyze in all experiment directories |
|
|
EOF |
|
|
} |
|
|
|
|
656 |
scandirs() |
scandirs() |
657 |
{ |
{ |
658 |
if [ $# -eq 0 ]; then |
if [ $# -eq 1 ]; then |
659 |
for arg in * ; do |
for arg in * ; do |
660 |
test -d $arg/input && echo $arg |
test -d $arg/$1 && echo $arg |
661 |
done |
done |
662 |
else |
else |
663 |
echo $* |
echo $* |
664 |
fi |
fi |
665 |
} |
} |
666 |
|
|
675 |
expts='' |
expts='' |
676 |
# ieee=1 |
# ieee=1 |
677 |
|
|
678 |
IEEE= |
IEEE=true |
679 |
if test "x$MITGCM_IEEE" != x ; then |
if test "x$MITGCM_IEEE" != x ; then |
680 |
IEEE=$MITGCM_IEEE |
IEEE=$MITGCM_IEEE |
681 |
fi |
fi |
686 |
NOGENMAKE=f |
NOGENMAKE=f |
687 |
NOCLEAN=f |
NOCLEAN=f |
688 |
NODEPEND=f |
NODEPEND=f |
689 |
|
POSTCLEAN=f |
690 |
|
|
691 |
BASH= |
BASH= |
692 |
OPTFILE=NONE |
OPTFILE=NONE |
693 |
ADDRESSES= |
ADDRESSES= |
694 |
TESTDIRS= |
TESTDIRS= |
695 |
|
SKIPDIRS= |
696 |
MPACKDIR="../tools/mpack-1.6" |
MPACKDIR="../tools/mpack-1.6" |
697 |
HAVE_MPACK= |
HAVE_MPACK= |
698 |
MPACK="$MPACKDIR/mpack" |
MPACK="$MPACKDIR/mpack" |
699 |
COMMAND= |
COMMAND= |
700 |
MAKE=make |
if test "x$MAKE" = x ; then |
701 |
|
MAKE=make |
702 |
|
fi |
703 |
|
if test "x$CC" = x ; then |
704 |
|
CC=cc |
705 |
|
fi |
706 |
|
JOBS= |
707 |
MPI=f |
MPI=f |
708 |
|
MULTI_THREAD=f |
709 |
|
OUTDIR= |
710 |
|
DELDIR= |
711 |
|
|
712 |
ADM= |
ADM= |
713 |
|
|
714 |
|
# Additional monitor types |
715 |
|
PTRACERS_NUM="1 2 3 4 5" |
716 |
|
|
717 |
printf "parsing options... " |
printf "parsing options... " |
718 |
|
|
719 |
ac_prev= |
ac_prev= |
748 |
-tdir=* | --tdir=*) |
-tdir=* | --tdir=*) |
749 |
TESTDIRS=$ac_optarg ;; |
TESTDIRS=$ac_optarg ;; |
750 |
|
|
751 |
|
-skipdir | --skipdir | -skd | --skd) |
752 |
|
ac_prev=SKIPDIRS ;; |
753 |
|
-skipdir=* | --skipdir=*) |
754 |
|
SKIPDIRS=$ac_optarg ;; |
755 |
|
|
756 |
-bash | --bash | -b | --b) |
-bash | --bash | -b | --b) |
757 |
ac_prev=BASH ;; |
ac_prev=BASH ;; |
758 |
-bash=* | --bash=*) |
-bash=* | --bash=*) |
768 |
-make=* | --make=*) |
-make=* | --make=*) |
769 |
MAKE=$ac_optarg ;; |
MAKE=$ac_optarg ;; |
770 |
|
|
771 |
|
-odir | --odir) |
772 |
|
ac_prev=OUTDIR ;; |
773 |
|
-odir=* | --odir=*) |
774 |
|
OUTDIR=$ac_optarg ;; |
775 |
|
|
776 |
|
-ptracers | --ptracers | -ptr | --ptr) |
777 |
|
ac_prev=PTRACERS_NUM ;; |
778 |
|
-ptracers=* | --ptracers=* | -ptr=* | --ptr=*) |
779 |
|
PTRACERS_NUM=$ac_optarg ;; |
780 |
|
|
781 |
|
-j) ac_prev=JOBS ;; |
782 |
|
-j=*) JOBS=$ac_optarg ;; |
783 |
|
|
784 |
-clean | --clean) |
-clean | --clean) |
785 |
CLEANUP=t ;; |
CLEANUP=t ; DELDIR=t ;; |
786 |
|
|
787 |
-quick | --quick | -q | --q) |
-quick | --quick | -q | --q) |
788 |
QUICK=t ;; |
QUICK=t ;; |
793 |
-nodepend | --nodepend | -nd | --nd) |
-nodepend | --nodepend | -nd | --nd) |
794 |
NODEPEND=t ;; |
NODEPEND=t ;; |
795 |
|
|
796 |
|
-postclean | --postclean | -pc | --pc) |
797 |
|
POSTCLEAN=t ;; |
798 |
|
|
799 |
-mpi) MPI=t ;; |
-mpi) MPI=t ;; |
800 |
|
|
801 |
|
-mth) MULTI_THREAD=t ;; |
802 |
|
|
803 |
-adm | -ad) ADM=t ;; |
-adm | -ad) ADM=t ;; |
804 |
|
|
805 |
-ieee) IEEE=true ;; |
-ieee) IEEE=true ;; |
809 |
-debug) debug=1 ;; |
-debug) debug=1 ;; |
810 |
-quiet) verbose=0 ;; |
-quiet) verbose=0 ;; |
811 |
|
|
812 |
|
-deldir | -dd) DELDIR=t ;; |
813 |
|
|
814 |
-*) |
-*) |
815 |
echo "Error: unrecognized option: "$ac_option |
echo "Error: unrecognized option: "$ac_option |
816 |
usage |
usage |
832 |
fi |
fi |
833 |
|
|
834 |
if test "x$TESTDIRS" = x ; then |
if test "x$TESTDIRS" = x ; then |
835 |
TESTDIRS=`scandirs` |
if test "x$ADM" = xt ; then |
836 |
|
LIST=`scandirs results_ad` |
837 |
|
else |
838 |
|
LIST=`scandirs results` |
839 |
|
fi |
840 |
|
else |
841 |
|
#- expand group of experiments: |
842 |
|
LIST=" " |
843 |
|
for xx in $TESTDIRS |
844 |
|
do |
845 |
|
case $xx in |
846 |
|
'basic') LIST=${LIST}" aim.5l_cs hs94.128x64x5 ideal_2D_oce" |
847 |
|
LIST=${LIST}" lab_sea tutorial_baroclinic_gyre" |
848 |
|
LIST=${LIST}" tutorial_global_oce_latlon tutorial_plume_on_slope" |
849 |
|
;; |
850 |
|
'tutorials') |
851 |
|
LIST=${LIST}" "`ls | grep 'tutorial_'` ;; |
852 |
|
*) LIST=${LIST}" "$xx ;; |
853 |
|
esac |
854 |
|
done |
855 |
fi |
fi |
856 |
|
#echo 'LIST='${LIST}'<' |
857 |
|
#- skip dirs, remove duplicate and non-directory: |
858 |
|
TESTDIRS=" " |
859 |
|
count=0 |
860 |
|
for xx in $LIST |
861 |
|
do |
862 |
|
yy=`echo $SKIPDIRS | grep -c $xx` |
863 |
|
if test $yy = 0 ; then |
864 |
|
if test -d $xx ; then |
865 |
|
yy=`echo $TESTDIRS | grep -c $xx` |
866 |
|
if test $yy = 0 ; then TESTDIRS=${TESTDIRS}" "$xx ; fi |
867 |
|
else count=1 ; |
868 |
|
echo ""; echo -n " -- skip \"$xx\" (not a directory !)" |
869 |
|
fi |
870 |
|
else |
871 |
|
if test $count = 1 ; then echo -n ", \"$xx\"" |
872 |
|
else count=1 ; echo "" ; echo -n " skip: \"$xx\"" |
873 |
|
fi |
874 |
|
fi |
875 |
|
done |
876 |
|
if test $count = 1 ; then echo "" ; echo -n " ... " ; fi |
877 |
|
#echo 'TESTDIRS='${TESTDIRS}'<' |
878 |
|
|
879 |
if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then |
if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then |
880 |
OPTFILE=$MITGCM_OF |
OPTFILE=$MITGCM_OF |
881 |
fi |
fi |
882 |
|
|
883 |
if test "x$ADM" = xt -a "x$COMMAND" = x ; then |
if test "x$ADM" = xt ; then |
884 |
COMMAND="./mitgcmuv_ad > output.txt_adm 2>&1" |
EXECUTABLE="mitgcmuv_ad" |
885 |
|
OUTPUTFILE="output_adm.txt" |
886 |
|
else |
887 |
|
EXECUTABLE="mitgcmuv" |
888 |
|
OUTPUTFILE="output.txt" |
889 |
fi |
fi |
890 |
|
|
891 |
if test "x$COMMAND" = x ; then |
if test "x$COMMAND" = x ; then |
892 |
COMMAND="make output.txt" |
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
893 |
|
fi |
894 |
|
if test "x$MPI" = xt ; then |
895 |
|
OUTPUTFILE="STDOUT.0000" |
896 |
fi |
fi |
897 |
|
|
898 |
echo "OK" |
#echo "OK" |
899 |
|
echo "OK (COMMAND= $COMMAND )" |
900 |
|
|
901 |
# create the FORTRAN comparison code |
# create the FORTRAN comparison code |
902 |
createcodelet |
createcodelet |
913 |
UNAMEA=`uname -a` |
UNAMEA=`uname -a` |
914 |
DATE=`date +%Y%m%d` |
DATE=`date +%Y%m%d` |
915 |
BASE="tr_"$MACH"_"$DATE"_" |
BASE="tr_"$MACH"_"$DATE"_" |
916 |
|
if test "x$OUTDIR" != x ; then |
917 |
|
BASE="tr_"$OUTDIR"_"$DATE"_" |
918 |
|
fi |
919 |
DNUM=0 |
DNUM=0 |
920 |
DRESULTS="$BASE$DNUM" |
DRESULTS="$BASE$DNUM" |
921 |
while test -e $DRESULTS ; do |
while test -e $DRESULTS ; do |
961 |
echo |
echo |
962 |
echo >> $SUMMARY |
echo >> $SUMMARY |
963 |
if test "x$ADM" = x ; then |
if test "x$ADM" = x ; then |
964 |
cat << EOF | tee -a $SUMMARY |
line_0=" ----T----- ----S----- ----U----- ----V-----" |
965 |
T S U V |
line_1="G D M c m s m s m s m s" |
966 |
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 ." |
967 |
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" |
968 |
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 ." |
969 |
2 d e n d n x n . n x n . n x n . n x n . |
for ii in $PTRACERS_NUM ; do |
970 |
|
# tst=`eval 'echo $HAVE_PTR0'$ii` |
971 |
EOF |
# if test "x$tst" = xt ; then |
972 |
|
line_0="$line_0 --PTR 0"$ii"--" |
973 |
|
line_1="$line_1 m s" |
974 |
|
line_2="$line_2 m m e ." |
975 |
|
line_3="$line_3 i a a d" |
976 |
|
line_4="$line_4 n x n ." |
977 |
|
# fi |
978 |
|
done |
979 |
|
echo "$line_0" | tee -a $SUMMARY |
980 |
|
echo "$line_1" | tee -a $SUMMARY |
981 |
|
echo "$line_2" | tee -a $SUMMARY |
982 |
|
echo "$line_3" | tee -a $SUMMARY |
983 |
|
echo "$line_4" | tee -a $SUMMARY |
984 |
|
echo " " | tee -a $SUMMARY |
985 |
else |
else |
986 |
echo "ADJOINT=true" >> $SUMMARY |
echo "ADJOINT=true" >> $SUMMARY |
987 |
echo >> $SUMMARY |
echo >> $SUMMARY |
1000 |
# Cleanup only! |
# Cleanup only! |
1001 |
if test "x$CLEANUP" = xt ; then |
if test "x$CLEANUP" = xt ; then |
1002 |
if test -r $dir/build/Makefile ; then |
if test -r $dir/build/Makefile ; then |
1003 |
|
echo ' ------ clean dir:' $dir/build |
1004 |
( cd $dir/build ; make CLEAN ) |
( cd $dir/build ; make CLEAN ) |
1005 |
fi |
fi |
1006 |
if test -r $dir/input/Makefile ; then |
if test -d $dir/run/CVS ; then |
1007 |
( cd $dir/input ; make CLEAN ) |
echo ' ------ clean dir:' $dir/run |
1008 |
|
run_clean $dir/run |
1009 |
fi |
fi |
1010 |
|
( |
1011 |
|
cd $dir |
1012 |
|
rm -rf tr_run.* |
1013 |
|
) |
1014 |
continue |
continue |
1015 |
fi |
fi |
1016 |
|
|
1020 |
if test "x$ADM" = x ; then |
if test "x$ADM" = x ; then |
1021 |
fout=$dir"/results/output.txt" |
fout=$dir"/results/output.txt" |
1022 |
else |
else |
1023 |
fout=$dir"/results_ad/output.txt_adm" |
fout=$dir"/results_ad/output_adm.txt" |
1024 |
fi |
fi |
1025 |
if test ! -r $fout ; then |
if test ! -r $fout ; then |
1026 |
echo "can't read \"$fout\" -- skipping $dir" |
echo "can't read \"$fout\" -- skipping $dir" |
1027 |
continue |
continue |
1028 |
fi |
fi |
1029 |
|
if test "x$ADM" = x ; then |
1030 |
|
check_for_add_mon_output $fout |
1031 |
|
fi |
1032 |
|
|
1033 |
|
# Check for additional types of monitor output |
1034 |
|
|
1035 |
builddir="input" |
builddir="build" |
1036 |
rundir="input" |
if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi |
1037 |
use_seperate_build=0 |
rundir="run" |
1038 |
if test -d $dir/build -a -r $dir/build ; then |
#rundir=$builddir |
1039 |
builddir="build" |
if test ! -d $dir/$rundir ; then |
1040 |
rundir="build" |
rundir=$builddir |
|
use_seperate_build=1 |
|
|
linkdata $use_seperate_build $dir/$rundir |
|
1041 |
fi |
fi |
1042 |
|
|
|
# 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 |
|
|
|
|
1043 |
if test "x$ADM" = x ; then |
if test "x$ADM" = x ; then |
1044 |
code_dir=code |
code_dir=code |
1045 |
CODE_DIR=$dir/code |
CODE_DIR=$dir/code |
1046 |
|
input_dirs='input' |
1047 |
else |
else |
1048 |
code_dir=code_ad |
code_dir=code_ad |
1049 |
CODE_DIR=$dir/code_ad |
CODE_DIR=$dir/code_ad |
1050 |
|
input_dirs='input_ad input' |
1051 |
fi |
fi |
1052 |
BUILD_DIR=$dir/$builddir |
BUILD_DIR=$dir/$builddir |
1053 |
|
|
1055 |
echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir" |
echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir" |
1056 |
continue |
continue |
1057 |
fi |
fi |
1058 |
|
if test ! -r $dir"/input/eedata.mth" -a "x$MULTI_THREAD" = "xt" ; then |
1059 |
|
echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir" |
1060 |
|
continue |
1061 |
|
fi |
1062 |
|
|
1063 |
|
# Check whether there are "extra runs" for this testdir |
1064 |
|
extra_runs= |
1065 |
|
if test "x$ADM" = x ; then |
1066 |
|
ex_run_dirs=`( cd $dir ; echo input.* )` |
1067 |
|
#echo "ex_run_dirs='$ex_run_dirs'" |
1068 |
|
for exd in $ex_run_dirs ; do |
1069 |
|
name=`echo $exd | sed -e 's/input.//g'` |
1070 |
|
outf="$dir/results/output.$name.txt" |
1071 |
|
if test -f $outf -a -r $outf ; then |
1072 |
|
if test "x$MULTI_THREAD" = "xt" ; then |
1073 |
|
if test -r $dir"/"$exd"/eedata.mth" ; then |
1074 |
|
extra_runs="$extra_runs $name" |
1075 |
|
#else echo $dir"/"$exd"/eedata.mth: not found" |
1076 |
|
fi |
1077 |
|
else |
1078 |
|
extra_runs="$extra_runs $name" |
1079 |
|
fi |
1080 |
|
fi |
1081 |
|
done |
1082 |
|
fi |
1083 |
|
|
1084 |
echo "-------------------------------------------------------------------------------" |
echo "-------------------------------------------------------------------------------" |
1085 |
echo |
echo |
1086 |
echo "Experiment: $dir" |
if test "x$extra_runs" = "x" ; then |
1087 |
|
echo "Experiment: $dir" |
1088 |
|
else |
1089 |
|
echo "Experiment: $dir ; extra_runs=$extra_runs" |
1090 |
|
fi |
1091 |
echo |
echo |
1092 |
unset genmake makedepend make run |
unset genmake makedepend make run |
1093 |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
1094 |
|
|
1095 |
# Create an output dir for each OPTFILE/tdir combination |
# Create an output dir for each OPTFILE/tdir combination |
1096 |
rel_CDIR=$DRESULTS"/"$dir |
rel_CDIR=$DRESULTS"/"$dir |
1098 |
CDIR=`pwd`"/$rel_CDIR" |
CDIR=`pwd`"/$rel_CDIR" |
1099 |
|
|
1100 |
if test "x$CLEANUP" = xt ; then |
if test "x$CLEANUP" = xt ; then |
1101 |
makeclean $dir/$builddir |
echo '====>>> this is to check that we never go through this part <<< ===' |
1102 |
|
makeclean $dir/$builddir \ |
1103 |
|
&& run_clean $dir/$rundir |
1104 |
else |
else |
1105 |
genmakemodel $dir/$builddir && genmake=Y \ |
genmakemodel $dir/$builddir && genmake=Y \ |
1106 |
&& makeclean $dir/$builddir \ |
&& makeclean $dir/$builddir \ |
1107 |
|
&& run_clean $dir/$rundir \ |
1108 |
&& symlink_mpifiles $dir $code_dir $builddir \ |
&& symlink_mpifiles $dir $code_dir $builddir \ |
1109 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
1110 |
&& makemodel $dir/$builddir && make=Y \ |
&& makemodel $dir/$builddir && make=Y \ |
1111 |
&& linkdata $use_seperate_build $dir/$rundir \ |
&& linkdata $dir/$rundir $input_dirs \ |
1112 |
&& runmodel $dir/$rundir && run=Y \ |
&& runmodel $dir/$rundir && run=Y \ |
1113 |
&& results=`testoutput $dir $rundir` |
&& results=`testoutput $dir $rundir "txt"` |
1114 |
fi |
fi |
1115 |
|
|
1116 |
echo |
echo |
1125 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
1126 |
|
|
1127 |
for ex in $extra_runs ; do |
for ex in $extra_runs ; do |
1128 |
test -e "$dir/tr_run" && rm -rf "$dir/tr_run" |
unset run |
1129 |
mkdir "$dir/tr_run" |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
1130 |
( cd "$dir/input" ; links=`ls -1 | grep -v CVS` ) |
# Create an output dir for each OPTFILE/tdir.ex combination |
1131 |
( |
rel_CDIR=$DRESULTS"/"$dir"."$ex |
1132 |
cd "$dir/tr_run" |
mkdir $rel_CDIR |
1133 |
for i in $links; do |
CDIR=`pwd`"/$rel_CDIR" |
1134 |
ln -s ../input/$i $i |
test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" |
1135 |
done |
run_clean $dir/tr_run.$ex |
1136 |
) |
linkdata $dir/tr_run.$ex input.$ex input |
1137 |
( cd "$dir/input.$ex" ; links=`ls -1 | grep -v CVS` ) |
runmodel $dir/tr_run.$ex && run=Y \ |
1138 |
( |
&& results=`testoutput $dir tr_run.$ex ${ex}".txt"` |
|
cd "$dir/tr_run" |
|
|
for i in $links; do |
|
|
test -e $i && rm -f $i |
|
|
ln -s ../input.$ex/$i $i |
|
|
done |
|
|
ln -s ../$builddir/Makefile Makefile |
|
|
ln -s ../$builddir/mitgcmuv mitgcmuv |
|
|
) |
|
|
runmodel $dir/tr_run && run=Y \ |
|
|
&& results=`testoutput $dir $rundir "."$ex` |
|
1139 |
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}` |
1140 |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
1141 |
fres="$fres.$ex" |
fres="$fres.$ex" |
1145 |
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
1146 |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
1147 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
1148 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt" |
1149 |
|
if test "x$POSTCLEAN" = xt ; then |
1150 |
|
run_clean $dir/tr_run.$ex |
1151 |
|
fi |
1152 |
done |
done |
1153 |
else |
else |
1154 |
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}` |
1160 |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
1161 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
1162 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
1163 |
|
grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \ |
1164 |
|
>> $CDIR"/summary.txt" |
1165 |
|
fi |
1166 |
|
|
1167 |
|
#postclean $dir/$builddir |
1168 |
|
if test "x$POSTCLEAN" = xt ; then |
1169 |
|
makeclean $dir/$builddir \ |
1170 |
|
&& run_clean $dir/$rundir |
1171 |
fi |
fi |
1172 |
|
|
1173 |
echo "-------------------------------------------------------------------------------" |
echo "-------------------------------------------------------------------------------" |
1187 |
if test "x$HAVE_MPACK" = xt ; then |
if test "x$HAVE_MPACK" = xt ; then |
1188 |
tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \ |
tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \ |
1189 |
&& gzip $DRESULTS".tar" \ |
&& gzip $DRESULTS".tar" \ |
1190 |
&& $MPACK -s MITgcm-test -m 1500000 $DRESULTS".tar.gz" $ADDRESSES |
&& $MPACK -s MITgcm-test -m 3555000 $DRESULTS".tar.gz" $ADDRESSES |
1191 |
RETVAL=$? |
RETVAL=$? |
1192 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
1193 |
echo |
echo |
1210 |
rm -f tmp_cmpnum.c tmp_cmpnum |
rm -f tmp_cmpnum.c tmp_cmpnum |
1211 |
|
|
1212 |
if test "x$CLEANUP" != xt ; then |
if test "x$CLEANUP" != xt ; then |
1213 |
cat $SUMMARY |
cat $SUMMARY | sed 's/ -- -- -- --//g' |
1214 |
if test -e tr_out.txt ; then |
if test -e tr_out.txt ; then |
1215 |
mv tr_out.txt tr_out.txt.old |
mv tr_out.txt tr_out.txt.old |
1216 |
fi |
fi |
1217 |
cat $SUMMARY > tr_out.txt |
cat $SUMMARY | sed 's/ -- -- -- --//g' > tr_out.txt |
1218 |
|
fi |
1219 |
|
|
1220 |
|
if test "x$DELDIR" = xt ; then |
1221 |
|
rm -rf $DRESULTS |
1222 |
fi |
fi |
1223 |
|
|