Skip to content

Commit

Permalink
Use new raft::compiled_static targets (#3842)
Browse files Browse the repository at this point in the history
rapidsai/raft#1746 added static targets for RAFT that can be used directly now instead of building RAFT static explicitly

Authors:
  - Divye Gala (https://github.com/divyegala)

Approvers:
  - Chuck Hastings (https://github.com/ChuckHastings)

URL: #3842
  • Loading branch information
divyegala authored Sep 6, 2023
1 parent 2b4118a commit a5e08c0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
20 changes: 14 additions & 6 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,19 @@ target_include_directories(cugraph
"$<INSTALL_INTERFACE:include>"
)

set(COMPILED_RAFT_LIB "")
if(CUDA_STATIC_RUNTIME)
get_target_property(_includes raft::raft INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(cugraph PUBLIC ${_includes})
# Add CTK include paths because we make our CTK library links private below
target_include_directories(cugraph SYSTEM PUBLIC ${CUDAToolkit_INCLUDE_DIRS})
if(CUGRAPH_COMPILE_RAFT_LIB)
set(COMPILED_RAFT_LIB raft::compiled_static)
endif()
else()
if(CUGRAPH_COMPILE_RAFT_LIB)
set(COMPILED_RAFT_LIB raft::compiled)
endif()
endif()

################################################################################
Expand All @@ -361,10 +369,10 @@ if (USE_CUGRAPH_OPS)
rmm::rmm
cugraph-ops::cugraph-ops++
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:raft::raft>
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:raft::compiled>
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:${COMPILED_RAFT_LIB}>
PRIVATE
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::raft>
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::compiled>
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:${COMPILED_RAFT_LIB}>
cuco::cuco
cugraph::cuHornet
NCCL::NCCL
Expand All @@ -374,10 +382,10 @@ else()
PUBLIC
rmm::rmm
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:raft::raft>
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:raft::compiled>
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:${COMPILED_RAFT_LIB}>
PRIVATE
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::raft>
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::compiled>
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:${COMPILED_RAFT_LIB}>
cuco::cuco
cugraph::cuHornet
NCCL::NCCL
Expand Down Expand Up @@ -481,12 +489,12 @@ target_link_libraries(cugraph_c
CUDA::cusparse${_ctk_static_suffix}
rmm::rmm
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:raft::raft>
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:raft::compiled>
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:${COMPILED_RAFT_LIB}>
PRIVATE
cuco::cuco
cugraph::cugraph
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::raft>
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::compiled>
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:${COMPILED_RAFT_LIB}>
)

################################################################################
Expand Down
12 changes: 7 additions & 5 deletions cpp/cmake/thirdparty/get_raft.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,19 @@ function(find_and_configure_raft)
set(CPM_DOWNLOAD_raft ON)
endif()

set(BUILD_RAFT_SHARED ON)
if(PKG_USE_RAFT_STATIC)
set(BUILD_RAFT_SHARED OFF)
if(PKG_COMPILE_RAFT_LIB)
if(NOT PKG_USE_RAFT_STATIC)
string(APPEND RAFT_COMPONENTS " compiled")
else()
string(APPEND RAFT_COMPONENTS " compiled_static")
endif()
endif()

rapids_cpm_find(raft ${PKG_VERSION}
GLOBAL_TARGETS raft::raft
BUILD_EXPORT_SET cugraph-exports
INSTALL_EXPORT_SET cugraph-exports
COMPONENTS compiled
COMPONENTS ${RAFT_COMPONENTS}
CPM_ARGS
EXCLUDE_FROM_ALL TRUE
GIT_REPOSITORY https://github.com/${PKG_FORK}/raft.git
Expand All @@ -49,7 +52,6 @@ function(find_and_configure_raft)
"RAFT_COMPILE_LIBRARY ${PKG_COMPILE_RAFT_LIB}"
"BUILD_TESTS OFF"
"BUILD_BENCH OFF"
"BUILD_SHARED_LIBS ${BUILD_RAFT_SHARED}"
)

if(raft_ADDED)
Expand Down
2 changes: 1 addition & 1 deletion python/cugraph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ if(NOT cugraph_FOUND)
# Statically link dependencies if building wheels
set(CUDA_STATIC_RUNTIME ON)
set(USE_RAFT_STATIC ON)
set(CUGRAPH_COMPILE_RAFT_DIST_LIBS OFF)
set(CUGRAPH_COMPILE_RAFT_LIB ON)
set(CUGRAPH_USE_CUGRAPH_OPS_STATIC ON)
set(CUGRAPH_EXCLUDE_CUGRAPH_OPS_FROM_ALL ON)
set(ALLOW_CLONE_CUGRAPH_OPS ON)
Expand Down
2 changes: 1 addition & 1 deletion python/pylibcugraph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ if (NOT cugraph_FOUND)
# Statically link dependencies if building wheels
set(CUDA_STATIC_RUNTIME ON)
set(USE_RAFT_STATIC ON)
set(CUGRAPH_COMPILE_RAFT_DIST_LIBS OFF)
set(CUGRAPH_COMPILE_RAFT_LIB ON)
set(CUGRAPH_USE_CUGRAPH_OPS_STATIC ON)
set(CUGRAPH_EXCLUDE_CUGRAPH_OPS_FROM_ALL ON)
set(ALLOW_CLONE_CUGRAPH_OPS ON)
Expand Down

0 comments on commit a5e08c0

Please sign in to comment.