From 5f4cd59e7cd54c56c3de7428e080a4f2346ce3c4 Mon Sep 17 00:00:00 2001 From: young Date: Fri, 7 May 2010 12:40:28 +0000 Subject: [PATCH] Changes to the configure system to link the libraries of MUMPS, BLACS, and SCALAPACK to deal.II. BLACS and SCALAPACK are treated as dependencies of MUMPS, but that can be compatibly changed in the future. git-svn-id: https://svn.dealii.org/trunk@21091 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/aclocal.m4 | 115 +++++++++++++++++++++++++- deal.II/base/include/base/config.h.in | 10 ++- deal.II/common/Make.global_options.in | 36 ++++++-- deal.II/configure.in | 8 +- deal.II/deal.II/Makefile | 6 ++ deal.II/lac/Makefile | 6 ++ 6 files changed, 171 insertions(+), 10 deletions(-) diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index 773b5493a9..6d10cfb290 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -5412,7 +5412,7 @@ AC_DEFUN(DEAL_II_CONFIGURE_PETSC, dnl AC_MSG_CHECKING([for PETSc library directory]) AC_ARG_WITH(petsc, - [AS_HELP_STRING([--with-petsc=path/to/slepc], + [AS_HELP_STRING([--with-petsc=path/to/petsc], [Specify the path to the PETSc installation, of which the include and library directories are subdirs; use this if you want to override the PETSC_DIR environment variable.])], [ dnl Special case when someone does --with-petsc=no @@ -6153,6 +6153,119 @@ AC_DEFUN(DEAL_II_CHECK_TRILINOS_HEADER_FILES, dnl ]) +dnl ------------------------------------------------------------ +dnl Check whether MUMPS is installed; and, if so, then check for +dnl two known dependecies, namely, SCALAPACK and BLACS. +dnl +dnl Usage: DEAL_II_CONFIGURE_MUMPS +dnl +dnl ------------------------------------------------------------ +AC_DEFUN(DEAL_II_CONFIGURE_MUMPS, dnl +[ + AC_MSG_CHECKING([for MUMPS library directory]) + AC_ARG_WITH(mumps, + [AS_HELP_STRING([--with-mumps=path/to/mumps], + [Specify the path to the MUMPS installation, for which the include directory and lib directory are subdirs; use this if you want to override the MUMPS_DIR environment variable.])], + [dnl action-if-given + if test "x$withval" = "xno" ; then + AC_MSG_RESULT([explicitly disabled]) + USE_CONTRIB_MUMPS=no + else + USE_CONTRIB_MUMPS=yes + DEAL_II_MUMPS_DIR="$withval" + AC_MSG_RESULT($DEAL_II_MUMPS_DIR) + dnl Make sure that what was specified is actually correct + if test ! -d $DEAL_II_MUMPS_DIR \ + -o ! -d $DEAL_II_MUMPS_DIR/include \ + -o ! -d $DEAL_II_MUMPS_DIR/lib \ + ; then + AC_MSG_ERROR([Path to MUMPS specified with --with-mumps does not point to a complete MUMPS installation]) + fi + fi + ], + [dnl action-if-not-given (do nothing) + USE_CONTRIB_MUMPS=no + ]) + + dnl ------------------------------------------------------------ + dnl If MUMPS was requested and found, we had better check for + dnl dependencies right here. First, SCALAPACK and then BLACS. + if test "$USE_CONTRIB_MUMPS" = "yes" ; then + + dnl ------------------------------------------------------------ + dnl Check whether SCALAPACK is installed + AC_MSG_CHECKING([for SCALAPACK library directory]) + AC_ARG_WITH(scalapack, + [AS_HELP_STRING([--with-scalapack=path/to/scalapack], + [Specify the path to the scalapack installation; use this if you want to override the SCALAPACK_DIR environment variable.])], + [dnl action-if-given (test) + DEAL_II_SCALAPACK_DIR="$withval" + AC_MSG_RESULT($DEAL_II_SCALAPACK_DIR) + dnl Make sure that what was specified is actually correct + if test ! -d $DEAL_II_SCALAPCK_DIR ; then + AC_MSG_ERROR([The path to SCALAPACK specified with --with-scalapack does t point to a complete SCALAPACK installation]) + fi + ], + [dnl action-if-not-given (bail out) + AC_MSG_ERROR([If MUMPS is used, the path to SCALAPACK must be specified with --with-scalapack]) + ]) + dnl ------------------------------------------------------------ + + dnl ------------------------------------------------------------ + dnl Check whether BLACS is installed and BLAS architecture type + AC_MSG_CHECKING([for BLACS library directory]) + AC_ARG_WITH(blacs, + [AS_HELP_STRING([--with-blacs=path/to/blacs], + [Specify the path to the BLACS installation; use this if you want to override the BLACS_DIR environment variable.])], + [dnl action-if-given + DEAL_II_BLACS_DIR="$withval" + AC_MSG_RESULT($DEAL_II_BLACS_DIR) + dnl Make sure that what was specified is actually correct + if test ! -d $DEAL_II_BLACS_DIR \ + -o ! -d $DEAL_II_BLACS_DIR/LIB ; then + AC_MSG_ERROR([The path to BLACS specified with --with-blacs does not point to a complete BLACS installation]) + fi + ], + [dnl action-if-not-given (bail out) + AC_MSG_ERROR([If MUMPS is used, the path to BLACS must be specified with --with-blacs]) + ]) + + dnl BLACS labels libraries with "communications library", + dnl "platform type" and "debug level" (see BlACS Bmake.inc for + dnl details of the meaning of these terms). Finally, determine what + dnl these are: + AC_MSG_CHECKING([for BLACS library architecture]) + BLACS_COMM=`cat $DEAL_II_BLACS_DIR/Bmake.inc \ + | grep "COMMLIB = " \ + | perl -pi -e 's/.*LIB =\s+//g;'` + BLACS_PLAT=`cat $DEAL_II_BLACS_DIR/Bmake.inc \ + | grep "PLAT = " \ + | perl -pi -e 's/.*PLAT =\s+//g;'` + BLACS_DEBUG=`cat $DEAL_II_BLACS_DIR/Bmake.inc \ + | grep "BLACSDBGLVL = " \ + | perl -pi -e 's/.*DBGLVL =\s+//g;'` + dnl and patch that together to make the BLACS architecture type: + DEAL_II_BLACS_ARCH="$BLACS_COMM-$BLACS_PLAT-$BLACS_DEBUG" + AC_MSG_RESULT($DEAL_II_BLACS_ARCH) + dnl ------------------------------------------------------------ + + fi + dnl End check for MUMPS dependencies + dnl ------------------------------------------------------------ + + dnl If we do get this far then define a macro that says so: + if test "$USE_CONTRIB_MUMPS" = "yes" ; then + AC_DEFINE([DEAL_II_USE_MUMPS], [1], + [Defined if a MUMPS installation was found and is going to be used ]) + dnl and set an additional variable: + DEAL_II_DEFINE_DEAL_II_USE_MUMPS=DEAL_II_USE_MUMPS + dnl and finally set with_mumps if this hasn't happened yet: + if test "x$with_mumps" = "x" ; then + with_mumps="yes" + fi + fi +]) + dnl ------------------------------------------------------------ dnl Check whether Metis is installed, and if so store the diff --git a/deal.II/base/include/base/config.h.in b/deal.II/base/include/base/config.h.in index 0fb95fd907..c5bb06ecc9 100644 --- a/deal.II/base/include/base/config.h.in +++ b/deal.II/base/include/base/config.h.in @@ -254,6 +254,9 @@ /* Defined if a Trilinos installation was found and is going to be used */ #undef DEAL_II_USE_TRILINOS +/* Defined if a MUMPS installation was found and is going to be used */ +#undef DEAL_II_USE_MUMPS + /* Define if vector iterators are just plain pointers */ #undef DEAL_II_VECTOR_ITERATOR_IS_POINTER @@ -603,9 +606,10 @@ * compatibility; and (ii) DEAL_II_PETSC_VERSION_GTE is used to add * functionality to the PETScWrappers that does not exist in previous * versions of PETSc. Examples of usage can be found in - * lac/source/petsc_matrix_base.h. Note: SLEPcWrappers do not need - * their own anological macros, since SLEPc and PETSc must have - * identical version numbers anyways. + * lac/source/petsc_matrix_base.h. + * + * Note: SLEPcWrappers do not need their own anological macros, since + * SLEPc and PETSc must have identical version numbers anyways. */ #define DEAL_II_PETSC_VERSION_LT(major,minor,subminor) \ ((PETSC_VERSION_MAJOR * 10000 + \ diff --git a/deal.II/common/Make.global_options.in b/deal.II/common/Make.global_options.in index 7ff04c54e1..f8b43139ff 100644 --- a/deal.II/common/Make.global_options.in +++ b/deal.II/common/Make.global_options.in @@ -65,8 +65,14 @@ DEAL_II_TRILINOS_LIBDIR = @DEAL_II_TRILINOS_LIBDIR@ DEAL_II_TRILINOS_SHARED = @DEAL_II_TRILINOS_SHARED@ DEAL_II_TRILINOS_STATIC = @DEAL_II_TRILINOS_STATIC@ +USE_CONTRIB_MUMPS = @USE_CONTRIB_MUMPS@ +DEAL_II_MUMPS_DIR = @DEAL_II_MUMPS_DIR@ +DEAL_II_SCALAPACK_DIR = @DEAL_II_SCALAPACK_DIR@ +DEAL_II_BLACS_DIR = @DEAL_II_BLACS_DIR@ +DEAL_II_BLACS_ARCH = @DEAL_II_BLACS_ARCH@ + USE_CONTRIB_METIS = @USE_CONTRIB_METIS@ -DEAL_II_METIS_LIBDIR = @DEAL_II_METIS_LIBDIR@ +DEAL_II_METIS_LIBDIR = @DEAL_II_METIS_LIBDIR@ USE_CONTRIB_HSL = @USE_CONTRIB_HSL@ USE_CONTRIB_UMFPACK = @USE_CONTRIB_UMFPACK@ @@ -206,6 +212,18 @@ ifeq ($(USE_CONTRIB_TRILINOS),yes) endif endif +# Using dealii with MUMPS means we need to link the MUMPS library as +# well as its dependencies, ie, SCALAPCK and BLACS +ifeq ($(USE_CONTRIB_MUMPS),yes) + lib-contrib-mumps = $(DEAL_II_MUMPS_DIR)/lib/libdmumps.a \ + $(DEAL_II_MUMPS_DIR)/lib/libmumps_common.a \ + $(DEAL_II_MUMPS_DIR)/lib/libpord.a + lib-contrib-mumps += $(DEAL_II_SCALAPACK_DIR)/libscalapack.a + lib-contrib-mumps += $(DEAL_II_BLACS_DIR)/LIB/blacsCinit_$(DEAL_II_BLACS_ARCH).a \ + $(DEAL_II_BLACS_DIR)/LIB/blacsF77init_$(DEAL_II_BLACS_ARCH).a \ + $(DEAL_II_BLACS_DIR)/LIB/blacs_$(DEAL_II_BLACS_ARCH).a +endif + # deal with HSL; this should have been $(lib-contrib-hsl) but for a long time we # accidentally had $(lib-hsl) -- so we simply make both symbols available ifeq ($(USE_CONTRIB_HSL),yes) @@ -219,7 +237,6 @@ ifeq ($(enable-threads),yes) lib-contrib-tbb.o = $D/lib/libtbb$(shared-lib-suffix) endif - # set paths to all the libraries we need: lib-base.o = $(LIBDIR)/libbase$(lib-suffix) \ $(lib-contrib-trilinos) \ @@ -230,11 +247,15 @@ lib-base.g = $(LIBDIR)/libbase.g$(lib-suffix) \ lib-lac.o = $(LIBDIR)/liblac$(lib-suffix) \ $(lib-hsl) \ - $(lib-contrib-petsc.o) $(lib-contrib-slepc) $(DEAL_II_PETSC_MPIUNI_LIB) \ + $(lib-contrib-petsc.o) $(DEAL_II_PETSC_MPIUNI_LIB) \ + $(lib-contrib-slepc) \ + $(lib-contrib-mumps) \ $(lib-contrib-metis) lib-lac.g = $(LIBDIR)/liblac.g$(lib-suffix) \ $(lib-hsl) \ - $(lib-contrib-petsc.g) $(lib-contrib-slepc) $(DEAL_II_PETSC_MPIUNI_LIB) \ + $(lib-contrib-petsc.g) $(DEAL_II_PETSC_MPIUNI_LIB) \ + $(lib-contrib-slepc) \ + $(lib-contrib-mumps) \ $(lib-contrib-metis) lib-deal2-1d.o = $(LIBDIR)/libdeal_II_1d$(lib-suffix) @@ -258,6 +279,7 @@ endif include-path-slepc = $(DEAL_II_SLEPC_DIR)/include include-path-slepc-conf = $(DEAL_II_SLEPC_DIR)/$(DEAL_II_PETSC_ARCH)/conf include-path-trilinos = $(DEAL_II_TRILINOS_INCDIR) +include-path-mumps = $(DEAL_II_MUMPS_DIR)/include # include paths as command line flags. while compilers allow a space between # the '-I' and the actual path, we also send these flags to the @@ -273,7 +295,7 @@ INCLUDE = -I$D/base/include -I$D/lac/include -I$D/deal.II/include \ # (and thus import all of its variables), but rather set up a scheme to # extract these values upon configuration # -# note also that this only works for PETSc before 2.3 :-] +# also, note that this only works for PETSc before 2.3 :-] ifeq ($(USE_CONTRIB_PETSC),yes) ifeq ($(DEAL_II_PETSC_VERSION_MINOR),2) include $(DEAL_II_PETSC_DIR)/bmake/$(DEAL_II_PETSC_ARCH)/packages @@ -290,6 +312,10 @@ ifeq ($(USE_CONTRIB_TRILINOS),yes) INCLUDE += -I$(include-path-trilinos) endif +ifeq ($(USE_CONTRIB_MUMPS),yes) + INCLUDE += -I$(include-path-mumps) +endif + ifeq ($(enable-threads),yes) INCLUDE += -I$(shell echo $D/contrib/tbb/tbb*/include) endif diff --git a/deal.II/configure.in b/deal.II/configure.in index 3fc9e56b62..f34464ffaa 100644 --- a/deal.II/configure.in +++ b/deal.II/configure.in @@ -403,7 +403,6 @@ dnl ------------------------------------------------------------- AC_MSG_RESULT() AC_MSG_RESULT(---------------- configuring additional libs ----------------) - DEAL_II_CONFIGURE_PETSC AC_SUBST(USE_CONTRIB_PETSC) AC_SUBST(DEAL_II_PETSC_DIR) @@ -429,6 +428,13 @@ AC_SUBST(DEAL_II_TRILINOS_LIBDIR) AC_SUBST(DEAL_II_TRILINOS_SHARED) AC_SUBST(DEAL_II_TRILINOS_STATIC) +DEAL_II_CONFIGURE_MUMPS +AC_SUBST(USE_CONTRIB_MUMPS) +AC_SUBST(DEAL_II_MUMPS_DIR) +AC_SUBST(DEAL_II_SCALAPACK_DIR) dnl MUMPS dependency +AC_SUBST(DEAL_II_BLACS_DIR) dnl MUMPS dependency +AC_SUBST(DEAL_II_BLACS_ARCH) +AC_SUBST(DEAL_II_DEFINE_DEAL_II_USE_MUMPS) dnl Make sure we configure for libraries used by other libraries. For dnl example, UMFPACK needs blas, and so does LAPACK diff --git a/deal.II/deal.II/Makefile b/deal.II/deal.II/Makefile index b1010a6a22..bf01fcb5e1 100644 --- a/deal.II/deal.II/Makefile +++ b/deal.II/deal.II/Makefile @@ -105,6 +105,12 @@ ifneq ($(GXX-VERSION),compaq_cxx) deplibs.o += $(lib-contrib-slepc) endif + # same with MUMPS + ifeq ($(USE_CONTRIB_MUMPS),yes) + deplibs.g += $(lib-contrib-mumps) + deplibs.o += $(lib-contrib-mumps) + endif + # and METIS ifeq ($(USE_CONTRIB_METIS),yes) deplibs.g += $(lib-contrib-metis) diff --git a/deal.II/lac/Makefile b/deal.II/lac/Makefile index e2b7fdabfa..a82c9e6a11 100644 --- a/deal.II/lac/Makefile +++ b/deal.II/lac/Makefile @@ -79,6 +79,12 @@ ifneq ($(GXX-VERSION),compaq_cxx) deplibs.o += $(lib-contrib-trilinos) endif + # same with MUMPS + ifeq ($(USE_CONTRIB_MUMPS),yes) + deplibs.g += $(lib-contrib-mumps) + deplibs.o += $(lib-contrib-mumps) + endif + # and METIS ifeq ($(USE_CONTRIB_METIS),yes) deplibs.g += $(lib-contrib-metis) -- 2.39.5