mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-18 15:15:56 +08:00
Update MPI commands
This commit is contained in:
parent
21aadab493
commit
bbcf9f31c6
@ -347,7 +347,7 @@ function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE)
|
|||||||
# library that has invalid or missing version information there would be warning
|
# library that has invalid or missing version information there would be warning
|
||||||
# messages emitted by ld.so in the compiler output. In either case, we'll treat
|
# messages emitted by ld.so in the compiler output. In either case, we'll treat
|
||||||
# the output as invalid.
|
# the output as invalid.
|
||||||
if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available")
|
if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available|command not found")
|
||||||
set(WRAPPER_RETURN 255)
|
set(WRAPPER_RETURN 255)
|
||||||
endif()
|
endif()
|
||||||
# Ensure that no error output might be passed upwards.
|
# Ensure that no error output might be passed upwards.
|
||||||
@ -615,6 +615,16 @@ function (_MPI_interrogate_compiler lang)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS)
|
||||||
|
list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS}")
|
||||||
|
endif()
|
||||||
|
if(MPI_${LANG}_EXTRA_COMPILE_OPTIONS)
|
||||||
|
list(APPEND MPI_COMPILE_OPTIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_OPTIONS}")
|
||||||
|
endif()
|
||||||
|
if(MPI_${LANG}_EXTRA_LIB_NAMES)
|
||||||
|
list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${MPI_${LANG}_EXTRA_LIB_NAMES}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# If we found MPI, set up all of the appropriate cache entries
|
# If we found MPI, set up all of the appropriate cache entries
|
||||||
if(NOT MPI_${LANG}_COMPILE_OPTIONS)
|
if(NOT MPI_${LANG}_COMPILE_OPTIONS)
|
||||||
set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_COMPILE_OPTIONS_WORK} CACHE STRING "MPI ${LANG} compilation options" FORCE)
|
set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_COMPILE_OPTIONS_WORK} CACHE STRING "MPI ${LANG} compilation options" FORCE)
|
||||||
@ -823,33 +833,43 @@ endfunction()
|
|||||||
|
|
||||||
macro(_MPI_assemble_libraries LANG)
|
macro(_MPI_assemble_libraries LANG)
|
||||||
set(MPI_${LANG}_LIBRARIES "")
|
set(MPI_${LANG}_LIBRARIES "")
|
||||||
foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES)
|
# Only for libraries do we need to check whether the compiler's linking stage is separate.
|
||||||
list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY})
|
if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS_IMPLICIT)
|
||||||
endforeach()
|
foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES)
|
||||||
endmacro()
|
list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY})
|
||||||
|
|
||||||
macro(_MPI_assemble_include_dirs LANG)
|
|
||||||
set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}")
|
|
||||||
if("${LANG}" MATCHES "(C|CXX)")
|
|
||||||
if(MPI_${LANG}_HEADER_DIR)
|
|
||||||
list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}")
|
|
||||||
endif()
|
|
||||||
else() # Fortran
|
|
||||||
if(MPI_${LANG}_F77_HEADER_DIR)
|
|
||||||
list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}")
|
|
||||||
endif()
|
|
||||||
if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS)
|
|
||||||
list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS)
|
|
||||||
foreach(mpiadditionalinclude IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS)
|
|
||||||
list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${mpiadditionalinclude}_INCLUDE_DIR}")
|
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
macro(_MPI_assemble_include_dirs LANG)
|
||||||
|
if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}")
|
||||||
|
set(MPI_${LANG}_INCLUDE_DIRS "")
|
||||||
|
else()
|
||||||
|
set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}")
|
||||||
|
if("${LANG}" MATCHES "(C|CXX)")
|
||||||
|
if(MPI_${LANG}_HEADER_DIR)
|
||||||
|
list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}")
|
||||||
|
endif()
|
||||||
|
else() # Fortran
|
||||||
|
if(MPI_${LANG}_F77_HEADER_DIR)
|
||||||
|
list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}")
|
||||||
|
endif()
|
||||||
|
if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS)
|
||||||
|
list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS)
|
||||||
|
foreach(MPI_ADDITIONAL_INC_DIR IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS)
|
||||||
|
list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${MPI_ADDITIONAL_INC_DIR}_INCLUDE_DIR}")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
function(_MPI_split_include_dirs LANG)
|
function(_MPI_split_include_dirs LANG)
|
||||||
|
if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
# Backwards compatibility: Search INCLUDE_PATH if given.
|
# Backwards compatibility: Search INCLUDE_PATH if given.
|
||||||
if(MPI_${LANG}_INCLUDE_PATH)
|
if(MPI_${LANG}_INCLUDE_PATH)
|
||||||
list(APPEND MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_INCLUDE_PATH}")
|
list(APPEND MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_INCLUDE_PATH}")
|
||||||
@ -885,6 +905,13 @@ function(_MPI_split_include_dirs LANG)
|
|||||||
endif()
|
endif()
|
||||||
mark_as_advanced(MPI_${LANG}_F77_HEADER_DIR MPI_${LANG}_MODULE_DIR)
|
mark_as_advanced(MPI_${LANG}_F77_HEADER_DIR MPI_${LANG}_MODULE_DIR)
|
||||||
endif()
|
endif()
|
||||||
|
# Remove duplicates and default system directories from the list.
|
||||||
|
if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)
|
||||||
|
list(REMOVE_DUPLICATES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)
|
||||||
|
foreach(MPI_IMPLICIT_INC_DIR IN LISTS CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES)
|
||||||
|
list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_IMPLICIT_INC_DIR})
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories" FORCE)
|
set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories" FORCE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
@ -1014,7 +1041,7 @@ elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
|
|||||||
elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "FreeBSD")
|
elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "FreeBSD")
|
||||||
# FreeBSD ships mpich under the normal system paths - but available openmpi implementations
|
# FreeBSD ships mpich under the normal system paths - but available openmpi implementations
|
||||||
# will be found in /usr/local/mpi/<name>
|
# will be found in /usr/local/mpi/<name>
|
||||||
MPI_search_mpi_prefix_folder("/usr/local/mpi/")
|
MPI_search_mpi_prefix_folder("/usr/local/mpi")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Most MPI distributions have some form of mpiexec or mpirun which gives us something we can look for.
|
# Most MPI distributions have some form of mpiexec or mpirun which gives us something we can look for.
|
||||||
@ -1050,48 +1077,54 @@ mark_as_advanced(MPIEXEC_EXECUTABLE MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXE
|
|||||||
#
|
#
|
||||||
# Once we find the new variables, we translate them back into their old
|
# Once we find the new variables, we translate them back into their old
|
||||||
# equivalents below.
|
# equivalents below.
|
||||||
foreach (LANG IN ITEMS C CXX)
|
if(NOT MPI_IGNORE_LEGACY_VARIABLES)
|
||||||
# Old input variables.
|
foreach (LANG IN ITEMS C CXX)
|
||||||
set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS)
|
# Old input variables.
|
||||||
|
set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS)
|
||||||
|
|
||||||
# Set new vars based on their old equivalents, if the new versions are not already set.
|
# Set new vars based on their old equivalents, if the new versions are not already set.
|
||||||
foreach (var ${_MPI_OLD_INPUT_VARS})
|
foreach (var ${_MPI_OLD_INPUT_VARS})
|
||||||
if (NOT MPI_${LANG}_${var} AND MPI_${var})
|
if (NOT MPI_${LANG}_${var} AND MPI_${var})
|
||||||
set(MPI_${LANG}_${var} "${MPI_${var}}")
|
set(MPI_${LANG}_${var} "${MPI_${var}}")
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
# Chop the old compile flags into options and definitions
|
|
||||||
if(MPI_${LANG}_COMPILE_FLAGS)
|
|
||||||
unset(MPI_${LANG}_COMPILE_OPTIONS)
|
|
||||||
unset(MPI_${LANG}_COMPILE_DEFINITIONS)
|
|
||||||
separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}")
|
|
||||||
foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS)
|
|
||||||
if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)")
|
|
||||||
list(APPEND MPI_${LANG}_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}")
|
|
||||||
else()
|
|
||||||
list(APPEND MPI_${LANG}_COMPILE_FLAGS "${_MPI_FLAG}")
|
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
unset(MPI_SEPARATE_FLAGS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# If a list of libraries was given, we'll split it into new-style cache variables
|
# Chop the old compile flags into options and definitions
|
||||||
if(NOT MPI_${LANG}_LIB_NAMES)
|
|
||||||
foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY)
|
unset(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS)
|
||||||
get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE)
|
unset(MPI_${LANG}_EXTRA_COMPILE_OPTIONS)
|
||||||
get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME)
|
if(MPI_${LANG}_COMPILE_FLAGS)
|
||||||
get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY)
|
separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}")
|
||||||
list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}")
|
foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS)
|
||||||
find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY
|
if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)")
|
||||||
NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}"
|
list(APPEND MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}")
|
||||||
HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB}
|
else()
|
||||||
DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI"
|
list(APPEND MPI_${LANG}_EXTRA_COMPILE_OPTIONS "${_MPI_FLAG}")
|
||||||
)
|
endif()
|
||||||
mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY)
|
endforeach()
|
||||||
endforeach()
|
unset(MPI_SEPARATE_FLAGS)
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
|
||||||
|
# If a list of libraries was given, we'll split it into new-style cache variables
|
||||||
|
unset(MPI_${LANG}_EXTRA_LIB_NAMES)
|
||||||
|
if(NOT MPI_${LANG}_LIB_NAMES)
|
||||||
|
foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY)
|
||||||
|
if(_MPI_LIB)
|
||||||
|
get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE)
|
||||||
|
get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME)
|
||||||
|
get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY)
|
||||||
|
list(APPEND MPI_${LANG}_EXTRA_LIB_NAMES "${_MPI_PLAIN_LIB_NAME}")
|
||||||
|
find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY
|
||||||
|
NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}"
|
||||||
|
HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB}
|
||||||
|
DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI"
|
||||||
|
)
|
||||||
|
mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY)
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|
||||||
unset(MPI_VERSION)
|
unset(MPI_VERSION)
|
||||||
@ -1100,6 +1133,11 @@ unset(MPI_VERSION_MINOR)
|
|||||||
|
|
||||||
unset(_MPI_MIN_VERSION)
|
unset(_MPI_MIN_VERSION)
|
||||||
|
|
||||||
|
# If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually.
|
||||||
|
if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME)
|
||||||
|
set(MPI_SKIP_COMPILER_WRAPPER TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
# This loop finds the compilers and sends them off for interrogation.
|
# This loop finds the compilers and sends them off for interrogation.
|
||||||
foreach(LANG IN ITEMS C CXX Fortran)
|
foreach(LANG IN ITEMS C CXX Fortran)
|
||||||
if(CMAKE_${LANG}_COMPILER_LOADED)
|
if(CMAKE_${LANG}_COMPILER_LOADED)
|
||||||
@ -1121,6 +1159,8 @@ foreach(LANG IN ITEMS C CXX Fortran)
|
|||||||
mark_as_advanced(MPI_CXX_SKIP_MPICXX)
|
mark_as_advanced(MPI_CXX_SKIP_MPICXX)
|
||||||
endif()
|
endif()
|
||||||
if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)))
|
if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)))
|
||||||
|
set(MPI_${LANG}_TRIED_IMPLICIT FALSE)
|
||||||
|
set(MPI_${LANG}_WORKS_IMPLICIT FALSE)
|
||||||
if(NOT MPI_${LANG}_COMPILER AND NOT MPI_ASSUME_NO_BUILTIN_MPI)
|
if(NOT MPI_${LANG}_COMPILER AND NOT MPI_ASSUME_NO_BUILTIN_MPI)
|
||||||
# Should the imported targets be empty, we effectively try whether the compiler supports MPI on its own, which is the case on e.g.
|
# Should the imported targets be empty, we effectively try whether the compiler supports MPI on its own, which is the case on e.g.
|
||||||
# Cray PrgEnv.
|
# Cray PrgEnv.
|
||||||
@ -1130,80 +1170,90 @@ foreach(LANG IN ITEMS C CXX Fortran)
|
|||||||
# If the compiler can build MPI code on its own, it functions as an MPI compiler and we'll set the variable to point to it.
|
# If the compiler can build MPI code on its own, it functions as an MPI compiler and we'll set the variable to point to it.
|
||||||
if(MPI_${LANG}_WORKS)
|
if(MPI_${LANG}_WORKS)
|
||||||
set(MPI_${LANG}_COMPILER "${CMAKE_${LANG}_COMPILER}" CACHE FILEPATH "MPI compiler for ${LANG}" FORCE)
|
set(MPI_${LANG}_COMPILER "${CMAKE_${LANG}_COMPILER}" CACHE FILEPATH "MPI compiler for ${LANG}" FORCE)
|
||||||
|
set(MPI_${LANG}_WORKS_IMPLICIT TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
set(MPI_${LANG}_TRIED_IMPLICIT TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually.
|
if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS)
|
||||||
if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME)
|
set(MPI_${LANG}_WRAPPER_FOUND FALSE)
|
||||||
set(MPI_SKIP_COMPILER_WRAPPER TRUE)
|
set(MPI_PINNED_COMPILER FALSE)
|
||||||
endif()
|
|
||||||
if(NOT MPI_SKIP_COMPILER_WRAPPER)
|
if(NOT MPI_SKIP_COMPILER_WRAPPER)
|
||||||
if(MPI_${LANG}_COMPILER)
|
if(MPI_${LANG}_COMPILER)
|
||||||
# If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler.
|
# If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler.
|
||||||
if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}")
|
if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}")
|
||||||
# Get rid of our default list of names and just search for the name the user wants.
|
# Get rid of our default list of names and just search for the name the user wants.
|
||||||
set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}")
|
set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}")
|
||||||
unset(MPI_${LANG}_COMPILER CACHE)
|
unset(MPI_${LANG}_COMPILER CACHE)
|
||||||
|
endif()
|
||||||
|
# If the user specifies a compiler, we don't want to try to search libraries either.
|
||||||
|
set(MPI_PINNED_COMPILER TRUE)
|
||||||
endif()
|
endif()
|
||||||
# If the user specifies a compiler, we don't want to try to search libraries either.
|
|
||||||
set(MPI_PINNED_COMPILER TRUE)
|
|
||||||
else()
|
|
||||||
set(MPI_PINNED_COMPILER FALSE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# If we have an MPI base directory, we'll try all compiler names in that one first.
|
# If we have an MPI base directory, we'll try all compiler names in that one first.
|
||||||
# This should prevent mixing different MPI environments
|
# This should prevent mixing different MPI environments
|
||||||
if(_MPI_BASE_DIR)
|
if(_MPI_BASE_DIR)
|
||||||
|
find_program(MPI_${LANG}_COMPILER
|
||||||
|
NAMES ${_MPI_${LANG}_COMPILER_NAMES}
|
||||||
|
PATH_SUFFIXES bin sbin
|
||||||
|
HINTS ${_MPI_BASE_DIR}
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
DOC "MPI compiler for ${LANG}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers),
|
||||||
|
# we shall try searching in the default paths.
|
||||||
find_program(MPI_${LANG}_COMPILER
|
find_program(MPI_${LANG}_COMPILER
|
||||||
NAMES ${_MPI_${LANG}_COMPILER_NAMES}
|
NAMES ${_MPI_${LANG}_COMPILER_NAMES}
|
||||||
PATH_SUFFIXES bin sbin
|
PATH_SUFFIXES bin sbin
|
||||||
HINTS ${_MPI_BASE_DIR}
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
DOC "MPI compiler for ${LANG}"
|
DOC "MPI compiler for ${LANG}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}")
|
||||||
|
set(MPI_PINNED_COMPILER TRUE)
|
||||||
|
|
||||||
|
# If we haven't made the implicit compiler test yet, perform it now.
|
||||||
|
if(NOT MPI_${LANG}_TRIED_IMPLICIT)
|
||||||
|
_MPI_create_imported_target(${LANG})
|
||||||
|
_MPI_check_lang_works(${LANG})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Should the MPI compiler not work implicitly for MPI, still interrogate it.
|
||||||
|
# Otherwise, MPI compilers for which CMake has separate linking stages, e.g. Intel MPI on Windows where link.exe is being used
|
||||||
|
# directly during linkage instead of CMAKE_<LANG>_COMPILER will not work.
|
||||||
|
if(NOT MPI_${LANG}_WORKS)
|
||||||
|
set(MPI_${LANG}_WORKS_IMPLICIT FALSE)
|
||||||
|
_MPI_interrogate_compiler(${LANG})
|
||||||
|
else()
|
||||||
|
set(MPI_${LANG}_WORKS_IMPLICIT TRUE)
|
||||||
|
endif()
|
||||||
|
elseif(MPI_${LANG}_COMPILER)
|
||||||
|
_MPI_interrogate_compiler(${LANG})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers),
|
if(NOT MPI_SKIP_GUESSING AND NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER)
|
||||||
# we shall try searching in the default paths.
|
# For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the
|
||||||
find_program(MPI_${LANG}_COMPILER
|
# settings for C. An MPI distribution that is in this situation would be IBM Platform MPI.
|
||||||
NAMES ${_MPI_${LANG}_COMPILER_NAMES}
|
if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND)
|
||||||
PATH_SUFFIXES bin sbin
|
set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" )
|
||||||
DOC "MPI compiler for ${LANG}"
|
set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" )
|
||||||
)
|
set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories")
|
||||||
|
set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" )
|
||||||
if(MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER)
|
set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" )
|
||||||
set(MPI_SKIP_GUESSING TRUE)
|
else()
|
||||||
elseif(MPI_${LANG}_COMPILER)
|
_MPI_guess_settings(${LANG})
|
||||||
_MPI_interrogate_compiler(${LANG})
|
endif()
|
||||||
else()
|
|
||||||
set(MPI_${LANG}_WRAPPER_FOUND FALSE)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
set(MPI_${LANG}_WRAPPER_FOUND FALSE)
|
|
||||||
set(MPI_PINNED_COMPILER FALSE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER)
|
|
||||||
# For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the
|
|
||||||
# settings for C. An MPI distribution that is in this situation would be IBM Platform MPI.
|
|
||||||
if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND)
|
|
||||||
set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" )
|
|
||||||
set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" )
|
|
||||||
set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories")
|
|
||||||
set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" )
|
|
||||||
set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" )
|
|
||||||
set(MPI_${LANG}_WRAPPER_FOUND TRUE)
|
|
||||||
elseif(NOT MPI_SKIP_GUESSING)
|
|
||||||
_MPI_guess_settings(${LANG})
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
_MPI_split_include_dirs(${LANG})
|
_MPI_split_include_dirs(${LANG})
|
||||||
if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER)
|
_MPI_assemble_include_dirs(${LANG})
|
||||||
_MPI_assemble_include_dirs(${LANG})
|
_MPI_assemble_libraries(${LANG})
|
||||||
_MPI_assemble_libraries(${LANG})
|
|
||||||
endif()
|
|
||||||
_MPI_adjust_compile_definitions(${LANG})
|
_MPI_adjust_compile_definitions(${LANG})
|
||||||
# We always create imported targets even if they're empty
|
# We always create imported targets even if they're empty
|
||||||
_MPI_create_imported_target(${LANG})
|
_MPI_create_imported_target(${LANG})
|
||||||
@ -1217,7 +1267,9 @@ foreach(LANG IN ITEMS C CXX Fortran)
|
|||||||
set(MPI_${LANG}_COMPILE_DEFINITIONS "" CACHE STRING "MPI ${LANG} compilation definitions" )
|
set(MPI_${LANG}_COMPILE_DEFINITIONS "" CACHE STRING "MPI ${LANG} compilation definitions" )
|
||||||
set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "MPI ${LANG} additional include directories")
|
set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "MPI ${LANG} additional include directories")
|
||||||
set(MPI_${LANG}_LINK_FLAGS "" CACHE STRING "MPI ${LANG} linker flags" )
|
set(MPI_${LANG}_LINK_FLAGS "" CACHE STRING "MPI ${LANG} linker flags" )
|
||||||
set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" )
|
if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER)
|
||||||
|
set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" )
|
||||||
|
endif()
|
||||||
mark_as_advanced(MPI_${LANG}_COMPILE_OPTIONS MPI_${LANG}_COMPILE_DEFINITIONS MPI_${LANG}_LINK_FLAGS
|
mark_as_advanced(MPI_${LANG}_COMPILE_OPTIONS MPI_${LANG}_COMPILE_DEFINITIONS MPI_${LANG}_LINK_FLAGS
|
||||||
MPI_${LANG}_LIB_NAMES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS MPI_${LANG}_COMPILER)
|
MPI_${LANG}_LIB_NAMES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS MPI_${LANG}_COMPILER)
|
||||||
|
|
||||||
@ -1337,7 +1389,7 @@ foreach(LANG IN ITEMS C CXX Fortran)
|
|||||||
set(MPI_${LANG}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT})
|
set(MPI_${LANG}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT})
|
||||||
|
|
||||||
unset(MPI_${LANG}_REQUIRED_VARS)
|
unset(MPI_${LANG}_REQUIRED_VARS)
|
||||||
if (MPI_${LANG}_WRAPPER_FOUND OR MPI_${LANG}_GUESS_FOUND)
|
if (NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}")
|
||||||
foreach(mpilibname IN LISTS MPI_${LANG}_LIB_NAMES)
|
foreach(mpilibname IN LISTS MPI_${LANG}_LIB_NAMES)
|
||||||
list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpilibname}_LIBRARY")
|
list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpilibname}_LIBRARY")
|
||||||
endforeach()
|
endforeach()
|
||||||
@ -1448,6 +1500,7 @@ if (MPI_NUMLIBS GREATER 1)
|
|||||||
else()
|
else()
|
||||||
set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND")
|
set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND")
|
||||||
endif()
|
endif()
|
||||||
|
set(MPI_IGNORE_LEGACY_VARIABLES TRUE)
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|
||||||
# unset these vars to cleanup namespace
|
# unset these vars to cleanup namespace
|
||||||
|
@ -350,6 +350,15 @@ Bug Fixes since HDF5-1.10.1 release
|
|||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
|
- cmake
|
||||||
|
|
||||||
|
The hdf5 fortran utility H5match_types needs to include mpi.h when
|
||||||
|
parallel is enabled..
|
||||||
|
|
||||||
|
Added target_include_directories command to H5match_types executable..
|
||||||
|
|
||||||
|
(ADB - 2017/12/20)
|
||||||
|
|
||||||
- cmake
|
- cmake
|
||||||
|
|
||||||
The hdf5 library used shared szip and zlib, which needlessly required
|
The hdf5 library used shared szip and zlib, which needlessly required
|
||||||
@ -367,7 +376,7 @@ Bug Fixes since HDF5-1.10.1 release
|
|||||||
CMake implementation for MPI was problematic and would create incorrect
|
CMake implementation for MPI was problematic and would create incorrect
|
||||||
MPI library references in the hdf5 libraries.
|
MPI library references in the hdf5 libraries.
|
||||||
|
|
||||||
Reworked the CMake MPI code to properly create CMake targets.Also merged
|
Reworked the CMake MPI code to properly create CMake targets. Also merged
|
||||||
the latest CMake FindMPI.cmake changes to the local copy. This is necessary
|
the latest CMake FindMPI.cmake changes to the local copy. This is necessary
|
||||||
until HDF changes the CMake minimum to 3.9 or greater.
|
until HDF changes the CMake minimum to 3.9 or greater.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user