From 80ce635d1af27cda823806663143b3780533b8c3 Mon Sep 17 00:00:00 2001 From: maier Date: Tue, 23 Oct 2012 10:14:42 +0000 Subject: [PATCH] Add support for SLEPc, code cleanup git-svn-id: https://svn.dealii.org/branches/branch_cmake@27174 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/cmake/configure/configure_1_mpi.cmake | 3 +- deal.II/cmake/configure/configure_1_tbb.cmake | 3 - .../cmake/configure/configure_arpack.cmake | 2 - deal.II/cmake/configure/configure_boost.cmake | 3 - .../configure/configure_functionparser.cmake | 1 - deal.II/cmake/configure/configure_hdf5.cmake | 3 +- .../cmake/configure/configure_lapack.cmake | 8 - deal.II/cmake/configure/configure_metis.cmake | 3 +- deal.II/cmake/configure/configure_mumps.cmake | 2 - .../cmake/configure/configure_netcdf.cmake | 1 - deal.II/cmake/configure/configure_p4est.cmake | 5 +- deal.II/cmake/configure/configure_petsc.cmake | 7 +- deal.II/cmake/configure/configure_slepc.cmake | 88 ++++++++++ .../cmake/configure/configure_trilinos.cmake | 3 +- .../cmake/configure/configure_umfpack.cmake | 1 - deal.II/cmake/features.m4 | 127 -------------- deal.II/cmake/modules/FindPETSC.cmake | 11 +- deal.II/cmake/modules/FindSLEPC.cmake | 162 ++++++++++++++++++ deal.II/include/deal.II/base/config.h.in | 8 + deal.II/include/deal.II/base/config.h.in.old | 3 - 20 files changed, 272 insertions(+), 172 deletions(-) create mode 100644 deal.II/cmake/configure/configure_slepc.cmake create mode 100644 deal.II/cmake/modules/FindSLEPC.cmake diff --git a/deal.II/cmake/configure/configure_1_mpi.cmake b/deal.II/cmake/configure/configure_1_mpi.cmake index e8bf9ad62f..669c2d7c7c 100644 --- a/deal.II/cmake/configure/configure_1_mpi.cmake +++ b/deal.II/cmake/configure/configure_1_mpi.cmake @@ -64,7 +64,7 @@ SET(FEATURE_MPI_CUSTOM_ERROR_MESSAGE TRUE) MACRO(FEATURE_MPI_ERROR_MESSAGE) MESSAGE(FATAL_ERROR "\n" - "Could not find any suitable mpi library!\n\n" + "Could not find any suitable mpi library!\n" "Please ensure that an mpi library is installed on your computer.\n" "If the library is not at a default location, either provide some hints\n" "for the autodetection, or set the relevant variables by hand in ccmake.\n" @@ -73,4 +73,3 @@ ENDMACRO() CONFIGURE_FEATURE(MPI) - diff --git a/deal.II/cmake/configure/configure_1_tbb.cmake b/deal.II/cmake/configure/configure_1_tbb.cmake index e881213a6d..4d4567c34c 100644 --- a/deal.II/cmake/configure/configure_1_tbb.cmake +++ b/deal.II/cmake/configure/configure_1_tbb.cmake @@ -124,7 +124,6 @@ ENDMACRO() MACRO(FEATURE_TBB_CONFIGURE_EXTERNAL var) - INCLUDE_DIRECTORIES(${TBB_INCLUDE_DIR}) IF (CMAKE_BUILD_TYPE MATCHES "Debug") @@ -152,7 +151,6 @@ ENDMACRO() MACRO(FEATURE_TBB_CONFIGURE_BUNDLED var) - # # Setup threading (before configuring our build...) # and if successfull return TRUE: @@ -180,4 +178,3 @@ ENDMACRO() CONFIGURE_FEATURE(TBB) - diff --git a/deal.II/cmake/configure/configure_arpack.cmake b/deal.II/cmake/configure/configure_arpack.cmake index 9f67911072..6e4ef1ef0e 100644 --- a/deal.II/cmake/configure/configure_arpack.cmake +++ b/deal.II/cmake/configure/configure_arpack.cmake @@ -27,7 +27,6 @@ ENDMACRO() MACRO(FEATURE_ARPACK_CONFIGURE_EXTERNAL var) - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${ARPACK_LIBRARIES}) ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${ARPACK_LINKER_FLAGS}") @@ -38,4 +37,3 @@ ENDMACRO() CONFIGURE_FEATURE(ARPACK) - diff --git a/deal.II/cmake/configure/configure_boost.cmake b/deal.II/cmake/configure/configure_boost.cmake index 327aca8465..a00bae58ca 100644 --- a/deal.II/cmake/configure/configure_boost.cmake +++ b/deal.II/cmake/configure/configure_boost.cmake @@ -49,7 +49,6 @@ ENDMACRO() MACRO(FEATURE_BOOST_CONFIGURE_EXTERNAL var) - INCLUDE_DIRECTORIES (${Boost_INCLUDE_DIR}) IF (CMAKE_BUILD_TYPE MATCHES "Debug") @@ -69,7 +68,6 @@ ENDMACRO() MACRO(FEATURE_BOOST_CONFIGURE_BUNDLED var) - # # We need to set some definitions to use the headers of the bundled boost # library: @@ -102,4 +100,3 @@ IF(NOT DEAL_II_WITH_BOOST) ) ENDIF() ENDIF() - diff --git a/deal.II/cmake/configure/configure_functionparser.cmake b/deal.II/cmake/configure/configure_functionparser.cmake index 399b22b4b4..ad92d51228 100644 --- a/deal.II/cmake/configure/configure_functionparser.cmake +++ b/deal.II/cmake/configure/configure_functionparser.cmake @@ -46,4 +46,3 @@ ENDMACRO() CONFIGURE_FEATURE(FUNCTIONPARSER) - diff --git a/deal.II/cmake/configure/configure_hdf5.cmake b/deal.II/cmake/configure/configure_hdf5.cmake index 62f8502ae7..f77a4add11 100644 --- a/deal.II/cmake/configure/configure_hdf5.cmake +++ b/deal.II/cmake/configure/configure_hdf5.cmake @@ -41,7 +41,7 @@ SET(FEATURE_HDF5_CUSTOM_ERROR_MESSAGE TRUE) MACRO(FEATURE_HDF5_ERROR_MESSAGE) MESSAGE(FATAL_ERROR "\n" - "Could not find the hdf5 library!\n\n" + "Could not find the hdf5 library!\n" "Please ensure that the hdf5 library is installed on your computer.\n" "If the library is not at a default location, either provide some hints\n" "for the autodetection:\n" @@ -53,4 +53,3 @@ ENDMACRO() CONFIGURE_FEATURE(HDF5) - diff --git a/deal.II/cmake/configure/configure_lapack.cmake b/deal.II/cmake/configure/configure_lapack.cmake index 91fc3bcbe8..f8bf62cf7d 100644 --- a/deal.II/cmake/configure/configure_lapack.cmake +++ b/deal.II/cmake/configure/configure_lapack.cmake @@ -36,9 +36,6 @@ ENDMACRO() # function we use. We have to ensure that this check is repeated every time # the lapack library or DEAL_II_WITH_LAPACK changes. # -# TODO: Known bug: At the moment we don't cover the case when the lapack -# library changes.. -# SET(DEAL_II_LAPACK_FUNCTIONS daxpy_ dgeev_ dgeevx_ dgelsd_ dgemm_ dgemv_ dgeqrf_ dgesdd_ dgesvd_ dgetrf_ @@ -70,7 +67,6 @@ ENDMACRO() MACRO(FEATURE_LAPACK_CONFIGURE_EXTERNAL var) - ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}") LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES @@ -80,15 +76,12 @@ MACRO(FEATURE_LAPACK_CONFIGURE_EXTERNAL var) CHECK_FOR_LAPACK_FUNCTIONS() SET(HAVE_LIBLAPACK TRUE) - SET(${var} TRUE) - ENDMACRO() CONFIGURE_FEATURE(LAPACK) - # # Call RESET_LAPACK_FUNCTIONS_CHECK if DEAL_II_WITH_LAPACK is unset to # clean the configuration @@ -96,4 +89,3 @@ CONFIGURE_FEATURE(LAPACK) IF(NOT DEAL_II_WITH_LAPACK) RESET_LAPACK_FUNCTIONS_CACHE() ENDIF() - diff --git a/deal.II/cmake/configure/configure_metis.cmake b/deal.II/cmake/configure/configure_metis.cmake index e55ad648ac..2ad1d6366f 100644 --- a/deal.II/cmake/configure/configure_metis.cmake +++ b/deal.II/cmake/configure/configure_metis.cmake @@ -52,7 +52,7 @@ SET(FEATURE_METIS_CUSTOM_ERROR_MESSAGE TRUE) MACRO(FEATURE_METIS_ERROR_MESSAGE) MESSAGE(FATAL_ERROR "\n" - "Could not find the metis library!\n\n" + "Could not find the metis library!\n" "Please ensure that the metis library version 5.0 or newer is installed on your computer.\n" "If the library is not at a default location, either provide some hints\n" "for the autodetection:\n" @@ -64,4 +64,3 @@ ENDMACRO() CONFIGURE_FEATURE(METIS) - diff --git a/deal.II/cmake/configure/configure_mumps.cmake b/deal.II/cmake/configure/configure_mumps.cmake index 743c825752..05f25a0434 100644 --- a/deal.II/cmake/configure/configure_mumps.cmake +++ b/deal.II/cmake/configure/configure_mumps.cmake @@ -30,7 +30,6 @@ ENDMACRO() MACRO(FEATURE_MUMPS_CONFIGURE_EXTERNAL var) - INCLUDE_DIRECTORIES(${MUMPS_INCLUDE_DIRS}) LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${MUMPS_LIBRARIES} @@ -62,4 +61,3 @@ ENDMACRO() CONFIGURE_FEATURE(MUMPS) - diff --git a/deal.II/cmake/configure/configure_netcdf.cmake b/deal.II/cmake/configure/configure_netcdf.cmake index cc5e4546ce..3ae1f84682 100644 --- a/deal.II/cmake/configure/configure_netcdf.cmake +++ b/deal.II/cmake/configure/configure_netcdf.cmake @@ -36,4 +36,3 @@ ENDMACRO() CONFIGURE_FEATURE(NETCDF) - diff --git a/deal.II/cmake/configure/configure_p4est.cmake b/deal.II/cmake/configure/configure_p4est.cmake index 281caac72c..028ca79a94 100644 --- a/deal.II/cmake/configure/configure_p4est.cmake +++ b/deal.II/cmake/configure/configure_p4est.cmake @@ -21,7 +21,6 @@ SET(FEATURE_P4EST_DEPENDS DEAL_II_WITH_MPI) MACRO(FEATURE_P4EST_FIND_EXTERNAL var) - FIND_PACKAGE(P4EST) IF(P4EST_FOUND) @@ -42,7 +41,6 @@ ENDMACRO() MACRO(FEATURE_P4EST_CONFIGURE_EXTERNAL var) - INCLUDE_DIRECTORIES(${P4EST_INCLUDE_DIRS}) # The user has to know the location of the p4est headers as well: @@ -61,7 +59,7 @@ SET(FEATURE_P4EST_CUSTOM_ERROR_MESSAGE TRUE) MACRO(FEATURE_P4EST_ERROR_MESSAGE) MESSAGE(FATAL_ERROR "\n" - "Could not find the p4est and sc libraries!\n\n" + "Could not find the p4est and sc libraries!\n" "Please ensure that the libraries are installed on your computer.\n" "If the libraries are not at a default location, either provide some hints\n" "for the autodetection:\n" @@ -73,4 +71,3 @@ ENDMACRO() CONFIGURE_FEATURE(P4EST) - diff --git a/deal.II/cmake/configure/configure_petsc.cmake b/deal.II/cmake/configure/configure_petsc.cmake index 392ed2bf9c..1b3f67c30c 100644 --- a/deal.II/cmake/configure/configure_petsc.cmake +++ b/deal.II/cmake/configure/configure_petsc.cmake @@ -63,12 +63,10 @@ MACRO(FEATURE_PETSC_FIND_EXTERNAL var) UNSET(PETSC_LIBRARIES CACHE) ENDIF() ENDIF() - ENDMACRO() MACRO(FEATURE_PETSC_CONFIGURE_EXTERNAL var) - INCLUDE_DIRECTORIES(${PETSC_INCLUDE_DIRS}) # The user has to know the location of the petsc headers as well: @@ -85,7 +83,6 @@ MACRO(FEATURE_PETSC_CONFIGURE_EXTERNAL var) # ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-long-long") - SET(DEAL_II_EXPAND_PETSC_VECTOR "PETScWrappers::Vector") SET(DEAL_II_EXPAND_PETSC_BLOCKVECTOR "PETScWrappers::BlockVector") @@ -103,8 +100,9 @@ SET(FEATURE_PETSC_CUSTOM_ERROR_MESSAGE TRUE) MACRO(FEATURE_PETSC_ERROR_MESSAGE) MESSAGE(FATAL_ERROR "\n" - "Could not find the petsc library!\n\n" + "Could not find the petsc library!\n" "Please ensure that the petsc library version 3.0.0 or newer is installed on your computer.\n" + "Furthermore PETSc has to be configured with the same mpi options as deal.II.\n" "If the library is not at a default location, either provide some hints\n" "for the autodetection:\n" "PETSc installed with --prefix=<...> to a destination:\n" @@ -119,4 +117,3 @@ ENDMACRO() CONFIGURE_FEATURE(PETSC) - diff --git a/deal.II/cmake/configure/configure_slepc.cmake b/deal.II/cmake/configure/configure_slepc.cmake new file mode 100644 index 0000000000..0f66434eed --- /dev/null +++ b/deal.II/cmake/configure/configure_slepc.cmake @@ -0,0 +1,88 @@ +##### +## +## Copyright (C) 2012 by the deal.II authors +## +## This file is part of the deal.II library. +## +## +## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later +## version of the LGPL license. +## +## Author: Matthias Maier +## +##### + +# +# Configuration for the SLEPC library: +# + + +SET(FEATURE_SLEPC_DEPENDS DEAL_II_WITH_PETSC) + + +MACRO(FEATURE_SLEPC_FIND_EXTERNAL var) + FIND_PACKAGE(SLEPC) + + IF(SLEPC_FOUND) + # + # Check whether SLEPc and PETSc are compatible. + # + IF("${SLEPC_VERSION}" STREQUAL "${PETSC_VERSION}") + SET(${var} TRUE) + ELSE() + + MESSAGE(WARNING "\n" + "Could not find a sufficient SLEPc installation: " + "The SLEPc library must have the same version as the PETSc library.\n\n" + ) + UNSET(SLEPC_INCLUDE_DIR_ARCH CACHE) + UNSET(SLEPC_INCLUDE_DIR_COMMON CACHE) + UNSET(SLEPC_INCLUDE_DIRS CACHE) + UNSET(SLEPC_LIBRARIES CACHE) + + SET(${var} FALSE) + ENDIF() + ENDIF() + +ENDMACRO() + + +MACRO(FEATURE_SLEPC_CONFIGURE_EXTERNAL var) + INCLUDE_DIRECTORIES(${SLEPC_INCLUDE_DIRS}) + + # The user has to know the location of the SLEPC headers as well: + LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${SLEPC_INCLUDE_DIRS}) + + LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES + ${SLEPC_LIBRARIES} + ) + + SET(DEAL_II_USE_SLEPC TRUE) + + SET(${var} TRUE) +ENDMACRO() + + +SET(FEATURE_SLEPC_CUSTOM_ERROR_MESSAGE TRUE) + + +MACRO(FEATURE_SLEPC_ERROR_MESSAGE) + MESSAGE(FATAL_ERROR "\n" + "Could not find the SLEPc library!\n" + "Please ensure that the SLEPc library version 3.0.0 or newer is installed on your computer\n" + "and the version is the same as the one of the installed PETSc library.\n" + "If the library is not at a default location, either provide some hints\n" + "for the autodetection:\n" + "SLEPc installed with --prefix=<...> to a destination:\n" + " $ SLEPC_DIR=\"...\" cmake <...>\n" + " $ cmake -DSLEPC_DIR=\"...\" <...>\n" + "SLEPc compiled in source tree:\n" + " $ SLEPC_DIR=\"...\" SLEPC_ARCH=\"...\" cmake <...>\n" + " $ cmake -DSLEPC_DIR=\"...\" -DSLEPC_ARCH=\"...\" <...>\n" + "or set the relevant variables by hand in ccmake.\n\n" + ) +ENDMACRO() + + +CONFIGURE_FEATURE(SLEPC) + diff --git a/deal.II/cmake/configure/configure_trilinos.cmake b/deal.II/cmake/configure/configure_trilinos.cmake index ad24c26128..5c974e70c8 100644 --- a/deal.II/cmake/configure/configure_trilinos.cmake +++ b/deal.II/cmake/configure/configure_trilinos.cmake @@ -214,6 +214,8 @@ MACRO(FEATURE_TRILINOS_ERROR_MESSAGE) MESSAGE(FATAL_ERROR "\n" "Could not find a suitable set of trilinos libraries!\n" "Please ensure that all necessary libraries are installed on your computer.\n" + "Some Trilinos versions have bugs that make it incompatible with deal.II.\n" + "(There will be a warning above if this is the case)\n" "If the libraries are not at a default location, either provide some hints\n" "for the autodetection:\n" " $ TRILINOS_DIR=\"...\" cmake <...>\n" @@ -224,4 +226,3 @@ ENDMACRO() CONFIGURE_FEATURE(TRILINOS) - diff --git a/deal.II/cmake/configure/configure_umfpack.cmake b/deal.II/cmake/configure/configure_umfpack.cmake index fbe7b75560..b4509f4e05 100644 --- a/deal.II/cmake/configure/configure_umfpack.cmake +++ b/deal.II/cmake/configure/configure_umfpack.cmake @@ -81,4 +81,3 @@ ENDMACRO() CONFIGURE_FEATURE(UMFPACK) - diff --git a/deal.II/cmake/features.m4 b/deal.II/cmake/features.m4 index 1542d699a6..eaa7c11e90 100644 --- a/deal.II/cmake/features.m4 +++ b/deal.II/cmake/features.m4 @@ -28,130 +28,3 @@ AC_DEFUN(DEAL_II_CONFIGURE_TECPLOT, dnl DEAL_II_ADD_EXTERNAL_LIBS_AT_FRONT($TECPLOT_LIB) fi ]) - - - -dnl ------------------------------------------------------------ -dnl Check whether SLEPc is installed, and if so store the -dnl respective links. -dnl -dnl Usage: DEAL_II_CONFIGURE_SLEPC -dnl -dnl ------------------------------------------------------------ -AC_DEFUN(DEAL_II_CONFIGURE_SLEPC, dnl -[ - AC_MSG_CHECKING([for SLEPc include directory]) - AC_ARG_WITH(slepc, - [AS_HELP_STRING([--with-slepc=path/to/slepc], - [Specify the path to the SLEPc installation, for which the include directory is a subdir; use this if you want to override the SLEPC_DIR environment variable.])], - [dnl Special case when someone does --with-slepc=no - if test "x$withval" = "xno" ; then - AC_MSG_RESULT([explicitly disabled]) - USE_CONTRIB_SLEPC=no - else - USE_CONTRIB_SLEPC=yes - DEAL_II_SLEPC_DIR="$withval" - AC_MSG_RESULT($DEAL_II_SLEPC_DIR) - - dnl Make sure that what was specified is actually correct - if test ! -d $DEAL_II_SLEPC_DIR \ - -o ! -d $DEAL_II_SLEPC_DIR/include \ - ; then - AC_MSG_ERROR([Path to SLEPc specified with --with-slepc does not point to a complete SLEPc installation]) - fi - - if test ! -d $DEAL_II_SLEPC_DIR/$DEAL_II_PETSC_ARCH \ - -o ! -d $DEAL_II_SLEPC_DIR/$DEAL_II_PETSC_ARCH/lib \ - ; then - AC_MSG_ERROR([SLEPc has not been compiled for the PETSc architecture]) - fi - fi - ], - [dnl Take something from the environment variables, if it is there - if test "x$SLEPC_DIR" != "x" ; then - USE_CONTRIB_SLEPC=yes - DEAL_II_SLEPC_DIR="$SLEPC_DIR" - AC_MSG_RESULT($DEAL_II_SLEPC_DIR) - - dnl Make sure that what this is actually correct - if test ! -d $DEAL_II_SLEPC_DIR \ - -o ! -d $DEAL_II_SLEPC_DIR/include \ - ; then - AC_MSG_ERROR([The path to SLEPc specified in the SLEPC_DIR environment variable does not point to a complete SLEPc installation]) - fi - else - USE_CONTRIB_SLEPC=no - DEAL_II_SLEPC_DIR="" - AC_MSG_RESULT(not found) - fi - ]) - - if test "$USE_CONTRIB_SLEPC" = "yes" ; then - AC_DEFINE([DEAL_II_USE_SLEPC], [1], - [Defined if a SLEPc 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 SLEPc, then the value of this variable expands to - dnl defining the string "DEAL_II_USE_SLEPC" for the preprocessor. If - dnl we don't have no SLEPc, then it does not define this string. - DEAL_II_DEFINE_DEAL_II_USE_SLEPC=DEAL_II_USE_SLEPC - fi - - dnl If we have found SLEPc, determine additional pieces of data - if test "$USE_CONTRIB_SLEPC" = "yes" \ - ; then - DEAL_II_CONFIGURE_SLEPC_VERSION - - dnl Finally set with_slepc if this hasn't happened yet - if test "x$with_slepc" = "x" ; then - with_slepc="yes" - fi fi -]) - -dnl ------------------------------------------------------------ -dnl Figure out the version numbers of SLEPc and compare with -dnl version numbers of PETSc. This is not strictly necessary -dnl but highly recommended that major, minor, and subminor -dnl version match. We blissfully ignor patch versions and hope -dnl for the best. If you want to overide all this you can. -dnl -dnl Usage: DEAL_II_CONFIGURE_SLEPC_VERSION -dnl -dnl ------------------------------------------------------------ -AC_DEFUN(DEAL_II_CONFIGURE_SLEPC_VERSION, dnl -[ - AC_MSG_CHECKING([for SLEPc version]) - DEAL_II_SLEPC_VERSION_MAJOR=`cat $DEAL_II_SLEPC_DIR/include/slepcversion.h \ - | grep "#define SLEPC_VERSION_MAJOR" \ - | perl -pi -e 's/.*MAJOR\s+//g;'` - DEAL_II_SLEPC_VERSION_MINOR=`cat $DEAL_II_SLEPC_DIR/include/slepcversion.h \ - | grep "#define SLEPC_VERSION_MINOR" \ - | perl -pi -e 's/.*MINOR\s+//g;'` - DEAL_II_SLEPC_VERSION_SUBMINOR=`cat $DEAL_II_SLEPC_DIR/include/slepcversion.h \ - | grep "#define SLEPC_VERSION_SUBMINOR" \ - | perl -pi -e 's/.*MINOR\s+//g;'` - SLEPC_VERSION="$DEAL_II_SLEPC_VERSION_MAJOR.$DEAL_II_SLEPC_VERSION_MINOR.$DEAL_II_SLEPC_VERSION_SUBMINOR" - - dnl Here is where we check if the SLEPc version we have is a - dnl release but do nothing about it. - SLEPC_RELEASE=`cat $DEAL_II_SLEPC_DIR/include/slepcversion.h \ - | grep "#define SLEPC_VERSION_RELEASE" \ - | perl -pi -e 's/.*RELEASE\s+//g;'` - if test "$SLEPC_RELEASE" = "0" ; then - SLEPC_VERSION+="-dev" - else - SLEPC_VERSION+="" - fi - AC_MSG_RESULT($SLEPC_VERSION) - - dnl Then check that PETSc and SLEPc versions are compatible ie. that - dnl they are equivalent. Patch numbers don't count for anything anymore, - dnl but, we do include whether PETSc and SLEPc are both release - dnl versions in the check. If they are not, we vomit. - if test "${PETSC_VERSION}" != "${SLEPC_VERSION}" \ - -o "${PETSC_RELEASE}" != "${SLEPC_RELEASE}" \ - ; then - AC_MSG_ERROR([If SLEPc is used, you must use the same version number as your PETSc Installation]) - fi -]) diff --git a/deal.II/cmake/modules/FindPETSC.cmake b/deal.II/cmake/modules/FindPETSC.cmake index a22d4d34be..ff8e4aa6d1 100644 --- a/deal.II/cmake/modules/FindPETSC.cmake +++ b/deal.II/cmake/modules/FindPETSC.cmake @@ -77,9 +77,9 @@ FIND_PATH(PETSC_INCLUDE_DIR_ARCH petscconf.h HINTS # petsc is special. Account for that ${PETSC_DIR} - ${PETSC_DIR}/${PETSC_ARCH}/include + ${PETSC_DIR}/${PETSC_ARCH} ${PETSC_INCLUDE_DIRS} - PATH_SUFFIXES include petsc + PATH_SUFFIXES petsc include include/petsc ) # @@ -98,9 +98,9 @@ FIND_PATH(PETSC_INCLUDE_DIR_ARCH petscconf.h FIND_PATH(PETSC_INCLUDE_DIR_COMMON petscversion.h HINTS ${PETSC_DIR} - ${PETSC_DIR}/${PETSC_ARCH}/include + ${PETSC_DIR}/${PETSC_ARCH} ${PETSC_INCLUDE_DIRS} - PATH_SUFFIXES petsc + PATH_SUFFIXES petsc include include/petsc ) # @@ -129,6 +129,8 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(PETSC DEFAULT_MSG ) IF(PETSC_FOUND) + SET(PETSC_PETSCCONF_H "${PETSC_INCLUDE_DIR_ARCH}/petscconf.h") + SET(PETSC_PETSCVERSION_H "${PETSC_INCLUDE_DIR_COMMON}/petscversion.h") # # Is petsc compiled with support for MPIUNI? @@ -165,7 +167,6 @@ IF(PETSC_FOUND) MARK_AS_ADVANCED(PETSC_LIBMPIUNI) ENDIF() - FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_VERSION_MAJOR_STRING REGEX "#define.*PETSC_VERSION_MAJOR") STRING(REGEX REPLACE "^.*PETSC_VERSION_MAJOR.*([0-9]+).*" "\\1" diff --git a/deal.II/cmake/modules/FindSLEPC.cmake b/deal.II/cmake/modules/FindSLEPC.cmake new file mode 100644 index 0000000000..b9c35f8e26 --- /dev/null +++ b/deal.II/cmake/modules/FindSLEPC.cmake @@ -0,0 +1,162 @@ +##### +## +## Copyright (C) 2012 by the deal.II authors +## +## This file is part of the deal.II library. +## +## +## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later +## version of the LGPL license. +## +## Author: Matthias Maier +## +##### + +# +# Try to find the SLEPC library +# +# This module exports: +# +# SLEPC_FOUND +# SLEPC_LIBRARIES +# SLEPC_INCLUDE_DIRS +# SLEPC_VERSION +# SLEPC_VERSION_MAJOR +# SLEPC_VERSION_MINOR +# SLEPC_VERSION_SUBMINOR +# SLEPC_VERSION_PATCH +# + +INCLUDE(FindPackageHandleStandardArgs) + +SET_IF_EMPTY(SLEPC_DIR "$ENV{SLEPC_DIR}") +SET_IF_EMPTY(SLEPC_ARCH "$ENV{SLEPC_ARCH}") +SET_IF_EMPTY(PETSC_DIR "$ENV{PETSC_DIR}") + +# +# Luckily, SLEPc wants the same insanity as PETSc, so we can just copy the +# mechanism. +# + +FIND_LIBRARY(SLEPC_LIBRARIES + NAMES slepc + HINTS + # SLEPC is special. Account for that + ${SLEPC_DIR} + ${SLEPC_DIR}/${SLEPC_ARCH} + ${PETSC_DIR} + PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib +) + + +# +# So, up to this point it was easy. Now, the tricky part: +# + + +# +# Search for the first part of the includes: +# +FIND_PATH(SLEPC_INCLUDE_DIR_ARCH slepcconf.h + HINTS + # SLEPC is special. Account for that + ${SLEPC_DIR} + ${SLEPC_DIR}/${SLEPC_ARCH} + ${SLEPC_INCLUDE_DIRS} + ${PETSC_DIR} + PATH_SUFFIXES slepc include include/slepc +) + +# +# Sometimes, this is not enough... +# If SLEPc is not installed but in source tree layout, there will be +# ${SLEPC_DIR}/${SLEPC_ARCH}/include - which we should have found by now. +# ${SLEPC_DIR}/include - which we still have to find. +# +# Or it is installed in a non standard layout in the system (e.g. in +# Gentoo), where there will be +# ${SLEPC_DIR}/${SLEPC_ARCH}/include +# /usr/include/slepc ... +# +# Either way, slepcversion.h should lie around: +# +FIND_PATH(SLEPC_INCLUDE_DIR_COMMON slepcversion.h + HINTS + ${SLEPC_DIR} + ${SLEPC_DIR}/${SLEPC_ARCH} + ${SLEPC_INCLUDE_DIRS} + ${PETSC_DIR} + PATH_SUFFIXES slepc include include/slepc +) + +# +# And finally set SLEPC_INCLUDE_DIRS depending on the outcome of our crude +# guess: +# +IF( SLEPC_INCLUDE_DIR_ARCH MATCHES "-NOTFOUND" OR + SLEPC_INCLUDE_DIR_COMMON MATCHES "-NOTFOUND" ) + SET(SLEPC_INCLUDE_DIRS "SLEPC_INCLUDE_DIRS-NOTFOUND" + CACHE STRING "Include paths for SLEPC" + FORCE + ) + UNSET(SLEPC_INCLUDE_DIR_ARCH CACHE) + UNSET(SLEPC_INCLUDE_DIR_COMMON CACHE) +ELSE() + UNSET(SLEPC_INCLUDE_DIRS CACHE) + SET(SLEPC_INCLUDE_DIRS + ${SLEPC_INCLUDE_DIR_ARCH} + ${SLEPC_INCLUDE_DIR_COMMON} + ) +ENDIF() + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SLEPC DEFAULT_MSG + SLEPC_LIBRARIES + SLEPC_INCLUDE_DIRS + ) + +IF(SLEPC_FOUND) + SET(SLEPC_SLEPCVERSION_H "${SLEPC_INCLUDE_DIR_COMMON}/slepcversion.h") + + FILE(STRINGS "${SLEPC_SLEPCVERSION_H}" SLEPC_VERSION_MAJOR_STRING + REGEX "#define.*SLEPC_VERSION_MAJOR") + STRING(REGEX REPLACE "^.*SLEPC_VERSION_MAJOR.*([0-9]+).*" "\\1" + SLEPC_VERSION_MAJOR "${SLEPC_VERSION_MAJOR_STRING}" + ) + + FILE(STRINGS "${SLEPC_SLEPCVERSION_H}" SLEPC_VERSION_MINOR_STRING + REGEX "#define.*SLEPC_VERSION_MINOR") + STRING(REGEX REPLACE "^.*SLEPC_VERSION_MINOR.*([0-9]+).*" "\\1" + SLEPC_VERSION_MINOR "${SLEPC_VERSION_MINOR_STRING}" + ) + + FILE(STRINGS "${SLEPC_SLEPCVERSION_H}" SLEPC_VERSION_SUBMINOR_STRING + REGEX "#define.*SLEPC_VERSION_SUBMINOR") + STRING(REGEX REPLACE "^.*SLEPC_VERSION_SUBMINOR.*([0-9]+).*" "\\1" + SLEPC_VERSION_SUBMINOR "${SLEPC_VERSION_SUBMINOR_STRING}" + ) + + FILE(STRINGS "${SLEPC_SLEPCVERSION_H}" SLEPC_VERSION_PATCH_STRING + REGEX "#define.*SLEPC_VERSION_PATCH") + STRING(REGEX REPLACE "^.*SLEPC_VERSION_PATCH.*([0-9]+).*" "\\1" + SLEPC_VERSION_PATCH "${SLEPC_VERSION_PATCH_STRING}" + ) + + SET(SLEPC_VERSION "${SLEPC_VERSION_MAJOR}.${SLEPC_VERSION_MINOR}.${SLEPC_VERSION_SUBMINOR}") + + MARK_AS_ADVANCED( + SLEPC_ARCH + SLEPC_DIR + SLEPC_INCLUDE_DIR_ARCH + SLEPC_INCLUDE_DIR_COMMON + SLEPC_INCLUDE_DIRS + SLEPC_LIBRARIES + ) +ELSE() + SET(SLEPC_DIR "" CACHE STRING + "An optional hint to a SLEPC directory" + ) + SET(SLEPC_ARCH "" CACHE STRING + "An optional hint to a SLEPC arch" + ) +ENDIF() + diff --git a/deal.II/include/deal.II/base/config.h.in b/deal.II/include/deal.II/base/config.h.in index 22f67a0e15..717627e803 100644 --- a/deal.II/include/deal.II/base/config.h.in +++ b/deal.II/include/deal.II/base/config.h.in @@ -265,6 +265,14 @@ (major)*10000 + (minor)*100 + (subminor)) +/**************************************** + * Configured in configure_slepc.cmake: * + ****************************************/ + +/* Defined if a SLEPc installation was found and is going to be used */ +#cmakedefine DEAL_II_USE_SLEPC + + /************************************** * Configured in configure_tbb.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 7aea871350..bb3cefc606 100644 --- a/deal.II/include/deal.II/base/config.h.in.old +++ b/deal.II/include/deal.II/base/config.h.in.old @@ -109,9 +109,6 @@ BUGS: this bug. */ #cmakedefine DEAL_II_TEMPL_SPEC_FRIEND_BUG -/* Defined if a SLEPc installation was found and is going to be used */ -#cmakedefine DEAL_II_USE_SLEPC - /* 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. */ -- 2.39.5