Fichiers
rocm-systems/cmake/Modules/FindMPI-Headers.cmake
T
Jonathan R. Madsen f147670a7a Various optimizations (#192)
* CDash name prefix {{ repo_owner }}-{{ ref_name }}

- remove /merge from CI name

* disable using BFD when sampling_include_inlines is OFF

- this consumes a lot of memory

* Improve finalization of rocprofiler

* update timemory submodule

- disable OMPT thread begin/end callbacks
- support hierarchies in signal handlers
- update operation::pop_node debugging
- settings_update_type + setting_supported_data_types
- fixed parsing args in timemory_init

* Improve timemory build time

* Remove kokkosp restrictions for perfetto

* omnitrace exe signal handler update

- configure signal handlers before main to allow libomnitrace to override

* Backtrace and timemory submodule updates

- Use unwind::cache w/o inline info
- update timemory submodule
  - unwind::cache updates
  - filepath updates
  - fix termination_signal_message
  - fix vsettings::report_change

* Update dyninst submodule

- updates BinaryEdit::getResolvedLibraryPath

* update timemory submodule

- update CpuArch support

* Cleanup configure warnings

* Update examples cmake and workflows

- (Mostly) eliminate configuration warnings

* omnitrace exe updates

- pass environ to BPatch::processCreate
- avoid trailing ":" in DYNINST_REWRITER_PATHS

* Update dyninst submodule

- Add flags to DyninstOptimization.cmake
- Remove strtok from BinaryEdit::getResolvedLibraryPath

* examples/mpi CMakeLists.txt update

- STATUS message about missing MPI during CI, otherwise AUTHOR_WARNING

* Dev build and linker flags

- use -gsplit-dwarf when OMNITRACE_BUILD_DEVELOPER is ON
  - disable when OMNITRACE_BUILD_NUMBER > 1
- OMNITRACE_BUILD_LINKER option
- add -fuse-ld=${OMNITRACE_BUILD_LINKER}
- omnitrace_add_cache_option function

* Update workflows to set OMNITRACE_BUILD_NUMBER

* Fix generator expressions for -fuse-ld

* Suppress some configuration warnings during CI

- helps to keep track of real warnings when they arise

* Update timemory and dyninst submodules with CMP0135

* Add -V flag to run-ci script
2022-11-01 17:28:12 -05:00

166 lignes
6.0 KiB
CMake

# ------------------------------------------------------------------------------#
#
# Finds headers for MPI
#
# ------------------------------------------------------------------------------#
include(FindPackageHandleStandardArgs)
set(MPI_HEADERS_VENDOR_INTERNAL
"OpenMPI"
CACHE STRING "Distribution type of internal mpi.h")
set(MPI_HEADERS_INCLUDE_DIR_INTERNAL
"${PROJECT_SOURCE_DIR}/source/lib/omnitrace/library/tpls/mpi"
CACHE PATH "Path to internal ${MPI_HEADERS_VENDOR_INTERNAL} mpi.h")
mark_as_advanced(MPI_HEADERS_VENDOR_INTERNAL)
mark_as_advanced(MPI_HEADERS_INCLUDE_DIR_INTERNAL)
if(DEFINED _MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR
AND NOT _MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR STREQUAL MPI_HEADERS_INCLUDE_DIR)
unset(MPI_HEADERS_VENDOR CACHE)
# if skip mpicxx is on because of internal unset this value
if(MPI_HEADERS_SKIP_MPICXX AND "${_MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR}"
STREQUAL "${MPI_HEADERS_INCLUDE_DIR_INTERNAL}")
unset(MPI_HEADERS_SKIP_MPICXX CACHE)
endif()
endif()
# define the (OMPI|MPICH)_SKIP_MPICXX pp definition
option(MPI_HEADERS_SKIP_MPICXX "Skip MPI C++" ON)
mark_as_advanced(MPI_HEADERS_SKIP_MPICXX)
# ------------------------------------------------------------------------------#
#
# Try to find an openmpi header
#
# ------------------------------------------------------------------------------#
find_path(
MPI_HEADERS_INCLUDE_DIR
NAMES mpi.h
PATH_SUFFIXES include/openmpi openmpi include
HINTS ${MPI_ROOT_DIR}
PATHS ${MPI_ROOT_DIR})
# ------------------------------------------------------------------------------#
#
# If direct find failed, try to find MPI and use MPI_C_INCLUDE_DIRS
#
# ------------------------------------------------------------------------------#
if(NOT MPI_HEADERS_INCLUDE_DIR)
find_package(MPI QUIET)
if(MPI_C_INCLUDE_DIRS)
set(MPI_HEADERS_INCLUDE_DIR
${MPI_C_INCLUDE_DIRS}
CACHE PATH "Include directory for MPI" FORCE)
elseif(MPI_CXX_INCLUDE_DIRS)
set(MPI_HEADERS_INCLUDE_DIR
${MPI_CXX_INCLUDE_DIRS}
CACHE PATH "Include directory for MPI" FORCE)
endif()
endif()
# ------------------------------------------------------------------------------#
#
# If found, try to determine the MPI vendor (i.e. distribution)
#
# ------------------------------------------------------------------------------#
if(MPI_HEADERS_INCLUDE_DIR)
file(STRINGS ${MPI_HEADERS_INCLUDE_DIR}/mpi.h _MPI_H_LINES REGEX "#([ \t]+)define ")
foreach(_LINE ${_MPI_H_LINES})
if("${_LINE}" MATCHES "define([ \t]+)OMPI_")
set(MPI_HEADERS_VENDOR
"OpenMPI"
CACHE STRING "MPI headers are from OpenMPI distribution")
break()
elseif("${_LINE}" MATCHES "define([ \t]+)MPICH_")
set(MPI_HEADERS_VENDOR
"MPICH"
CACHE STRING "MPI headers are from MPICH distribution")
break()
elseif("${_LINE}" MATCHES "define([ \t]+)MVAPICH_")
set(MPI_HEADERS_VENDOR
"MVAPICH"
CACHE STRING "MPI headers are from MVAPICH distribution")
break()
endif()
endforeach()
endif()
# ------------------------------------------------------------------------------#
#
# If not found, use internal version or if vendor is MPICH set to internal
#
# ------------------------------------------------------------------------------#
if(NOT MPI_HEADERS_INCLUDE_DIR)
set(MPI_HEADERS_INCLUDE_DIR
"${MPI_HEADERS_INCLUDE_DIR_INTERNAL}"
CACHE PATH "" FORCE)
set(MPI_HEADERS_VENDOR
"${MPI_HEADERS_VENDOR_INTERNAL}"
CACHE STRING "MPI headers are from OpenMPI distribution" FORCE)
set(MPI_HEADERS_SKIP_MPICXX
ON
CACHE BOOL "" FORCE)
elseif("${MPI_HEADERS_VENDOR}" STREQUAL "MPICH")
option(
MPI_HEADERS_ALLOW_MPICH
"Permit the use of MPI headers from MPICH instead of using internal OpenMPI header"
OFF)
mark_as_advanced(MPI_HEADERS_ALLOW_MPICH)
if(NOT MPI_HEADERS_ALLOW_MPICH)
set(_MESSAGE "\nFound MPI headers belonging to a MPICH distribution. ")
set(_MESSAGE
"${_MESSAGE}The data types for MPICH will cause segfaults when an application uses OpenMPI, "
)
set(_MESSAGE
"${_MESSAGE}whereas the OpenMPI data types are compatible with both. ")
set(_MESSAGE
"${_MESSAGE}Forcing internal OpenMPI header... This can be disabled via MPI_HEADERS_ALLOW_MPICH=ON ...\n"
)
message(AUTHOR_WARNING "${_MESSAGE}")
unset(_MESSAGE)
set(MPI_HEADERS_INCLUDE_DIR
"${MPI_HEADERS_INCLUDE_DIR_INTERNAL}"
CACHE PATH "" FORCE)
set(MPI_HEADERS_VENDOR
"${MPI_HEADERS_VENDOR_INTERNAL}"
CACHE STRING "MPI headers are from OpenMPI distribution" FORCE)
set(MPI_HEADERS_SKIP_MPICXX
ON
CACHE BOOL "" FORCE)
endif()
endif()
# set local variable
if(MPI_HEADERS_INCLUDE_DIR)
set(MPI_HEADERS_INCLUDE_DIRS ${MPI_HEADERS_INCLUDE_DIR})
endif()
mark_as_advanced(MPI_HEADERS_INCLUDE_DIR)
# store value to detect changes
set(_MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR
"${MPI_HEADERS_INCLUDE_DIR}"
CACHE INTERNAL "Last value of MPI_HEADERS_INCLUDE_DIR")
# handle find_package
find_package_handle_standard_args(MPI-Headers REQUIRED_VARS MPI_HEADERS_INCLUDE_DIR)
if(MPI-Headers_FOUND)
add_library(MPI::MPI_HEADERS IMPORTED INTERFACE)
if(MPI_HEADERS_SKIP_MPICXX)
if(MPI_HEADERS_VENDOR STREQUAL "MPICH")
target_compile_definitions(MPI::MPI_HEADERS INTERFACE MPICH_SKIP_MPICXX=1)
else()
target_compile_definitions(MPI::MPI_HEADERS INTERFACE OMPI_SKIP_MPICXX=1)
endif()
endif()
target_include_directories(
MPI::MPI_HEADERS INTERFACE $<$<COMPILE_LANGUAGE:C>:${MPI_HEADERS_INCLUDE_DIR}>
$<$<COMPILE_LANGUAGE:CXX>:${MPI_HEADERS_INCLUDE_DIR}>)
endif()