From eae7795ee3ff0fc7df9f460cfc389a0d5b9606be Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Tue, 19 Apr 2022 15:53:31 -0400 Subject: [PATCH] Turn off cuco dependency in RAFT. Re-establish explicit `cuco` and `libcuxx` cmake dependencies (#2132) Note: This PR depends on https://github.com/rapidsai/raft/pull/540 and should work once it is merged. Authors: - Corey J. Nolet (https://github.com/cjnolet) Approvers: - Chuck Hastings (https://github.com/ChuckHastings) - Rick Ratzel (https://github.com/rlratzel) URL: https://github.com/rapidsai/cugraph/pull/2132 --- cpp/CMakeLists.txt | 10 +++++-- cpp/cmake/thirdparty/get_cuco.cmake | 34 +++++++++++++++++++++++ cpp/cmake/thirdparty/get_libcudacxx.cmake | 24 ++++++++++++++++ cpp/cmake/thirdparty/get_raft.cmake | 6 ++-- 4 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 cpp/cmake/thirdparty/get_cuco.cmake create mode 100644 cpp/cmake/thirdparty/get_libcudacxx.cmake diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 14440e20892..870c553815f 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -135,9 +135,7 @@ rapids_cpm_init() # following public header-only raft dependencies: # * RMM # * Thrust -# * libcu++ # * GTest/GMock -# * cuCollections # # The CMakeLists.txt for each of these projects are properly configured # to generate a build and install export-set, so reimplementing finding or @@ -145,6 +143,11 @@ rapids_cpm_init() # error-prone if something about those targets change and our implementation # lags behind. ### + +# Putting this before raft to override RAFT from pulling them in. +include(cmake/thirdparty/get_libcudacxx.cmake) +include(cmake/thirdparty/get_cuco.cmake) + include(cmake/thirdparty/get_raft.cmake) include(cmake/thirdparty/get_libcugraphops.cmake) @@ -290,6 +293,7 @@ target_link_libraries(cugraph PUBLIC cugraph-ops::cugraph-ops++ raft::raft + cuco::cuco PRIVATE cugraph::cuHornet NCCL::NCCL @@ -405,6 +409,8 @@ target_link_libraries(cugraph_c CUDA::curand CUDA::cusolver CUDA::cusparse + raft::raft + cuco::cuco PRIVATE cugraph::cugraph ) diff --git a/cpp/cmake/thirdparty/get_cuco.cmake b/cpp/cmake/thirdparty/get_cuco.cmake new file mode 100644 index 00000000000..63453071ece --- /dev/null +++ b/cpp/cmake/thirdparty/get_cuco.cmake @@ -0,0 +1,34 @@ +#============================================================================= +# 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 0ca860b824f5dc22cf8a41f09912e62e11f07d82 + 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/cmake/thirdparty/get_libcudacxx.cmake b/cpp/cmake/thirdparty/get_libcudacxx.cmake new file mode 100644 index 00000000000..41e5998a448 --- /dev/null +++ b/cpp/cmake/thirdparty/get_libcudacxx.cmake @@ -0,0 +1,24 @@ +# ============================================================================= +# Copyright (c) 2020-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. +# ============================================================================= + +# This function finds libcudacxx and sets any additional necessary environment variables. +function(find_and_configure_libcudacxx) + include(${rapids-cmake-dir}/cpm/libcudacxx.cmake) + + rapids_cpm_libcudacxx(BUILD_EXPORT_SET cugraph-exports + INSTALL_EXPORT_SET cugraph-exports) + +endfunction() + +find_and_configure_libcudacxx() diff --git a/cpp/cmake/thirdparty/get_raft.cmake b/cpp/cmake/thirdparty/get_raft.cmake index c659424fea9..431a511c2c8 100644 --- a/cpp/cmake/thirdparty/get_raft.cmake +++ b/cpp/cmake/thirdparty/get_raft.cmake @@ -32,6 +32,7 @@ function(find_and_configure_raft) BUILD_EXPORT_SET cugraph-exports INSTALL_EXPORT_SET cugraph-exports CPM_ARGS + EXCLUDE_FROM_ALL TRUE GIT_REPOSITORY https://github.com/${PKG_FORK}/raft.git GIT_TAG ${PKG_PINNED_TAG} SOURCE_SUBDIR cpp @@ -39,6 +40,7 @@ function(find_and_configure_raft) "RAFT_COMPILE_LIBRARIES OFF" "BUILD_TESTS OFF" "BUILD_BENCH OFF" + "RAFT_ENABLE_cuco_DEPENDENCY OFF" ) if(raft_ADDED) @@ -53,8 +55,8 @@ endfunction() # To use a different RAFT locally, set the CMake variable # CPM_raft_SOURCE=/path/to/local/raft find_and_configure_raft(VERSION ${CUGRAPH_MIN_VERSION_raft} - FORK rapidsai - PINNED_TAG branch-${CUGRAPH_BRANCH_VERSION_raft} + FORK cjnolet + PINNED_TAG build_2206_cuco_distance_component # When PINNED_TAG above doesn't match cugraph, # force local raft clone in build directory