From 54d458e72367063c1a33f89840d083c2f7e765e5 Mon Sep 17 00:00:00 2001 From: young Date: Thu, 27 Nov 2008 01:44:02 +0000 Subject: [PATCH] Autodetect SLEPc based on the PETSc config git-svn-id: https://svn.dealii.org/trunk@17758 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/aclocal.m4 | 175 ++++++++++++++++++++++++++ deal.II/base/include/base/config.h.in | 3 + deal.II/common/Make.global_options.in | 25 +++- deal.II/configure.in | 11 +- deal.II/deal.II/Makefile | 6 + deal.II/doc/doxygen/options.dox.in | 1 + deal.II/lac/Makefile | 8 +- 7 files changed, 223 insertions(+), 6 deletions(-) diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index d0188d7542..e10212eecb 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -5431,6 +5431,181 @@ AC_DEFUN(DEAL_II_CONFIGURE_PETSC_MPIUNI_LIB, dnl +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 +[ + dnl First check for the SLEPc directory + AC_MSG_CHECKING(for SLEPc library directory) + + AC_ARG_WITH(slepc, + [ --with-slepc=/path/to/slepc Specify the path to the SLEPc installation, + of which the include and library directories + are subdirs; 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/include \ + -o ! -d $DEAL_II_SLEPC_DIR/lib ; then + AC_MSG_ERROR([Path to SLEPc specified with --with-slepc does not + point to a complete SLEPc installation]) + 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/include \ + -o ! -d $DEAL_II_SLEPC_DIR/lib ; 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 + DEAL_II_CONFIGURE_SLEPC_ARCH + + 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 architecture used for SLEPc, since that determines +dnl where object and configuration files will be found. +dnl +dnl Usage: DEAL_II_CONFIGURE_SLEPC_ARCH +dnl +dnl ------------------------------------------------------------ +AC_DEFUN(DEAL_II_CONFIGURE_SLEPC_ARCH, dnl +[ + AC_MSG_CHECKING(for SLEPc library architecture) + + AC_ARG_WITH(slepc-arch, + [ --with-slepc-arch=architecture Specify the architecture for your SLEPc + installation; use this if you want to override + the SLEPC_ARCH environment variable.], + [ + DEAL_II_SLEPC_ARCH=$withval + AC_MSG_RESULT($DEAL_II_SLEPC_ARCH) + ], + [ + dnl Take something from the environment variables, if it is there + if test "x$SLEPC_ARCH" != "x" ; then + DEAL_II_SLEPC_ARCH="$SLEPC_ARCH" + AC_MSG_RESULT($DEAL_II_SLEPC_ARCH) + else + AC_MSG_ERROR([If SLEPc is used, you must specify the architecture + either through the SLEPC_ARCH environment variable, + or through the --with-slepc-arch flag]) + fi + ]) + + + if test "x$SLEPC_ARCH" != "x" ; then + dnl Make sure that what was specified is actually correct. + if test ! -d $DEAL_II_SLEPC_DIR/lib/$DEAL_II_SLEPC_ARCH \ + ; then + AC_MSG_ERROR([SLEPc has not been compiled for the architecture + specified with --with-slepc-arch]) + fi + fi + + dnl Then check that PETSc and SLEPc architectures are compatible + dnl ie. that they are the same. + if test "$DEAL_II_SLEPC_ARCH" != "$DEAL_II_PETSC_ARCH" ; then + AC_MSG_ERROR([If SLEPc is used, you must specify the same + architecture as your PETSc Installation either + through the SLEPC_ARCH environment variable, + or through the --with-slepc-arch flag]) + 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" + AC_MSG_RESULT($SLEPC_VERSION) + + dnl Then check that PETSc and SLEPc versions are compatible + dnl ie. that they are equivalent. + if test "${DEAL_II_PETSC_VERSION_MAJOR}" != "${DEAL_II_SLEPC_VERSION_MAJOR}" \ + -o "${DEAL_II_PETSC_VERSION_MINOR}" != "${DEAL_II_SLEPC_VERSION_MINOR}" \ + -o "${DEAL_II_PETSC_VERSION_SUBMINOR}" != "${DEAL_II_SLEPC_VERSION_SUBMINOR}" ; then + AC_MSG_ERROR([If SLEPc is used, you must use the same version + number as your PETSc Installation]) + fi +]) + + + dnl ------------------------------------------------------------ dnl Check whether Trilinos is installed, and if so store the dnl respective links diff --git a/deal.II/base/include/base/config.h.in b/deal.II/base/include/base/config.h.in index 684d4b1f23..6f1354ec43 100644 --- a/deal.II/base/include/base/config.h.in +++ b/deal.II/base/include/base/config.h.in @@ -212,6 +212,9 @@ /* Defined if a PETSc installation was found and is going to be used */ #undef DEAL_II_USE_PETSC +/* Defined if a SLEPc installation was found and is going to be used */ +#undef DEAL_II_USE_SLEPC + /* Defined if a Trilinos installation was found and is going to be used */ #undef DEAL_II_USE_TRILINOS diff --git a/deal.II/common/Make.global_options.in b/deal.II/common/Make.global_options.in index 4c316eada2..d61ed07a91 100644 --- a/deal.II/common/Make.global_options.in +++ b/deal.II/common/Make.global_options.in @@ -54,6 +54,13 @@ DEAL_II_PETSC_VERSION_MINOR = @DEAL_II_PETSC_VERSION_MINOR@ DEAL_II_PETSC_VERSION_SUBMINOR = @DEAL_II_PETSC_VERSION_SUBMINOR@ DEAL_II_PETSC_MPIUNI_LIB = @DEAL_II_PETSC_MPIUNI_LIB@ +USE_CONTRIB_SLEPC = @USE_CONTRIB_SLEPC@ +DEAL_II_SLEPC_DIR = @DEAL_II_SLEPC_DIR@ +DEAL_II_SLEPC_ARCH = @DEAL_II_SLEPC_ARCH@ +DEAL_II_SLEPC_VERSION_MAJOR = @DEAL_II_SLEPC_VERSION_MAJOR@ +DEAL_II_SLEPC_VERSION_MINOR = @DEAL_II_SLEPC_VERSION_MINOR@ +DEAL_II_SLEPC_VERSION_SUBMINOR = @DEAL_II_SLEPC_VERSION_SUBMINOR@ + USE_CONTRIB_TRILINOS = @USE_CONTRIB_TRILINOS@ DEAL_II_TRILINOS_INCDIR = @DEAL_II_TRILINOS_INCDIR@ DEAL_II_TRILINOS_LIBDIR = @DEAL_II_TRILINOS_LIBDIR@ @@ -161,11 +168,12 @@ else endif endif +# similar (and simpler) for slepc + lib-contrib-slepc = $(DEAL_II_SLEPC_DIR)/lib/$(DEAL_II_SLEPC_ARCH)/libslepc$(lib-suffix) # same for metis, except that there is only one library in that case lib-contrib-metis = $(DEAL_II_METIS_LIBDIR)/libmetis.a - # if PETSC is used, we need to add a number of libraries to what # we link for LAC ifeq ($(USE_CONTRIB_PETSC),yes) @@ -174,6 +182,11 @@ ifeq ($(USE_CONTRIB_PETSC),yes) LIBS += $(DEAL_II_PETSC_MPIUNI_LIB) endif +# if SLEPC is used, we need to add one library to the lac libs +ifeq ($(USE_CONTRIB_SLEPC),yes) + lib-lac.g += $(lib-contrib-slepc) + lib-lac.o += $(lib-contrib-slepc) +endif # If METIS was detected, add it to the lac libs, since this is where we call # them @@ -182,13 +195,14 @@ ifeq ($(USE_CONTRIB_METIS),yes) lib-lac.o += $(lib-contrib-metis) endif - # include paths. do not take into account a possibly existing # environment variable, since the compiler will evaluate the value of # that anyway at compile time include-path-petsc = $(DEAL_II_PETSC_DIR)/include include-path-petsc-bmake = $(DEAL_II_PETSC_DIR)/bmake/$(DEAL_II_PETSC_ARCH) +include-path-slepc = $(DEAL_II_SLEPC_DIR)/include +include-path-slepc-bmake = $(DEAL_II_SLEPC_DIR)/bmake/$(DEAL_II_SLEPC_ARCH) include-path-trilinos = $(DEAL_II_TRILINOS_INCDIR) include-path-metis = $(DEAL_II_METIS_INCDIR) @@ -200,7 +214,7 @@ INCLUDE = -I$D/base/include -I$D/lac/include -I$D/deal.II/include \ @UMFPACK_INCLUDE_DIR@ @HSL_INCLUDE_DIR@ \ -I$D/contrib -# add PETSc, Trilinos and METIS include path if necessary. this rule +# add PETSc, SLEPSc, Trilinos and METIS include path if necessary. this rule # (and the one further down below to get correct flags) should eventually # be replaced by something where we do not blindly include PETSc make files # (and thus import all of its variables), but rather set up a scheme to @@ -215,6 +229,10 @@ ifeq ($(USE_CONTRIB_PETSC),yes) $(MPI_INCLUDE) endif +ifeq ($(USE_CONTRIB_SLEPC),yes) + INCLUDE += -I$(include-path-slepc) -I$(include-path-slepc-bmake) +endif + ifeq ($(USE_CONTRIB_TRILINOS),yes) INCLUDE += -I$(include-path-trilinos) @@ -286,4 +304,3 @@ ifeq ($(USE_CONTRIB_PETSC),yes) CXXFLAGS.o += $(OCXX_PETSCFLAGS) endif - diff --git a/deal.II/configure.in b/deal.II/configure.in index 03371f18f1..66eacc7011 100644 --- a/deal.II/configure.in +++ b/deal.II/configure.in @@ -23,7 +23,7 @@ dnl clearing the cache define([AC_CACHE_LOAD], )dnl define([AC_CACHE_SAVE], )dnl -AC_INIT(deal.II, 6.2.pre, dealii@dealii.org, deal.II) +AC_INIT(projekt, 6.2.pre, tyoung@ippt.gov.pl, projekt) AC_REVISION($Revision$) AC_PREREQ(2.61) @@ -399,6 +399,15 @@ AC_SUBST(DEAL_II_PETSC_VERSION_SUBMINOR) AC_SUBST(DEAL_II_PETSC_MPIUNI_LIB) AC_SUBST(DEAL_II_DEFINE_DEAL_II_USE_PETSC) +DEAL_II_CONFIGURE_SLEPC +AC_SUBST(USE_CONTRIB_SLEPC) +AC_SUBST(DEAL_II_SLEPC_DIR) +AC_SUBST(DEAL_II_SLEPC_ARCH) +AC_SUBST(DEAL_II_SLEPC_VERSION_MAJOR) +AC_SUBST(DEAL_II_SLEPC_VERSION_MINOR) +AC_SUBST(DEAL_II_SLEPC_VERSION_SUBMINOR) +AC_SUBST(DEAL_II_DEFINE_DEAL_II_USE_SLEPC) + DEAL_II_CONFIGURE_TRILINOS AC_SUBST(USE_CONTRIB_TRILINOS) AC_SUBST(DEAL_II_TRILINOS_INCDIR) diff --git a/deal.II/deal.II/Makefile b/deal.II/deal.II/Makefile index c6c64c9358..3981d1a0b4 100644 --- a/deal.II/deal.II/Makefile +++ b/deal.II/deal.II/Makefile @@ -101,6 +101,12 @@ ifneq ($(GXX-VERSION),compaq_cxx) deplibs.o += $(lib-contrib-petsc.o) endif + # same with SLEPC + ifeq ($(USE_CONTRIB_SLEPC),yes) + deplibs.g += $(lib-contrib-slepc) + deplibs.o += $(lib-contrib-slepc) + endif + # and METIS ifeq ($(USE_CONTRIB_METIS),yes) deplibs.g += $(lib-contrib-metis) diff --git a/deal.II/doc/doxygen/options.dox.in b/deal.II/doc/doxygen/options.dox.in index bc54f25dac..7cebae0ae9 100644 --- a/deal.II/doc/doxygen/options.dox.in +++ b/deal.II/doc/doxygen/options.dox.in @@ -1013,6 +1013,7 @@ INCLUDE_FILE_PATTERNS = PREDEFINED = DOXYGEN=1 \ DEBUG=1 \ DEAL_II_USE_PETSC=1 \ + DEAL_II_USE_SLEPC=1 \ DEAL_II_USE_TRILINOS=1 \ DEAL_II_USE_MT=1 \ DEAL_II_USE_MT_POSIX=1 diff --git a/deal.II/lac/Makefile b/deal.II/lac/Makefile index aa8ee1fe6b..852d875bb1 100644 --- a/deal.II/lac/Makefile +++ b/deal.II/lac/Makefile @@ -73,7 +73,13 @@ ifneq ($(GXX-VERSION),compaq_cxx) deplibs.o += $(lib-contrib-petsc.o) endif - # same with PETSC + # same with SLEPC + ifeq ($(USE_CONTRIB_SLEPC),yes) + deplibs.g += $(lib-contrib-slepc) + deplibs.o += $(lib-contrib-slepc) + endif + + # same with TRILINOS ifeq ($(USE_CONTRIB_TRILINOS),yes) deplibs.g += $(lib-contrib-trilinos) deplibs.o += $(lib-contrib-trilinos) -- 2.39.5