Skip to content

Refactor CMakeLists.txt to better express usage requirements #4309

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

Merged
75 changes: 16 additions & 59 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ rapids_find_package(CUDAToolkit REQUIRED
INSTALL_EXPORT_SET cugraph-exports
)

set(CUGRAPH_C_FLAGS "")
set(CUGRAPH_CXX_FLAGS "")
set(CUGRAPH_CUDA_FLAGS "")

Expand Down Expand Up @@ -106,6 +107,7 @@ endif()

if(NOT USE_CUGRAPH_OPS)
message(STATUS "Disabling functions that reference cugraph-ops")
list(APPEND CUGRAPH_C_FLAGS -DNO_CUGRAPH_OPS)
list(APPEND CUGRAPH_CXX_FLAGS -DNO_CUGRAPH_OPS)
list(APPEND CUGRAPH_CUDA_FLAGS -DNO_CUGRAPH_OPS)
endif()
Expand Down Expand Up @@ -143,7 +145,6 @@ if(USE_CUGRAPH_OPS)
include(cmake/thirdparty/get_libcugraphops.cmake)
endif()

include(cmake/thirdparty/get_nccl.cmake)

if (BUILD_CUGRAPH_MTMG_TESTS)
include(cmake/thirdparty/get_ucp.cmake)
Expand Down Expand Up @@ -339,49 +340,26 @@ 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 )
if(CUGRAPH_COMPILE_RAFT_LIB)
set(COMPILED_RAFT_LIB raft::compiled)
if(USE_RAFT_STATIC)
set(COMPILED_RAFT_LIB raft::compiled_static)
endif()
else()
if(CUGRAPH_COMPILE_RAFT_LIB)
set(COMPILED_RAFT_LIB raft::compiled)
endif()
endif()

################################################################################
# - link libraries -------------------------------------------------------------
if (USE_CUGRAPH_OPS)
target_link_libraries(cugraph
PUBLIC
rmm::rmm
cugraph-ops::cugraph-ops++
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:raft::raft>
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:${COMPILED_RAFT_LIB}>
PRIVATE
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::raft>
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:${COMPILED_RAFT_LIB}>
cuco::cuco
NCCL::NCCL
)
else()
target_link_libraries(cugraph
PUBLIC
rmm::rmm
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:raft::raft>
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:${COMPILED_RAFT_LIB}>
PRIVATE
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::raft>
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:${COMPILED_RAFT_LIB}>
cuco::cuco
NCCL::NCCL
target_link_libraries(cugraph
PUBLIC
rmm::rmm
raft::raft
$<BUILD_LOCAL_INTERFACE:CUDA::toolkit>
$<TARGET_NAME_IF_EXISTS:cugraph-ops::cugraph-ops++>
PRIVATE
${COMPILED_RAFT_LIB}
cuco::cuco
)
endif()

################################################################################
# - C-API library --------------------------------------------------------------
Expand Down Expand Up @@ -468,30 +446,9 @@ target_include_directories(cugraph_c
"$<INSTALL_INTERFACE:include>"
)

if(CUDA_STATIC_RUNTIME)
get_target_property(_includes raft::raft INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(cugraph_c PUBLIC ${_includes})
# Add CTK include paths because we make our CTK library links private below
target_include_directories(cugraph_c SYSTEM PUBLIC ${CUDAToolkit_INCLUDE_DIRS})
set(_ctk_static_suffix "_static")
endif()

################################################################################
# - C-API link libraries -------------------------------------------------------
target_link_libraries(cugraph_c
PUBLIC
CUDA::curand${_ctk_static_suffix}
CUDA::cusolver${_ctk_static_suffix}
CUDA::cusparse${_ctk_static_suffix}
rmm::rmm
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:raft::raft>
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:${COMPILED_RAFT_LIB}>
PRIVATE
cuco::cuco
cugraph::cugraph
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::raft>
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:${COMPILED_RAFT_LIB}>
)
target_link_libraries(cugraph_c PRIVATE cugraph::cugraph)

################################################################################
# - generate tests -------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ void per_v_transform_reduce_dst_key_aggregated_outgoing_e(

auto edge_partition_src_value_input =
edge_partition_src_input_device_view_t(edge_src_value_input, i);
auto edge_partition_e_value_input = edge_partition_e_input_device_view_t(edge_value_input, i);
[[maybe_unused]] auto edge_partition_e_value_input =
edge_partition_e_input_device_view_t(edge_value_input, i);

std::optional<rmm::device_uvector<edge_t>> offsets_with_mask{std::nullopt};
if (edge_partition_e_mask) {
Expand Down Expand Up @@ -452,7 +453,7 @@ void per_v_transform_reduce_dst_key_aggregated_outgoing_e(
rmm::device_uvector<vertex_t> unreduced_majors(max_chunk_size, handle.get_stream());
rmm::device_uvector<vertex_t> unreduced_minor_keys(unreduced_majors.size(),
handle.get_stream());
auto unreduced_key_aggregated_edge_values =
[[maybe_unused]] auto unreduced_key_aggregated_edge_values =
detail::allocate_optional_dataframe_buffer<optional_edge_value_buffer_value_type>(
unreduced_majors.size(), handle.get_stream());
rmm::device_uvector<std::byte> d_tmp_storage(0, handle.get_stream());
Expand Down Expand Up @@ -761,7 +762,7 @@ void per_v_transform_reduce_dst_key_aggregated_outgoing_e(

rmm::device_uvector<vertex_t> rx_majors(0, handle.get_stream());
rmm::device_uvector<vertex_t> rx_minor_keys(0, handle.get_stream());
auto rx_key_aggregated_edge_values =
[[maybe_unused]] auto rx_key_aggregated_edge_values =
detail::allocate_optional_dataframe_buffer<optional_edge_value_buffer_value_type>(
0, handle.get_stream());
auto mem_frugal_flag =
Expand Down
Loading