From 5507f08f0edfa64835f52211a125a97dc6332a7a Mon Sep 17 00:00:00 2001 From: maier Date: Thu, 4 Oct 2012 11:05:11 +0000 Subject: [PATCH] Add support for MUMPS git-svn-id: https://svn.dealii.org/branches/branch_cmake@26942 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/cmake/configure/configure_mumps.cmake | 48 ++++++++++ deal.II/cmake/modules/FindMUMPS.cmake | 83 +++++++++++++++++ deal.II/cmake/modules/FindP4EST.cmake | 2 +- deal.II/cmake/modules/FindSCALAPACK.cmake | 88 +++++++++++++++++++ deal.II/include/deal.II/base/config.h.in | 8 ++ deal.II/include/deal.II/base/config.h.in.old | 3 - 6 files changed, 228 insertions(+), 4 deletions(-) create mode 100644 deal.II/cmake/configure/configure_mumps.cmake create mode 100644 deal.II/cmake/modules/FindMUMPS.cmake create mode 100644 deal.II/cmake/modules/FindSCALAPACK.cmake diff --git a/deal.II/cmake/configure/configure_mumps.cmake b/deal.II/cmake/configure/configure_mumps.cmake new file mode 100644 index 0000000000..4fd8fd7859 --- /dev/null +++ b/deal.II/cmake/configure/configure_mumps.cmake @@ -0,0 +1,48 @@ +##### +## +## 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 MUMPS library: +# + +OPTION(DEAL_II_WITH_MUMPS + "Build deal.II with support for MUMPS." + OFF) + +SET(FEATURE_MUMPS_DEPENDS DEAL_II_WITH_MPI) + + +MACRO(FEATURE_MUMPS_FIND_EXTERNAL var) + FIND_PACKAGE(MUMPS) + + IF(MUMPS_FOUND) + SET(${var} TRUE) + ENDIF() +ENDMACRO() + + +MACRO(FEATURE_MUMPS_CONFIGURE_EXTERNAL var) + + INCLUDE_DIRECTORIES(${MUMPS_INCLUDE_DIRS}) + LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${MUMPS_LIBRARIES}) + ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${MUMPS_LINKER_FLAGS}") + + SET(DEAL_II_USE_MUMPS TRUE) + + SET(${var} TRUE) +ENDMACRO() + + +CONFIGURE_FEATURE(MUMPS) + diff --git a/deal.II/cmake/modules/FindMUMPS.cmake b/deal.II/cmake/modules/FindMUMPS.cmake new file mode 100644 index 0000000000..c348f60772 --- /dev/null +++ b/deal.II/cmake/modules/FindMUMPS.cmake @@ -0,0 +1,83 @@ +##### +## +## 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 MUMPS library +# +# This module exports +# +# MUMPS_INCLUDE_DIRS +# MUMPS_LIBRARIES +# MUMPS_LINKER_FLAGS +# + +SET_IF_EMPTY(MUMPS_DIR "$ENV{MUMPS_DIR}") + +INCLUDE(FindPackageHandleStandardArgs) + +# +# Search for all known dependencies of MUMPS: +# (We'll rely on the user of FindMUMPS, setting up mpi *cough*) +# +FIND_PACKAGE(SCALAPACK) # which will also include lapack and blas + +# +# TODO: libpord.a ? +# + +FIND_PATH(MUMPS_INCLUDE_DIRS dmumps_c.h + HINTS + ${MUMPS_DIR} + PATH_SUFFIXES + mumps include/mumps include + ) + +FIND_LIBRARY(DMUMPS_LIBRARY + NAMES dmumps + HINTS + ${MUMPS_DIR} + PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib + ) + +FIND_LIBRARY(MUMPS_COMMON_LIBRARY + NAMES mumps_common + HINTS + ${MUMPS_DIR} + PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib + ) + +SET(MUMPS_LIBRARIES + ${DMUMPS_LIBRARY} + ${MUMPS_COMMON_LIBRARY} + ${LAPACK_LIBRARIES} + ) + +SET(MUMPS_LINKER_FLAGS + ${LAPACK_LINKER_FLAGS} + ) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(MUMPS DEFAULT_MSG + DMUMPS_LIBRARY + MUMPS_COMMON_LIBRARY + LAPACK_FOUND + ) + +IF(MUMPS_FOUND) + MARK_AS_ADVANCED( + DMUMPS_LIBRARY + MUMPS_COMMON_LIBRARY + MUMPS_INCLUDE_DIRS + ) +ENDIF() + diff --git a/deal.II/cmake/modules/FindP4EST.cmake b/deal.II/cmake/modules/FindP4EST.cmake index 0596743a86..b9fac0f009 100644 --- a/deal.II/cmake/modules/FindP4EST.cmake +++ b/deal.II/cmake/modules/FindP4EST.cmake @@ -56,9 +56,9 @@ SET(P4EST_INCLUDE_DIRS ) FIND_PACKAGE_HANDLE_STANDARD_ARGS(P4EST DEFAULT_MSG - SC_FOUND P4EST_LIBRARY P4EST_INCLUDE_DIR + SC_FOUND ) IF(P4EST_FOUND) diff --git a/deal.II/cmake/modules/FindSCALAPACK.cmake b/deal.II/cmake/modules/FindSCALAPACK.cmake new file mode 100644 index 0000000000..0b16faf660 --- /dev/null +++ b/deal.II/cmake/modules/FindSCALAPACK.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 +## +##### + +# +# Try to find the SCALAPACK library +# +# Used as a helper module for FindMUMPS.cmake +# +# This module exports +# +# SCALAPACK_LIBRARIES +# SCALAPACK_LINKER_FLAGS +# + +SET_IF_EMPTY(SCALAPCK_DIR "$ENV{SCALAPACK_DIR}") +SET_IF_EMPTY(BLACS_DIR "$ENV{BLACS_DIR}") + +INCLUDE(FindPackageHandleStandardArgs) + +# +# SCALAPACK needs LAPACK and BLAS as dependency, search for them with the help +# of the LAPACK find module: +# +# TODO: SCALAPACK and mpi... +# +FIND_PACKAGE(LAPACK) + +FIND_LIBRARY(SCALAPACK_LIBRARY + NAMES scalapack + HINTS + ${SCALAPACK_DIR} + PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib +) + +SET(SCALAPACK_LIBRARIES + ${SCALAPACK_LIBRARY} + ${LAPACK_LIBRARIES} + ) + +SET(SCALAPACK_LINKER_FLAGS + ${LAPACK_LINKER_FLAGS} + ) + +# +# Well, depending on the version of scalapack and the distribution it might +# be necessary to search for blacs, too. So we do this in a very +# probabilistic way... +# +FIND_LIBRARY(BLACS_LIBRARY + NAMES blacs + ${BLACS_DIR} + ${SCALAPACK_DIR} + ${SCALAPACK_DIR}/../blacs/ + PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib +) + +IF(NOT BLACS_LIBRARY MATCHES "-NOTFOUND") + LIST(APPEND SCLAPACK_LIBRARIES + ${BLACS_LIBRARY} + ) +ENDIF() + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SCALAPACK DEFAULT_MSG + SCALAPACK_LIBRARY + LAPACK_FOUND + ) + +IF(SCALAPACK_FOUND) + MARK_AS_ADVANCED( + lapack_LIBRARY + atlas_LIBRARY + blas_LIBRARY + SCALAPACK_LIBRARY + BLACS_LIBRARY + ) +ENDIF() + diff --git a/deal.II/include/deal.II/base/config.h.in b/deal.II/include/deal.II/base/config.h.in index 59c907f57c..f9da08a7bc 100644 --- a/deal.II/include/deal.II/base/config.h.in +++ b/deal.II/include/deal.II/base/config.h.in @@ -191,6 +191,14 @@ #cmakedefine DEAL_II_COMPILER_SUPPORTS_MPI +/***************************************** + * Configured in configure_mumps.cmake: * + *****************************************/ + +/* Defined if an MUMPS installation was found and is going to be used */ +#cmakedefine DEAL_II_USE_MUMPS + + /***************************************** * Configured in configure_netcdf.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 a853c94766..7aea871350 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 MUMPS installation was found and is going to be used */ -#cmakedefine DEAL_II_USE_MUMPS - /* Defined if a SLEPc installation was found and is going to be used */ #cmakedefine DEAL_II_USE_SLEPC -- 2.39.5