Skip to content

Commit

Permalink
only do CUDA-specific test when CUDA is enabled
Browse files Browse the repository at this point in the history
Signed-off-by: Carl Pearson <cwpears@sandia.gov>
  • Loading branch information
cwpearson committed Feb 19, 2025
1 parent e496036 commit 8c958bd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions unit_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,24 @@ if(KOKKOSCOMM_ENABLE_MPI)
${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 2 ./test-mpi
)

add_executable(test-mpi-sendrecv)
target_sources(test-mpi-sendrecv PRIVATE mpi/test_mpi_sendrecv.cpp)
target_link_libraries(test-mpi-sendrecv MPI::MPI_CXX)
if (KOKKOS_ENABLE_CUDA)
add_executable(test-mpi-cuda-sendrecv)
target_sources(test-mpi-cuda-sendrecv PRIVATE mpi/test_mpi_cuda_sendrecv.cpp)
target_link_libraries(test-mpi-cuda-sendrecv MPI::MPI_CXX)

# MPICH needs dynamic cudart (we think, pmodels/mpich#7304)
if (KOKKOSCOMM_IMPL_MPI_IS_MPICH AND KOKKOS_ENABLE_CUDA)
# this one doesn't work for reasons I don't understand
# set_target_properties(test-mpi-sendrecv PROPERTIES CUDA_RUNTIME_LIBRARY Shared)
# this one does work
target_compile_options(test-mpi-sendrecv PUBLIC --cudart shared)
target_link_options(test-mpi-sendrecv PUBLIC --cudart shared)
# MPICH needs dynamic cudart (we think, pmodels/mpich#7304)
if (KOKKOSCOMM_IMPL_MPI_IS_MPICH AND KOKKOS_ENABLE_CUDA)
# Setting the CUDA_RUNTIME_LIBRARY property on this target to "Shared" doesn't work for
# reasons I don't understand.
target_compile_options(test-mpi-cuda-sendrecv PUBLIC --cudart shared)
target_link_options(test-mpi-cuda-sendrecv PUBLIC --cudart shared)
endif()
add_test(
NAME test-mpi-cuda-sendrecv
COMMAND
${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 2 ./test-mpi-cuda-sendrecv
)
endif()
add_test(
NAME test-mpi-sendrecv
COMMAND
${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 2 ./test-mpi-sendrecv
)


endif()
Expand Down
File renamed without changes.

0 comments on commit 8c958bd

Please sign in to comment.