3 ##################################
6 # the package is needed
7 find_package(MPI REQUIRED)
9 # now perform some more in-depth tests of whether the MPI library supports CUDA memory
10 if (ENABLE_CUDA AND NOT DEFINED ENABLE_MPI_CUDA)
11 if (MPI_LIBRARY MATCHES mpich)
12 # find out if this is MVAPICH2
13 get_filename_component(_mpi_library_dir ${MPI_LIBRARY} PATH)
14 find_program(MPICH2_VERSION
15 NAMES mpichversion mpich2version
16 HINTS ${_mpi_library_dir} ${_mpi_library_dir}/../bin
19 execute_process(COMMAND ${MPICH2_VERSION}
20 OUTPUT_VARIABLE _output)
21 if (_output MATCHES "--enable-cuda")
23 message(STATUS "Found MVAPICH2 with CUDA support.")
26 elseif(MPI_LIBRARY MATCHES libmpi)
27 # find out if this is OpenMPI
28 get_filename_component(_mpi_library_dir ${MPI_LIBRARY} PATH)
29 find_program(OMPI_INFO
31 HINTS ${_mpi_library_dir} ${_mpi_library_dir}/../bin
34 execute_process(COMMAND ${OMPI_INFO}
35 OUTPUT_VARIABLE _output)
36 if (_output MATCHES "smcuda")
38 message(STATUS "Found OpenMPI with CUDA support.")
44 message(STATUS "MPI<->CUDA interoperability is available, but disabled by default.")
45 option(ENABLE_MPI_CUDA "Enable MPI<->CUDA interoperability" off)
47 message(STATUS "MPI<->CUDA interoperability does not appear to be available.")
48 option(ENABLE_MPI_CUDA "Enable MPI<->CUDA interoperability" off)
50 endif (ENABLE_CUDA AND NOT DEFINED ENABLE_MPI_CUDA)
53 # add include directories
54 include_directories(${MPI_C_INCLUDE_PATH})