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

Use rapids_cuda_set_runtime to determine cuda runtime usage by target #14833

Merged
merged 4 commits into from
Jan 23, 2024
Merged
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
16 changes: 5 additions & 11 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ include(../fetch_rapids.cmake)
include(rapids-cmake)
include(rapids-cpm)
include(rapids-cuda)
include(${rapids-cmake-dir}/cuda/set_runtime.cmake)
include(rapids-export)
include(rapids-find)

Expand Down Expand Up @@ -780,17 +781,7 @@ if(TARGET conda_env)
target_link_libraries(cudf PRIVATE conda_env)
endif()

if(CUDA_STATIC_RUNTIME)
# Tell CMake what CUDA language runtime to use
set_target_properties(cudf PROPERTIES CUDA_RUNTIME_LIBRARY Static)
# Make sure to export to consumers what runtime we used
target_link_libraries(cudf PUBLIC CUDA::cudart_static)
else()
# Tell CMake what CUDA language runtime to use
set_target_properties(cudf PROPERTIES CUDA_RUNTIME_LIBRARY Shared)
# Make sure to export to consumers what runtime we used
target_link_libraries(cudf PUBLIC CUDA::cudart)
endif()
rapids_cuda_set_runtime(cudf USE_STATIC ${CUDA_STATIC_RUNTIME})

file(
WRITE "${CUDF_BINARY_DIR}/fatbin.ld"
Expand Down Expand Up @@ -838,6 +829,7 @@ if(CUDF_BUILD_TESTUTIL)
PUBLIC cudf
PRIVATE $<TARGET_NAME_IF_EXISTS:conda_env>
)
rapids_cuda_set_runtime(cudftest_default_stream USE_STATIC ${CUDA_STATIC_RUNTIME})

add_library(cudf::cudftest_default_stream ALIAS cudftest_default_stream)

Expand Down Expand Up @@ -881,6 +873,7 @@ if(CUDF_BUILD_TESTUTIL)
cudftestutil PUBLIC "$<BUILD_INTERFACE:${CUDF_SOURCE_DIR}>"
"$<BUILD_INTERFACE:${CUDF_SOURCE_DIR}/src>"
)
rapids_cuda_set_runtime(cudftestutil USE_STATIC ${CUDA_STATIC_RUNTIME})
add_library(cudf::cudftestutil ALIAS cudftestutil)

endif()
Expand Down Expand Up @@ -919,6 +912,7 @@ if(CUDF_BUILD_STREAMS_TEST_UTIL)
if(CUDF_BUILD_STACKTRACE_DEBUG)
target_link_libraries(${_tgt} PRIVATE cudf_backtrace)
endif()
rapids_cuda_set_runtime(${_tgt} USE_STATIC ${CUDA_STATIC_RUNTIME})
add_library(cudf::${_tgt} ALIAS ${_tgt})

if("${_mode}" STREQUAL "testing")
Expand Down
5 changes: 3 additions & 2 deletions cpp/cmake/Modules/JitifyPreprocessKernels.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# =============================================================================
# Copyright (c) 2021-2023, NVIDIA CORPORATION.
# Copyright (c) 2021-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
Expand All @@ -16,7 +16,8 @@
add_executable(jitify_preprocess "${JITIFY_INCLUDE_DIR}/jitify2_preprocess.cpp")

target_compile_definitions(jitify_preprocess PRIVATE "_FILE_OFFSET_BITS=64")
target_link_libraries(jitify_preprocess CUDA::cudart ${CMAKE_DL_LIBS})
rapids_cuda_set_runtime(jitify_preprocess USE_STATIC ${CUDA_STATIC_RUNTIME})
target_link_libraries(jitify_preprocess PUBLIC ${CMAKE_DL_LIBS})

# Take a list of files to JIT-compile and run them through jitify_preprocess.
function(jit_preprocess_files)
Expand Down
1 change: 1 addition & 0 deletions cpp/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function(ConfigureTest CMAKE_TEST_NAME)
${CMAKE_TEST_NAME} PRIVATE cudftestutil GTest::gmock_main GTest::gtest_main
$<TARGET_NAME_IF_EXISTS:conda_env>
)
rapids_cuda_set_runtime(${CMAKE_TEST_NAME} USE_STATIC ${CUDA_STATIC_RUNTIME})
rapids_test_add(
NAME ${CMAKE_TEST_NAME}
COMMAND ${CMAKE_TEST_NAME}
Expand Down