12 |
echo "where possible OPTIONS are:" |
echo "where possible OPTIONS are:" |
13 |
echo " (-help|-h) print usage" |
echo " (-help|-h) print usage" |
14 |
echo " (-mth) run multi-threaded (using eedata.mth)" |
echo " (-mth) run multi-threaded (using eedata.mth)" |
15 |
echo " (-mpi) compile and run using MPI" |
echo " (-mpi) use MPI to compile and run on 2 processors" |
16 |
|
echo " (-MPI) NUMBER use MPI to compile and run on max NUMBER procs" |
17 |
|
echo " (-mfile|-mf) STRING MPI: file with list of possible machines to run on" |
18 |
echo " (-ieee/-noieee) if possible, use IEEE compiler flags" |
echo " (-ieee/-noieee) if possible, use IEEE compiler flags" |
19 |
echo " (DEF=\"-ieee\")" |
echo " (DEF=\"-ieee\")" |
20 |
echo " (-gsl) compile with \"-gsl\" flag" |
echo " (-gsl) compile with \"-gsl\" flag" |
27 |
echo " (-tdir|-t) STRING list of group and/or exp. dirs to test" |
echo " (-tdir|-t) STRING list of group and/or exp. dirs to test" |
28 |
echo " (recognized groups: basic, tutorials)" |
echo " (recognized groups: basic, tutorials)" |
29 |
echo " (DEF=\"\" which test all)" |
echo " (DEF=\"\" which test all)" |
30 |
|
echo " (if list= 'start_from THIS_EXP' then" |
31 |
|
echo " test THIS_EXP + all the following)" |
32 |
echo " (-skipdir|-skd) STRING list of exp. dirs to skip" |
echo " (-skipdir|-skd) STRING list of exp. dirs to skip" |
33 |
echo " (DEF=\"\" which test all)" |
echo " (DEF=\"\" which test all)" |
34 |
echo " (-bash|-b) STRING preferred location of a \"bash\" or" |
echo " (-bash|-b) STRING preferred location of a \"bash\" or" |
37 |
echo " (-adm|-ad) perform an adjoint run" |
echo " (-adm|-ad) perform an adjoint run" |
38 |
echo " (-oad) perform an OpenAD adjoint run" |
echo " (-oad) perform an OpenAD adjoint run" |
39 |
echo " (-command|-c) STRING command to run" |
echo " (-command|-c) STRING command to run" |
40 |
|
echo " (-makedepend|-md) STRING command to use for \"makedepend\"" |
41 |
echo " (-make|-m) STRING command to use for \"make\"" |
echo " (-make|-m) STRING command to use for \"make\"" |
42 |
echo " (DEF=\"make\")" |
echo " (DEF=\"make\")" |
43 |
echo " (-odir) STRING used to build output directory name" |
echo " (-odir) STRING used to build output directory name" |
44 |
echo " (DEF=\"hostname\")" |
echo " (DEF=\"hostname\")" |
45 |
echo " (-ptracers|-ptr) STRING specify which ptracers to test" |
# echo " (-ptracers|-ptr) STRING specify which ptracers to test" |
46 |
echo " (DEF=\"1 2 3 4 5\")" |
# echo " (DEF=\"1 2 3 4 5\")" |
47 |
echo " (-match) NUMBER Matching Criteria (number of digits)" |
echo " (-match) NUMBER Matching Criteria (number of digits)" |
48 |
echo " (DEF=\"12\")" |
echo " (DEF=\"$MATCH_CRIT\")" |
49 |
echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" |
echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" |
50 |
echo " (-clean) *ONLY* run \"make CLEAN\"" |
echo " (-clean) *ONLY* run \"make CLEAN\" & clean run-dir" |
51 |
echo " (-norun|-nr) skip the \"runmodel\" stage (stop after make)" |
echo " (-norun|-nr) skip the \"runmodel\" stage (stop after make)" |
52 |
echo " (-runonly|-ro) *ONLY* run stage (=\"-quick\" without make)" |
echo " (-runonly|-ro) *ONLY* run stage (=\"-quick\" without make)" |
53 |
echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\"" |
echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\"" |
54 |
echo " (-nogenmake|-ng) skip the genmake stage" |
echo " (-nogenmake|-ng) skip the genmake stage" |
55 |
echo " (-noclean|-nc) skip the \"make clean\" stage" |
echo " (-noclean|-nc) skip the \"make clean\" stage" |
56 |
echo " (-nodepend|-nd) skip the \"make depend\" stage" |
echo " (-nodepend|-nd) skip the \"make depend\" stage" |
57 |
|
echo " (-postclean|-pc) after each exp. test, clean build-dir & run-dir" |
58 |
|
echo " (-deloutp|-do) delete output files after successful run" |
59 |
echo " (-deldir|-dd) on success, delete the output directory" |
echo " (-deldir|-dd) on success, delete the output directory" |
60 |
echo " (-ts) provide timing information per timestep" |
echo " (-ts) provide timing information per timestep" |
61 |
echo " (-papis) provide MFlop/s per timestep using PAPI" |
echo " (-papis) provide MFlop/s per timestep using PAPI" |
238 |
listVar=" $sVar "`echo "$listVar " | sed "s/ $sVar / /g"` |
listVar=" $sVar "`echo "$listVar " | sed "s/ $sVar / /g"` |
239 |
fi |
fi |
240 |
if [ $debug -gt 0 ]; then echo "testoutput_run: listVar(M)='$listVar'" 1>&2 ; fi |
if [ $debug -gt 0 ]; then echo "testoutput_run: listVar(M)='$listVar'" 1>&2 ; fi |
241 |
echo "listVar='$listVar'" > $CDIR"/summary.txt" |
echo "listVar='$listVar'" >> $locDIR"/summary.txt" |
242 |
|
#--- |
243 |
allargs="" |
allargs="" |
244 |
for xx in $listVar |
for xx in $listVar |
245 |
do |
do |
325 |
( |
( |
326 |
cd $1; |
cd $1; |
327 |
command="$GENMAKE2 -ds -m $MAKE" |
command="$GENMAKE2 -ds -m $MAKE" |
328 |
|
if test "x$MKDEPEND" != x ; then |
329 |
|
command="$command -makedepend=$MKDEPEND" |
330 |
|
fi |
331 |
if test "x$ADM" = xt ; then |
if test "x$ADM" = xt ; then |
332 |
command="$command --mods=../code_ad" |
command="$command --mods=../code_ad" |
333 |
elif test "x$OADM" = xt ; then |
elif test "x$OADM" = xt ; then |
344 |
if test "x$GSL" = xt ; then |
if test "x$GSL" = xt ; then |
345 |
command="$command -gsl" |
command="$command -gsl" |
346 |
fi |
fi |
347 |
if test "x$MPI" = xt ; then |
if test "x$MPI" != x0 ; then |
348 |
command="$command -mpi" |
command="$command -mpi" |
349 |
fi |
fi |
350 |
if test "x$MULTI_THREAD" = xt ; then |
if test "x$MULTI_THREAD" = xt ; then |
364 |
command="$command -pcls" |
command="$command -pcls" |
365 |
fi |
fi |
366 |
fi |
fi |
367 |
printf 'genmake ... ' 1>&2 |
printf 'genmake ... ' |
368 |
# $command > make.log 2>&1 |
eval $command > genmake.tr_log 2>&1 |
|
eval $command > make.log 2>&1 |
|
369 |
RETVAL=$? |
RETVAL=$? |
370 |
# Reduce the size of the testing emails! |
# Reduce the size of the testing emails! |
371 |
head -100 Makefile > $CDIR/Makefile_head |
head -100 Makefile > $CDIR/Makefile_head |
372 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
373 |
tail make.log |
tail genmake.tr_log |
374 |
echo "genmakemodel: genmake failed" 1>&2 |
echo "genmakemodel: genmake failed" |
375 |
cp genmake_* make.log $CDIR |
cp genmake.log genmake_* genmake.tr_log $CDIR |
376 |
return 1 |
return 1 |
377 |
else |
else |
378 |
echo "successful" 1>&2 |
echo "successful" |
379 |
fi |
fi |
380 |
) |
) |
381 |
fi |
fi |
384 |
makeclean() |
makeclean() |
385 |
{ |
{ |
386 |
# makeclean directory |
# makeclean directory |
387 |
|
if test "x$NODEPEND" = xf ; then rm -f $1/make.tr_log ; fi |
388 |
if test "x$NOCLEAN" = xt ; then |
if test "x$NOCLEAN" = xt ; then |
389 |
echo "make Clean skipped!" |
echo "make Clean skipped!" |
390 |
else |
else |
392 |
cd $1; |
cd $1; |
393 |
#if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi |
#if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi |
394 |
if test -r Makefile ; then |
if test -r Makefile ; then |
395 |
printf 'clean build-dir: make Clean ... ' 2>&1 |
printf 'clean build-dir: make Clean ... ' |
396 |
$MAKE Clean >> make.log 2>&1 |
$MAKE Clean >> make.tr_log 2>&1 |
397 |
RETVAL=$? |
RETVAL=$? |
398 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
399 |
tail make.log |
tail make.tr_log |
400 |
echo "makeclean: \"make Clean\" failed" 1>&2 |
echo "makeclean: \"make Clean\" failed" |
401 |
cp make.log $CDIR"/make.log" |
cp make.tr_log genmake.log genmake.tr_log $CDIR |
402 |
return 1 |
return 1 |
403 |
fi |
fi |
404 |
echo successful 1>&2 |
echo successful |
405 |
else |
else |
406 |
echo '' |
echo '' |
407 |
fi |
fi |
418 |
else |
else |
419 |
( |
( |
420 |
cd $1; |
cd $1; |
421 |
printf 'clean run-dir ... ' 2>&1 |
printf 'clean run-dir ... ' |
422 |
# part of what is done after "make clean" when doing "make CLEAN" |
# part of what is done after "make clean" when doing "make CLEAN" |
423 |
find . -name "*.meta" -exec rm {} \; |
find . -name "*.meta" -exec rm {} \; |
424 |
find . -name "*.data" -exec rm {} \; |
find . -name "*.data" -exec rm {} \; |
425 |
find . -name "fort.*" -exec rm {} \; |
find . -name "fort.*" -exec rm {} \; |
426 |
find . -type l -exec rm {} \; |
find . -type l -exec rm {} \; |
427 |
rm -f $EXECUTABLE *.txt STD* *diagnostics.log datetime |
#- should remove executable only if sym-link (alredy done above) |
428 |
|
rm -f $RUNLOG *.txt STD* *diagnostics.log datetime |
429 |
rm -rf mnc_test_* |
rm -rf mnc_test_* |
430 |
rm -f *_MIT_CE_000.opt0000 costfunction*0000 |
rm -f *_MIT_CE_000.opt0000 costfunction*0000 |
431 |
echo successful 1>&2 |
echo successful |
432 |
exit 0 |
exit 0 |
433 |
) |
) |
434 |
fi |
fi |
442 |
else |
else |
443 |
( |
( |
444 |
cd $1; |
cd $1; |
445 |
printf 'make depend ... ' 1>&2 |
printf 'make depend ... ' |
446 |
$MAKE depend >> make.log 2>&1 |
$MAKE depend >> make.tr_log 2>&1 |
447 |
RETVAL=$? |
RETVAL=$? |
448 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
449 |
tail make.log |
tail make.tr_log |
450 |
echo "makedependmodel: make depend failed" 1>&2 |
echo "makedependmodel: make depend failed" |
451 |
cp make.log $CDIR"/make.log" |
cp make.tr_log genmake.log genmake.tr_log $CDIR |
452 |
return 1 |
return 1 |
453 |
else |
else |
454 |
echo successful 1>&2 |
echo successful |
455 |
fi |
fi |
456 |
) |
) |
457 |
fi |
fi |
461 |
{ |
{ |
462 |
# makemodel directory |
# makemodel directory |
463 |
( |
( |
464 |
|
mk_fail=0 |
465 |
if test "x$NOMAKE" = xt ; then |
if test "x$NOMAKE" = xt ; then |
466 |
cd $1; |
cd $1; |
467 |
if test -x $EXECUTABLE ; then |
if test -x $EXECUTABLE ; then |
468 |
echo "make skipped!" |
echo "make skipped!" |
469 |
else |
else |
470 |
echo "no executable!" |
echo "no executable!" |
471 |
return 2 |
mk_fail=3 |
472 |
fi |
fi |
473 |
else |
else |
474 |
cd $1; |
cd $1; |
475 |
if test -r Makefile ; then |
if test -r Makefile ; then |
476 |
printf 'make ... ' 1>&2 |
printf 'make ... ' |
477 |
if test "x$ADM" = xt ; then |
if test "x$ADM" = xt ; then |
478 |
$MAKE adall >> make.log 2>&1 |
$MAKE adall >> make.tr_log 2>&1 |
479 |
elif test "x$OADM" = xt ; then |
elif test "x$OADM" = xt ; then |
480 |
$MAKE adAll >> make.log 2>&1 |
$MAKE adAll >> make.tr_log 2>&1 |
481 |
else |
else |
482 |
if test "x$JOBS" = x ; then |
if test "x$JOBS" = x ; then |
483 |
$MAKE >> make.log 2>&1 |
$MAKE >> make.tr_log 2>&1 |
484 |
else |
else |
485 |
$MAKE -j $JOBS >> make.log 2>&1 |
$MAKE -j $JOBS >> make.tr_log 2>&1 |
486 |
fi |
fi |
487 |
fi |
fi |
488 |
RETVAL=$? |
RETVAL=$? |
489 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
490 |
tail make.log |
tail make.tr_log |
491 |
echo failed 1>&2 |
echo failed |
492 |
cp make.log $CDIR"/make.log" |
cp make.tr_log genmake.log genmake.tr_log $CDIR |
493 |
rm -f $EXECUTABLE |
rm -f $EXECUTABLE |
494 |
return 1 |
mk_fail=1 |
495 |
else |
else |
496 |
echo successful 1>&2 |
echo successful |
497 |
fi |
fi |
498 |
|
else |
499 |
|
echo "no Makefile !" |
500 |
|
mk_fail=2 |
501 |
fi |
fi |
502 |
fi |
fi |
503 |
|
if test "x$ADM" = xt -a -f taf_ad.log ; then |
504 |
|
head -1 taf_ad.log >> $CDIR"/summary.txt" |
505 |
|
nerr=`grep -c 'TAF *.* ERROR ' taf_ad.log` |
506 |
|
nwar=`grep -c 'TAF RECOMPUTATION *.* WARNING ' taf_ad.log` |
507 |
|
echo " TAF reports $nerr Errors and $nwar Recomputation Warnings" \ |
508 |
|
>> $CDIR"/summary.txt" |
509 |
|
fi |
510 |
|
if test $mk_fail != 0 ; then return $mk_fail ; fi |
511 |
) |
) |
512 |
} |
} |
513 |
|
|
514 |
|
mk_mpi_size() |
515 |
|
{ |
516 |
|
# mk_mpi_size input_file output_file proc_Nb prefer_to_split_X |
517 |
|
# |
518 |
|
# make new SIZE.h (=output_file) from SIZE.h_mpi (=input_file) |
519 |
|
# for an MPI build with no more than proc_Nb processors ; |
520 |
|
# return the effective number of processors. |
521 |
|
|
522 |
|
inp=$1 |
523 |
|
out=$2 |
524 |
|
np=$3 |
525 |
|
dirX=$4 |
526 |
|
tmp=TTT.$$ |
527 |
|
|
528 |
|
px=`grep "^ & *nPx *=" $inp | sed "s/^ & *nPx *= *//" | sed 's/, *$//'` |
529 |
|
py=`grep "^ & *nPy *=" $inp | sed "s/^ & *nPy *= *//" | sed 's/, *$//'` |
530 |
|
sx=`grep "^ & *nSx *=" $inp | sed "s/^ & *nSx *= *//" | sed 's/, *$//'` |
531 |
|
sy=`grep "^ & *nSy *=" $inp | sed "s/^ & *nSy *= *//" | sed 's/, *$//'` |
532 |
|
|
533 |
|
#- find the largest divisor of input_file proc Nb, but not larger than $np |
534 |
|
pp=0 |
535 |
|
i=1 |
536 |
|
while [ $i -le $px ] ; do |
537 |
|
if [ `expr $px % $i` -eq 0 ] ; then |
538 |
|
j=1 |
539 |
|
while [ $j -le $py ] ; do |
540 |
|
if [ `expr $py % $j` -eq 0 ] ; then |
541 |
|
ij=`expr $i \* $j` |
542 |
|
if [ $ij -gt $pp ] ; then |
543 |
|
flag=1 |
544 |
|
elif [ $ij -eq $pp ] ; then |
545 |
|
flag=$dirX |
546 |
|
else |
547 |
|
flag=0 |
548 |
|
fi |
549 |
|
if test $flag = 1 ; then |
550 |
|
if [ $ij -le $np ] ; then |
551 |
|
ix=$i ; jy=$j ; pp=$ij |
552 |
|
#echo " ix,jy= $ix,$jy" |
553 |
|
fi |
554 |
|
fi |
555 |
|
fi |
556 |
|
j=`expr $j + 1` |
557 |
|
done |
558 |
|
fi |
559 |
|
i=`expr $i + 1` |
560 |
|
done |
561 |
|
|
562 |
|
#- create new SIZE.h type file: |
563 |
|
sx=`expr $sx \* $px / $ix` |
564 |
|
sy=`expr $sy \* $py / $jy` |
565 |
|
if [ $verbose -gt 1 ]; then |
566 |
|
echo " px,py,np= $px,$py,$np : New MPI size: px,py= $ix,$jy : sx,sy= $sx,$sy" |
567 |
|
fi |
568 |
|
sed "/^ \& *nPx *=/s/[0-9]*,/$ix,/" $inp > $tmp |
569 |
|
sed "/^ \& *nPy *=/s/[0-9]*,/$jy,/" $tmp > $out |
570 |
|
sed "/^ \& *nSx *=/s/[0-9]*,/$sx,/" $out > $tmp |
571 |
|
sed "/^ \& *nSy *=/s/[0-9]*,/$sy,/" $tmp > $out |
572 |
|
rm -f $tmp |
573 |
|
return $pp |
574 |
|
} |
575 |
|
|
576 |
symlink_mpifiles() |
symlink_mpifiles() |
577 |
{ |
{ |
578 |
# Put special links so that MPI specific files are used |
# Put special links so that MPI specific files are used |
581 |
|
|
582 |
dir=$1 |
dir=$1 |
583 |
code_dir=$2 |
code_dir=$2 |
584 |
BUILD_DIR=$dir/$3 |
build_dir=$dir/$3 |
|
CODE_DIR=$dir/$code_dir |
|
585 |
|
|
586 |
# These are files that should replace their counter-part when using -mpi |
# These are files that should replace their counter-part when using -mpi |
587 |
MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi" -print)` |
MPI_FILES=`(cd $dir/$code_dir; find . -name "*_mpi" -print)` |
588 |
|
|
589 |
# Is this an MPI run? |
for ii in $MPI_FILES ; do |
590 |
if test "x$MPI" = xt ; then |
i=`echo $ii | sed 's:^\./::'` |
591 |
# YES: We symbolically link these files to the build |
name=`echo $i | sed 's:_mpi::'` |
592 |
# dir so long as there is no real file in place |
file="../$code_dir/$i" |
593 |
for ii in $MPI_FILES ; do |
if test $name = 'SIZE.h' ; then file="SIZE.h.mpi" ; fi |
594 |
i=`echo $ii | sed 's:^\./::'` |
|
595 |
name=`echo $i | sed 's:_mpi::' ` |
# Is this an MPI run? |
596 |
cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1 |
if test "x$MPI" = x0 ; then |
597 |
RETVAL=$? |
# NO: We undo any _mpi symbolically linked files |
598 |
if test "x$RETVAL" != x0 ; then |
if test -L $build_dir/$name ; then |
599 |
if ! test -f $BUILD_DIR/$i ; then |
( cd $build_dir ; cmp $name $file > /dev/null 2>&1 ) |
|
#echo Linking $name to $i |
|
|
(cd $BUILD_DIR; ln -sf ../$code_dir/$i $name) |
|
|
fi |
|
|
fi |
|
|
done |
|
|
else |
|
|
# NO: We undo any _mpi symbolically linked files |
|
|
for ii in $MPI_FILES ; do |
|
|
i=`echo $ii | sed 's:^\./::'` |
|
|
name=`echo $i | sed 's:_mpi::' ` |
|
|
if test -L $BUILD_DIR/$name ; then |
|
|
cmp $BUILD_DIR/$name "../$code_dir/$name"_mpi > /dev/null 2>&1 |
|
600 |
RETVAL=$? |
RETVAL=$? |
601 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
602 |
#echo Un-linking $name from $linktarg |
if [ $verbose -gt 1 ]; then |
603 |
rm -f $BUILD_DIR/$name |
echo " Un-linking $name from ../$code_dir" ; fi |
604 |
|
rm -f $build_dir/$name |
605 |
fi |
fi |
606 |
fi |
fi |
607 |
done |
else |
608 |
fi |
# YES: We symbolically link these files to the build |
609 |
|
# dir so long as there is no real file in place |
610 |
|
( cd $build_dir ; cmp $name $file > /dev/null 2>&1 ) |
611 |
|
RETVAL=$? |
612 |
|
if [ $verbose -gt 1 ]; then echo " cmp $name $file returns: $RETVAL" ; fi |
613 |
|
if test "x$RETVAL" != x0 ; then |
614 |
|
if test -h $build_dir/$name ; then rm -f $build_dir/$name ; fi |
615 |
|
if test ! -r $build_dir/$name ; then |
616 |
|
if [ $verbose -gt 1 ]; then echo " Linking $name to $file" ; fi |
617 |
|
(cd $build_dir; ln -sf $file $name) |
618 |
|
fi |
619 |
|
fi |
620 |
|
fi |
621 |
|
done |
622 |
} |
} |
623 |
|
|
624 |
linkdata() |
linkdata() |
629 |
if test -d $1 ; then |
if test -d $1 ; then |
630 |
( |
( |
631 |
cd $1 ; shift |
cd $1 ; shift |
632 |
|
echo 'linkdata from dirs:' $* |
633 |
inpMPI=`(cd ../$1 ; find . -name "*.mpi" -print | sed 's:^\./::')` |
inpMPI=`(cd ../$1 ; find . -name "*.mpi" -print | sed 's:^\./::')` |
634 |
for xx in $inpMPI ; do |
for xx in $inpMPI ; do |
635 |
if test -r "../"$1"/"$xx ; then |
if test -r "../"$1"/"$xx ; then |
636 |
# found 1 _mpi sfx file in 1rst input dir and it is readable |
# found 1 _mpi sfx file in 1rst input dir and it is readable |
637 |
yy=`echo $xx | sed 's:\.mpi$::'` |
yy=`echo $xx | sed 's:\.mpi$::'` |
638 |
if test "x$MPI" = "xt" ; then |
if test "x$MPI" = "x0" ; then |
639 |
# mpi test: remove symbolic link & link _mpi sfx file |
# not mpi test: remove symbolic link |
640 |
|
if test -h $yy ; then rm -f $yy ; fi |
641 |
|
else |
642 |
|
# mpi test: remove symbolic link & link .mpi sfx file |
643 |
if test -h $yy ; then rm -f $yy ; fi |
if test -h $yy ; then rm -f $yy ; fi |
644 |
if test ! -r $yy ; then |
if test ! -r $yy ; then |
645 |
ln -sf "../"$1"/"$xx $yy ; |
ln -sf "../"$1"/"$xx $yy ; |
646 |
printf "$xx " 1>&2 |
printf " $xx" 1>&2 |
647 |
fi |
fi |
|
else |
|
|
# not mpi test: remove symbolic link |
|
|
if test -h $yy ; then rm -f $yy ; fi |
|
648 |
fi |
fi |
649 |
fi |
fi |
650 |
done |
done |
655 |
if test -h eedata ; then rm -f eedata ; fi |
if test -h eedata ; then rm -f eedata ; fi |
656 |
if test ! -r eedata ; then |
if test ! -r eedata ; then |
657 |
ln -sf "../"$1"/eedata.mth" eedata ; |
ln -sf "../"$1"/eedata.mth" eedata ; |
658 |
printf 'eedata.mth ' 1>&2 |
printf ' eedata.mth' 1>&2 |
659 |
fi |
fi |
660 |
else |
else |
661 |
# not multi-threaded test: remove eedata symbolic link |
# not multi-threaded test: remove eedata symbolic link |
665 |
prevDir='NONE' |
prevDir='NONE' |
666 |
for ldir in $* ; do |
for ldir in $* ; do |
667 |
if test -d "../"$ldir -a $ldir != $prevDir ; then |
if test -d "../"$ldir -a $ldir != $prevDir ; then |
668 |
printf 'ldir='${ldir} 1>&2 |
printf " ldir=${ldir}:" 1>&2 |
669 |
files=`( cd "../"$ldir ; ls -1 | grep -v CVS )` |
files=`( cd "../"$ldir ; ls -1 | grep -v CVS )` |
670 |
for i in $files ; do |
for i in $files ; do |
671 |
if test ! -d "../"$ldir/$i ; then |
if test ! -d "../"$ldir/$i ; then |
675 |
fi |
fi |
676 |
fi |
fi |
677 |
done |
done |
678 |
|
printf ' ;' 1>&2 |
679 |
if test -x "../"$ldir"/"prepare_run ; then |
if test -x "../"$ldir"/"prepare_run ; then |
680 |
"../"$ldir"/"prepare_run |
"../"$ldir"/"prepare_run 1>&2 |
681 |
|
else |
682 |
|
echo '' 1>&2 |
683 |
fi |
fi |
|
printf ' ; ' 1>&2 |
|
684 |
fi |
fi |
685 |
prevDir=$ldir |
prevDir=$ldir |
686 |
done |
done |
692 |
{ |
{ |
693 |
# runmodel directory |
# runmodel directory |
694 |
# |
# |
695 |
# runs "$COMMAND in "directory" |
# runs $COMMAND in "directory" |
696 |
# (where "$COMMAND" is relative to "directory") |
# (where "$COMMAND" is relative to "directory") |
697 |
( |
( |
698 |
cd $1 |
cd $1 |
699 |
printf 'runmodel in %s ...' $1 1>&2 |
printf 'runmodel in %s ... ' $1 |
700 |
# make output.txt |
if test "x$MPI" != x0 ; then |
701 |
echo |
#- adjust the MPI run command with the right number of Procs |
702 |
|
#echo '' ; echo " COMMAND='$COMMAND'" |
703 |
|
COMMAND=`echo $COMMAND | sed "s/ TR_NPROC / $LOC_NPROC /"` |
704 |
|
if test "x$MPI_MFILE" != x ; then |
705 |
|
COMMAND=`echo $COMMAND | sed "s/ TR_MFILE / ..\/..\/$LOC_MFILE /"` |
706 |
|
fi |
707 |
|
#echo " COMMAND='$COMMAND'" |
708 |
|
fi |
709 |
if test -L $EXECUTABLE ; then |
if test -L $EXECUTABLE ; then |
710 |
if test -x "../"$builddir"/"$EXECUTABLE ; then |
if test -x "../"$builddir"/"$EXECUTABLE ; then |
711 |
diff -q $EXECUTABLE "../"$builddir"/"$EXECUTABLE > /dev/null 2>&1 |
cmp $EXECUTABLE "../"$builddir"/"$EXECUTABLE > /dev/null 2>&1 |
712 |
outD=$? ; if test $outD != 0 ; then rm -f $EXECUTABLE ; fi |
outD=$? ; if test "x$outD" != x0 ; then rm -f $EXECUTABLE ; fi |
713 |
else rm -f $EXECUTABLE |
else rm -f $EXECUTABLE |
714 |
fi |
fi |
715 |
fi |
fi |
718 |
ln -sf "../"$builddir"/"$EXECUTABLE . |
ln -sf "../"$builddir"/"$EXECUTABLE . |
719 |
fi |
fi |
720 |
if test ! -x $EXECUTABLE ; then |
if test ! -x $EXECUTABLE ; then |
721 |
rm -f $RUNLOG ; touch $RUNLOG |
rm -f $RUNLOG ; touch $RUNLOG |
722 |
if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi |
if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi |
723 |
echo " no executable:" $EXECUTABLE >> $RUNLOG |
echo " no executable:" $EXECUTABLE >> $RUNLOG |
724 |
RETVAL=8 |
RETVAL=8 |
725 |
ENDVAL=-1 |
ENDVAL=-1 |
726 |
else |
else |
727 |
if test ! -f $OUTPUTFILE -o $OUTPUTFILE -ot $EXECUTABLE ; then |
if test ! -f $OUTPUTFILE -o $OUTPUTFILE -ot $EXECUTABLE ; then |
728 |
# output do not exist or is older than executable: |
# output do not exist or is older than executable: |
729 |
rm -f $RUNLOG ; touch $RUNLOG |
rm -f $RUNLOG ; touch $RUNLOG |
730 |
if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi |
if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi |
731 |
( eval $COMMAND ) >> $RUNLOG 2>&1 |
( eval $COMMAND ) >> $RUNLOG 2>&1 |
732 |
RETVAL=$? |
RETVAL=$? |
733 |
else |
ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'` |
734 |
RETVAL=0 |
if [ $POSTCLEAN -eq 1 -a $ENDVAL -gt 0 ] ; then |
735 |
if test -f $RUNLOG ; then |
find . -name "*.meta" -exec rm {} \; |
736 |
if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi |
find . -name "*.data" -exec rm {} \; |
737 |
echo "---------->> $OUTPUTFILE is up to date " >> $RUNLOG 2>&1 |
rm -rf mnc_test_* |
|
else |
|
|
touch $RUNLOG |
|
|
if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi |
|
|
echo "---------->> $OUTPUTFILE is up to date " >> $RUNLOG 2>&1 |
|
|
echo " no previous $RUNLOG: assume NORMAL END" >> $RUNLOG 2>&1 |
|
|
fi |
|
738 |
fi |
fi |
739 |
ENDVAL=`cat $RUNLOG | grep -v 'ABNORMAL END' | grep -c 'NORMAL END'` |
else |
740 |
|
RETVAL=0 |
741 |
|
ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'` |
742 |
|
touch $RUNLOG |
743 |
|
if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi |
744 |
|
echo "---------->> $OUTPUTFILE is up to date " >> $RUNLOG 2>&1 |
745 |
|
fi |
746 |
fi |
fi |
747 |
rm -f run.log_tmp |
rm -f run.log_tmp |
748 |
|
#- in all cases where OutputFile exists, report SIZE (and AD time) |
749 |
|
if test -f $OUTPUTFILE ; then |
750 |
|
grep '(PID\.TID 0000\.0001) n.. =' $OUTPUTFILE \ |
751 |
|
| sed 's/(PID.TID 0000.0001) //' >> $CDIR"/summary.txt" |
752 |
|
if test "x$ADM" = xt ; then |
753 |
|
grep -A3 'Seconds in section "ALL' $OUTPUTFILE >> $CDIR"/summary.txt" |
754 |
|
fi |
755 |
|
fi |
756 |
|
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
757 |
if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then |
if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then |
758 |
tail $RUNLOG |
echo successful |
759 |
echo successful 1>&2 |
printf '=> output from running in %s :\n' $1 1>&2 |
760 |
# === Reduce the size of the testing emails! |
tail $RUNLOG | sed 's/^.*/> &/g' 1>&2 |
|
#cp $OUTPUTFILE $CDIR"/"$OUTPUTFILE |
|
|
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
|
761 |
return 0 |
return 0 |
762 |
elif [ $RETVAL -ne 0 -a $ENDVAL -gt 0 ] ; then |
elif [ $RETVAL -ne 0 -a $ENDVAL -gt 0 ] ; then |
763 |
#-- for some weird cases (run is finihed but with error code) |
#-- for some weird cases (run is finihed but with error code) |
764 |
tail $RUNLOG |
echo 'finished with error (run:' $RETVAL ' end:' $ENDVAL ')' |
765 |
echo finished with error '(run:' $RETVAL ' end:' $ENDVAL ')' 1>&2 |
printf '=> output from running in %s :\n' $1 1>&2 |
766 |
|
tail $RUNLOG | sed 's/^.*/> &/g' 1>&2 |
767 |
return 0 |
return 0 |
768 |
else |
else |
769 |
tail $RUNLOG |
echo 'failed (run:' $RETVAL ' end:' $ENDVAL ')' |
770 |
echo failed '(run:' $RETVAL ' end:' $ENDVAL ')' 1>&2 |
printf '=> output from running in %s :\n' $1 1>&2 |
771 |
|
tail $RUNLOG | sed 's/^.*/> &/g' 1>&2 |
772 |
cp $RUNLOG $CDIR"/"$RUNLOG |
cp $RUNLOG $CDIR"/"$RUNLOG |
|
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
|
773 |
return 1 |
return 1 |
774 |
fi |
fi |
775 |
) |
) |
871 |
|
|
872 |
check_eedata() |
check_eedata() |
873 |
{ |
{ |
874 |
# check_eedata size.h eedata |
# check_eedata eedata size.h |
875 |
if [ $# -eq 2 ] ; then |
if [ $# -eq 2 ] ; then |
876 |
if test -f $1 -a -f $2 ; then |
if test -f $1 -a -f $2 ; then |
877 |
sx=`grep "^ & *nSx *=" $1 | sed "s/^ & *nSx *=//" | sed 's/, *$//'` |
nx=`grep "^ *nTx *=" $1 | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"` |
878 |
nx=`grep "^ *nTx *=" $2 | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"` |
sx=`grep "^ & *nSx *=" $2 | sed "s/^ & *nSx *=//" | sed 's/, *$//'` |
879 |
if test "x$nx" = x ; then |
if test "x$nx" = x ; then |
880 |
rx=10 |
rx=10 |
881 |
else |
else |
882 |
rx=`expr $sx % $nx` |
rx=`expr $sx % $nx` |
883 |
fi |
fi |
884 |
sy=`grep "^ & *nSy *=" $1 | sed "s/^ & *nSy *=//" | sed 's/, *$//'` |
ny=`grep "^ *nTy *=" $1 | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"` |
885 |
ny=`grep "^ *nTy *=" $2 | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"` |
sy=`grep "^ & *nSy *=" $2 | sed "s/^ & *nSy *=//" | sed 's/, *$//'` |
886 |
if test "x$ny" = x ; then |
if test "x$ny" = x ; then |
887 |
ry=20 |
ry=20 |
888 |
else |
else |
889 |
ry=`expr $sy % $ny` |
ry=`expr $sy % $ny` |
890 |
fi |
fi |
891 |
echo `expr $rx + $ry` |
echo `expr $rx + $ry` |
892 |
else |
else |
893 |
echo '-1' |
echo '-1' |
894 |
fi |
fi |
895 |
|
elif [ $# -eq 1 ] ; then |
896 |
|
if test -f $1 ; then |
897 |
|
nx=`grep "^ *nTx *=" $1 | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"` |
898 |
|
if test "x$nx" = x ; then nx=1 ; fi |
899 |
|
ny=`grep "^ *nTy *=" $1 | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"` |
900 |
|
if test "x$ny" = x ; then ny=1 ; fi |
901 |
|
#echo $nx $ny |
902 |
|
echo $nx |
903 |
|
else |
904 |
|
echo '-1' |
905 |
|
fi |
906 |
else |
else |
907 |
echo '-2' |
echo '-2' |
908 |
fi |
fi |
915 |
# Default properties |
# Default properties |
916 |
debug=0 |
debug=0 |
917 |
verbose=1 |
verbose=1 |
|
clean=0 |
|
918 |
|
|
919 |
IEEE=true |
IEEE=true |
920 |
if test "x$MITGCM_IEEE" != x ; then |
if test "x$MITGCM_IEEE" != x ; then |
929 |
NOGENMAKE=f |
NOGENMAKE=f |
930 |
NOCLEAN=f |
NOCLEAN=f |
931 |
NODEPEND=f |
NODEPEND=f |
932 |
POSTCLEAN=f |
POSTCLEAN=0 |
933 |
|
|
934 |
BASH= |
BASH= |
935 |
OPTFILE=NONE |
OPTFILE=NONE |
940 |
HAVE_MPACK= |
HAVE_MPACK= |
941 |
MPACK= |
MPACK= |
942 |
COMMAND= |
COMMAND= |
943 |
|
MKDEPEND= |
944 |
if test "x$MAKE" = x ; then |
if test "x$MAKE" = x ; then |
945 |
MAKE=make |
MAKE=make |
946 |
fi |
fi |
948 |
CC=cc |
CC=cc |
949 |
fi |
fi |
950 |
JOBS= |
JOBS= |
951 |
MPI=f |
MPI=0 |
952 |
|
MPI_MFILE= |
953 |
MULTI_THREAD=f |
MULTI_THREAD=f |
954 |
OUTDIR= |
OUTDIR= |
955 |
DELDIR= |
DELDIR= |
961 |
# list of pTracers to check for monitor output |
# list of pTracers to check for monitor output |
962 |
PTRACERS_NUM="1 2 3 4 5" |
PTRACERS_NUM="1 2 3 4 5" |
963 |
|
|
964 |
MATCH_CRIT=13 |
MATCH_CRIT=10 |
965 |
|
|
966 |
printf "parsing options... " |
printf "parsing options... " |
967 |
|
|
979 |
|
|
980 |
case $ac_option in |
case $ac_option in |
981 |
|
|
982 |
-help | --help | -h | --h) |
-help | --help | -h | --h) usage ;; |
983 |
usage ;; |
|
984 |
|
-optfile | --optfile | -of | --of) ac_prev=OPTFILE ;; |
985 |
-optfile | --optfile | -of | --of) |
-optfile=* | --optfile=* | -of=* | --of=*) OPTFILE=$ac_optarg ;; |
986 |
ac_prev=OPTFILE ;; |
|
987 |
-optfile=* | --optfile=* | -of=* | --of=*) |
-addr | --addr | -a | --a) ac_prev=ADDRESSES ;; |
988 |
OPTFILE=$ac_optarg ;; |
-addr=* | --addr=* | -a=* | --a=*) ADDRESSES=$ac_optarg ;; |
989 |
|
-mpackdir | --mpackdir | -mpd | --mpd) ac_prev=MPACKDIR ;; |
990 |
-addr | --addr | -a | --a) |
-mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*) MPACKDIR=$ac_optarg ;; |
991 |
ac_prev=ADDRESSES ;; |
|
992 |
-addr=* | --addr=* | -a=* | --a=*) |
-tdir | --tdir | -t | --t) ac_prev=TESTDIRS ;; |
993 |
ADDRESSES=$ac_optarg ;; |
-tdir=* | --tdir=* | -t=* | --t=*) TESTDIRS=$ac_optarg ;; |
994 |
-mpackdir | --mpackdir | -mpd | --mpd) |
-skipdir | --skipdir | -skd | --skd) ac_prev=SKIPDIRS ;; |
995 |
ac_prev=MPACKDIR ;; |
-skipdir=* | --skipdir=* | -skd=* | --skd=*) SKIPDIRS=$ac_optarg ;; |
996 |
-mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*) |
|
997 |
MPACKDIR=$ac_optarg ;; |
-bash | --bash | -b | --b) ac_prev=BASH ;; |
998 |
|
-bash=* | --bash=* | -b=* | --b=*) BASH=$ac_optarg ;; |
999 |
-tdir | --tdir | -t | --t) |
|
1000 |
ac_prev=TESTDIRS ;; |
-command | --command | -c | --c) ac_prev=COMMAND ;; |
1001 |
-tdir=* | --tdir=* | -t=* | --t=*) |
-command=* | --command=* | -c=* | --c=*) COMMAND=$ac_optarg ;; |
1002 |
TESTDIRS=$ac_optarg ;; |
|
1003 |
|
-makedepend | --makedepend | -md | --md) ac_prev=MKDEPEND ;; |
1004 |
-skipdir | --skipdir | -skd | --skd) |
-makedepend=* | --makedepend=* | -md=* | --md=*) MKDEPEND=$ac_optarg ;; |
1005 |
ac_prev=SKIPDIRS ;; |
|
1006 |
-skipdir=* | --skipdir=* | -skd=* | --skd=*) |
-make | --make | -m | --m) ac_prev=MAKE ;; |
1007 |
SKIPDIRS=$ac_optarg ;; |
-make=* | --make=* | -m=* | --m=*) MAKE=$ac_optarg ;; |
1008 |
|
|
1009 |
-bash | --bash | -b | --b) |
-odir | --odir) ac_prev=OUTDIR ;; |
1010 |
ac_prev=BASH ;; |
-odir=* | --odir=*) OUTDIR=$ac_optarg ;; |
1011 |
-bash=* | --bash=* | -b=* | --b=*) |
|
1012 |
BASH=$ac_optarg ;; |
-ptracers | --ptracers | -ptr | --ptr) ac_prev=PTRACERS_NUM ;; |
1013 |
|
-ptracers=* | --ptracers=* | -ptr=* | --ptr=*) PTRACERS_NUM=$ac_optarg ;; |
|
-command | --command | -c | --c) |
|
|
ac_prev=COMMAND ;; |
|
|
-command=* | --command=* | -c=* | --c=*) |
|
|
COMMAND=$ac_optarg ;; |
|
|
|
|
|
-make | --make | -m | --m) |
|
|
ac_prev=MAKE ;; |
|
|
-make=* | --make=* | -m=* | --m=*) |
|
|
MAKE=$ac_optarg ;; |
|
|
|
|
|
-odir | --odir) |
|
|
ac_prev=OUTDIR ;; |
|
|
-odir=* | --odir=*) |
|
|
OUTDIR=$ac_optarg ;; |
|
|
|
|
|
-ptracers | --ptracers | -ptr | --ptr) |
|
|
ac_prev=PTRACERS_NUM ;; |
|
|
-ptracers=* | --ptracers=* | -ptr=* | --ptr=*) |
|
|
PTRACERS_NUM=$ac_optarg ;; |
|
1014 |
|
|
1015 |
-match | --match ) ac_prev=MATCH_CRIT ;; |
-match | --match ) ac_prev=MATCH_CRIT ;; |
1016 |
-match=* | --match=* ) MATCH_CRIT=$ac_optarg ;; |
-match=* | --match=* ) MATCH_CRIT=$ac_optarg ;; |
1018 |
-j | --j) ac_prev=JOBS ;; |
-j | --j) ac_prev=JOBS ;; |
1019 |
-j=* | --j=*) JOBS=$ac_optarg ;; |
-j=* | --j=*) JOBS=$ac_optarg ;; |
1020 |
|
|
1021 |
-clean | --clean) |
-clean | --clean) CLEANUP=t ; DELDIR=t ;; |
|
CLEANUP=t ; DELDIR=t ;; |
|
|
|
|
|
-norun | --norun | -nr | --nr) |
|
|
NORUN=t ;; |
|
|
-runonly | --runonly | -ro | --ro) |
|
|
QUICK=t ; NOMAKE=t ;; |
|
|
-quick | --quick | -q | --q) |
|
|
QUICK=t ;; |
|
|
-nogenmake | --nogenmake | -ng | --ng) |
|
|
NOGENMAKE=t ;; |
|
|
-noclean | --noclean | -nc | --nc) |
|
|
NOCLEAN=t ;; |
|
|
-nodepend | --nodepend | -nd | --nd) |
|
|
NODEPEND=t ;; |
|
1022 |
|
|
1023 |
-postclean | --postclean | -pc | --pc) |
-norun | --norun | -nr | --nr) NORUN=t ;; |
1024 |
POSTCLEAN=t ;; |
-runonly | --runonly | -ro | --ro) QUICK=t ; NOMAKE=t ;; |
1025 |
|
-quick | --quick | -q | --q) QUICK=t ;; |
1026 |
|
-nogenmake | --nogenmake | -ng | --ng) NOGENMAKE=t ;; |
1027 |
|
-noclean | --noclean | -nc | --nc) NOCLEAN=t ;; |
1028 |
|
-nodepend | --nodepend | -nd | --nd) NODEPEND=t ;; |
1029 |
|
|
1030 |
|
-postclean | --postclean | -pc | --pc) POSTCLEAN=2 ;; |
1031 |
|
-deloutp | --deloutp | -do | --do) POSTCLEAN=1 ;; |
1032 |
|
|
1033 |
|
-mpi | --mpi) MPI=2 ;; |
1034 |
|
-MPI | --MPI) ac_prev=MPI ;; |
1035 |
|
-MPI=* | --MPI=*) MPI=$ac_optarg ;; |
1036 |
|
|
1037 |
-mpi) MPI=t ;; |
-mfile | --mfile | -mf | --mf) ac_prev=MPI_MFILE ;; |
1038 |
|
-mfile=* | --mfile=* | -mf=* | --mf=*) MPI_MFILE=$ac_optarg ;; |
1039 |
|
|
1040 |
-mth) MULTI_THREAD=t ;; |
-mth) MULTI_THREAD=t ;; |
1041 |
|
|
1042 |
-adm | -ad) ADM=t ;; |
-adm | -ad) ADM=t ;; |
|
|
|
1043 |
-oad) OADM=t; NODEPEND=t ;; |
-oad) OADM=t; NODEPEND=t ;; |
1044 |
|
|
1045 |
-ieee) IEEE=true ;; |
-ieee) IEEE=true ;; |
1046 |
-noieee) IEEE= ;; |
-noieee) IEEE= ;; |
1047 |
-gsl) GSL=t ;; |
-gsl) GSL=t ;; |
1048 |
|
|
1049 |
-verbose) verbose=2 ;; |
-verbose) verbose=2 ;; |
1050 |
-debug) debug=1 ;; |
-debug) debug=1 ;; |
1058 |
-papis) PAPIS=t;; |
-papis) PAPIS=t;; |
1059 |
-pcls) PCL=t;; |
-pcls) PCL=t;; |
1060 |
|
|
1061 |
-*) |
-*) echo "Error: unrecognized option: "$ac_option |
1062 |
echo "Error: unrecognized option: "$ac_option |
usage ;; |
1063 |
usage |
*) echo "Error: unrecognized argument: "$ac_option |
1064 |
;; |
usage ;; |
|
|
|
|
*) |
|
|
echo "Error: unrecognized argument: "$ac_option |
|
|
usage |
|
|
;; |
|
1065 |
|
|
1066 |
esac |
esac |
1067 |
|
|
1073 |
NODEPEND=t |
NODEPEND=t |
1074 |
fi |
fi |
1075 |
|
|
1076 |
|
#- check length of MPI machine file: |
1077 |
|
if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then |
1078 |
|
if test -r $MPI_MFILE ; then |
1079 |
|
nl=`wc -l $MPI_MFILE | awk '{print $1}'` |
1080 |
|
if [ $nl -lt $MPI ] ; then |
1081 |
|
echo "Error: need at least $MPI nodes (currently only $nl) in MPI_MFILE=$MPI_FILE" |
1082 |
|
usage |
1083 |
|
fi |
1084 |
|
if [ $verbose -gt 1 ]; then |
1085 |
|
echo " MPI_MFILE=$MPI_MFILE : $nl procs for MPI=$MPI run" |
1086 |
|
fi |
1087 |
|
else |
1088 |
|
echo "Error: cannot access MPI_MFILE=$MPI_FILE" |
1089 |
|
usage |
1090 |
|
fi |
1091 |
|
fi |
1092 |
|
|
1093 |
#- setting for forward or ADM testing |
#- setting for forward or ADM testing |
1094 |
if test "x$ADM" = xt ; then |
if test "x$ADM" = xt ; then |
1095 |
code_dir=code_ad |
code_dir=code_ad |
1108 |
EXECUTABLE="mitgcmuv" |
EXECUTABLE="mitgcmuv" |
1109 |
fi |
fi |
1110 |
|
|
1111 |
|
xx=`echo $TESTDIRS | awk '{print $1}'` |
1112 |
if test "x$TESTDIRS" = x ; then |
if test "x$TESTDIRS" = x ; then |
1113 |
LIST=`scandirs results/$ref_outp` |
LIST=`scandirs results/$ref_outp` |
1114 |
|
elif test $xx = 'start_from' ; then |
1115 |
|
xx=`echo $TESTDIRS | awk '{print $2}'` |
1116 |
|
LIST=`scandirs results/$ref_outp | sed -n "/$xx/,$ p"` |
1117 |
else |
else |
1118 |
#- expand group of experiments: |
#- expand group of experiments: |
1119 |
LIST=" " |
LIST=" " |
1157 |
OPTFILE=$MITGCM_OF |
OPTFILE=$MITGCM_OF |
1158 |
fi |
fi |
1159 |
|
|
1160 |
RUNLOG="run.log" |
LOC_MFILE='tr_mpi_mfile' |
1161 |
|
RUNLOG="run.tr_log" |
1162 |
OUTPUTFILE=$ref_outp |
OUTPUTFILE=$ref_outp |
1163 |
if test "x$COMMAND" = x ; then |
if test "x$COMMAND" = x ; then |
1164 |
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
1165 |
fi |
fi |
1166 |
if test "x$MPI" = xt ; then |
if test "x$MPI" != x0 ; then |
1167 |
OUTPUTFILE="STDOUT.0000" |
OUTPUTFILE="STDOUT.0000" |
1168 |
fi |
fi |
1169 |
|
|
1256 |
fi |
fi |
1257 |
else |
else |
1258 |
echo >> $SUMMARY |
echo >> $SUMMARY |
1259 |
echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY |
echo "No \"OPTFILE\" was specified ; genmake2 found and uses:" >> $SUMMARY |
1260 |
echo " so the genmake default will be used." >> $SUMMARY |
#-note: to be filled later after 1rst run |
1261 |
fi |
fi |
1262 |
echo |
echo |
1263 |
echo >> $SUMMARY |
echo >> $SUMMARY |
1266 |
then line_0="default "$MATCH_CRIT ; |
then line_0="default "$MATCH_CRIT ; |
1267 |
else line_0="default "$MATCH_CRIT ; fi |
else line_0="default "$MATCH_CRIT ; fi |
1268 |
line_0="$line_0 ----T----- ----S----- ----U----- ----V-----" |
line_0="$line_0 ----T----- ----S----- ----U----- ----V-----" |
|
# line_0=" ----T----- ----S----- ----U----- ----V-----" |
|
1269 |
line_1="G D M c m s m s m s m s" |
line_1="G D M c m s m s m s m s" |
1270 |
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 ." |
1271 |
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" |
1298 |
|
|
1299 |
EOF |
EOF |
1300 |
fi |
fi |
1301 |
|
echo "-------------------------------------------------------------------------------" |
1302 |
|
|
1303 |
# ...and each test directory... |
# ...and each test directory... |
1304 |
for dir in $TESTDIRS ; do |
for dir in $TESTDIRS ; do |
1307 |
builddir="build" |
builddir="build" |
1308 |
if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi |
if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi |
1309 |
rundir="run" |
rundir="run" |
1310 |
|
pfxdir="tr_$rundir" |
1311 |
if test ! -d $dir/$rundir ; then |
if test ! -d $dir/$rundir ; then |
1312 |
rundir=$builddir |
rundir=$builddir |
1313 |
fi |
fi |
1318 |
if test "x$CLEANUP" = xt ; then |
if test "x$CLEANUP" = xt ; then |
1319 |
echo -n ' --- dir:' $BUILD_DIR ': ' |
echo -n ' --- dir:' $BUILD_DIR ': ' |
1320 |
makeclean $BUILD_DIR |
makeclean $BUILD_DIR |
1321 |
rm -f $BUILD_DIR/$EXECUTABLE |
( cd $BUILD_DIR |
1322 |
|
rm -f $EXECUTABLE *.bak |
1323 |
|
rm -f genmake_state genmake_*optfile genmake.log |
1324 |
|
rm -f SIZE.h.mpi genmake.tr_log make.tr_log |
1325 |
|
) |
1326 |
if test -d $dir/$rundir/CVS ; then |
if test -d $dir/$rundir/CVS ; then |
1327 |
echo -n ' --- dir:' $dir/$rundir ': ' |
echo -n ' --- dir:' $dir/$rundir ': ' |
1328 |
run_clean $dir/$rundir |
run_clean $dir/$rundir |
1329 |
fi |
fi |
1330 |
trdir=`( cd $dir ; find . -type d -name "tr_run.*" -print | sed 's/^.\///')` |
trdir=`( cd $dir ; find . -type d -name "$pfxdir.*" -print | sed 's/^.\///')` |
1331 |
ttd=`echo $trdir | wc -w` |
ttd=`echo $trdir | wc -w` |
1332 |
if test $ttd != 0 ; then |
if test $ttd != 0 ; then |
1333 |
echo ' --- rm dir:' $trdir |
echo ' --- rm dir:' $trdir |
1346 |
|
|
1347 |
# Check for specific files for particular type of run |
# Check for specific files for particular type of run |
1348 |
|
|
1349 |
if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then |
if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" != "x0" ; then |
1350 |
echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir" |
echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir" |
1351 |
continue |
continue |
1352 |
fi |
fi |
1354 |
echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir" |
echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir" |
1355 |
continue |
continue |
1356 |
fi |
fi |
1357 |
if test "x$MPI" = "xt" -a "x$MULTI_THREAD" = "xt" ; then |
|
1358 |
retv=`check_eedata $CODE_DIR"/SIZE.h_mpi" $dir"/input/eedata.mth"` |
if test "x$MPI" != "x0" ; then |
1359 |
if test $retv != 0 ; then |
prefer_X=0 |
1360 |
echo "input/eedata.mth tiling misfit -- skipping $dir" |
if test "x$MULTI_THREAD" = "xt" ; then |
1361 |
continue |
retv=`check_eedata $dir"/input/eedata.mth"` |
1362 |
fi |
if test $retv = 1 ; then prefer_X=1 ; fi |
1363 |
|
fi |
1364 |
|
#- create new SIZE.h with no more than '$MPI' Procs |
1365 |
|
mk_mpi_size $CODE_DIR"/SIZE.h_mpi" $BUILD_DIR"/tr_size.mpi" $MPI $prefer_X |
1366 |
|
LOC_NPROC=$? |
1367 |
|
( cd $BUILD_DIR |
1368 |
|
if test -r SIZE.h.mpi ; then |
1369 |
|
cmp tr_size.mpi SIZE.h.mpi > /dev/null 2>&1 ; RETVAL=$? |
1370 |
|
else RETVAL=1 |
1371 |
|
fi |
1372 |
|
if test "x$RETVAL" = x0 ; then |
1373 |
|
rm -f tr_size.mpi |
1374 |
|
else |
1375 |
|
rm -f SIZE.h.mpi ; mv tr_size.mpi SIZE.h.mpi |
1376 |
|
fi |
1377 |
|
) |
1378 |
|
if test "x$MPI_MFILE" != x ; then |
1379 |
|
#- create new MPI machine-file with the right number of Procs |
1380 |
|
rm -f $LOC_MFILE |
1381 |
|
cat $MPI_MFILE | sort | uniq | head -$LOC_NPROC > $LOC_MFILE |
1382 |
|
nl=`wc -l $LOC_MFILE | awk '{print $1}'` |
1383 |
|
if [ $nl -lt $LOC_NPROC ] ; then |
1384 |
|
rm -f $LOC_MFILE |
1385 |
|
cat $MPI_MFILE | head -$LOC_NPROC > $LOC_MFILE |
1386 |
|
#sed -n "1,$LOC_NPROC p" $MPI_MFILE > $LOC_MFILE |
1387 |
|
fi |
1388 |
|
if [ $verbose -gt 1 ]; then |
1389 |
|
nl=`wc -l $LOC_MFILE | awk '{print $1}'` |
1390 |
|
echo " new LOC_MFILE=$LOC_MFILE : $nl procs for LOC_NPROC=$LOC_NPROC" |
1391 |
|
fi |
1392 |
|
fi |
1393 |
|
if test "x$MULTI_THREAD" = "xt" ; then |
1394 |
|
retv=`check_eedata $dir"/input/eedata.mth" $BUILD_DIR"/SIZE.h.mpi"` |
1395 |
|
if test $retv != 0 ; then |
1396 |
|
echo "input/eedata.mth tiling misfit -- skipping $dir" |
1397 |
|
continue |
1398 |
|
fi |
1399 |
|
fi |
1400 |
fi |
fi |
1401 |
|
|
1402 |
# Check whether there are "extra runs" for this testdir |
# Check whether there are "extra runs" for this testdir |
1412 |
if test -f $outf -a -r $outf ; then |
if test -f $outf -a -r $outf ; then |
1413 |
if test "x$MULTI_THREAD" = "xt" ; then |
if test "x$MULTI_THREAD" = "xt" ; then |
1414 |
if test -r $dir"/"$exd"/eedata.mth" ; then |
if test -r $dir"/"$exd"/eedata.mth" ; then |
1415 |
if test "x$MPI" = "xt" ; then |
if test "x$MPI" = "x0" ; then |
1416 |
retv=`check_eedata $CODE_DIR"/SIZE.h_mpi" $dir"/"$exd"/eedata.mth"` |
extra_runs="$extra_runs $name" |
1417 |
|
else |
1418 |
|
retv=`check_eedata $dir"/"$exd"/eedata.mth" $BUILD_DIR"/SIZE.h.mpi"` |
1419 |
if test $retv = 0 ; then |
if test $retv = 0 ; then |
1420 |
extra_runs="$extra_runs $name" |
extra_runs="$extra_runs $name" |
1421 |
else |
else |
1422 |
echo $exd"/eedata.mth tiling misfit -- skipping $dir" |
echo $exd"/eedata.mth tiling misfit -- skipping $dir" |
1423 |
fi |
fi |
|
else |
|
|
extra_runs="$extra_runs $name" |
|
1424 |
fi |
fi |
1425 |
#else echo $dir"/"$exd"/eedata.mth: not found" |
#else echo $dir"/"$exd"/eedata.mth: not found" |
1426 |
fi |
fi |
1430 |
fi |
fi |
1431 |
done |
done |
1432 |
|
|
|
echo "-------------------------------------------------------------------------------" |
|
1433 |
echo |
echo |
1434 |
if test "x$extra_runs" = "x" ; then |
if test "x$extra_runs" = "x" ; then |
1435 |
echo "Experiment: $dir" |
echo "Experiment: $dir" |
1440 |
unset genmake makedepend make run |
unset genmake makedepend make run |
1441 |
results=$EMPTY_RESULTS |
results=$EMPTY_RESULTS |
1442 |
|
|
1443 |
# Create an output dir for each OPTFILE/tdir combination |
# Create an output dir & summary.txt file for each tested experiment (tdir) |
1444 |
rel_CDIR=$DRESULTS"/"$dir |
locDIR=$DRESULTS"/"$dir |
1445 |
mkdir $rel_CDIR |
mkdir $locDIR |
1446 |
CDIR=`pwd`"/$rel_CDIR" |
#- report to this experiment local summary file --- |
1447 |
|
echo "DATE='$DATE' ; tdir='$dir'" > $locDIR"/summary.txt" |
1448 |
|
echo "MACH='$MACH'" >> $locDIR"/summary.txt" |
1449 |
|
echo "UNAMEA='$UNAMEA'" >> $locDIR"/summary.txt" |
1450 |
|
CDIR=`pwd`"/$locDIR" |
1451 |
|
|
1452 |
if test "x$NORUN" = xt ; then |
if test "x$NORUN" = xt ; then |
1453 |
run=N |
run=N |
1454 |
genmakemodel $dir/$builddir && genmake=Y \ |
genmakemodel $dir/$builddir && genmake=Y \ |
1455 |
&& makeclean $dir/$builddir \ |
&& makeclean $dir/$builddir \ |
|
&& run_clean $dir/$rundir \ |
|
1456 |
&& symlink_mpifiles $dir $code_dir $builddir \ |
&& symlink_mpifiles $dir $code_dir $builddir \ |
1457 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
1458 |
&& makemodel $dir/$builddir && make=Y |
&& makemodel $dir/$builddir && make=Y |
1459 |
else |
else |
1460 |
genmakemodel $dir/$builddir && genmake=Y \ |
genmakemodel $dir/$builddir && genmake=Y \ |
1461 |
&& makeclean $dir/$builddir \ |
&& makeclean $dir/$builddir \ |
|
&& run_clean $dir/$rundir \ |
|
1462 |
&& symlink_mpifiles $dir $code_dir $builddir \ |
&& symlink_mpifiles $dir $code_dir $builddir \ |
1463 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
1464 |
&& makemodel $dir/$builddir && make=Y \ |
&& makemodel $dir/$builddir && make=Y \ |
1465 |
&& linkdata $dir/$rundir $inputdir input \ |
&& run_clean $dir/$rundir \ |
1466 |
|
&& linkdata $dir/$rundir $inputdir \ |
1467 |
&& runmodel $dir/$rundir && run=Y \ |
&& runmodel $dir/$rundir && run=Y \ |
1468 |
&& results=`testoutput_run $dir $rundir $ref_outp` |
&& results=`testoutput_run $dir $rundir $ref_outp` |
1469 |
fi |
fi |
|
|
|
1470 |
#echo "results='$results'" |
#echo "results='$results'" |
1471 |
echo |
|
1472 |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
1473 |
echo |
echo 1>&2 |
1474 |
echo "$fres" | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</' >> $SUMMARY |
echo "$fres" | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</' >> $SUMMARY |
1475 |
touch $CDIR"/summary.txt" |
echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt" |
|
echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $CDIR"/summary.txt" |
|
|
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
|
|
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
|
|
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
|
|
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
|
|
if test "x$ADM" = xt ; then |
|
|
head -1 $dir/$builddir/taf_ad.log >> $CDIR"/summary.txt" |
|
|
grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \ |
|
|
>> $CDIR"/summary.txt" |
|
|
fi |
|
1476 |
|
|
1477 |
for ex in $extra_runs ; do |
for ex in $extra_runs ; do |
1478 |
unset run |
unset run |
1479 |
results=$EMPTY_RESULTS |
results=$EMPTY_RESULTS |
1480 |
# reference output file |
# reference output file |
1481 |
refExOut=`echo $ref_outp | sed "s/\./.${ex}./g"` |
refExOut=`echo $ref_outp | sed "s/\./.${ex}./g"` |
1482 |
# Create an output dir for each OPTFILE/tdir.ex combination |
# Create an output dir & summary.txt file for each extra run (tdir.ex) |
1483 |
rel_CDIR=$DRESULTS"/"$dir"."$ex |
locDIR=$DRESULTS"/"$dir"."$ex |
1484 |
mkdir $rel_CDIR |
mkdir $locDIR |
1485 |
CDIR=`pwd`"/$rel_CDIR" |
#- report to this experiment local summary file --- |
1486 |
test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" |
echo "DATE='$DATE' ; tdir='$dir.$ex'" > $locDIR"/summary.txt" |
1487 |
run_clean $dir/tr_run.$ex |
#echo "MACH='$MACH'" >> $locDIR"/summary.txt" |
1488 |
linkdata $dir/tr_run.$ex $inputdir.$ex $inputdir input |
#echo "UNAMEA='$UNAMEA'" >> $locDIR"/summary.txt" |
1489 |
runmodel $dir/tr_run.$ex && run=Y \ |
CDIR=`pwd`"/$locDIR" |
1490 |
&& results=`testoutput_run $dir tr_run.$ex $refExOut` |
test ! -e "$dir/$pfxdir.$ex" && mkdir "$dir/$pfxdir.$ex" |
1491 |
|
run_clean $dir/$pfxdir.$ex |
1492 |
|
linkdata $dir/$pfxdir.$ex $inputdir.$ex $inputdir |
1493 |
|
runmodel $dir/$pfxdir.$ex && run=Y \ |
1494 |
|
&& results=`testoutput_run $dir $pfxdir.$ex $refExOut` |
1495 |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
1496 |
fres="$fres.$ex" |
fres="$fres.$ex" |
1497 |
echo |
echo 1>&2 |
1498 |
echo "$fres" | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</' >> $SUMMARY |
echo "$fres" | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</' >> $SUMMARY |
1499 |
touch $CDIR"/summary.txt" |
echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt" |
1500 |
echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $CDIR"/summary.txt" |
if test "x$POSTCLEAN" = x2 ; then |
1501 |
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
run_clean $dir/$pfxdir.$ex |
|
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
|
|
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
|
|
echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt" |
|
|
if test "x$ADM" = xt ; then |
|
|
head -1 $dir/$builddir/taf_ad.log >> $CDIR"/summary.txt" |
|
|
grep -A3 'Seconds in section "ALL' $dir/tr_run.$ex/$OUTPUTFILE \ |
|
|
>> $CDIR"/summary.txt" |
|
|
fi |
|
|
if test "x$POSTCLEAN" = xt ; then |
|
|
run_clean $dir/tr_run.$ex |
|
1502 |
fi |
fi |
1503 |
done |
done |
1504 |
|
|
1505 |
|
if test -f $DRESULTS"/"genmake_state ; then : ; else |
1506 |
|
if test -f $dir/$builddir/Makefile ; then |
1507 |
|
mkOpt=`grep '^# OPTFILE=' $dir/$builddir/Makefile 2>/dev/null | head -1 | sed 's/^# //'` |
1508 |
|
echo "from '$dir/$builddir/Makefile', extract:" > $DRESULTS/genmake_state |
1509 |
|
sed -n '/^# executed by:/,+1 p' $dir/$builddir/Makefile >> $DRESULTS/genmake_state |
1510 |
|
echo " $mkOpt" >> $DRESULTS/genmake_state |
1511 |
|
if test "x$OPTFILE" = xNONE ; then |
1512 |
|
eval $mkOpt |
1513 |
|
sed "/^No \"OPTFILE\" was specified ; genmake2/a\ OPTFILE=${OPTFILE}"\ |
1514 |
|
$SUMMARY > tr_0.tmp_log |
1515 |
|
RETVAL=$? |
1516 |
|
if test "x$RETVAL" = x0 ; then rm -f $SUMMARY |
1517 |
|
cp tr_0.tmp_log $SUMMARY |
1518 |
|
else rm -f tr_0.tmp_log |
1519 |
|
fi |
1520 |
|
fi |
1521 |
|
gmkLog=$dir/$builddir/genmake.log |
1522 |
|
grep '^Get compiler version using:' $gmkLog > /dev/null 2>&1 |
1523 |
|
RETVAL=$? |
1524 |
|
if test "x$RETVAL" = x0 ; then |
1525 |
|
echo "from '$gmkLog', extract compiler version:" >> $DRESULTS/genmake_state |
1526 |
|
sed -n '/Get compiler version/,/<-- compiler version/p' $gmkLog \ |
1527 |
|
| grep -v '^... compiler version ' > tr_1.tmp_log |
1528 |
|
sed -n '1,/^$/p' tr_1.tmp_log | sed '/^$/d' | sed 's/^./ &/' \ |
1529 |
|
>> $DRESULTS/genmake_state |
1530 |
|
rm -f tr_1.tmp_log |
1531 |
|
fi |
1532 |
|
fi |
1533 |
|
fi |
1534 |
#postclean $dir/$builddir |
#postclean $dir/$builddir |
1535 |
if test "x$POSTCLEAN" = xt ; then |
if test "x$POSTCLEAN" = x2 ; then |
1536 |
makeclean $dir/$builddir \ |
makeclean $dir/$builddir \ |
1537 |
&& run_clean $dir/$rundir |
&& run_clean $dir/$rundir |
1538 |
fi |
fi |
1539 |
|
if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then rm -f $LOC_MFILE ; fi |
1540 |
|
|
1541 |
echo "-------------------------------------------------------------------------------" |
echo "-------------------------------------------------------------------------------" |
1542 |
|
|