From 2f301ad120fe9c7cba9db8b2d4aa3219e0e7a1d6 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Mon, 25 Jul 2022 09:21:33 -0700 Subject: [PATCH] Make cuco a private dependency and leverage rapids-cmake (#2432) After #2398 cuco is not actually part of libcugraph's public API and should not be required by consumers. Since it is already not being installed, this PR removes it from the public link interface of libcugraph. This PR also uses rapids-cmake to fetch cuco, ensuring that libcugraph remains in sync with the rest of RAPIDS. There are a handful of tests that still rely on `libcugraph::detail` APIs that use cuco. To minimize the leakage of these dependencies, they are explicitly linked to cuco (rather than the current approach where they receive the cuco headers transitively from the libcugraph target). Authors: - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - Rick Ratzel (https://github.com/rlratzel) - Chuck Hastings (https://github.com/ChuckHastings) URL: https://github.com/rapidsai/cugraph/pull/2432 --- cpp/CMakeLists.txt | 9 ++++---- cpp/cmake/thirdparty/get_cuco.cmake | 34 ----------------------------- cpp/tests/CMakeLists.txt | 14 ++++++++++++ 3 files changed, 19 insertions(+), 38 deletions(-) delete mode 100644 cpp/cmake/thirdparty/get_cuco.cmake diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 5398b526a9e..24713376dd5 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -153,7 +153,8 @@ rapids_cpm_init() # Putting this before raft to override RAFT from pulling them in. include(cmake/thirdparty/get_libcudacxx.cmake) -include(cmake/thirdparty/get_cuco.cmake) +include(${rapids-cmake-dir}/cpm/cuco.cmake) +rapids_cpm_cuco(BUILD_EXPORT_SET cugraph-exports) include(cmake/thirdparty/get_raft.cmake) @@ -311,8 +312,8 @@ if (USE_CUGRAPH_OPS) PUBLIC cugraph-ops::cugraph-ops++ raft::raft - cuco::cuco PRIVATE + cuco::cuco cugraph::cuHornet NCCL::NCCL ) @@ -320,8 +321,8 @@ else() target_link_libraries(cugraph PUBLIC raft::raft - cuco::cuco PRIVATE + cuco::cuco cugraph::cuHornet NCCL::NCCL ) @@ -441,8 +442,8 @@ target_link_libraries(cugraph_c CUDA::cusolver CUDA::cusparse raft::raft - cuco::cuco PRIVATE + cuco::cuco cugraph::cugraph ) diff --git a/cpp/cmake/thirdparty/get_cuco.cmake b/cpp/cmake/thirdparty/get_cuco.cmake deleted file mode 100644 index ac1eb993d35..00000000000 --- a/cpp/cmake/thirdparty/get_cuco.cmake +++ /dev/null @@ -1,34 +0,0 @@ -#============================================================================= -# Copyright (c) 2021-2022, 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= - -function(find_and_configure_cuco VERSION) - - rapids_cpm_find(cuco ${VERSION} - GLOBAL_TARGETS cuco::cuco - BUILD_EXPORT_SET cugraph-exports - CPM_ARGS - EXCLUDE_FROM_ALL TRUE - GIT_REPOSITORY https://github.com/NVIDIA/cuCollections.git - GIT_TAG 55029034c3f82bca36148c9be29941b37492394d - OPTIONS "BUILD_TESTS OFF" - "BUILD_BENCHMARKS OFF" - "BUILD_EXAMPLES OFF" - ) - -endfunction() - -# cuCollections doesn't have a version yet -find_and_configure_cuco(0.0) diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index dead8173993..e4bb190f142 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -43,6 +43,8 @@ target_link_libraries(cugraphtestutil PUBLIC cugraph::cugraph NCCL::NCCL + PRIVATE + cuco::cuco ) @@ -467,6 +469,7 @@ ConfigureTest(RANDOM_WALKS_LOW_LEVEL_TEST sampling/rw_low_level_test.cu) ########################################################################################### # - MG NBR SAMPLING tests ----------------------------------------------------------------- ConfigureTest(UNIFORM_NEIGHBOR_SAMPLING_TEST sampling/sg_uniform_neighbor_sampling.cu) +target_link_libraries(UNIFORM_NEIGHBOR_SAMPLING_TEST PRIVATE cuco::cuco) ################################################################################################### # FIXME: since this is technically not a test, consider refactoring the the @@ -581,48 +584,59 @@ if(BUILD_CUGRAPH_MG_TESTS) ########################################################################################### # - MG PRIMS COUNT_IF_V tests ------------------------------------------------------------- ConfigureTestMG(MG_COUNT_IF_V_TEST prims/mg_count_if_v.cu) + target_link_libraries(MG_COUNT_IF_V_TEST PRIVATE cuco::cuco) ########################################################################################### # - MG PRIMS TRANSFORM_REDUCE_V_FRONTIER_OUTGOING_E_BY_DST tests -------------------------- ConfigureTestMG(MG_TRANSFORM_REDUCE_V_FRONTIER_OUTGOING_E_BY_DST_TEST prims/mg_transform_reduce_v_frontier_outgoing_e_by_dst.cu) + target_link_libraries(MG_TRANSFORM_REDUCE_V_FRONTIER_OUTGOING_E_BY_DST_TEST PRIVATE cuco::cuco) ########################################################################################### # - MG PRIMS REDUCE_V tests --------------------------------------------------------------- ConfigureTestMG(MG_REDUCE_V_TEST prims/mg_reduce_v.cu) + target_link_libraries(MG_REDUCE_V_TEST PRIVATE cuco::cuco) ########################################################################################### # - MG PRIMS TRANSFORM_REDUCE_V tests ----------------------------------------------------- ConfigureTestMG(MG_TRANSFORM_REDUCE_V_TEST prims/mg_transform_reduce_v.cu) + target_link_libraries(MG_TRANSFORM_REDUCE_V_TEST PRIVATE cuco::cuco) ########################################################################################### # - MG PRIMS TRANSFORM_REDUCE_E tests ----------------------------------------------------- ConfigureTestMG(MG_TRANSFORM_REDUCE_E_TEST prims/mg_transform_reduce_e.cu) + target_link_libraries(MG_TRANSFORM_REDUCE_E_TEST PRIVATE cuco::cuco) ########################################################################################### # - MG PRIMS COUNT_IF_E tests ------------------------------------------------------------- ConfigureTestMG(MG_COUNT_IF_E_TEST prims/mg_count_if_e.cu) + target_link_libraries(MG_COUNT_IF_E_TEST PRIVATE cuco::cuco) ########################################################################################### # - MG PRIMS PER_V_TRANSFORM_REDUCE_INCOMING_OUTGOING_E tests ----------------------------- ConfigureTestMG(MG_PER_V_TRANSFORM_REDUCE_INCOMING_OUTGOING_E_TEST prims/mg_per_v_transform_reduce_incoming_outgoing_e.cu) + target_link_libraries(MG_PER_V_TRANSFORM_REDUCE_INCOMING_OUTGOING_E_TEST PRIVATE cuco::cuco) ########################################################################################### # - MG PRIMS EXTRACT_IF_E tests ----------------------------------------------------------- ConfigureTestMG(MG_EXTRACT_IF_E_TEST prims/mg_extract_if_e.cu) + target_link_libraries(MG_EXTRACT_IF_E_TEST PRIVATE cuco::cuco) ########################################################################################### # - MG GATHER_UTILS tests ----------------------------------------------------------------- ConfigureTestMG(MG_GATHER_UTILS_TEST sampling/detail/mg_gather_utils.cu) + target_link_libraries(MG_GATHER_UTILS_TEST PRIVATE cuco::cuco) ########################################################################################### # - MG GATHER_ONE_HOP tests --------------------------------------------------------------- ConfigureTestMG(MG_GATHER_ONE_HOP_TEST sampling/detail/mg_gather_one_hop.cu) + target_link_libraries(MG_GATHER_ONE_HOP_TEST PRIVATE cuco::cuco) ########################################################################################### # - MG NBR SAMPLING tests ----------------------------------------------------------------- ConfigureTestMG(MG_UNIFORM_NEIGHBOR_SAMPLING_TEST sampling/mg_uniform_neighbor_sampling.cu) + target_link_libraries(MG_UNIFORM_NEIGHBOR_SAMPLING_TEST PRIVATE cuco::cuco) ########################################################################################### # - RANDOM_WALKS tests --------------------------------------------------------------------