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

Turn off cuco dependency in RAFT. Re-establish explicit cuco and libcuxx cmake dependencies #2132

Merged
merged 14 commits into from
Apr 19, 2022
Merged
17 changes: 14 additions & 3 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,21 @@ 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
# fetching those targets in cuGraph is redundant (at best), and potentially
# 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_thrust.cmake)
include(cmake/thirdparty/get_rmm.cmake)
include(cmake/thirdparty/get_libcudacxx.cmake)
include(cmake/thirdparty/get_cuco.cmake)

include(cmake/thirdparty/get_raft.cmake)
include(cmake/thirdparty/get_libcugraphops.cmake)

Expand Down Expand Up @@ -287,8 +292,11 @@ target_include_directories(cugraph
target_link_libraries(cugraph
PUBLIC
cugraphops::cugraphops
raft::raft
PRIVATE
raft::raft
cugraph::Thrust
cuco::cuco
cugraph::Thrust
cugraph::cuHornet
NCCL::NCCL
)
Expand Down Expand Up @@ -398,6 +406,9 @@ target_link_libraries(cugraph_c
CUDA::cusolver
CUDA::cusparse
PRIVATE
cugraph::Thrust
raft::raft
cuco::cuco
cugraph::cugraph
)

Expand Down
34 changes: 34 additions & 0 deletions cpp/cmake/thirdparty/get_cuco.cmake
Original file line number Diff line number Diff line change
@@ -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)
24 changes: 24 additions & 0 deletions cpp/cmake/thirdparty/get_libcudacxx.cmake
Original file line number Diff line number Diff line change
@@ -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()
1 change: 1 addition & 0 deletions cpp/cmake/thirdparty/get_raft.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function(find_and_configure_raft)
"RAFT_COMPILE_LIBRARIES OFF"
"BUILD_TESTS OFF"
"BUILD_BENCH OFF"
"RAFT_ENABLE_cuco_DEPENDENCY OFF"
)

if(raft_ADDED)
Expand Down
22 changes: 22 additions & 0 deletions cpp/cmake/thirdparty/get_rmm.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#=============================================================================
# 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_rmm)
include(${rapids-cmake-dir}/cpm/rmm.cmake)
rapids_cpm_rmm(BUILD_EXPORT_SET cugraph-exports)
endfunction()

find_and_configure_rmm()
23 changes: 23 additions & 0 deletions cpp/cmake/thirdparty/get_thrust.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# =============================================================================
# Copyright (c) 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.
# =============================================================================

# Use CPM to find or clone thrust
function(find_and_configure_thrust)
include(${rapids-cmake-dir}/cpm/thrust.cmake)

rapids_cpm_thrust(NAMESPACE cugraph)
rapids_export_package(BUILD Thrust cugraph-exports)
endfunction()

find_and_configure_thrust()
8 changes: 8 additions & 0 deletions cpp/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ target_include_directories(cugraphtestutil

target_link_libraries(cugraphtestutil
PUBLIC
raft::raft
cugraph::cugraph
NCCL::NCCL
)
Expand Down Expand Up @@ -72,6 +73,8 @@ function(ConfigureTest CMAKE_TEST_NAME)

target_link_libraries(${CMAKE_TEST_NAME}
PRIVATE
raft::raft
cugraph::Thrust
cugraphtestutil
cugraph::cugraph
GTest::gtest
Expand Down Expand Up @@ -148,6 +151,8 @@ function(ConfigureTestMG CMAKE_TEST_NAME)

target_link_libraries(${CMAKE_TEST_NAME}
PRIVATE
raft::raft
cugraph::Thrust
cugraphmgtestutil
cugraphtestutil
cugraph::cugraph
Expand Down Expand Up @@ -233,6 +238,7 @@ function(ConfigureCTest CMAKE_TEST_NAME)

target_link_libraries(${CMAKE_TEST_NAME}
PRIVATE
raft::raft
cugraph::cugraph_c
cugraph_c_testutil
GTest::gtest
Expand All @@ -257,6 +263,8 @@ function(ConfigureCTestMG CMAKE_TEST_NAME)

target_link_libraries(${CMAKE_TEST_NAME}
PRIVATE
raft::raft
cugraph::Thrust
cugraph::cugraph_c
cugraph_c_testutil
GTest::gtest
Expand Down