Commit bf40c447 authored by Chris Cantwell's avatar Chris Cantwell
Browse files

Merge branch 'fix/mpi-cmake' into 'master'

Switch to MPI_lang_... variables

This MR switches the CMake configuration to use `MPI_<lang>_...` variables instead of the existing `MPI_...` variables. Currently Nektar++ uses `MPI_LIBRARY` and `MPI_EXTRA_LIBRARY`, which have been deprecated for some time. In recent versions of CMake, at least on OS X, `MPI_EXTRA_LIBRARY` is no longer set, meaning that Nektar++ fails to configure if MPI is enabled. A similar fix has also been applied to gsmpi which has the same issue.

See merge request !725
parents 38003171 f9fc39db
......@@ -37,6 +37,7 @@ v4.4.0
- Fix bug in `Vmath::FillWhiteNoise` which caused `ForcingNoise` to have
a repeated pattern (!718)
- Fix bug in the calculation of the RHS magnitude in CG solver (!721)
- Fix bug in MPI detection for recent CMake on OS X (!725)
- Fix bug in CMake Homebrew and MacPorts detection for OS X (!729)
- Fix bug in FieldUtils when using half mode expansions (!734)
- Do not read the same fld/pts files again for every variable (!670)
......
......@@ -64,13 +64,12 @@ SET(NEKTAR++_TP_INCLUDE_DIRS
SET(NEKTAR_USE_MPI "@NEKTAR_USE_MPI@")
IF( NEKTAR_USE_MPI )
SET(MPI_LIBRARY "@MPI_LIBRARY@")
SET(MPI_EXTRA_LIBRARY "@MPI_EXTRA_LIBRARY@")
SET(MPI_INCLUDE_PATH "@MPI_INCLUDE_PATH@")
SET(MPI_C_LIBRARIES "@MPI_C_LIBRARIES@")
SET(MPI_C_INCLUDE_PATH "@MPI_C_INCLUDE_PATH@")
SET(NEKTAR++_TP_INCLUDE_DIRS
${NEKTAR++_TP_INCLUDE_DIRS} ${MPI_INCLUDE_PATH})
${NEKTAR++_TP_INCLUDE_DIRS} ${MPI_C_INCLUDE_PATH})
SET(NEKTAR++_TP_LIBRARIES
${NEKTAR++_TP_LIBRARIES} ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
${NEKTAR++_TP_LIBRARIES} ${MPI_C_LIBRARIES})
SET(NEKTAR++_DEFINITIONS
"${NEKTAR++_DEFINITIONS} -DNEKTAR_USE_MPI")
ENDIF( NEKTAR_USE_MPI )
......
......@@ -13,7 +13,8 @@ CMAKE_DEPENDENT_OPTION(THIRDPARTY_BUILD_GSMPI
"NEKTAR_USE_MPI" OFF)
IF( NEKTAR_USE_MPI )
# First check to see if our compiler has MPI built in to avoid linking libraries etc.
# First check to see if our compiler has MPI built in to avoid linking
# libraries etc.
INCLUDE (CheckIncludeFiles)
INCLUDE (CheckFunctionExists)
CHECK_INCLUDE_FILES (mpi.h HAVE_MPI_H)
......@@ -22,12 +23,10 @@ IF( NEKTAR_USE_MPI )
SET(MPI_BUILTIN OFF CACHE INTERNAL
"Determines whether MPI is built into the compiler")
IF (NOT "${HAVE_MPI_H}" OR NOT "${HAVE_MPI_SEND}")
INCLUDE (FindMPI)
MARK_AS_ADVANCED(MPI_LIBRARY)
MARK_AS_ADVANCED(MPI_EXTRA_LIBRARY)
MARK_AS_ADVANCED(file_cmd)
INCLUDE_DIRECTORIES( ${MPI_INCLUDE_PATH} )
MESSAGE(STATUS "Found MPI: ${MPI_LIBRARY}")
FIND_PACKAGE(MPI REQUIRED)
INCLUDE_DIRECTORIES( ${MPI_CXX_INCLUDE_PATH} )
MESSAGE(STATUS "Found MPI: ${MPI_CXX_LIBRARIES}")
ELSE()
SET(MPI_BUILTIN ON)
MESSAGE(STATUS "Found MPI: built in")
......@@ -52,8 +51,8 @@ IF( NEKTAR_USE_MPI )
IF (THIRDPARTY_BUILD_GSMPI)
EXTERNALPROJECT_ADD(
gsmpi-1.2.1
URL ${TPURL}/gsmpi-1.2.1.tar.bz2
URL_MD5 18dcb4cd1dcc7876173465c404b1142d
URL ${TPURL}/gsmpi-1.2.1_1.tar.bz2
URL_MD5 c247ed68134a65b8033c639277e46825
STAMP_DIR ${TPBUILD}/stamp
DOWNLOAD_DIR ${TPSRC}
SOURCE_DIR ${TPSRC}/gsmpi-1.2.1
......
......@@ -441,11 +441,11 @@ ENDIF()
IF( NEKTAR_USE_MPI )
TARGET_LINK_LIBRARIES(LibUtilities LINK_PRIVATE ${GSMPI_LIBRARY} ${XXT_LIBRARY})
IF (NOT MPI_BUILTIN)
TARGET_LINK_LIBRARIES(LibUtilities LINK_PUBLIC ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
TARGET_LINK_LIBRARIES(LibUtilities LINK_PUBLIC ${MPI_CXX_LIBRARIES})
SET_TARGET_PROPERTIES(LibUtilities
PROPERTIES LINK_FLAGS "${THE_LINK_FLAGS} ${MPI_LINK_FLAGS}")
PROPERTIES LINK_FLAGS "${THE_LINK_FLAGS} ${MPI_CXX_LINK_FLAGS}")
SET_TARGET_PROPERTIES(LibUtilities
PROPERTIES COMPILE_FLAGS "${THE_COMPILE_FLAGS} ${MPI_COMPILE_FLAGS}")
PROPERTIES COMPILE_FLAGS "${THE_COMPILE_FLAGS} ${MPI_CXX_COMPILE_FLAGS}")
ENDIF()
ADD_DEPENDENCIES(LibUtilities gsmpi-1.2.1)
ENDIF( NEKTAR_USE_MPI )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment