From 5781e1c67a4eb27f0bd82a0476820fb16e8d3d2d Mon Sep 17 00:00:00 2001 From: Thomas Witkowski <thomas.witkowski@gmx.de> Date: Tue, 28 Jul 2009 07:44:52 +0000 Subject: [PATCH] Added --with-petsc parameter to automake system. --- AMDiS/Makefile.in | 1 + AMDiS/bin/Makefile.am | 3 +- AMDiS/bin/Makefile.in | 4 +- AMDiS/configure | 71 ++++++---- AMDiS/configure.ac | 3 + AMDiS/src/DOFMatrix.h | 8 +- AMDiS/src/ParallelDomainBase.cc | 240 +++++--------------------------- AMDiS/src/ParallelDomainVec.cc | 2 +- AMDiS/src/ProblemVec.cc | 22 ++- 9 files changed, 102 insertions(+), 252 deletions(-) diff --git a/AMDiS/Makefile.in b/AMDiS/Makefile.in index 056838fe..e7566807 100644 --- a/AMDiS/Makefile.in +++ b/AMDiS/Makefile.in @@ -138,6 +138,7 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PETSC_DIR = @PETSC_DIR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ diff --git a/AMDiS/bin/Makefile.am b/AMDiS/bin/Makefile.am index 6fe348bc..a6a74172 100644 --- a/AMDiS/bin/Makefile.am +++ b/AMDiS/bin/Makefile.am @@ -33,8 +33,7 @@ if USE_PARALLEL_DOMAIN_AMDIS $(PARALLEL_DIR)/ParallelDomainScal.h $(PARALLEL_DIR)/ParallelDomainScal.cc \ $(PARALLEL_DIR)/ParallelDomainVec.h $(PARALLEL_DIR)/ParallelDomainVec.cc libamdis_la_CXXFLAGS += -DHAVE_PARALLEL_DOMAIN_AMDIS=1 -# AMDIS_INCLUDES += -I/work/home7/witkowsk/local/include - AMDIS_INCLUDES += -I/u/witkowski/local/petsc-3.0.0-p4/include -I/u/witkowski/local/petsc-3.0.0-p4/linux-gnu-c-debug/include + AMDIS_INCLUDES += -I$(PETSC_DIR)/include -I$(PETSC_DIR)/$(PETSC_ARCH)/include endif if ENABLE_UMFPACK diff --git a/AMDiS/bin/Makefile.in b/AMDiS/bin/Makefile.in index 79f9d24e..aace53f9 100644 --- a/AMDiS/bin/Makefile.in +++ b/AMDiS/bin/Makefile.in @@ -43,8 +43,7 @@ host_triplet = @host@ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(PARALLEL_DIR)/ParallelDomainVec.h $(PARALLEL_DIR)/ParallelDomainVec.cc @USE_PARALLEL_DOMAIN_AMDIS_TRUE@am__append_3 = -DHAVE_PARALLEL_DOMAIN_AMDIS=1 -# AMDIS_INCLUDES += -I/work/home7/witkowsk/local/include -@USE_PARALLEL_DOMAIN_AMDIS_TRUE@am__append_4 = -I/u/witkowski/local/petsc-3.0.0-p4/include -I/u/witkowski/local/petsc-3.0.0-p4/linux-gnu-c-debug/include +@USE_PARALLEL_DOMAIN_AMDIS_TRUE@am__append_4 = -I$(PETSC_DIR)/include -I$(PETSC_DIR)/$(PETSC_ARCH)/include @ENABLE_UMFPACK_TRUE@am__append_5 = -DHAVE_UMFPACK=1 -DMTL_HAS_UMFPACK @ENABLE_UMFPACK_TRUE@am__append_6 = -I$(LIB_DIR)/UFconfig \ @ENABLE_UMFPACK_TRUE@ -I$(LIB_DIR)/AMD/Include \ @@ -395,6 +394,7 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PETSC_DIR = @PETSC_DIR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ diff --git a/AMDiS/configure b/AMDiS/configure index f9cd175d..4196f21b 100755 --- a/AMDiS/configure +++ b/AMDiS/configure @@ -462,7 +462,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT AMDIS_DEBUG_TRUE AMDIS_DEBUG_FALSE CXX CC AMDIS_INTEL_TRUE AMDIS_INTEL_FALSE AMDIS_OPENMP_TRUE AMDIS_OPENMP_FALSE OPENMP_FLAG MPI_DIR USE_PARALLEL_AMDIS_TRUE USE_PARALLEL_AMDIS_FALSE USE_PARALLEL_DOMAIN_AMDIS_TRUE USE_PARALLEL_DOMAIN_AMDIS_FALSE ENABLE_UMFPACK_TRUE ENABLE_UMFPACK_FALSE ENABLE_MKL_TRUE ENABLE_MKL_FALSE DUNE_DIR ENABLE_DUNE_TRUE ENABLE_DUNE_FALSE ENABLE_BOOST_TRUE ENABLE_BOOST_FALSE CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT AMDIS_DEBUG_TRUE AMDIS_DEBUG_FALSE CXX CC AMDIS_INTEL_TRUE AMDIS_INTEL_FALSE AMDIS_OPENMP_TRUE AMDIS_OPENMP_FALSE OPENMP_FLAG MPI_DIR PETSC_DIR USE_PARALLEL_AMDIS_TRUE USE_PARALLEL_AMDIS_FALSE USE_PARALLEL_DOMAIN_AMDIS_TRUE USE_PARALLEL_DOMAIN_AMDIS_FALSE ENABLE_UMFPACK_TRUE ENABLE_UMFPACK_FALSE ENABLE_MKL_TRUE ENABLE_MKL_FALSE DUNE_DIR ENABLE_DUNE_TRUE ENABLE_DUNE_FALSE ENABLE_BOOST_TRUE ENABLE_BOOST_FALSE CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1046,6 +1046,7 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-mpi=MPI_DIR + --with-petsc=PETSC_DIR --with-dune=DUNE_DIR --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-pic try to use only PIC/non-PIC objects [default=use @@ -2078,6 +2079,17 @@ if test $mpidir != no ; then fi + +# Check whether --with-petsc or --without-petsc was given. +if test "${with_petsc+set}" = set; then + withval="$with_petsc" + petscdir=$withval +else + petscdir=no +fi; +PETSC_DIR=$petscdir + + # Check whether --enable-parmetis or --disable-parmetis was given. if test "${enable_parmetis+set}" = set; then enableval="$enable_parmetis" @@ -4410,7 +4422,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4413 "configure"' > conftest.$ac_ext + echo '#line 4425 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5545,7 +5557,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5548:" \ +echo "$as_me:5560:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 @@ -6608,11 +6620,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6611: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6623: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6615: \$? = $ac_status" >&5 + echo "$as_me:6627: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -6876,11 +6888,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6879: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6891: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6883: \$? = $ac_status" >&5 + echo "$as_me:6895: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -6980,11 +6992,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6983: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6995: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6987: \$? = $ac_status" >&5 + echo "$as_me:6999: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8449,7 +8461,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 8452 "configure"' > conftest.$ac_ext + echo '#line 8464 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -9346,7 +9358,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 9349 "configure" +#line 9361 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -9446,7 +9458,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 9449 "configure" +#line 9461 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11789,11 +11801,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11792: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11804: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11796: \$? = $ac_status" >&5 + echo "$as_me:11808: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -11893,11 +11905,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11896: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11908: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11900: \$? = $ac_status" >&5 + echo "$as_me:11912: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12429,7 +12441,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 12432 "configure"' > conftest.$ac_ext + echo '#line 12444 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -13487,11 +13499,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13490: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13502: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13494: \$? = $ac_status" >&5 + echo "$as_me:13506: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13591,11 +13603,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13594: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13606: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13598: \$? = $ac_status" >&5 + echo "$as_me:13610: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15040,7 +15052,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 15043 "configure"' > conftest.$ac_ext + echo '#line 15055 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -15818,11 +15830,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15821: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15833: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15825: \$? = $ac_status" >&5 + echo "$as_me:15837: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16086,11 +16098,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16089: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16101: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16093: \$? = $ac_status" >&5 + echo "$as_me:16105: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16190,11 +16202,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16193: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16205: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16197: \$? = $ac_status" >&5 + echo "$as_me:16209: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17659,7 +17671,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 17662 "configure"' > conftest.$ac_ext + echo '#line 17674 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -19661,6 +19673,7 @@ s,@AMDIS_OPENMP_TRUE@,$AMDIS_OPENMP_TRUE,;t t s,@AMDIS_OPENMP_FALSE@,$AMDIS_OPENMP_FALSE,;t t s,@OPENMP_FLAG@,$OPENMP_FLAG,;t t s,@MPI_DIR@,$MPI_DIR,;t t +s,@PETSC_DIR@,$PETSC_DIR,;t t s,@USE_PARALLEL_AMDIS_TRUE@,$USE_PARALLEL_AMDIS_TRUE,;t t s,@USE_PARALLEL_AMDIS_FALSE@,$USE_PARALLEL_AMDIS_FALSE,;t t s,@USE_PARALLEL_DOMAIN_AMDIS_TRUE@,$USE_PARALLEL_DOMAIN_AMDIS_TRUE,;t t diff --git a/AMDiS/configure.ac b/AMDiS/configure.ac index f03e2bd5..192f423f 100644 --- a/AMDiS/configure.ac +++ b/AMDiS/configure.ac @@ -54,6 +54,9 @@ if test $mpidir != no ; then AC_SUBST(CC, $mpidir/bin/mpicc) fi +AC_ARG_WITH(petsc, [ --with-petsc=PETSC_DIR], petscdir=$withval, petscdir=no) +AC_SUBST(PETSC_DIR, $petscdir) + AC_ARG_ENABLE(parmetis, [ --enable-parmetis Compile with the ParMetis library], [case "${enableval}" in diff --git a/AMDiS/src/DOFMatrix.h b/AMDiS/src/DOFMatrix.h index b26fdd0e..5ae24aa9 100644 --- a/AMDiS/src/DOFMatrix.h +++ b/AMDiS/src/DOFMatrix.h @@ -256,12 +256,14 @@ namespace AMDiS { } /** \brief - * Finishes insertion. For compressed matrix types, this is where the - * compression happens. + * Finishes insertion. For compressed matrix types, this is where the + * compression happens. */ void finishInsertion() { - TEST_EXIT(inserter)("Inserter wasn't used or is already finished."); + FUNCNAME("DOFMatrix::finishInsertion()"); + + TEST_EXIT(inserter)("Inserter wasn't used or is already finished.\n"); delete inserter; inserter= 0; diff --git a/AMDiS/src/ParallelDomainBase.cc b/AMDiS/src/ParallelDomainBase.cc index 5bcb5022..68b3ad19 100644 --- a/AMDiS/src/ParallelDomainBase.cc +++ b/AMDiS/src/ParallelDomainBase.cc @@ -67,23 +67,6 @@ namespace AMDiS { if (mpiSize <= 1) return; -#if 0 - if (mpiRank == 0) { - std::map<int, double> vec; - - TraverseStack stack; - ElInfo *elInfo = stack.traverseFirst(mesh, -1, - Mesh::CALL_LEAF_EL | Mesh::FILL_NEIGH); - while (elInfo) { - vec[elInfo->getElement()->getIndex()] = static_cast<double>(elInfo->getElement()->getIndex()); - elInfo = stack.traverseNext(elInfo); - } - - ElementFileWriter::writeFile(vec, feSpace, "test.vtu"); - } -#endif - - // Test, if the mesh is the macro mesh only! Paritioning of the mesh is supported // only for macro meshes, so it will not work yet if the mesh is already refined // in some way. @@ -130,23 +113,6 @@ namespace AMDiS { updateDofAdmins(); -#if 0 - if (mpiRank == 0) { - TraverseStack stack; - ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL); - while (elInfo) { - if (elInfo->getElement()->getIndex() == 4) { - WorldVector<double> x; - mesh->getDofIndexCoords(elInfo->getElement()->getDOF(0), feSpace, x); - std::cout << "FOUND!" << std::endl; - x.print(); - } - - elInfo = stack.traverseNext(elInfo); - } - } -#endif - // === Global refinements. === @@ -317,7 +283,7 @@ namespace AMDiS { clock_t first = clock(); - using mtl::tag::major; using mtl::tag::nz; using mtl::begin; using mtl::end; + using mtl::tag::row; using mtl::tag::nz; using mtl::begin; using mtl::end; namespace traits= mtl::traits; typedef DOFMatrix::base_matrix_type Matrix; @@ -334,32 +300,32 @@ namespace AMDiS { if ((*mat)[i][j]) { Matrix bmat = (*mat)[i][j]->getBaseMatrix(); - traits::row<Matrix>::type row(bmat); traits::col<Matrix>::type col(bmat); traits::const_value<Matrix>::type value(bmat); - typedef traits::range_generator<major, Matrix>::type cursor_type; + typedef traits::range_generator<row, Matrix>::type cursor_type; typedef traits::range_generator<nz, cursor_type>::type icursor_type; - for (cursor_type cursor = begin<major>(bmat), - cend = end<major>(bmat); cursor != cend; ++cursor) { + for (cursor_type cursor = begin<row>(bmat), + cend = end<row>(bmat); cursor != cend; ++cursor) { + + int r = mapLocalGlobalDOFs[*cursor] * nComponents + i; + r -= rstart * nComponents; + + if (r >= nRankRows) + continue; + for (icursor_type icursor = begin<nz>(cursor), icend = end<nz>(cursor); icursor != icend; ++icursor) if (value(*icursor) != 0.0) { - int r = mapLocalGlobalDOFs[row(*icursor)] * nComponents + i; - r -= rstart * nComponents; - int c = mapLocalGlobalDOFs[col(*icursor)] * nComponents + j; - if (r < nRankRows) { - - if (c >= rstart * nComponents && - c < rstart * nComponents + nRankRows) - d_nnz[r]++; - else - o_nnz[r]++; - } - } + if (c >= rstart * nComponents && + c < rstart * nComponents + nRankRows) + d_nnz[r]++; + else + o_nnz[r]++; + } } } @@ -389,6 +355,9 @@ namespace AMDiS { for (int i = 0; i < nComponents; i++) setDofVector(vec->getDOFVector(i), nComponents, i); + VecAssemblyBegin(petscRhsVec); + VecAssemblyEnd(petscRhsVec); + INFO(info, 8)("Fill petsc matrix needed %.5f seconds\n", TIME_USED(first, clock())); } @@ -401,7 +370,7 @@ namespace AMDiS { PC pc; KSPCreate(PETSC_COMM_WORLD, &ksp); - KSPSetOperators(ksp, petscMatrix, petscMatrix, DIFFERENT_NONZERO_PATTERN); + KSPSetOperators(ksp, petscMatrix, petscMatrix, SAME_NONZERO_PATTERN); KSPGetPC(ksp, &pc); //PCSetType(pc, PCJACOBI); PCSetType(pc, PCILU); @@ -471,17 +440,21 @@ namespace AMDiS { { FUNCNAME("ParallelDomainBase::solvePetscMatrix()"); - KSP ksp; + KSP solver; PC pc; - KSPCreate(PETSC_COMM_WORLD, &ksp); - KSPSetOperators(ksp, petscMatrix, petscMatrix, DIFFERENT_NONZERO_PATTERN); - KSPGetPC(ksp, &pc); + KSPCreate(PETSC_COMM_WORLD, &solver); + KSPSetOperators(solver, petscMatrix, petscMatrix, SAME_NONZERO_PATTERN); + + KSPSetTolerances(solver, 1.e-8, PETSC_DEFAULT, PETSC_DEFAULT, PETSC_DEFAULT); + KSPSetType(solver, KSPBCGS); + KSPMonitorSet(solver, myKSPMonitor, PETSC_NULL, 0); + + KSPGetPC(solver, &pc); PCSetType(pc, PCKSP); - KSPSetTolerances(ksp, 1.e-8, PETSC_DEFAULT, PETSC_DEFAULT, PETSC_DEFAULT); - KSPSetType(ksp, KSPBCGS); - KSPMonitorSet(ksp, myKSPMonitor, PETSC_NULL, 0); - KSPSolve(ksp, petscRhsVec, petscSolVec); + + KSPSetUp(solver); + KSPSolve(solver, petscRhsVec, petscSolVec); PetscScalar *vecPointer; VecGetArray(petscSolVec, &vecPointer); @@ -550,6 +523,8 @@ namespace AMDiS { delete [] sendBuffers[i]; MatDestroy(petscMatrix); + PCDestroy(pc); + KSPDestroy(solver); } @@ -655,24 +630,6 @@ namespace AMDiS { bool isRankDOF2 = (find(rankDOFs.begin(), rankDOFs.end(), boundDOF2) != rankDOFs.end()); bool ranksBoundary = isRankDOF1 || isRankDOF2; -#if 0 - if (mpiRank == 3 && ranksBoundary && - partitionVec[elInfo->getNeighbour(i)->getIndex()] == 2) { - std::cout << "ADD MY BOUND " << element->getIndex() << "/" << i - << " with " - << elInfo->getNeighbour(i)->getIndex() << "/" - << elInfo->getSideOfNeighbour(i) << std::endl; - } - - if (mpiRank == 2 && !ranksBoundary && - partitionVec[elInfo->getNeighbour(i)->getIndex()] == 3) { - std::cout << "ADD OT BOUND " << element->getIndex() << "/" << i - << " with " - << elInfo->getNeighbour(i)->getIndex() << "/" - << elInfo->getSideOfNeighbour(i) << std::endl; - } -#endif - // === And add the part of the interior boundary. === AtomicBoundary& bound = @@ -832,15 +789,6 @@ namespace AMDiS { for (DofContainer::iterator dofIt = rankAllDofs.begin(); dofIt != rankAllDofs.end(); ++dofIt) { -#if 0 - if (mpiRank == 0) { - std::cout << "COORDs of dof = " << i << std::endl; - WorldVector<double> x; - mesh->getDofIndexCoords(*dofIt, feSpace, x); - x.print(); - } -#endif - rankDofsNewLocalIndex[*dofIt] = i; // First, we set all dofs in ranks partition to be owend by the rank. Later, // the dofs in ranks partition that are owned by other rank are set to false. @@ -930,11 +878,6 @@ namespace AMDiS { sendBuffers[i][c++] = *(dofIt->first); sendBuffers[i][c++] = dofIt->second; -#if 0 - if (mpiRank == 3 && sendIt->first == 2) - std::cout << "SEND DOF: " << dofIt->first << std::endl; -#endif - sendDofs[sendIt->first].push_back(dofIt->first); } @@ -997,11 +940,6 @@ namespace AMDiS { if (*(dofIt->first) == oldDof && !dofChanged[dofIt->first]) { dofChanged[dofIt->first] = true; -#if 0 - if (mpiRank == 2 && recvIt->first == 3) - std::cout << "RECV DOF: " << dofIt->first << std::endl; -#endif - recvDofs[recvIt->first].push_back(dofIt->first); rankDofsNewGlobalIndex[dofIt->first] = newGlobalDof; isRankDof[rankDofsNewLocalIndex[dofIt->first]] = false; @@ -1065,16 +1003,6 @@ namespace AMDiS { for (std::vector<AtomicBoundary>::iterator boundIt = it->second.begin(); boundIt != it->second.end(); ++boundIt) { -#if 0 - if (mpiRank == 3 && it->first == 2) - std::cout << "GO ON MY BOUND: " << boundIt->rankObject.elIndex - << "/" << boundIt->rankObject.ithObjAtBoundary << " with " - << boundIt->neighbourObject.elIndex << "/" - << boundIt->neighbourObject.ithObjAtBoundary - << std::endl; -#endif - - DofContainer dofs; DofContainer &dofsToSend = sendDofs[it->first]; @@ -1095,17 +1023,6 @@ namespace AMDiS { ERROR_EXIT("Should never happen!\n"); } -#if 0 - if (mpiRank == 3 && it->first == 2) { - WorldVector<double> x; - mesh->getDofIndexCoords(dofs[0], feSpace, x); - x.print(); - mesh->getDofIndexCoords(dofs[1], feSpace, x); - x.print(); - } -#endif - - for (DofContainer::iterator dofIt = dofs.begin(); dofIt != dofs.end(); ++dofIt) if (find(dofsToSend.begin(), dofsToSend.end(), *dofIt) == dofsToSend.end()) dofsToSend.push_back(*dofIt); @@ -1128,16 +1045,6 @@ namespace AMDiS { for (std::vector<AtomicBoundary>::iterator boundIt = it->second.begin(); boundIt != it->second.end(); ++boundIt) { -#if 0 - if (mpiRank == 2 && it->first == 3) - std::cout << "GO ON OT BOUND: " << boundIt->rankObject.elIndex - << "/" << boundIt->rankObject.ithObjAtBoundary << " with " - << boundIt->neighbourObject.elIndex << "/" - << boundIt->neighbourObject.ithObjAtBoundary - << std::endl; -#endif - - DofContainer dofs; DofContainer &dofsToRecv = recvDofs[it->first]; @@ -1168,16 +1075,6 @@ namespace AMDiS { ERROR_EXIT("Should never happen!\n"); } -#if 0 - if (mpiRank == 2 && it->first == 3) { - WorldVector<double> x; - mesh->getDofIndexCoords(dofs[0], feSpace, x); - x.print(); - mesh->getDofIndexCoords(dofs[1], feSpace, x); - x.print(); - } -#endif - for (DofContainer::iterator dofIt = dofs.begin(); dofIt != dofs.end(); ++dofIt) { DofContainer::iterator eraseIt = find(rankDOFs.begin(), rankDOFs.end(), *dofIt); if (eraseIt != rankDOFs.end()) @@ -1547,22 +1444,9 @@ namespace AMDiS { int nSendInt = rankIt->second.size(); int* buffer = new int[nSendInt]; - for (int i = 0; i < nSendInt; i++) { - -#if 0 - if (mpiRank == 3 && rankIt->first == 2) { - std::cout << "MY BOUND: " << (rankIt->second)[i].rankObject.elIndex - << "/" << (rankIt->second)[i].rankObject.ithObjAtBoundary - << " with neig " - << (rankIt->second)[i].neighbourObject.elIndex - << "/" << (rankIt->second)[i].neighbourObject.ithObjAtBoundary - << std::endl; - } -#endif - - + for (int i = 0; i < nSendInt; i++) buffer[i] = (rankIt->second)[i].rankObject.elIndex; - } + sendBuffers.push_back(buffer); request[requestCounter++] = @@ -1593,20 +1477,6 @@ namespace AMDiS { ("Boundaries does not fit together!\n"); for (int i = 0; i < static_cast<int>(rankIt->second.size()); i++) { - -#if 0 - if (mpiRank == 2 && rankIt->first == 3) { - std::cout << "OT BOUND: " << (rankIt->second)[i].rankObject.elIndex - << "/" << (rankIt->second)[i].rankObject.ithObjAtBoundary - << " with neig " - << (rankIt->second)[i].neighbourObject.elIndex - << "/" << (rankIt->second)[i].neighbourObject.ithObjAtBoundary - << std::endl; - } - -#endif - - int elIndex1 = recvBuffers[bufCounter][i]; int elIndex2 = otherIntBoundary.boundary[rankIt->first][i].neighbourObject.elIndex; @@ -1622,27 +1492,6 @@ namespace AMDiS { { FUNCNAME("ParallelDomainBase::DbgTestCommonDofs()"); - -#if 0 - { - TraverseStack stack; - ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER); - while (elInfo) { - Element *el = elInfo->getElement(); - for (int i = 0; i < 3; i++) { - if (mpiRank == 2 && el->getDOF(i, 0) == 3) - std::cout << "RANK 2 EL = " << el->getIndex() << " i = " << i << std::endl; - - if (mpiRank == 3 && el->getDOF(i, 0) == 4) - std::cout << "RANK 3 EL = " << el->getIndex() << " i = " << i << std::endl; - - } - - elInfo = stack.traverseNext(elInfo); - } - } -#endif - // Maps to each neighbour rank an array of WorldVectors. This array contain the // coordinates of all dofs this rank shares on the interior boundary with the // neighbour rank. A rank sends the coordinates to another rank, if it owns the @@ -1662,13 +1511,6 @@ namespace AMDiS { bool b = mesh->getDofIndexCoords(*dofIt, feSpace, coords); TEST_EXIT(b)("Cannot find DOF in mesh!\n"); -#if 0 - if (mpiRank == 3 && it->first == 2) { - std::cout << "SEND COORDS: " << *dofIt << " = " << **dofIt << std::endl; - coords.print(); - } -#endif - sendCoords[it->first].push_back(coords); } } @@ -1680,14 +1522,6 @@ namespace AMDiS { bool b = mesh->getDofIndexCoords(*dofIt, feSpace, coords); TEST_EXIT(b)("Cannot find DOF in mesh!\n"); recvCoords[it->first].push_back(coords); - -#if 0 - if (mpiRank == 2 && it->first == 3) { - std::cout << "RECV COORDS: " << *dofIt << " = " << **dofIt << std::endl; - coords.print(); - } -#endif - } } diff --git a/AMDiS/src/ParallelDomainVec.cc b/AMDiS/src/ParallelDomainVec.cc index c2a127ec..5416c468 100644 --- a/AMDiS/src/ParallelDomainVec.cc +++ b/AMDiS/src/ParallelDomainVec.cc @@ -66,7 +66,7 @@ namespace AMDiS { #else INFO(info, 8)("solution of discrete system needed %.5f seconds\n", TIME_USED(first, clock())); -#endif +#endif } } diff --git a/AMDiS/src/ProblemVec.cc b/AMDiS/src/ProblemVec.cc index 39fcd144..bdbea9e7 100644 --- a/AMDiS/src/ProblemVec.cc +++ b/AMDiS/src/ProblemVec.cc @@ -666,6 +666,9 @@ namespace AMDiS { traverseInfo.updateStatus(); + // Used to calculate the overall number of non zero entries. + int nnz = 0; + for (int i = 0; i < nComponents; i++) { for (int j = 0; j < nComponents; j++) { @@ -687,9 +690,8 @@ namespace AMDiS { // If the matrix should not be assembled, the rhs vector has to be considered. // This will be only done, if i == j. So, if both is not true, we can jump // to the next matrix. - if (!assembleMatrix && i != j) { + if (!assembleMatrix && i != j) continue; - } if (assembleMatrix && matrix->getBoundaryManager()) matrix->getBoundaryManager()->initMatrix(matrix); @@ -759,6 +761,12 @@ namespace AMDiS { matrix->getBoundaryManager()->exitMatrix(matrix); assembledMatrix[i][j] = true; + + if (assembleMatrix) + matrix->finishInsertion(); + + if (matrix) + nnz += matrix->getBaseMatrix().nnz(); } // And now assemble boundary conditions on the vectors @@ -768,16 +776,6 @@ namespace AMDiS { assembleFlag); } - int nnz = 0; - - // Finish insertion - for (int i = 0; i < nComponents; i++) - for (int j = 0; j < nComponents; j++) - if ((*systemMatrix)[i][j]) { - (*systemMatrix)[i][j]->finishInsertion(); - nnz += (*systemMatrix)[i][j]->getBaseMatrix().nnz(); - } - solverMatrix.setMatrix(*systemMatrix); createPrecon(); -- GitLab