Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the capability to detect if linked kokkos enabled rdc and to a… #56

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,19 @@ install(
# install flcl module files in include directory
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mod/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")

# add rdc stuff if building tests or examples
if(BUILD_TESTING OR BUILD_EXAMPLES)
# get kokkos flags from kokkos package
get_target_property(Kokkos_FLAGS Kokkos::kokkoscore INTERFACE_COMPILE_OPTIONS)
# set the USE_RDC variable if kokkos has set it
string(REGEX MATCH "relocatable-device-code=true"
USE_RDC "${Kokkos_FLAGS}")
mark_as_advanced(USE_RDC)
if(USE_RDC)
enable_language(CUDA)
endif()
endif()

#unit testing section and toggle
if(BUILD_TESTING)
add_subdirectory(test)
Expand Down
3 changes: 3 additions & 0 deletions examples/01-axpy-ndarray/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ endif()
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
set_target_properties(example-axpy-ndarray PROPERTIES LINKER_LANGUAGE Fortran)
endif()
if(USE_RDC)
set_target_properties(example-axpy-ndarray PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
endif()
set(RPATHS "$ENV{LD_LIBRARY_PATH}")
set_target_properties(example-axpy-ndarray PROPERTIES
BUILD_WITH_INSTALL_RPATH True
Expand Down
3 changes: 3 additions & 0 deletions examples/02-axpy-dualview/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ endif()
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
set_target_properties(example-axpy-dualview PROPERTIES LINKER_LANGUAGE Fortran)
endif()
if(USE_RDC)
set_target_properties(example-axpy-dualview PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
endif()
set(RPATHS "$ENV{LD_LIBRARY_PATH}")
set_target_properties(example-axpy-dualview PROPERTIES
BUILD_WITH_INSTALL_RPATH True
Expand Down
3 changes: 3 additions & 0 deletions examples/03-axpy-view/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ endif()
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
set_target_properties(example-axpy-view PROPERTIES LINKER_LANGUAGE Fortran)
endif()
if(USE_RDC)
set_target_properties(example-axpy-view PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
endif()
set(RPATHS "$ENV{LD_LIBRARY_PATH}")
set_target_properties(example-axpy-view PROPERTIES
BUILD_WITH_INSTALL_RPATH True
Expand Down
3 changes: 3 additions & 0 deletions examples/04-complex-ndarray/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ endif()
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
set_target_properties(example-complex-ndarray PROPERTIES LINKER_LANGUAGE Fortran)
endif()
if(USE_RDC)
set_target_properties(example-complex-ndarray PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
endif()
set(RPATHS "$ENV{LD_LIBRARY_PATH}")
set_target_properties(example-complex-ndarray PROPERTIES
BUILD_WITH_INSTALL_RPATH True
Expand Down
4 changes: 4 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ foreach(file ${files})
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
set_target_properties(${file_without_ext} PROPERTIES LINKER_LANGUAGE Fortran)
endif()
if(USE_RDC)
set_target_properties(${file_without_ext} PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
endif()

set(RPATHS "$ENV{LD_LIBRARY_PATH}")
set_target_properties(${file_without_ext} PROPERTIES
BUILD_WITH_INSTALL_RPATH True
Expand Down