From: maier Date: Mon, 17 Sep 2012 16:00:02 +0000 (+0000) Subject: Add support for Trilinos (beta) X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fefe97a45c5b1fa49f919cd62daafc6caa88bdd6;p=dealii-svn.git Add support for Trilinos (beta) git-svn-id: https://svn.dealii.org/branches/branch_cmake@26431 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index 26be28f67c..19f9ee25be 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -97,7 +97,7 @@ OPTION(DEAL_II_ALLOW_CONTRIB OPTION(DEAL_II_WITH_BLAS "Build deal.II with support for BLAS." - ON) + OFF) OPTION(DEAL_II_WITH_FUNCTIONPARSER "Build deal.II with support for functionparser." @@ -109,7 +109,7 @@ OPTION(DEAL_II_FORCE_CONTRIB_FUNCTIONPARSER OPTION(DEAL_II_WITH_LAPACK "Build deal.II with support for LAPACK." - ON) + OFF) OPTION(DEAL_II_WITH_METIS "Build deal.II with support for Metis." @@ -130,9 +130,13 @@ OPTION(DEAL_II_FORCE_CONTRIB_TBB "Always use the bundled tbb library instead of an external one." OFF) +OPTION(DEAL_II_WITH_TRILINOS + "Build deal.II with support for trilinos." + ON) + OPTION(DEAL_II_WITH_UMFPACK "Build deal.II with support for UMFPACK." - ON) + OFF) OPTION(DEAL_II_FORCE_CONTRIB_UMFPACK "Always use the bundled umfpack library instead of an external one." OFF) @@ -267,6 +271,8 @@ INCLUDE(configure_netcdf) INCLUDE(configure_tbb) +INCLUDE(configure_trilinos) + # configure_boost depends on configure_tbb INCLUDE(configure_boost) diff --git a/deal.II/contrib/cmake/check/check_for_cxx_features.cmake b/deal.II/contrib/cmake/check/check_for_cxx_features.cmake index b9637a5fcc..b405c9980a 100644 --- a/deal.II/contrib/cmake/check/check_for_cxx_features.cmake +++ b/deal.II/contrib/cmake/check/check_for_cxx_features.cmake @@ -146,7 +146,8 @@ IF(DEAL_II_HAVE_CXX11_FLAG) MESSAGE(STATUS "Sufficient C++11 support. Enabling -std=c++0x.") - SET(DEAL_II_CAN_USE_CXX1X TRUE) + SET(DEAL_II_CAN_USE_CXX1X TRUE) # TODO + SET(DEAL_II_CAN_USE_CXX11 TRUE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") # TODO diff --git a/deal.II/contrib/cmake/configure/configure_metis.cmake b/deal.II/contrib/cmake/configure/configure_metis.cmake index 385b42df0c..1f9e9c216b 100644 --- a/deal.II/contrib/cmake/configure/configure_metis.cmake +++ b/deal.II/contrib/cmake/configure/configure_metis.cmake @@ -13,11 +13,6 @@ MACRO(FEATURE_METIS_FIND_EXTERNAL var) Could not find a sufficient modern metis installation: Version 5.x required! -Please ensure that a sufficiently modern version of metis is installed on -your computer. If the library is not at a default location, either provide -some hints for the autodetection, or set the relevant variables by hand in -ccmake. - " ) ENDIF() diff --git a/deal.II/contrib/cmake/configure/configure_trilinos.cmake b/deal.II/contrib/cmake/configure/configure_trilinos.cmake new file mode 100644 index 0000000000..13b3b2d2fb --- /dev/null +++ b/deal.II/contrib/cmake/configure/configure_trilinos.cmake @@ -0,0 +1,214 @@ +# +# Configuration for the trilinos library: +# + +INCLUDE(CheckCXXSourceCompiles) +INCLUDE(CheckIncludeFile) + + +MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var) + + FIND_PACKAGE(TRILINOS) + + IF(TRILINOS_FOUND) + SET(${var} TRUE) + # + # So, we have a library. Let's see whether we can use it: + # + + + # + # Trilinos 10.6 had quite a number of bugs we ran into, see + # for example + # https://software.sandia.gov/bugzilla/show_bug.cgi?id=5062 + # https://software.sandia.gov/bugzilla/show_bug.cgi?id=5319 + # + IF(TRILINOS_MAJOR EQUAL 10 AND TRILINOS_MINOR EQUAL 6) + MESSAGE(WARNING " +Trilinos versions ${TRILINOS_MAJOR}.${TRILINOS_MINOR}.x have bugs that make +it incompatible with deal.II. Please use versions before 10.6 or after +10.8.1. + +") + SET(${var} FALSE) + ENDIF() + + + # + # The same is unfortunately true for 10.8.[01]: + # https://software.sandia.gov/bugzilla/show_bug.cgi?id=5370 + # + IF( TRILINOS_MAJOR EQUAL 10 AND + TRILINOS_MINOR EQUAL 8 AND + TRILINOS_SUBMINOR LESS 2 ) + MESSAGE(WARNING " +Trilinos versions 10.8.0 and 10.8.1 have bugs that make +it incompatible with deal.II. Please use versions before 10.6 or after +10.8.1. + +") + SET(${var} FALSE) + ENDIF() + + + # + # Trilinos has to be configured with the same MPI configuration as + # deal.II. So check this: + # + # TODO: Refine this check... + # + IF("${TRILINOS_MPI_LIBRARIES}" EQUAL "") + SET(TRILINOS_USE_MPI TRUE) + ENDIF() + IF( (TRILINOS_USE_MPI AND NOT DEAL_II_COMPILER_SUPPORTS_MPI) OR + (NOT TRILINOS_USE_MPI AND DEAL_II_COMPILER_SUPPORTS_MPI)) + MESSAGE(WARNING " +Trilinos has to be configured with the same MPI configuration as deal.II. + +") + SET(${var} FALSE) + ENDIF() + + + # + # Some verions of Sacado_cmath.hpp does things that aren't compatible + # with the -std=c++0x flag of GCC, see deal.II FAQ. + # Test whether that is indeed the case + # + LIST(APPEND CMAKE_REQUIRED_INCLUDES ${TRILINOS_INCLUDE_DIR}) + LIST(APPEND CMAKE_REQUIRED_FLAGS "-std=c++0x") + CHECK_CXX_SOURCE_COMPILES( + " + #include + int main(){ return 0; } + " + TRILINOS_SUPPORTS_CPP11) + LIST(REMOVE_ITEM CMAKE_REQUIRED_FLAGS "-std=c++0x") + LIST(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES ${TRILINOS_INCLUDE_DIR}) + + IF(DEAL_II_CAN_USE_CXX11 AND NOT TRILINOS_SUPPORTS_CPP11) + MESSAGE(WARNING " +Your Trilinos installation is not compatible with the C++ standard selected for this compiler. +See the deal.II FAQ page for a solution. + +") + SET(${var} FALSE) + ENDIF() + + + # + # Check whether we can find all header files used in deal.II: + # + LIST(APPEND CMAKE_REQUIRED_INCLUDES ${TRILINOS_INCLUDE_DIR}) + CHECK_INCLUDE_FILE("Amesos.h" TRILINOS_HAVE_AMESOS_H) + CHECK_INCLUDE_FILE("Epetra_CrsGraph.h" TRILINOS_HAVE_EPETRA_CRSGRAPH_H) + CHECK_INCLUDE_FILE("Epetra_CrsMatrix.h" TRILINOS_HAVE_EPETRA_CRSMATRIX_H) + CHECK_INCLUDE_FILE("Epetra_Import.h" TRILINOS_HAVE_EPETRA_H) + CHECK_INCLUDE_FILE("Epetra_LinearProblem.h" TRILINOS_HAVE_EPETRA_H) + CHECK_INCLUDE_FILE("Epetra_Map.h" TRILINOS_HAVE_EPETRA_H) + CHECK_INCLUDE_FILE("Epetra_MultiVector.h" TRILINOS_HAVE_EPETRA_H) + CHECK_INCLUDE_FILE("Epetra_Operator.h" TRILINOS_HAVE_EPETRA_H) + CHECK_INCLUDE_FILE("Epetra_SerialComm.h" TRILINOS_HAVE_EPETRA_H) + CHECK_INCLUDE_FILE("Epetra_Vector.h" TRILINOS_HAVE_EPETRA_H) + CHECK_INCLUDE_FILE("Ifpack.h" TRILINOS_HAVE_IFPACK_H) + CHECK_INCLUDE_FILE("ml_MultiLevelPreconditioner.h" TRILINOS_HAVE_ML_MULTILEVELPRECONDITIONER_H) + CHECK_INCLUDE_FILE("AztecOO.h" TRILINOS_HAVE_AZTECOO_H) + CHECK_INCLUDE_FILE("AztecOO_Operator.h" TRILINOS_HAVE_AZTECOO_OPERATOR_H) + CHECK_INCLUDE_FILE("Sacado.hpp" TRILINOS_HAVE_SACADO_HPP) + CHECK_INCLUDE_FILE("Teuchos_ParameterList.hpp" TRILINOS_HAVE_TEUCHOS_PARAMETERLIST_HPP) + CHECK_INCLUDE_FILE("Teuchos_RCP.hpp" TRILINOS_HAVE_TEUCHOS_RCP_HPP) + CHECK_INCLUDE_FILE("Teuchos_RefCountPtr.hpp" TRILINOS_HAVE_TEUCHOS_REFCOUNTPTR_HPP) + LIST(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES ${TRILINOS_INCLUDE_DIR}) + + # + # TODO: + # + IF(NOT + (TRILINOS_HAVE_AMESOS_H AND + TRILINOS_HAVE_EPETRA_CRSGRAPH_H AND + TRILINOS_HAVE_EPETRA_CRSMATRIX_H AND + TRILINOS_HAVE_EPETRA_H AND + TRILINOS_HAVE_EPETRA_H AND + TRILINOS_HAVE_EPETRA_H AND + TRILINOS_HAVE_EPETRA_H AND + TRILINOS_HAVE_EPETRA_H AND + TRILINOS_HAVE_EPETRA_H AND + TRILINOS_HAVE_EPETRA_H AND + TRILINOS_HAVE_IFPACK_H AND + TRILINOS_HAVE_ML_MULTILEVELPRECONDITIONER_H AND + TRILINOS_HAVE_AZTECOO_H AND + TRILINOS_HAVE_AZTECOO_OPERATOR_H AND + TRILINOS_HAVE_SACADO_HPP AND + TRILINOS_HAVE_TEUCHOS_PARAMETERLIST_HPP AND + TRILINOS_HAVE_TEUCHOS_RCP_HPP AND + TRILINOS_HAVE_TEUCHOS_REFCOUNTPTR_HPP)) +# MESSAGE(WARNING " +#The Trilinos installation is missing one or more header files necessary for +#the deal.II Trilinos interfaces. Please re-install Trilinos with the missing +#Trilinos subpackages enabled. +# +#") +# SET(${var} FALSE) + ENDIF() + + ENDIF(TRILINOS_FOUND) + +ENDMACRO() + + +MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL var) + + INCLUDE_DIRECTORIES(${TRILINOS_INCLUDE_DIR}) + + LIST(APPEND deal_ii_external_libraries + ${TRILINOS_LIBRARIES} + ${Trilinos_TPL_LIBRARIES} + ) + + SET(DEAL_II_USE_TRILINOS TRUE) + + SET(DEAL_II_EXPAND_TRILINOS_VECTOR "TrilinosWrappers::Vector") + SET(DEAL_II_EXPAND_TRILINOS_MPI_VECTOR "TrilinosWrappers::MPI::Vector") + SET(DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR "TrilinosWrappers::BlockVector") + SET(DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR "TrilinosWrappers::MPI::BlockVector") + SET(DEAL_II_EXPAND_TRILINOS_SPARSITY_PATTERN "TrilinosWrappers::SparsityPattern") + SET(DEAL_II_EXPAND_TRILINOS_BLOCK_SPARSITY_PATTERN "TrilinosWrappers::BlockSparsityPattern") + + + # + # used with -W -Wall (which includes -Wunused). Regrettable + # though it may be, these warnings pretty much drown everything + # else and we better disable some of the warnings to enable us + # to see through the clutter. + # + CHECK_CXX_COMPILER_FLAG( + "-Wno-unused" + DEAL_II_HAVE_WNO_UNUSED_FLAG + ) + IF(DEAL_II_HAVE_WNO_UNUSED_FLAG) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused") + ENDIF() + + CHECK_CXX_COMPILER_FLAG( + "-Wno-overloaded-virtual" + DEAL_II_HAVE_WNO_OVERLOADED_VIRTUAL_FLAG + ) + IF(DEAL_II_HAVE_WNO_OVERLOADED_VIRTUAL_FLAG) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual") + ENDIF() + + CHECK_CXX_COMPILER_FLAG( + "-Wno-extra" + DEAL_II_HAVE_WNO_EXTRA_FLAG + ) + IF(DEAL_II_HAVE_WNO_EXTRA_FLAG) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-extra") + ENDIF() + + + SET(${var} TRUE) + +ENDMACRO() + + +CONFIGURE_FEATURE(TRILINOS) diff --git a/deal.II/contrib/cmake/modules/FindMETIS.cmake b/deal.II/contrib/cmake/modules/FindMETIS.cmake index cb97539b93..a61f125836 100644 --- a/deal.II/contrib/cmake/modules/FindMETIS.cmake +++ b/deal.II/contrib/cmake/modules/FindMETIS.cmake @@ -4,12 +4,12 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PATH(METIS_INCLUDE_DIR metis.h PATH_SUFFIXES metis -) + ) FIND_LIBRARY(METIS_LIBRARY NAMES metis PATH_SUFFIXES lib64 lib -) + ) # # Extract the version number out of metis.h diff --git a/deal.II/contrib/cmake/modules/FindTRILINOS.cmake b/deal.II/contrib/cmake/modules/FindTRILINOS.cmake new file mode 100644 index 0000000000..0c1334efbb --- /dev/null +++ b/deal.II/contrib/cmake/modules/FindTRILINOS.cmake @@ -0,0 +1,61 @@ +# Try to find the Trilinos + +INCLUDE(FindPackageHandleStandardArgs) + +# +# Include the trilinos package configuration: +# +find_package(TRILINOS + CONFIG + NAMES Trilinos TRILINOS + HINTS ${TRILINOS_DIR} + PATH_PREFIXES lib64/cmake/Trilinos lib/cmake/Trilinos + ) + +STRING(REGEX REPLACE + "^([0-9]+).*$" "\\1" + TRILINOS_MAJOR "${Trilinos_VERSION}") + +STRING(REGEX REPLACE + "^[0-9]+\\.([0-9]+).*$" "\\1" + TRILINOS_MINOR "${Trilinos_VERSION}") + +STRING(REGEX REPLACE + "^[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" + TRILINOS_SUBMINOR "${Trilinos_VERSION}") + + +# TODO: Trilinos may export more than one include dir. +FIND_PATH(TRILINOS_INCLUDE_DIR Trilinos_version.h + HINTS ${Trilinos_INCLUDE_DIRS} + ) + +# +# We'd like to have the full library names but the Trilinos package only +# exports a list with short names... +# So we check again for every lib and store the full path: +# +FOREACH(macro_library ${Trilinos_LIBRARIES}) + FIND_LIBRARY(TRILINOS_LIBRARY_${macro_library} + NAMES ${macro_library} + HINTS ${Trilinos_LIBRARY_DIRS} + ) + MARK_AS_ADVANCED(TRILINOS_LIBRARY_${macro_library}) + + LIST(APPEND TRILINOS_LIBRARIES ${TRILINOS_LIBRARY_${macro_library}}) +ENDFOREACH() + + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(TRILINOS DEFAULT_MSG + TRILINOS_DIR + TRILINOS_INCLUDE_DIR + TRILINOS_LIBRARIES + ) + +IF(TRILINOS_FOUND) + MARK_AS_ADVANCED( + TRILINOS_DIR + TRILINOS_INCLUDE_DIR + TRILINOS_LIBRARIES + ) +ENDIF() diff --git a/deal.II/features.m4 b/deal.II/features.m4 index fae309429b..6e62f09557 100644 --- a/deal.II/features.m4 +++ b/deal.II/features.m4 @@ -579,615 +579,6 @@ AC_DEFUN(DEAL_II_CONFIGURE_SLEPC_VERSION, dnl -dnl ------------------------------------------------------------ -dnl Check whether Trilinos is installed, and if so store the -dnl respective links -dnl -dnl Usage: DEAL_II_CONFIGURE_TRILINOS -dnl -dnl ------------------------------------------------------------ -AC_DEFUN(DEAL_II_CONFIGURE_TRILINOS, dnl -[ - AC_MSG_CHECKING(for Trilinos directory) - - AC_ARG_WITH(trilinos, - [AS_HELP_STRING([--with-trilinos=/path/to/trilinos], - [Specify the path to the Trilinos installation, of which the include and lib directories are subdirs; use this if you want to override the TRILINOS_DIR environment variable.])], - [ - dnl Special case when someone does --with-trilinos=no - if test "x$withval" = "xno" ; then - AC_MSG_RESULT([explicitly disabled]) - USE_CONTRIB_TRILINOS=no - else - USE_CONTRIB_TRILINOS=yes - DEAL_II_TRILINOS_DIR="$withval" - AC_MSG_RESULT($DEAL_II_TRILINOS_DIR) - - dnl Make sure that what was specified is actually correct - if test ! -d $DEAL_II_TRILINOS_DIR/include \ - -o ! -d $DEAL_II_TRILINOS_DIR/lib ; then - AC_MSG_ERROR([Path to Trilinos specified with --with-trilinos does not point to a complete Trilinos installation]) - fi - - DEAL_II_TRILINOS_INCDIR="$DEAL_II_TRILINOS_DIR/include" - DEAL_II_TRILINOS_LIBDIR="$DEAL_II_TRILINOS_DIR/lib" - fi - ], - [ - dnl Take something from the environment variables, if it is there - if test "x$TRILINOS_DIR" != "x" ; then - dnl Special case when someone does --with-trilinos=no - if test "x$withval" = "xno" ; then - AC_MSG_RESULT([explicitly disabled]) - USE_CONTRIB_TRILINOS=no - else - USE_CONTRIB_TRILINOS=yes - DEAL_II_TRILINOS_DIR="$TRILINOS_DIR" - AC_MSG_RESULT($DEAL_II_TRILINOS_DIR) - - dnl Make sure that what this is actually correct - if test ! -d $DEAL_II_TRILINOS_DIR/include \ - -o ! -d $DEAL_II_TRILINOS_DIR/lib ; then - AC_MSG_ERROR([The path to Trilinos specified in the TRILINOS_DIR environment variable does not point to a complete Trilinos installation]) - fi - DEAL_II_TRILINOS_INCDIR="$DEAL_II_TRILINOS_DIR/include" - DEAL_II_TRILINOS_LIBDIR="$DEAL_II_TRILINOS_DIR/lib" - fi - else - USE_CONTRIB_TRILINOS=no - DEAL_II_TRILINOS_DIR="" - AC_MSG_RESULT(not found) - fi - ]) - - AC_MSG_CHECKING(for Trilinos header directory) - - AC_ARG_WITH(trilinos-include, - [AS_HELP_STRING([--with-trilinos-include=/path/to/trilinos], - [Specify the path to the Trilinos include; use this if you want to override the TRILINOS_INCDIR environment variable.])], - [ - dnl Special case when someone does --with-trilinos=no - if test "x$withval" = "xno" ; then - AC_MSG_RESULT([explicitly disabled]) - USE_CONTRIB_TRILINOS=no - else - USE_CONTRIB_TRILINOS=yes - DEAL_II_TRILINOS_INCDIR="$withval" - AC_MSG_RESULT($DEAL_II_TRILINOS_INCDIR) - - dnl Make sure that what was specified is actually correct - if test ! -d $DEAL_II_TRILINOS_INCDIR ; then - AC_MSG_ERROR([Path to Trilinos specified with --with-trilinos-include does not point to a complete Trilinos installation]) - fi - fi - ], - [ - dnl Take something from the environment variables, if it is there - if test "x$TRILINOS_INCDIR" != "x" ; then - USE_CONTRIB_TRILINOS=yes - DEAL_II_TRILINOS_INCDIR="$TRILINOS_INCDIR" - AC_MSG_RESULT($DEAL_II_TRILINOS_INCDIR) - - dnl Make sure that what this is actually correct - if test ! -d $DEAL_II_TRILINOS_INCDIR ; then - AC_MSG_ERROR([The path to Trilinos includes specified in the TRILINOS_INCDIR environment variable does not point to a valid directory]) - fi - else - dnl --with-trilinos-include not explicitly specified. do - dnl nothing if --with-trilinos has previously been specified, - dnl otherwise say no to trilinos - if test "x${USE_CONTRIB_TRILINOS}" != "xyes" ; then - USE_CONTRIB_TRILINOS=no - DEAL_II_TRILINOS_INCDIR="" - AC_MSG_RESULT(not found) - else - AC_MSG_RESULT(not explicitly specified) - fi - fi - ]) - - AC_MSG_CHECKING(for Trilinos library directory) - - AC_ARG_WITH(trilinos-libs, - [AS_HELP_STRING([--with-trilinos-libs=/path/to/trilinos], - [Specify the path to the Trilinos libraries; use this if you want to override the TRILINOS_LIBDIR environment variable.])], - [ - dnl Special case when someone does --with-trilinos=no - if test "x$withval" = "xno" ; then - AC_MSG_RESULT([explicitly disabled]) - USE_CONTRIB_TRILINOS=no - else - USE_CONTRIB_TRILINOS=yes - DEAL_II_TRILINOS_LIBDIR="$withval" - AC_MSG_RESULT($DEAL_II_TRILINOS_LIBDIR) - - dnl Make sure that what was specified is actually correct - if test ! -d $DEAL_II_TRILINOS_LIBDIR ; then - AC_MSG_ERROR([Path to Trilinos libraries with --with-trilinos-libs does not point to a valid directory]) - fi - fi - ], - [ - dnl Take something from the environment variables, if it is there - if test "x$TRILINOS_LIBDIR" != "x" ; then - USE_CONTRIB_TRILINOS=yes - DEAL_II_TRILINOS_LIBDIR="$TRILINOS_LIBDIR" - AC_MSG_RESULT($DEAL_II_TRILINOS_LIBDIR) - - dnl Make sure that what this is actually correct - if test ! -d $DEAL_II_TRILINOS_LIBDIR ; then - AC_MSG_ERROR([The path to Trilinos specified in the TRILINOS_LIBDIR environment variable does not point to a complete Trilinos installation]) - fi - else - dnl --with-trilinos-libs not explicitly specified. do - dnl nothing if --with-trilinos has previously been specified, - dnl otherwise say no to trilinos - if test "x${USE_CONTRIB_TRILINOS}" != "xyes" ; then - USE_CONTRIB_TRILINOS=no - DEAL_II_TRILINOS_LIBDIR="" - AC_MSG_RESULT(not found) - else - AC_MSG_RESULT(not explicitly specified) - fi - fi - ]) - - dnl If we have found Trilinos, determine and set additional pieces of data - if test "$USE_CONTRIB_TRILINOS" = "yes" ; then - AC_DEFINE(DEAL_II_USE_TRILINOS, 1, - [Defined if a Trilinos installation was found and is going - to be used]) - - dnl Set an additional variable (not via AC_DEFINE, since we don't want - dnl to have it in config.h) which we can use in doc/doxygen/options.dox.in. - dnl If we have Trilinos, then the value of this variable expands to - dnl defining the string "DEAL_II_USE_TRILINOS" for the preprocessor. If - dnl we don't have no Trilinos, then it does not define this string. - DEAL_II_DEFINE_DEAL_II_USE_TRILINOS=DEAL_II_USE_TRILINOS - - DEAL_II_CONFIGURE_TRILINOS_VERSION - DEAL_II_CHECK_TRILINOS_MPI_CONSISTENCY - DEAL_II_CHECK_TRILINOS_SHARED_STATIC - DEAL_II_CHECK_TRILINOS_LIBS - DEAL_II_CHECK_TRILINOS_WARNINGS - DEAL_II_CHECK_TRILINOS_HEADER_FILES - - DEAL_II_EXPAND_TRILINOS_VECTOR="TrilinosWrappers::Vector" - DEAL_II_EXPAND_TRILINOS_MPI_VECTOR="TrilinosWrappers::MPI::Vector" - DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR="TrilinosWrappers::BlockVector" - DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR="TrilinosWrappers::MPI::BlockVector" - DEAL_II_EXPAND_TRILINOS_SPARSITY_PATTERN="TrilinosWrappers::SparsityPattern" - DEAL_II_EXPAND_TRILINOS_BLOCK_SPARSITY_PATTERN="TrilinosWrappers::BlockSparsityPattern" - - dnl Finally set with_trilinos if this hasn't happened yet - if test "x$with_trilinos" = "x" ; then - with_trilinos="yes" - fi - fi - - dnl Make sure that the right values for Trilinos vectors are written into - dnl common/template-arguments.in - AC_SUBST(DEAL_II_EXPAND_TRILINOS_VECTOR) - AC_SUBST(DEAL_II_EXPAND_TRILINOS_MPI_VECTOR) - AC_SUBST(DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR) - AC_SUBST(DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR) - AC_SUBST(DEAL_II_EXPAND_TRILINOS_SPARSITY_PATTERN) - AC_SUBST(DEAL_II_EXPAND_TRILINOS_BLOCK_SPARSITY_PATTERN) -]) - - - -dnl ------------------------------------------------------------ -dnl Figure out the version numbers of Trilinos. -dnl -dnl Usage: DEAL_II_CONFIGURE_TRILINOS_VERSION -dnl -dnl ------------------------------------------------------------ -AC_DEFUN(DEAL_II_CONFIGURE_TRILINOS_VERSION, dnl -[ - AC_MSG_CHECKING([for Trilinos version]) - DEAL_II_TRILINOS_VERSION_MAJOR=`cat $DEAL_II_TRILINOS_INCDIR/Trilinos_version.h \ - | grep "#define TRILINOS_MAJOR_VERSION" \ - | perl -pi -e 's/.*VERSION\s+//g;'` - DEAL_II_TRILINOS_VERSION_MINOR=`cat $DEAL_II_TRILINOS_INCDIR/Trilinos_version.h \ - | grep "#define TRILINOS_MAJOR_MINOR_VERSION" \ - | perl -pi -e 's/.*VERSION\s+\d?\d(\d\d)\d\d/\1/g;' \ - | perl -pi -e 's/0(\d)/\1/g;'` - DEAL_II_TRILINOS_VERSION_SUBMINOR=`cat $DEAL_II_TRILINOS_INCDIR/Trilinos_version.h \ - | grep "#define TRILINOS_MAJOR_MINOR_VERSION" \ - | perl -pi -e 's/.*VERSION\s+\d?\d\d\d(\d\d)/\1/g;' \ - | perl -pi -e 's/0(\d)/\1/g;'` - AC_MSG_RESULT([$DEAL_II_TRILINOS_VERSION_MAJOR.$DEAL_II_TRILINOS_VERSION_MINOR.$DEAL_II_TRILINOS_VERSION_SUBMINOR]) - - dnl Verify that we have at least Trilinos 10. This is the - dnl version where Trilinos started using cmake, which allow - dnl us to figure out which libraries Trilinos has built - dnl and in which order they need to be linked - if test "$DEAL_II_TRILINOS_VERSION_MAJOR" -lt 10 ; then - AC_MSG_ERROR([Trilinos versions prior to 10.0 are no longer supported with deal.II.]) - fi - - dnl Trilinos 10.6 had quite a number of bugs we ran into, see - dnl for example - dnl https://software.sandia.gov/bugzilla/show_bug.cgi?id=5062 - dnl https://software.sandia.gov/bugzilla/show_bug.cgi?id=5319 - dnl The same is unfortunately true for 10.8.[01]: - dnl https://software.sandia.gov/bugzilla/show_bug.cgi?id=5370 - if test "$DEAL_II_TRILINOS_VERSION_MAJOR" = 10 -a "$DEAL_II_TRILINOS_VERSION_MINOR" = 6 ; then - AC_MSG_ERROR([Trilinos versions 10.6.x have bugs that make it incompatible - with deal.II. Please use versions before 10.6 or after 10.8.1.]) - fi - if test "$DEAL_II_TRILINOS_VERSION_MAJOR" = 10 \ - -a "$DEAL_II_TRILINOS_VERSION_MINOR" = 8 \ - -a "$DEAL_II_TRILINOS_VERSION_SUBMINOR" -lt 2 ; then - AC_MSG_ERROR([Trilinos versions 10.8.0 and 10.8.1 have bugs that make it incompatible - with deal.II. Please use versions before 10.6 or after 10.8.1.]) - fi - - AC_SUBST(DEAL_II_TRILINOS_VERSION_MAJOR) - AC_SUBST(DEAL_II_TRILINOS_VERSION_MINOR) - AC_SUBST(DEAL_II_TRILINOS_VERSION_SUBMINOR) - AC_SUBST(DEAL_II_TRILINOS_LIBPREFIX) -]) - - - -dnl ------------------------------------------------------------- -dnl Make sure that if Trilinos was built with/without MPI, then -dnl deal.II was built with the same flags. -dnl -dnl Usage: DEAL_II_CHECK_TRILINOS_MPI_CONSISTENCY -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_TRILINOS_MPI_CONSISTENCY, dnl -[ - dnl Check for presence of Epetra_config.h that we need to detect MPI - dnl settings - AC_MSG_CHECKING(Epetra_config.h presence) - if test -f $DEAL_II_TRILINOS_INCDIR/Epetra_config.h ; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - exit 1; - fi - - AC_MSG_CHECKING(for consistency of Trilinos and deal.II MPI settings) - AC_LANG(C++) - - OLD_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS -I$DEAL_II_TRILINOS_INCDIR" - - dnl Trilinos Epetra's Epetra_config.h might provide - dnl #define PACKAGE_BUGREPORT - dnl #define PACKAGE_NAME - dnl #define PACKAGE_STRING - dnl #define PACKAGE_TARNAME - dnl #define PACKAGE_VERSION - dnl which is already set for the deal.II package. So undefine them for - dnl this test. - cp confdefs.h confdefs.h.bak - echo "#undef PACKAGE_BUGREPORT" >> confdefs.h - echo "#undef PACKAGE_NAME" >> confdefs.h - echo "#undef PACKAGE_STRING" >> confdefs.h - echo "#undef PACKAGE_TARNAME" >> confdefs.h - echo "#undef PACKAGE_VERSION" >> confdefs.h - - if test "x$DEAL_II_USE_MPI" = "xyes" ; then - dnl So we support MPI. Check that our Trilinos installation - dnl does too. Epetra sets the variable HAVE_MPI to 1 in case - dnl supports MPI, and does not set it otherwise, so just read - dnl out that information. - AC_TRY_COMPILE( - [ - #include - ], - [ - #ifndef HAVE_MPI - compile error; - #endif - ], - [ - AC_MSG_RESULT(yes) - ], - [ - AC_MSG_ERROR([Trilinos was not built for MPI, but deal.II is!]) - exit 1; - ]) - else - dnl So we don't support MPI. Check that our Trilinos installation - dnl doesn't either. - AC_TRY_COMPILE( - [ - #include - ], - [ - #ifdef HAVE_MPI - compile error; - #endif - ], - [ - AC_MSG_RESULT(yes) - ], - [ - AC_MSG_ERROR([Trilinos was built for MPI, but deal.II is not!]) - exit 1; - ]) - fi - - mv confdefs.h.bak confdefs.h - CXXFLAGS="${OLD_CXXFLAGS}" -]) - - - -dnl ------------------------------------------------------------ -dnl Check whether the installed version of Trilinos uses shared -dnl or static libs, or both. Produce an error if this doesn't -dnl match the kind of libraries we produce here -dnl -dnl Usage: DEAL_II_CHECK_TRILINOS_SHARED_STATIC -dnl -dnl ------------------------------------------------------------ -AC_DEFUN(DEAL_II_CHECK_TRILINOS_SHARED_STATIC, dnl -[ - dnl Check using the epetra library since that should always be there - dnl The problem is that on Debian, the library isn't called - dnl libepetra.so, but instead libtrilinos_epetra.so, so - dnl record this prefix in a variable of its own - AC_MSG_CHECKING(whether Trilinos uses shared libraries) - if test -f $DEAL_II_TRILINOS_LIBDIR/libepetra${shared_lib_suffix} ; then - AC_MSG_RESULT(yes) - DEAL_II_TRILINOS_SHARED=yes - elif test -f $DEAL_II_TRILINOS_LIBDIR/libtrilinos_epetra${shared_lib_suffix} ; then - AC_MSG_RESULT(yes) - DEAL_II_TRILINOS_SHARED=yes - DEAL_II_TRILINOS_LIBPREFIX="trilinos_" - else - AC_MSG_RESULT(no) - fi - - AC_MSG_CHECKING(whether Trilinos uses static libraries) - if test -f $DEAL_II_TRILINOS_LIBDIR/libepetra${static_lib_suffix} ; then - AC_MSG_RESULT(yes) - DEAL_II_TRILINOS_STATIC=yes - elif test -f $DEAL_II_TRILINOS_LIBDIR/libtrilinos_epetra${static_lib_suffix} ; then - AC_MSG_RESULT(yes) - DEAL_II_TRILINOS_STATIC=yes - DEAL_II_TRILINOS_LIBPREFIX="libtrilinos_" - else - AC_MSG_RESULT(no) - fi - - dnl Make sure something is set at least - if test "x${DEAL_II_TRILINOS_SHARED}${DEAL_II_TRILINOS_STATIC}" = "x" ; then - AC_MSG_ERROR([Unable to determine whether Trilinos uses shared or static libraries.]) - fi - - - dnl Now make sure the Trilinos libs are of the same kind as the ones we - dnl produce here - if test "x$enableshared" = "xyes" -a "x$DEAL_II_TRILINOS_SHARED" != "xyes" ; then - AC_MSG_ERROR([When building deal.II with shared libraries, Trilinos also needs to be built with shared libraries]) - fi - - if test "x$enableshared" = "xno" -a "x$DEAL_II_TRILINOS_STATIC" != "xyes" ; then - AC_MSG_ERROR([When building deal.II with shared libraries, Trilinos also needs to be built with shared libraries]) - fi - - dnl If we use shared libs (and we've made sure above that Trilinos provides - dnl these as well), then set some of the LD_FLAGS and similar - if test "x$enableshared" = "xyes" ; then - LDFLAGS="$LDFLAGS -L$DEAL_II_TRILINOS_LIBDIR" - if test "x$LD_PATH_OPTION" != "xno" ; then - LDFLAGS="$LDFLAGS $LD_PATH_OPTION$DEAL_II_TRILINOS_LIBDIR" - fi - fi -]) - - - -dnl ------------------------------------------------------------ -dnl Figure out which libraries Trilinos has built and that we -dnl need to link against. Also make sure we know their order -dnl -dnl Usage: DEAL_II_CHECK_TRILINOS_LIBS -dnl -dnl ------------------------------------------------------------ -AC_DEFUN(DEAL_II_CHECK_TRILINOS_LIBS, dnl -[ - AC_MSG_CHECKING(for the set of Trilinos libraries) - - dnl Trilinos' cmake invokation stores the set of libraries - dnl in a special file for consumption of cmake at a later - dnl time. We'll simply grep through it. Unfortunately, it has - dnl changed place in Trilinos starting from version 10.8.0, and - dnl at least 10.0.4 did not have the file at all. So test - dnl whether the file is available at one location or another - dnl and if it is at neither then fall back to a hardcoded - dnl list of libraries - if test -f $DEAL_II_TRILINOS_LIBDIR/cmake/Trilinos/TrilinosConfig.cmake ; then - dnl This is the location for 10.8 and following - DEAL_II_TRILINOS_LIBS="`grep Trilinos_LIBRARIES $DEAL_II_TRILINOS_LIBDIR/cmake/Trilinos/TrilinosConfig.cmake \ - | perl -pi -e 's/.*\"(.*)\".*/\1/g; s/;/ /g;'`" - - dnl Above, we may have set DEAL_II_TRILINOS_LIBPREFIX="trilinos_" to deal - dnl with alternate naming conventions on Debian. However, if - dnl we can get the list of libraries from Trilinos directly we - dnl don't really need to do this any more - DEAL_II_TRILINOS_LIBPREFIX="" - else - if test -f $DEAL_II_TRILINOS_INCDIR/TrilinosConfig.cmake ; then - dnl The location prior to 10.8 - DEAL_II_TRILINOS_LIBS="`grep Trilinos_LIBRARIES $DEAL_II_TRILINOS_INCDIR/TrilinosConfig.cmake \ - | perl -pi -e 's/.*\"(.*)\".*/\1/g; s/;/ /g;'`" - - dnl Same as above - DEAL_II_TRILINOS_LIBPREFIX="" - else - dnl Fall back to the fixed list. This should only be necessary - dnl for Trilinos versions before 10.4. If, for a later version, - dnl this happens, we don't want to fall back to this list, so - dnl add an assertion. - if test $DEAL_II_TRILINOS_VERSION_MAJOR = 10 -a \ - $DEAL_II_TRILINOS_VERSION_MINOR -lt 4 ; then - : - else - AC_MSG_ERROR([package file TrilinosConfig.cmake not found]) - fi - DEAL_II_TRILINOS_LIBS="stratimikosamesos stratimikosaztecoo stratimikosifpack stratimikosml stratimikos ml amesos belos ifpack aztecoo rtop sacado thyra thyraepetra thyraepetraext epetraext epetra teuchos triutils" - fi - fi - AC_MSG_RESULT([$DEAL_II_TRILINOS_LIBS]) - AC_SUBST(DEAL_II_TRILINOS_LIBS) -]) - - - -dnl ------------------------------------------------------------ -dnl Trilinos has headers that produce tons of warnings when -dnl used with -W -Wall (which includes -Wunused). Regrettable -dnl though it may be, these warnings pretty much drown everything -dnl else and we better disable some of the warnings to enable us -dnl to see through the clutter. -dnl -dnl Usage: DEAL_II_CHECK_TRILINOS_WARNINGS -dnl -dnl ------------------------------------------------------------ -AC_DEFUN(DEAL_II_CHECK_TRILINOS_WARNINGS, dnl -[ - OLD_CXXFLAGS="$CXXFLAGS" - - if test "$GXX" = yes ; then - AC_MSG_CHECKING(whether we can use -Wno-unused to suppress Trilinos warnings) - CXXFLAGS=-Wno-unused - AC_TRY_COMPILE([], [;], - [ - AC_MSG_RESULT(yes) - CXXFLAGSG="$CXXFLAGSG -Wno-unused" - ], - [ - AC_MSG_RESULT(no) - ]) - - AC_MSG_CHECKING(whether we can use -Wno-overloaded-virtual to suppress Trilinos warnings) - CXXFLAGS=-Wno-overloaded-virtual - AC_TRY_COMPILE([], [;], - [ - AC_MSG_RESULT(yes) - CXXFLAGSG="$CXXFLAGSG -Wno-overloaded-virtual" - ], - [ - AC_MSG_RESULT(no) - ]) - - AC_MSG_CHECKING(whether we can use -Wno-extra to suppress Trilinos warnings) - CXXFLAGS=-Wno-extra - AC_TRY_COMPILE([], [;], - [ - AC_MSG_RESULT(yes) - CXXFLAGSG="$CXXFLAGSG -Wno-extra" - ], - [ - AC_MSG_RESULT(no) - ]) - fi - - CXXFLAGS="${OLD_CXXFLAGS}" -]) - - - -dnl ------------------------------------------------------------ -dnl Trilinos consists of a number of individual packages. We -dnl need several of those so we should make sure at configure -dnl that all necessary Trilinos packages were compiled and installed -dnl when Trilinos was built. -dnl -dnl Usage: DEAL_II_CHECK_TRILINOS_HEADER_FILES -dnl -dnl ------------------------------------------------------------ -AC_DEFUN(DEAL_II_CHECK_TRILINOS_HEADER_FILES, dnl -[ - OLD_CXXFLAGS="$CXXFLAGS" - OLD_CPPFLAGS="$CPPFLAGS" - - CPPFLAGS="-I$DEAL_II_TRILINOS_INCDIR $CPPFLAGS" - CXXFLAGS="-I$DEAL_II_TRILINOS_INCDIR $CXXFLAGS" - - dnl This is a subtle problem: Trilinos ML's ml_config.h has a - dnl #define HAVE_INTTYPES_H - dnl without giving it a value. On the other hand, the previous - dnl autoconf test for this header file will have put a - dnl #define HAVE_INTTYPES_H 1 - dnl into confdefs.h, which will lead to an error. Avoid this - dnl problem by #undefining HAVE_INTTYPES_H for now and undoing - dnl this later on again. - dnl - dnl Note that we have to do essentially the same trick as - dnl well during compile time; see the block in AH_BOTTOM in - dnl configure.in that goes into base/include/base/config.h - cp confdefs.h confdefs.h.bak - echo "#ifdef HAVE_INTTYPES_H" >> confdefs.h - echo "#undef HAVE_INTTYPES_H" >> confdefs.h - echo "#endif" >> confdefs.h - - dnl Sacado_cmath.hpp does things that aren't compatible - dnl with the -std=c++0x flag of GCC, see deal.II FAQ. - dnl Test whether that is indeed the case - if test -f $DEAL_II_TRILINOS_INCDIR/Sacado_cmath.hpp ; then - CXX_FLAGS_SAVED="$CXXFLAGS" - CXXFLAGS="$CXXFLAGSG -I$DEAL_II_TRILINOS_INCDIR" - AC_MSG_CHECKING([whether Sacado_cmath.hpp is C++11 compatible]) - AC_TRY_COMPILE( - [ - #include - ], - [;], - [ - AC_MSG_RESULT([yes]) - ], - [ - AC_MSG_RESULT([no]) - AC_MSG_ERROR([*** Your Trilinos installation is not compatible with the C++ standard selected for this compiler. See the deal.II FAQ page for a solution. ***]) - ]) - else - AC_MSG_ERROR([File $DEAL_II_TRILINOS_INCDIR/Sacado_cmath.hpp not found.]) - fi - - dnl Now just check that all headers we need are in fact there - AC_CHECK_HEADERS([Amesos.h \ - Epetra_CrsGraph.h \ - Epetra_CrsMatrix.h \ - Epetra_Import.h \ - Epetra_LinearProblem.h \ - Epetra_Map.h \ - Epetra_MultiVector.h \ - Epetra_Operator.h \ - Epetra_SerialComm.h \ - Epetra_Vector.h \ - Ifpack.h \ - ml_MultiLevelPreconditioner.h \ - AztecOO.h \ - AztecOO_Operator.h \ - Sacado.hpp \ - Teuchos_ParameterList.hpp \ - Teuchos_RCP.hpp \ - Teuchos_RefCountPtr.hpp - ], - [], - [ - AC_MSG_ERROR([The Trilinos installation is missing one or more header files necessary for the deal.II Trilinos interfaces. Please re-install Trilinos with the missing Trilinos sub-packages enabled.]) - ], - []) - mv confdefs.h.bak confdefs.h - - CPPFLAGS="${OLD_CPPFLAGS}" - CXXFLAGS="${OLD_CXXFLAGS}" -]) - - - - dnl ------------------------------------------------------------ dnl Check whether MUMPS is installed; and, if so, then check for dnl two known dependecies, namely, SCALAPACK and BLACS. diff --git a/deal.II/include/deal.II/base/config.h.in b/deal.II/include/deal.II/base/config.h.in index 7067af9d67..75b5486e49 100644 --- a/deal.II/include/deal.II/base/config.h.in +++ b/deal.II/include/deal.II/base/config.h.in @@ -211,9 +211,9 @@ #cmakedefine HAVE_LIBNETCDF -/****************************************** - * Configured in configure_threads.cmake: * - ******************************************/ +/************************************** + * Configured in configure_tbb.cmake: * + **************************************/ /* Flag indicating whether the library shall be compiled for multithreaded * applications. If so, then it is set to one, otherwise to zero. @@ -242,6 +242,14 @@ #endif +/******************************************* + * Configured in configure_trilinos.cmake: * + *******************************************/ + +/* Defined if a Trilinos installation was found and is going to be used */ +#cmakedefine DEAL_II_USE_TRILINOS + + /****************************************** * Configured in configure_umfpack.cmake: * ******************************************/ diff --git a/deal.II/include/deal.II/base/config.h.in.old b/deal.II/include/deal.II/base/config.h.in.old index eb582e9c1d..fbb87918cd 100644 --- a/deal.II/include/deal.II/base/config.h.in.old +++ b/deal.II/include/deal.II/base/config.h.in.old @@ -170,9 +170,6 @@ /* Defined if a SLEPc installation was found and is going to be used */ #cmakedefine DEAL_II_USE_SLEPC -/* Defined if a Trilinos installation was found and is going to be used */ -#cmakedefine DEAL_II_USE_TRILINOS - /* This error appears in the Apple edition of the gcc 3.3, which ships with Darwin7.9.0 and probably previous version. It leads to problems during linking. For the details, look at aclocal.m4 in the top-level directory. */