diff --git a/AMDiS/AMDISConfig.cmake.in b/AMDiS/AMDISConfig.cmake.in index fce5e1081008deab9cc0c33d3c08edbde90d0ad7..5c2e53181fc706bd2637cedcc22a25e2b66c3dcc 100644 --- a/AMDiS/AMDISConfig.cmake.in +++ b/AMDiS/AMDISConfig.cmake.in @@ -60,6 +60,7 @@ endif(Boost_FOUND) set(AMDIS_NEED_ZOLTAN @ENABLE_ZOLTAN@) set(AMDIS_HAS_PARALLEL_DOMAIN @ENABLE_PARALLEL_DOMAIN@) +set(AMDIS_OPENMP @ENABLE_OPENMP@) set(AMDIS_NEED_UMFPACK @ENABLE_UMFPACK@) set(AMDIS_NEED_PNG @ENABLE_PNG@) set(AMDIS_NEED_BDDCML @ENABLE_BDDCML@) @@ -72,6 +73,20 @@ set(AMDIS_VERSION @CurrentRevision@) set(AMDIS_MAJOR_VERSION @AMDIS_MAJOR@) set(AMDIS_MINOR_VERSION @AMDIS_MINOR@) +if(CMAKE_BUILD_TYPE STREQUAL "") + set(CMAKE_BUILD_TYPE "Release") +endif() + +if(AMDIS_OPENMP) + if(CMAKE_CXX_COMPILER MATCHES ".*icpc") + list(APPEND AMDIS_COMPILEFLAGS "-openmp") + list(APPEND AMDIS_LIBRARIES "-openmp") + else() + list(APPEND AMDIS_COMPILEFLAGS "-fopenmp") + list(APPEND AMDIS_LIBRARIES "-fopenmp") + endif() +endif(AMDIS_OPENMP) + if(AMDIS_NEED_UMFPACK) set(AMDIS_UMFPACK_PATH @UMFPACK_PATH@) list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_UMFPACK_PATH}) diff --git a/AMDiS/src/Debug.cc b/AMDiS/src/Debug.cc index 2b652c1d3b93c59321dfec641e60579cc76d0a6c..725c2602e543e44702a5b4a2f993c60c37c56ee8 100644 --- a/AMDiS/src/Debug.cc +++ b/AMDiS/src/Debug.cc @@ -66,13 +66,14 @@ namespace AMDiS { #endif - void writeDofIndexMesh(const FiniteElemSpace *feSpace) + void writeDofIndexMesh(const FiniteElemSpace *feSpace, + string filename) { DOFVector<double> tmp(feSpace, "tmp"); DOFIterator<double> it(&tmp, USED_DOFS); for (it.reset(); !it.end(); ++it) *it = it.getDOFIndex(); - VtkWriter::writeFile(tmp, "dofindex.vtu"); + VtkWriter::writeFile(tmp, filename); } diff --git a/AMDiS/src/Debug.h b/AMDiS/src/Debug.h index 0e80c8fe0c2f9a620aa11d1214b54ae3d1b73bec..c5733537ea4da05a05fcb55b0f5f8da5ede0766b 100644 --- a/AMDiS/src/Debug.h +++ b/AMDiS/src/Debug.h @@ -68,9 +68,11 @@ namespace AMDiS { * Create a vtu file with name 'dofindex.vtu'. All nodes in the mesh are colored * by the global DOF index. * - * \param[in] feSpace The FE space to be used. + * \param[in] feSpace The FE space to be used. + * \param[in] filename Name of the VTU file */ - void writeDofIndexMesh(const FiniteElemSpace *feSpace); + void writeDofIndexMesh(const FiniteElemSpace *feSpace, + string filename = "dofindex.vtu"); void colorEdgeInMesh(const FiniteElemSpace *feSpace, Element *el, diff --git a/AMDiS/src/FirstOrderTerm.cc b/AMDiS/src/FirstOrderTerm.cc index ce0c3944ace2bc030582e20e14ba80dc8d581b06..2e211892706359648d44a860ec8f4bbca94c02fa 100644 --- a/AMDiS/src/FirstOrderTerm.cc +++ b/AMDiS/src/FirstOrderTerm.cc @@ -638,17 +638,23 @@ namespace AMDiS { } } - void Vec3FctAtQP_FOT::eval( int nPoints, - const mtl::dense_vector<double>& uhAtQP, - const mtl::dense_vector<WorldVector<double> >& grdUhAtQP, - const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP, - mtl::dense_vector<double>& result, - double fac) + void Vec3FctAtQP_FOT::eval(int nPoints, + const mtl::dense_vector<double>& uhAtQP, + const mtl::dense_vector<WorldVector<double> >& grdUhAtQP, + const mtl::dense_vector<WorldMatrix<double> >& D2UhAtQP, + mtl::dense_vector<double>& result, + double fac) { - if (num_rows(grdUhAtQP) > 0) + if (num_rows(grdUhAtQP) == 0) + return; + + if (bOne > -1) { + ERROR_EXIT("Not yet implemented!\n"); + } else { for (int iq = 0; iq < nPoints; iq++) result[iq] += fac * (*f)(vec1AtQPs[iq], vec2AtQPs[iq] ,vec3AtQPs[iq]) * ((*b) * grdUhAtQP[iq]); + } } diff --git a/AMDiS/src/ProblemStat.cc b/AMDiS/src/ProblemStat.cc index ece5db9b64a2dc3d5422a4e1a52eb9c1d8585dbc..f3cd56683472f47358e19ad0f91e0d1a5e88d738 100644 --- a/AMDiS/src/ProblemStat.cc +++ b/AMDiS/src/ProblemStat.cc @@ -864,6 +864,12 @@ namespace AMDiS { if (assembleMatrix && matrix->getBoundaryManager()) matrix->getBoundaryManager()->initMatrix(matrix); + // This OpenMP barrier is required for the case of periodc boundary + // conditions. In this case, we may have a data race between + // fillBoundaryCondition and exitMatrix, where both make use of the + // vertex vector associated. +#pragma omp barrier + // The simplest case: either the right hand side has no operaters, no aux // fe spaces, or all aux fe spaces are equal to the row and col fe space. assembleOnOneMesh(componentSpaces[rowComponent], @@ -872,12 +878,14 @@ namespace AMDiS { ((rowComponent == colComponent) && asmVector) ? rhs->getDOFVector(rowComponent) : NULL); + +#pragma omp barrier assembledMatrix[rowComponent][colComponent] = true; if (assembleMatrix) matrix->finishInsertion(); - + if (assembleMatrix && matrix->getBoundaryManager()) matrix->getBoundaryManager()->exitMatrix(matrix); diff --git a/AMDiS/src/SecondOrderTerm.h b/AMDiS/src/SecondOrderTerm.h index 879eb8d797df9185a23cefa01c9647f6c81852b8..e6c57766d1e04c38250eede141dea67087377c9c 100644 --- a/AMDiS/src/SecondOrderTerm.h +++ b/AMDiS/src/SecondOrderTerm.h @@ -66,17 +66,16 @@ namespace AMDiS { bool symm, double factor) const; - /** \brief - * Evaluation of \f$ \Lambda \cdot A \cdot \Lambda^t\f$ for \f$ A \f$ - * the matrix having a ONE in the position \f$ (K,L) \f$ - * and ZEROS in all other positions. - */ + /// Evaluation of \f$ \Lambda \cdot A \cdot \Lambda^t\f$ for \f$ A \f$ + /// the matrix having a ONE in the position \f$ (K,L) \f$ + /// and ZEROS in all other positions. static void lalt_kl(const DimVec<WorldVector<double> >& Lambda, int k, int l, mtl::dense2D<double>& LALt, double factor); - /// Evaluation of \f$ \Lambda \cdot A \cdot \Lambda^t\f$ for A equal to the identity. + /// Evaluation of \f$ \Lambda \cdot A \cdot \Lambda^t\f$ for A equal to + /// the identity. inline void l1lt(const DimVec<WorldVector<double> >& Lambda, mtl::dense2D<double>& LALt, double factor) const