From 3158d7aa2ed86aaf1fa802253c913de5e03c3d40 Mon Sep 17 00:00:00 2001 From: maier Date: Sat, 12 Oct 2013 19:18:42 +0000 Subject: [PATCH] Provide MPI version number (and OMPI version number as well) git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@31210 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/cmake/configure/configure_1_mpi.cmake | 50 +++++++++++++++++++ deal.II/cmake/setup_finalize.cmake | 4 ++ deal.II/doc/users/Config.sample | 3 ++ 3 files changed, 57 insertions(+) diff --git a/deal.II/cmake/configure/configure_1_mpi.cmake b/deal.II/cmake/configure/configure_1_mpi.cmake index 5140848840..0d1050a8aa 100644 --- a/deal.II/cmake/configure/configure_1_mpi.cmake +++ b/deal.II/cmake/configure/configure_1_mpi.cmake @@ -82,6 +82,56 @@ MACRO(FEATURE_MPI_FIND_EXTERNAL var) ENDIF() ENDFOREACH() + # + # Manually assemble some version information: + # + IF(EXISTS ${MPI_INCLUDE_PATH}/mpi.h) + FILE(STRINGS "${MPI_INCLUDE_PATH}/mpi.h" MPI_VERSION_MAJOR_STRING + REGEX "#define.*MPI_VERSION") + STRING(REGEX REPLACE "^.*MPI_VERSION.*([0-9]+).*" "\\1" + MPI_VERSION_MAJOR "${MPI_VERSION_MAJOR_STRING}" + ) + FILE(STRINGS "${MPI_INCLUDE_PATH}/mpi.h" MPI_VERSION_MINOR_STRING + REGEX "#define.*MPI_SUBVERSION") + STRING(REGEX REPLACE "^.*MPI_SUBVERSION.*([0-9]+).*" "\\1" + MPI_VERSION_MINOR "${MPI_VERSION_MINOR_STRING}" + ) + SET(MPI_VERSION "${MPI_VERSION_MAJOR}.${MPI_VERSION_MINOR}") + IF("${MPI_VERSION}" STREQUAL ".") + SET(MPI_VERSION) + SET(MPI_VERSION_MAJOR) + SET(MPI_VERSION_MINOR) + ENDIF() + + # OMPI specific version number: + FILE(STRINGS "${MPI_INCLUDE_PATH}/mpi.h" OMPI_VERSION_MAJOR_STRING + REGEX "#define.*OMPI_MAJOR_VERSION") + STRING(REGEX REPLACE "^.*OMPI_MAJOR_VERSION.*([0-9]+).*" "\\1" + OMPI_VERSION_MAJOR "${OMPI_VERSION_MAJOR_STRING}" + ) + FILE(STRINGS "${MPI_INCLUDE_PATH}/mpi.h" OMPI_VERSION_MINOR_STRING + REGEX "#define.*OMPI_MINOR_VERSION") + STRING(REGEX REPLACE "^.*OMPI_MINOR_VERSION.*([0-9]+).*" "\\1" + OMPI_VERSION_MINOR "${OMPI_VERSION_MINOR_STRING}" + ) + FILE(STRINGS "${MPI_INCLUDE_PATH}/mpi.h" OMPI_VERSION_RELEASE_STRING + REGEX "#define.*OMPI_RELEASE_VERSION") + STRING(REGEX REPLACE "^.*OMPI_RELEASE_VERSION.*([0-9]+).*" "\\1" + OMPI_VERSION_SUBMINOR "${OMPI_VERSION_RELEASE_STRING}" + ) + SET(OMPI_VERSION + "${OMPI_VERSION_MAJOR}.${OMPI_VERSION_MINOR}.${OMPI_VERSION_SUBMINOR}" + ) + IF("${OMPI_VERSION}" STREQUAL "..") + SET(OMPI_VERSION) + SET(OMPI_VERSION_MAJOR) + SET(OMPI_VERSION_MINOR) + SET(OMPI_VERSION_SUBMINOR) + ENDIF() + + ENDIF() + + # Hide some variables: MARK_AS_ADVANCED(MPI_EXTRA_LIBRARY MPI_LIBRARY) diff --git a/deal.II/cmake/setup_finalize.cmake b/deal.II/cmake/setup_finalize.cmake index 8dd205b3b6..4c4fc377ff 100644 --- a/deal.II/cmake/setup_finalize.cmake +++ b/deal.II/cmake/setup_finalize.cmake @@ -208,6 +208,10 @@ FOREACH(_var ${_features}) _detailed("# TBB_VERSION = ${TBB_VERSION}\n") ENDIF() + IF(_feature MATCHES "MPI" AND DEFINED OMPI_VERSION) + _detailed("# OMPI_VERSION = ${OMPI_VERSION}\n") + ENDIF() + # # Print out ${_feature}_DIR: # diff --git a/deal.II/doc/users/Config.sample b/deal.II/doc/users/Config.sample index 4bcbbcbe20..7b4500bf2f 100644 --- a/deal.II/doc/users/Config.sample +++ b/deal.II/doc/users/Config.sample @@ -334,6 +334,9 @@ # SET(MPI_CXX_INCLUDE_PATH "include directory for mpi" CACHE STRING "") # SET(MPI_CXX_COMPILE_FLAGS "..." CACHE STRING "") # SET(MPI_CXX_LINK_FLAGS "..." CACHE STRING "") +# SET(MPI_VERSION "x.y" CACHE STRING "") +# SET(MPI_VERSION_MAJOR "x" CACHE STRING "") +# SET(MPI_VERSION_MINOR "y" CACHE STRING "") # # Additionally: # -- 2.39.5