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

[FIX] Use rapids_find_package to get cugraph-ops #2148

Merged
merged 5 commits into from
Mar 27, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ rapids_cmake_build_type(Release)
option(BUILD_CUGRAPH_MG_TESTS "Build cuGraph multigpu algorithm tests" OFF)
option(CMAKE_CUDA_LINEINFO "Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler" OFF)
option(BUILD_TESTS "Configure CMake to build tests" ON)
option(BUILD_CUGRAPH_OPS_PYTHON_LIBRARY "Build cugraph-ops python library." OFF)

################################################################################
# - compiler options -----------------------------------------------------------
Expand Down Expand Up @@ -286,7 +287,7 @@ target_include_directories(cugraph
# - link libraries -------------------------------------------------------------
target_link_libraries(cugraph
PUBLIC
cugraphops::cugraphops
cugraph-ops::cugraph-ops++
raft::raft
PRIVATE
cugraph::cuHornet
Expand Down
56 changes: 40 additions & 16 deletions cpp/cmake/thirdparty/get_libcugraphops.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,50 @@
# limitations under the License.
#=============================================================================

function(find_and_configure_cugraphops)
set(CUGRAPH_MIN_VERSION_cugraph_ops "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}.00")
set(CUGRAPH_BRANCH_VERSION_cugraph_ops "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}")

if(TARGET cugraphops::cugraphops)
return()
endif()
function(find_and_configure_cugraph_ops)

rapids_find_generate_module(cugraphops
HEADER_NAMES graph/sampling.hpp
LIBRARY_NAMES cugraph-ops++
INCLUDE_SUFFIXES cugraph-ops
BUILD_EXPORT_SET cugraph-exports
INSTALL_EXPORT_SET cugraph-exports
)
set(oneValueArgs VERSION FORK PINNED_TAG CLONE_ON_PIN)
cmake_parse_arguments(PKG "" "${oneValueArgs}" "" ${ARGN} )

if(PKG_CLONE_ON_PIN AND NOT PKG_PINNED_TAG STREQUAL "branch-${CUGRAPH_BRANCH_VERSION_cugraph_ops}")
message("Pinned tag found: ${PKG_PINNED_TAG}. Cloning cugraph-ops locally.")
set(CPM_DOWNLOAD_cugraph-ops ON)
endif()

rapids_find_package(cugraphops
trxcllnt marked this conversation as resolved.
Show resolved Hide resolved
REQUIRED
BUILD_EXPORT_SET cugraph-exports
INSTALL_EXPORT_SET cugraph-exports
rapids_cpm_find(cugraph-ops ${PKG_VERSION}
trxcllnt marked this conversation as resolved.
Show resolved Hide resolved
GLOBAL_TARGETS cugraph-ops::cugraph-ops++
BUILD_EXPORT_SET cugraph-exports
INSTALL_EXPORT_SET cugraph-exports
CPM_ARGS
GIT_REPOSITORY https://github.com/${PKG_FORK}/cugraph-ops.git
GIT_TAG ${PKG_PINNED_TAG}
OPTIONS
"BUILD_CUGRAPH_OPS_CPP_LIBRARY ON"
"BUILD_CUGRAPH_OPS_CPP_TESTS OFF"
"BUILD_CUGRAPH_OPS_PYTHON_LIBRARY ${PKG_BUILD_CUGRAPH_OPS_PYTHON_LIBRARY}"
)

endfunction()

find_and_configure_cugraphops()
###
# Change pinned tag and fork here to test a commit in CI
#
# To use a locally-built cugraph-ops package, set the CMake variable
# `-D cugraph-ops_ROOT=/path/to/cugraph-ops/build`
#
# To use a local clone of cugraph-ops source and allow CMake to build
# cugraph-ops as part of building cugraph itself, set the CMake variable
# `-D CPM_cugraph-ops_SOURCE=/path/to/cugraph-ops`
###
find_and_configure_cugraph_ops(VERSION ${CUGRAPH_MIN_VERSION_cugraph_ops}
FORK rapidsai
PINNED_TAG branch-${CUGRAPH_BRANCH_VERSION_cugraph_ops}
# When PINNED_TAG above doesn't match cugraph,
# force local cugraph-ops clone in build directory
# even if it's already installed.
CLONE_ON_PIN ON
BUILD_CUGRAPH_OPS_PYTHON_LIBRARY ${BUILD_CUGRAPH_OPS_PYTHON_LIBRARY}
)
2 changes: 1 addition & 1 deletion cpp/cmake/thirdparty/get_raft.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ endfunction()

# Change pinned tag and fork here to test a commit in CI
# To use a different RAFT locally, set the CMake variable
# RPM_raft_SOURCE=/path/to/local/raft
# 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}
Expand Down