diff --git a/scripts/check-dist.sh b/scripts/check-dist.sh new file mode 100755 index 0000000000000000000000000000000000000000..bacc725af685c41111044851e5e5b7b4096db08c --- /dev/null +++ b/scripts/check-dist.sh @@ -0,0 +1,114 @@ +#!/bin/bash + +# check for parameter pointing to DUNE base directory +# --------------------------------------------------- + +DUNECONTROL="dune-common/bin/dunecontrol" + +if test \( $# -lt 1 \) -o ! -e $1/$DUNECONTROL ; then + echo "Usage: $0 <dune-base-dir>" + exit 1 +fi + +# set up some variables +# --------------------- + +WORKINGDIR=`pwd` +cd $1 +DUNEDIR=`pwd` +FEMDIR="$DUNEDIR/dune-fem" +SCRIPTSDIR="$FEMDIR/scripts" +OPTSDIR="$SCRIPTSDIR/opts" + +MODULES="dune-common dune-geometry dune-grid dune-istl dune-spgrid dune-fem dune-alugrid" + +# fetch missing tarballs from website +# ----------------------------------- + +for MODULE in $MODULES ; do + # ignore missing modules since istl may be missing + if ! test -d $DUNEDIR/$MODULE ; then + continue; + fi + + cd $DUNEDIR/$MODULE + if test x`find -maxdepth 1 -name "*.tar.gz"` != x ; then + continue + fi + + if test "$MODULE" != "dune-fem" ; then + echo + cached="/usr/people/dune/src/tarballs/$MODULE-1.2svn.tar.gz" + if test -e $cached ; then + echo "Copying tarball from backup ($cached)..." + cp $cached . + fi + fi + + if test x`find -maxdepth 1 -name "*.tar.gz"` == x ; then + echo "Fatal: No tarball available for $MODULE" + exit 1 + fi +done + +# perform tests +# ------------- + +TESTDIR=`mktemp -d -p $WORKINGDIR dune-tmp-XXXXXX` + +do_configure() +{ + local check=`mktemp -p $WORKINGDIR check.XXXXXX` + { + $DUNECONTROL --opts=$OPTSDIR/$OPTS all + echo $? > $check + } 2>&1 | dd conv=notrunc > $CONFIGLOG 2>/dev/null + local return_value=`cat $check` + rm $check + return $return_value +} + +errors=0 +for OPTS in `cd $OPTSDIR ; ls *.opts` ; do + echo + echo "Checking $OPTS..." + + cd $TESTDIR + rm -rf * + + find $DUNEDIR -maxdepth 2 -name "*.tar.gz" -exec tar -xzf \{\} \; + + for MODULE in $MODULES ; do + if ls -d ${MODULE}* &> /dev/null ; then + mv `ls -d ${MODULE}*` $MODULE + fi + done + + CONFIGLOG="$WORKINGDIR/${OPTS%.opts}-conf.out" + if ! do_configure ; then + echo "Error: Cannot configure with $OPTS (see $CONFIGLOG)" + errors=$((errors+1)) + continue + fi + + cd $WORKINGDIR + CHECKLOG="$WORKINGDIR/${OPTS%.opts}-check.out" + MAKE_CHECK_FLAGS="" + MAKE_CHECK_FLAGS="$(source $OPTSDIR/$OPTS; echo $MAKE_CHECK_FLAGS)" + if ! $SCRIPTSDIR/check-tests.sh $TESTDIR/dune-fem "$MAKE_CHECK_FLAGS"; then + echo "Error: Check failed with $OPTS (see $CHECKLOG)" + errors=$((errors+1)) + fi + mv $WORKINGDIR/check-tests.out $CHECKLOG +done + +# clean up +# -------- + +rm -rf $TESTDIR + +if test $errors -gt 0 ; then + exit 1 +else + exit 0 +fi diff --git a/scripts/check-header.sh b/scripts/check-header.sh new file mode 100755 index 0000000000000000000000000000000000000000..2ce9b88a00ed4ca10bbcd49968904dea35d3c836 --- /dev/null +++ b/scripts/check-header.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +if test $# -lt 1 ; then + echo "Usage: $0 <header>" + exit 1 +fi + +# use new version of header check +make HEADER=$1 headercheck 1>/dev/null +SUCCESS=$? + +exit $SUCCESS + +############################################# +# old version of header check +############################################# + +PROJECTDIR=`pwd` +cd `dirname $0` +SCRIPTSDIR=`pwd` +HEADER=$1 + +if test ! -f $PROJECTDIR/dune.module ; then + echo "This script can only be executed from a DUNE project directory." + exit 1 +fi + +if ! test -e $PROJECTDIR/$HEADER ; then + echo "'$HEADER' does not exist." + exit 1 +fi + +if test ! -f $PROJECTDIR/make.inc ; then + echo "'make.inc' missing from project directory. Did you forget to configure?" + exit 1 +fi + +TEMPDIR=`mktemp -d --tmpdir tmp-header-XXXXXX` + +cd $TEMPDIR +cp $PROJECTDIR/make.inc Makefile +echo ".cc.o:" >> Makefile +echo -e -n "\t\${CXX} -c -I$PROJECTDIR " >> Makefile +echo '${AM_CPPFLAGS} ${AM_CXXFLAGS} -o $@ $<' >> Makefile + +echo "#include <config.h>" >> test.cc +echo "#include <${HEADER}>" >> test.cc +echo "#include <${HEADER}>" >> test.cc +echo "int main () {}" >> test.cc + +make test.o 1>/dev/null +SUCCESS=$? + +rm -f test.o +rm -f test.cc +rm -f Makefile + +cd $PROJECTDIR +rmdir $TEMPDIR + +exit $SUCCESS diff --git a/scripts/check-headers.sh b/scripts/check-headers.sh new file mode 100755 index 0000000000000000000000000000000000000000..28a1f8fecc6c96366ae9fe0511aadcb4013bf7eb --- /dev/null +++ b/scripts/check-headers.sh @@ -0,0 +1,124 @@ +#!/bin/bash + +PROJECTDIR=`pwd` +cd `dirname $0` +SCRIPTSDIR=`pwd` + +if test ! -f $PROJECTDIR/dune.module ; then + echo "This script can only be executed from a DUNE project directory." + exit 1 +fi + +compile=1 +for arg in $@ ; do + if test "x$arg" == "xfast" ; then + compile=0 + continue + fi + + echo "Usage: $0 [fast]" + exit 1 +done + +cd $PROJECTDIR +sourcedirs=`grep "^[[:space:]]*Sources:" dune.module | cut -s -d ':' -f2` +if test "x$sourcedirs" = "x" ; then + echo -n "[.] " + echo "Warning: 'Sources' not found in dune.module, assuming 'dune'." + sourcedirs="dune" +fi + +files="" +for directory in $sourcedirs ; do + dirfiles=`find -H $directory -type d | sed "/$directory.*\/\..*/ d"` + files="$files $dirfiles" +done + +errors=0 +for directory in $files ; do + makefile=$directory/Makefile.am + headerfiles=`ls -1 $directory | sed '/.*\.hh$/ p ; d'` + + if test ! -f $makefile ; then + if test "x$headerfiles" != "x" ; then + echo -n "[$directory] " + echo "Warning: No 'Makefile.am' found." + fi + continue + fi + + extradist=`cat $makefile | sed 'H ; s/.*//g ; x ; s/\n/ /g ; s/[ \t][ \t]*/ /g ; /\\\\$/! { p ; d } ; s/\\\\$// ; x ; d' | grep '^[ \t]*EXTRA_DIST' | sed 's/^.*EXTRA_DIST.*=//'` + for pattern in $extradist ; do + if test x`echo $pattern | grep '^[$]'` != x ; then + echo -n "[$directory] " + echo "Warning: Skipping check for variable '$pattern' in EXTRA_DIST." + continue + fi + for file in $directory/$pattern ; do + if test ! -f $file ; then + echo -n "[$directory] " + echo "Error: Distributed file does not exists: $file" + errors=$((errors+1)) + fi + done + done + + # IGNORE_HEADERS fem headercheck ignore + ignore=`grep "IGNORE_HEADERS" $makefile` + if test "x$ignore" != "x" ; then + continue + fi + + # headercheck_IGNORE core headercheck ignore + ignore=`grep "headercheck_IGNORE" $makefile` + if test "x$ignore" != "x" ; then + continue + fi + + headers=`cat $makefile | sed 'H ; s/.*//g ; x ; s/\n/ /g ; s/[ \t][ \t]*/ /g ; /\\\\$/! { p ; d } ; s/\\\\$// ; x ; d' | grep '_HEADERS' | sed 's/^.*_HEADERS.*=//'` + + for header in $headers ; do + if test x`echo $header | grep '^[$]'` != x ; then + echo -n "[$directory] " + echo "Warning: Skipping check for variable '$header' in headers declaration." + continue + fi + if test ! -e $directory/$header ; then + echo -n "[$directory] " + echo "Error: Header does not exist: $header" + errors=$((errors+1)) + fi + done + + for filename in $headerfiles ; do + found="false" + for header in $headers ; do + if test "x$header" = "x$filename" ; then + found="true" + fi + done + if test "x$found" = "xfalse" ; then + echo -n "[$directory] " + echo "Warning: Header is not included in Makefile.am: $filename" + fi + done + + if test $compile -ne 0 ; then + for filename in $headerfiles ; do + if ! $SHELL $SCRIPTSDIR/check-header.sh $directory/$filename &>/dev/null ; then + echo -n "[$directory] " + echo "Error: Header does not compile: $filename" + errors=$((errors+1)) + fi + done + fi + +# for filename in `ls $directory | sed "/.*.hh/ p ; d"` ; do +# echo $directory : $filename +# done +done + +if [ $errors -gt 0 ] ; then + echo "Number of errors: $errors" + exit 1 +fi diff --git a/scripts/check-tests.sh b/scripts/check-tests.sh new file mode 100755 index 0000000000000000000000000000000000000000..3cd8bcf05abb6a8b22226a08bd2f0a48bdd9bf42 --- /dev/null +++ b/scripts/check-tests.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +if test $# -lt 1 ; then + echo "Usage: $0 <dune-fem-dir> [MAKE_CHECK_FLAGS]" + exit 1 +fi + +MAKE_CHECK_FLAGS=$2 + +WORKINGDIR=`pwd` +cd $1 +FEMDIR=`pwd` + +CHECKLOG=$WORKINGDIR/check-tests.out +make -i check $MAKE_CHECK_FLAGS &> $CHECKLOG + +retvalue=0 +warnings=`grep warning: $CHECKLOG | grep -v "default CommunicationManager is used" | grep -v "GRIDDIM not defined" | grep -v "No GRIDTYPE defined" | grep -v "Hdiv-Projection only working for polOrd = 1" | grep -v "YaspGrid does not provide a HierarchicIndexSet" | wc -l` +if test $warnings -gt 0 ; then + echo "Warning: $warnings compiler warnings occurred." +fi +errors=`grep error: $CHECKLOG | wc -l` +if test $errors -gt 0 ; then + echo "Error: $errors compile time errors occurred." + retvalue=1 +fi +urefs=`grep ": undefined reference" $CHECKLOG | wc -l` +if test $urefs -gt 0 ; then + echo "Error: $urefs undefined linker references occurred." + retvalue=1 +fi + +#if test x`grep "\\"All \\[\\[\\:digit\\:\\]\\]\\+ tests passed\\"" $CHECKLOG` == x ; then +# exit 1 +#fi + +exit $retvalue diff --git a/scripts/fullcheck.sh b/scripts/fullcheck.sh new file mode 100755 index 0000000000000000000000000000000000000000..7b7cf2b95f4e76ba528f19109778ef0c30bb371e --- /dev/null +++ b/scripts/fullcheck.sh @@ -0,0 +1,129 @@ +#!/bin/bash + +# check for parameter pointing to DUNE base directory +# --------------------------------------------------- + +DUNECONTROL="dune-common/bin/dunecontrol" + +if test \( $# -lt 1 \) -o ! -e $1/$DUNECONTROL ; then + echo "Usage: $0 <dune-base-dir>" + exit 1 +fi + +echo "Full Check of dune-femo-dg" +echo "--------------------------" + +echo +echo "Host Name: $HOSTNAME" +echo "Host Type: $HOSTTYPE" + +# set up some variables +# --------------------- + +WORKINGDIR=`pwd` +cd $1 +DUNEDIR=`pwd` +FEMDIR="$DUNEDIR/dune-fem-dg" +SCRIPTSDIR="$FEMDIR/scripts" +OPTSDIR="$SCRIPTSDIR/opts" + +# search for all existing dune modules +# ------------------------------------ +MODULES="" +for modctrl in $(find -name dune.module -print); do + MODULES+="$(dirname $modctrl | sed -e 's@^[.]/@@g') " +done + +errors=0 + +# check headers in Makefile.am in each MODULE +# ------------------------------------------- + +echo +echo "Checking Makefile.am's *_HEADERS variables..." +cd $FEMDIR +if ! $SCRIPTSDIR/check-headers.sh fast ; then + errors=$((errors+1)) +fi + +# configure with minimal options +# ------------------------------ + +MINIMALOPTS="$OPTSDIR/minimal.opts" + +if test ! -e $MINIMALOPTS ; then + echo "Error: $MINIMALOPTS not found." + exit 1 +fi + +minimal_configure() +{ + local check=`mktemp -p $WORKINGDIR check.XXXXXX` + { + $DUNECONTROL --opts=$MINIMALOPTS all + echo $? > $check + } 2>&1 | dd conv=notrunc > $WORKINGDIR/minimal-svn-conf.out 2>/dev/null + local return_value=`cat $check` + rm $check + return $return_value +} + +echo +echo "Configuring with minimal options..." +cd $DUNEDIR +if ! minimal_configure ; then + echo "Fatal: Cannot configure with minimal options (see $WORKINGDIR/minimal-svn-conf.out)." + exit 1 +fi + + +# check headers +# ------------- + +for module in $MODULES; +do + echo + echo "Checking headers in $module ..." + cd $DUNEDIR/$module + if ! $SCRIPTSDIR/check-headers.sh ; then + if test "x$module" == "xdune-fem"; then + errors=$((errors+1)) + fi + fi +done + +# build tarballs +# -------------- + +for MODULE in $MODULES ; do + # ignore missing modules since istl may be missing + if ! test -d $DUNEDIR/$MODULE ; then + continue; + fi + + echo + echo "Making tarball in $MODULE..." + + cd $DUNEDIR/$MODULE + find -maxdepth 1 -name "*.tar.gz" -delete + if ! make dist &> $WORKINGDIR/$MODULE-dist.out ; then + echo "Error: Cannot make tarball for $MODULE (see $WORKINGDIR/$MODULE-dist.out)" + if test $MODULE == dune-fem ; then + errors=$((errors+1)) + fi + fi +done + +# check distributions +# ------------------- + +cd $WORKINGDIR +if ! $SCRIPTSDIR/check-dist.sh $DUNEDIR ; then + errors=$((errors+1)) +fi + +if test $errors -gt 0 ; then + exit 1 +else + exit 0 +fi diff --git a/scripts/mpiexec.sh b/scripts/mpiexec.sh new file mode 100755 index 0000000000000000000000000000000000000000..399044db129d7abb3dfb5cc9991bd6e66256a040 --- /dev/null +++ b/scripts/mpiexec.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# where should the program run +EXECHOST=localhost + +# current path +PWD=`pwd` + +# your specific parameters, use export PARAMETER=... +if [ "$MPIEXEC_PARAMETER" == "" ]; then + MPIEXEC_PARAMETER="parameter" +fi + +# executable to execute +if [ "$MPIEXEC_PROG" == "" ]; then + echo "no executable given, export MPIEXEC_PROG='your program'" + exit 1 +fi + +# executable, change to your needs +PROG=$PWD/$MPIEXEC_PROG + +#env | grep OMPI +# rank and size info (OpenMPI) +RANK=$OMPI_COMM_WORLD_RANK +SIZE=$OMPI_COMM_WORLD_SIZE + +if [ "$1" == "" ] ; then + if [ "$GDB" == "gdb" ] ; then + exec xterm -T "$PROG: P[ $RANK ]" -e gdb --command=run.gdb --args $PROG + else + if [ "$FILES" == "outfiles" ] ; then + exec $PROG $PARAMETER 2> $PWD/mpierr.$RANK 1> $PWD/mpiout.$RANK + else + exec $PROG $PARAMETER + fi + fi +else + if [ "$2" == "outfiles" ] ; then + export FILES="outfiles" + fi + if [ "$2" == "gdb" ] ; then + export GDB="gdb" + echo "Start in Debug Mode" + echo "run $PARAMETER" > run.gdb + # start mpi program (will go into first if + nice mpiexec -n $1 -host $EXECHOST "$0" + else + # start mpi program (will go into first if + nice mpiexec -n $1 "$0" + fi +fi diff --git a/scripts/opts/config_all.opts b/scripts/opts/config_all.opts new file mode 100644 index 0000000000000000000000000000000000000000..fd30de5b9913d8316ee6ae324205681e7445b9c1 --- /dev/null +++ b/scripts/opts/config_all.opts @@ -0,0 +1,24 @@ +# use these options for configure if no options a provided on the cmdline +# #AUTOGEN_FLAGS="--ac=2.59 --am=-1.8" +MODULEDIR=/hosts/raid5/aragorn/dune/modules/$HOSTTYPE +CONFIGURE_FLAGS="\ +--enable-experimental-grid-extensions \ +--enable-fieldvector-size-is-method \ +--without-gmp \ +--enable-parallel \ +--with-petsc=$MODULEDIR/petsc \ +--prefix=/hosts/gandalf/raid5/morgoth/dune/src/dune \ +--with-alugrid=$MODULEDIR/alugrid \ +--with-alberta=$MODULEDIR/alberta \ +--x-includes=/usr/X11R6/include \ +--x-libraries=/usr/X11R6/lib \ +--enable-fieldvector-size-is-method \ +--disable-documentation \ +--with-grape=$MODULEDIR/grape" +MAKE_FLAGS= + + +# These flags are necessary to perform grid specific checks! +MAKE_CHECK_FLAGS="GRIDTYPE=ALUGRID_SIMPLEX GRIDDIM=3" + +MAKE_FLAGS=-j8 diff --git a/scripts/opts/config_alu.opts b/scripts/opts/config_alu.opts new file mode 100644 index 0000000000000000000000000000000000000000..59eb91da69cc57f2cb6f8b3bad4cf234898491ac --- /dev/null +++ b/scripts/opts/config_alu.opts @@ -0,0 +1,19 @@ +MODULEDIR=/hosts/raid5/aragorn/dune/modules/$HOSTTYPE +CONFIGURE_FLAGS="\ +--disable-documentation \ +--enable-experimental-grid-extensions \ +--enable-parallel \ +--without-gmp \ +--prefix=/hosts/gandalf/raid5/morgoth/dune/src/dune \ +--with-alugrid=$MODULEDIR/alugrid \ +--x-includes=/usr/X11R6/include \ +--x-libraries=/usr/X11R6/lib \ +--enable-fieldvector-size-is-method \ +--with-grape=$MODULEDIR/grape" +MAKE_FLAGS= + + +# These flags are necessary to perform grid specific checks! +MAKE_CHECK_FLAGS="GRIDTYPE=ALUGRID_SIMPLEX GRIDDIM=2" + +MAKE_FLAGS=-j8 diff --git a/scripts/opts/config_none.opts b/scripts/opts/config_none.opts new file mode 100644 index 0000000000000000000000000000000000000000..21fac832cb9a0b6d15f371287f55c2905d91a157 --- /dev/null +++ b/scripts/opts/config_none.opts @@ -0,0 +1,13 @@ +CONFIGURE_FLAGS="\ +--disable-documentation \ +--enable-fieldvector-size-is-method \ +--enable-experimental-grid-extensions \ +--without-gmp \ +--prefix=/hosts/gandalf/raid5/morgoth/dune/src/dune" +MAKE_FLAGS= + + +# These flags are necessary to perform grid specific checks! +MAKE_CHECK_FLAGS="GRIDTYPE=YASPGRID GRIDDIM=2" + +MAKE_FLAGS=-j8 diff --git a/scripts/opts/config_spgrid.opts b/scripts/opts/config_spgrid.opts new file mode 100644 index 0000000000000000000000000000000000000000..473d31275aee57456134db9120f77cc1dff62e58 --- /dev/null +++ b/scripts/opts/config_spgrid.opts @@ -0,0 +1,13 @@ +CONFIGURE_FLAGS="\ +--disable-documentation \ +--enable-fieldvector-size-is-method \ +--enable-experimental-grid-extensions \ +--without-gmp \ +--prefix=/hosts/gandalf/raid5/morgoth/dune/src/dune" +MAKE_FLAGS= + + +# These flags are necessary to perform grid specific checks! +MAKE_CHECK_FLAGS="GRIDTYPE=SPGRID GRIDDIM=2" + +MAKE_FLAGS=-j8 diff --git a/scripts/opts/minimal.opts b/scripts/opts/minimal.opts new file mode 100644 index 0000000000000000000000000000000000000000..a868906d5cfcb51cb016a4ac0c26a41e0271f049 --- /dev/null +++ b/scripts/opts/minimal.opts @@ -0,0 +1,6 @@ +CONFIGURE_FLAGS="--disable-documentation \ +--enable-fieldvector-size-is-method \ +--without-gmp \ +--enable-experimental-grid-extensions" +MAKE_FLAGS= +MAKE_FLAGS=-j8