From 2e06f0fe8870494c9108da2ff2916c77dbbcc5e0 Mon Sep 17 00:00:00 2001 From: turcksin Date: Fri, 31 May 2013 22:58:10 +0000 Subject: [PATCH] Add the preprocessor command to use 64bit global indices to CMake and check that PETSc and Trilinos are compatible with 64bit indices. git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_4@29701 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/cmake/configure/configure_petsc.cmake | 29 +++++++++++++- .../cmake/configure/configure_trilinos.cmake | 40 ++++++++++++++++++- deal.II/cmake/modules/FindPETSC.cmake | 12 ++++++ deal.II/cmake/modules/FindTRILINOS.cmake | 16 +++++++- deal.II/cmake/scripts/report_features.cc.in | 3 ++ deal.II/include/deal.II/base/config.h.in | 10 +++++ deal.II/include/deal.II/base/types.h | 1 - 7 files changed, 107 insertions(+), 4 deletions(-) diff --git a/deal.II/cmake/configure/configure_petsc.cmake b/deal.II/cmake/configure/configure_petsc.cmake index eaad928c7d..a7d8d6d626 100644 --- a/deal.II/cmake/configure/configure_petsc.cmake +++ b/deal.II/cmake/configure/configure_petsc.cmake @@ -45,7 +45,7 @@ MACRO(FEATURE_PETSC_FIND_EXTERNAL var) # Petsc has to be configured with the same MPI configuration as # deal.II. # - # petscconf.h should export PETSC_HAVE_MPIUNI 1 in case mpi support is + # petscconf.h should export PETSC_HAVE_MPIUNI 1 in case mpi support is # _NOT_ enabled. # So we check for this: # @@ -65,6 +65,33 @@ MACRO(FEATURE_PETSC_FIND_EXTERNAL var) SET(${var} FALSE) ENDIF() + + # + # Petsc has to be configured with the same number of bits for indices as + # deal.II. + # + # petscconf.h should export PETSC_WITH_64BIT_INDICES 1 in case 64bits + # indices support is enabled. + # So we check for this: + # + IF( (NOT PETSC_WITH_64BIT_INDICES AND DEAL_II_WITH_64BIT_INDICES) + OR + (PETSC_WITH_64BIT_INDICES AND NOT DEAL_II_WITH_64BIT_INDICES)) + MESSAGE(STATUS "Could not find a sufficient PETSc installation: " + "PETSc has to be configured to use the same number of bits for the " + "global indices as deal.II." + ) + SET(PETSC_ADDITIONAL_ERROR_STRING + ${PETSC_ADDITIONAL_ERROR_STRING} + "Could not find a sufficient PETSc installation:\n" + "PETSc has to be configured to use the same number of bits for the " + "global indices as deal.II, but found:\n" + " DEAL_II_WITH_64BIT_INDICES = ${DEAL_II_WITH_64BIT_INDICES}\n" + " PETSC_WITH_64BIT_INDICES = (${PETSC_WITH_64BIT_INDICES})\n" + ) + SET(${var} FALSE) + ENDIF() + IF(NOT ${var}) UNSET(PETSC_INCLUDE_DIR_ARCH CACHE) UNSET(PETSC_INCLUDE_DIR_COMMON CACHE) diff --git a/deal.II/cmake/configure/configure_trilinos.cmake b/deal.II/cmake/configure/configure_trilinos.cmake index 346d2165fb..d7e08f752f 100644 --- a/deal.II/cmake/configure/configure_trilinos.cmake +++ b/deal.II/cmake/configure/configure_trilinos.cmake @@ -115,9 +115,47 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var) SET(${var} FALSE) ENDIF() + # + # Trilinos has to be configured with 32bit indices if deal.II uses unsigned long + # long int. + # + IF(TRILINOS_WITH_NO_32BIT_INDICES AND NOT DEAL_II_WITH_64BIT_INDICES) + MESSAGE(STATUS "deal.II was configured to use 32bit global indices but " + "Trilinos was not." + ) + SET(TRILINOS_ADDITIONAL_ERROR_STRING + ${TRILINOS_ADDITIONAL_ERROR_STRING} + "The Trilinos installation (found at \"${TRILINOS_DIR}\")\n" + "has to be configured to use the same number of bits as deal.II, but " + "found:\n" + " DEAL_II_WITH_64BIT_INDICES = ${DEAL_II_WITH_64BIT_INDICES}\n" + " TRILINOS_WITH_NO_32BIT_INDICES = ${TRILINOS_WITH_NO_32_BIT_INDICES}\n" + ) + SET(${var} FALSE) + ENDIF() + + # + # Trilinos has to be configured with 64bit indices if deal.II uses unsigned long + # long int. + # + IF(TRILINOS_WITH_NO_64BIT_INDICES AND DEAL_II_WITH_64BIT_INDICES) + MESSAGE(STATUS "deal.II was configured to use 64bit global indices but " + "Trilinos was not." + ) + SET(TRILINOS_ADDITIONAL_ERROR_STRING + ${TRILINOS_ADDITIONAL_ERROR_STRING} + "The Trilinos installation (found at \"${TRILINOS_DIR}\")\n" + "has to be configured to use the same number of bits as deal.II, but " + "found:\n" + " DEAL_II_WITH_64BIT_INDICES = ${DEAL_II_WITH_64BIT_INDICES}\n" + " TRILINOS_WITH_NO_64BIT_INDICES = ${TRILINOS_WITH_NO_64_BIT_INDICES}\n" + ) + SET(${var} FALSE) + ENDIF() + # - # Some verions of Sacado_cmath.hpp does things that aren't compatible + # Some versions of Sacado_cmath.hpp do things that aren't compatible # with the -std=c++0x flag of GCC, see deal.II FAQ. # Test whether that is indeed the case # diff --git a/deal.II/cmake/modules/FindPETSC.cmake b/deal.II/cmake/modules/FindPETSC.cmake index e61211b6f0..b3fddfac03 100644 --- a/deal.II/cmake/modules/FindPETSC.cmake +++ b/deal.II/cmake/modules/FindPETSC.cmake @@ -26,6 +26,7 @@ # PETSC_VERSION_SUBMINOR # PETSC_VERSION_PATCH # PETSC_WITH_MPIUNI +# PETSC_WITH_64BIT_INDICES # INCLUDE(FindPackageHandleStandardArgs) @@ -153,6 +154,17 @@ IF(PETSC_FOUND) SET(PETSC_WITH_MPIUNI TRUE) ENDIF() + # + # Is petsc compiled with support for 64BIT_INDICES? + # + FILE(STRINGS "${PETSC_PETSCCONF_H}" PETSC_64BIT_INDICES_STRING + REGEX "#define.*PETSC_USE_64BIT_INDICES 1") + IF("${PETSC_64BIT_INDICES_STRING}" STREQUAL "") + SET(PETSC_WITH_64BIT_INDICES FALSE) + ELSE() + SET(PETSC_WITH_64BIT_INDICES TRUE) + 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/FindTRILINOS.cmake b/deal.II/cmake/modules/FindTRILINOS.cmake index 0c30184f78..d038db322a 100644 --- a/deal.II/cmake/modules/FindTRILINOS.cmake +++ b/deal.II/cmake/modules/FindTRILINOS.cmake @@ -99,7 +99,7 @@ IF(TRILINOS_FOUND) TRILINOS_VERSION_SUBMINOR "${Trilinos_VERSION}") # - # Determine whether Trilinos was configured with MPI: + # Determine whether Trilinos was configured with MPI and 64bit indices: # FIND_FILE(EPETRA_CONFIG_H Epetra_config.h HINTS ${TRILINOS_INCLUDE_DIRS} @@ -117,6 +117,20 @@ IF(TRILINOS_FOUND) ELSE() SET(TRILINOS_WITH_MPI TRUE) ENDIF() + FILE(STRINGS "${EPETRA_CONFIG_H}" EPETRA_32BIT_STRING + REGEX "#define EPETRA_NO_32BIT_GLOBAL_INDICES") + IF("${EPETRA_64BIT_STRING}" STREQUAL "") + SET(TRILINOS_WITH_NO_32BITS_INDICES TRUE) + ELSE() + SET(TRILINOS_WITH_NO_32BITS_INDICES FALSE) + ENDIF() + FILE(STRINGS "${EPETRA_CONFIG_H}" EPETRA_64BIT_STRING + REGEX "#define EPETRA_NO_64BIT_GLOBAL_INDICES") + IF("${EPETRA_64BIT_STRING}" STREQUAL "") + SET(TRILINOS_WITH_NO_64BITS_INDICES TRUE) + ELSE() + SET(TRILINOS_WITH_NO_64BITS_INDICES FALSE) + ENDIF() UNSET(EPETRA_CONFIG_H CACHE) diff --git a/deal.II/cmake/scripts/report_features.cc.in b/deal.II/cmake/scripts/report_features.cc.in index 6e9570453f..3b0c072a01 100644 --- a/deal.II/cmake/scripts/report_features.cc.in +++ b/deal.II/cmake/scripts/report_features.cc.in @@ -166,4 +166,7 @@ std::cout << "dealii-feature: BOOST=" std::cout << "dealii-feature: LibZ=yes" << std::endl; #endif +#ifdef DEAL_II_WITH_64BIT_INDICES + std::cout << "dealii-feature: 64bit_indices=yes" < #include diff --git a/deal.II/include/deal.II/base/types.h b/deal.II/include/deal.II/base/types.h index a4cd002287..27aac6be0b 100644 --- a/deal.II/include/deal.II/base/types.h +++ b/deal.II/include/deal.II/base/types.h @@ -52,7 +52,6 @@ namespace types */ const unsigned int artificial_subdomain_id DEAL_II_DEPRECATED = static_cast(-2); -#define DEAL_II_USE_LARGE_INDEX_TYPE #ifdef DEAL_II_USE_LARGE_INDEX_TYPE /** * The type used for global indices of -- 2.39.5