From f873e238aa0e611f6352f7c91501a562eeaa6437 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 23 May 2024 18:32:58 -0400 Subject: [PATCH] Use rapids_cpm_nvtx3 to get same nvtx3 target state as rmm (#15840) We need to use the `rapids_cpm_nvtx3` so that the nvtx3 targets, and setup are consistent across rmm and cudf. If we don't we get errors around incorrect exports when building statically or link errors when building shared. Authors: - Robert Maynard (https://github.com/robertmaynard) Approvers: - Vyas Ramasubramani (https://github.com/vyasr) - Nghia Truong (https://github.com/ttnghia) - Jason Lowe (https://github.com/jlowe) URL: https://github.com/rapidsai/cudf/pull/15840 --- cpp/CMakeLists.txt | 4 ++-- cpp/benchmarks/CMakeLists.txt | 2 +- cpp/cmake/thirdparty/get_nvtx.cmake | 16 +++++++--------- cpp/tests/CMakeLists.txt | 4 ++-- java/src/main/native/CMakeLists.txt | 2 +- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 7390c465ccb..1eab51c8827 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -794,8 +794,8 @@ add_dependencies(cudf jitify_preprocess_run) target_link_libraries( cudf PUBLIC ${ARROW_LIBRARIES} CCCL::CCCL rmm::rmm - PRIVATE $ cuco::cuco ZLIB::ZLIB nvcomp::nvcomp kvikio::kvikio - $ nanoarrow + PRIVATE $ cuco::cuco ZLIB::ZLIB nvcomp::nvcomp + kvikio::kvikio $ nanoarrow ) # Add Conda library, and include paths if specified diff --git a/cpp/benchmarks/CMakeLists.txt b/cpp/benchmarks/CMakeLists.txt index 170cf27b72b..10f645dfec0 100644 --- a/cpp/benchmarks/CMakeLists.txt +++ b/cpp/benchmarks/CMakeLists.txt @@ -25,7 +25,7 @@ target_compile_options( target_link_libraries( cudf_datagen PUBLIC GTest::gmock GTest::gtest benchmark::benchmark nvbench::nvbench Threads::Threads cudf - cudftestutil nvtx3-cpp + cudftestutil nvtx3::nvtx3-cpp PRIVATE $ ) diff --git a/cpp/cmake/thirdparty/get_nvtx.cmake b/cpp/cmake/thirdparty/get_nvtx.cmake index c722c4f70f1..e236d586522 100644 --- a/cpp/cmake/thirdparty/get_nvtx.cmake +++ b/cpp/cmake/thirdparty/get_nvtx.cmake @@ -12,16 +12,14 @@ # the License. # ============================================================================= -# This function finds NVTX and sets any additional necessary environment variables. +# Need to call rapids_cpm_nvtx3 to get support for an installed version of nvtx3 and to support +# installing it ourselves function(find_and_configure_nvtx) - rapids_cpm_find( - NVTX3 3.1.0 - GLOBAL_TARGETS nvtx3-c nvtx3-cpp - CPM_ARGS - GIT_REPOSITORY https://github.com/NVIDIA/NVTX.git - GIT_TAG v3.1.0 - GIT_SHALLOW TRUE SOURCE_SUBDIR c - ) + include(${rapids-cmake-dir}/cpm/nvtx3.cmake) + + # Find or install nvtx3 + rapids_cpm_nvtx3(BUILD_EXPORT_SET cudf-exports INSTALL_EXPORT_SET cudf-exports) + endfunction() find_and_configure_nvtx() diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index db934818ae7..7db9a06e809 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -56,8 +56,8 @@ function(ConfigureTest CMAKE_TEST_NAME) target_link_libraries( ${CMAKE_TEST_NAME} - PRIVATE cudftestutil GTest::gmock GTest::gmock_main GTest::gtest GTest::gtest_main nvtx3-cpp - $ "${_CUDF_TEST_EXTRA_LIB}" + PRIVATE cudftestutil GTest::gmock GTest::gmock_main GTest::gtest GTest::gtest_main + nvtx3::nvtx3-cpp $ "${_CUDF_TEST_EXTRA_LIB}" ) rapids_cuda_set_runtime(${CMAKE_TEST_NAME} USE_STATIC ${CUDA_STATIC_RUNTIME}) rapids_test_add( diff --git a/java/src/main/native/CMakeLists.txt b/java/src/main/native/CMakeLists.txt index 0d5339a1402..56f8f9d0472 100644 --- a/java/src/main/native/CMakeLists.txt +++ b/java/src/main/native/CMakeLists.txt @@ -239,7 +239,7 @@ endif() # When nvcomp is installed we need to use nvcomp::nvcomp but from the cudf build directory it will # just be nvcomp. target_link_libraries( - cudfjni ${CUDF_LINK} PRIVATE nvtx3-cpp $ + cudfjni ${CUDF_LINK} PRIVATE nvtx3::nvtx3-cpp $ $ )