-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from cwpearson/cmake/mpi-vendor
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
function(kokkoscomm_set_mpi_vendor_variables) | ||
# Initialize the variables to false | ||
set(KOKKOSCOMM_IMPL_MPI_IS_MPICH FALSE CACHE BOOL "Is MPI MPICH") | ||
set(KOKKOSCOMM_IMPL_MPI_IS_OPENMPI FALSE CACHE BOOL "Is MPI OpenMPI") | ||
|
||
if(KOKKOSCOMM_ENABLE_MPI) | ||
if(NOT MPIEXEC_EXECUTABLE) | ||
message(WARNING "MPIEXEC_EXECUTABLE is not set - unable to determine MPI vendor") | ||
return() | ||
endif() | ||
|
||
# Get the directory of the MPI executable | ||
get_filename_component(MPIEXEC_DIR ${MPIEXEC_EXECUTABLE} DIRECTORY) | ||
|
||
# Check for mpichversion | ||
find_program(MPICHVERSION_EXECUTABLE mpichversion HINTS ${MPIEXEC_DIR}) | ||
find_program(OMPI_INFO_EXECUTABLE ompi_info HINTS ${MPIEXEC_DIR}) | ||
|
||
if (MPICHVERSION_EXECUTABLE AND OPENMPI_INFO_EXECUTABLE) | ||
message(WARNING "Both MPICHVERSION_EXECUTABLE and OMPI_INFO_EXECUTABLE are set - unable to determine MPI vendor") | ||
elseif(MPICHVERSION_EXECUTABLE) | ||
message(STATUS "Detected MPI as MPICH") | ||
set(KOKKOSCOMM_IMPL_MPI_IS_MPICH TRUE CACHE BOOL "Is MPI MPICH" FORCE) | ||
elseif(OMPI_INFO_EXECUTABLE) | ||
message(STATUS "Detected MPI as Open MPI") | ||
set(KOKKOSCOMM_IMPL_MPI_IS_OPENMPI TRUE CACHE BOOL "Is MPI OpenMPI" FORCE) | ||
endif() | ||
endif() | ||
endfunction() |