Skip to content

Commit 80d0ecb

Browse files
Refactor CMakeLists.txt to better express usage requirements (#4309)
Previously the cugraph CMakeLists.txt genernated non-relocatable targets due to embedding absolute paths to RAFT and the CUDAToolkit. While refactoring those issues out I also made a general cleanup pass over the rest of the CMake code. Authors: - Robert Maynard (https://github.com/robertmaynard) Approvers: - Vyas Ramasubramani (https://github.com/vyasr) - Bradley Dice (https://github.com/bdice) - Chuck Hastings (https://github.com/ChuckHastings) URL: #4309
1 parent 70a3892 commit 80d0ecb

File tree

3 files changed

+108
-150
lines changed

3 files changed

+108
-150
lines changed

cpp/CMakeLists.txt

Lines changed: 16 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ rapids_find_package(CUDAToolkit REQUIRED
7777
INSTALL_EXPORT_SET cugraph-exports
7878
)
7979

80+
set(CUGRAPH_C_FLAGS "")
8081
set(CUGRAPH_CXX_FLAGS "")
8182
set(CUGRAPH_CUDA_FLAGS "")
8283

@@ -106,6 +107,7 @@ endif()
106107

107108
if(NOT USE_CUGRAPH_OPS)
108109
message(STATUS "Disabling functions that reference cugraph-ops")
110+
list(APPEND CUGRAPH_C_FLAGS -DNO_CUGRAPH_OPS)
109111
list(APPEND CUGRAPH_CXX_FLAGS -DNO_CUGRAPH_OPS)
110112
list(APPEND CUGRAPH_CUDA_FLAGS -DNO_CUGRAPH_OPS)
111113
endif()
@@ -143,7 +145,6 @@ if(USE_CUGRAPH_OPS)
143145
include(cmake/thirdparty/get_libcugraphops.cmake)
144146
endif()
145147

146-
include(cmake/thirdparty/get_nccl.cmake)
147148

148149
if (BUILD_CUGRAPH_MTMG_TESTS)
149150
include(cmake/thirdparty/get_ucp.cmake)
@@ -339,49 +340,26 @@ target_include_directories(cugraph
339340
"$<INSTALL_INTERFACE:include>"
340341
)
341342

342-
set(COMPILED_RAFT_LIB "")
343-
if(CUDA_STATIC_RUNTIME)
344-
get_target_property(_includes raft::raft INTERFACE_INCLUDE_DIRECTORIES)
345-
target_include_directories(cugraph PUBLIC ${_includes})
346-
# Add CTK include paths because we make our CTK library links private below
347-
target_include_directories(cugraph SYSTEM PUBLIC ${CUDAToolkit_INCLUDE_DIRS})
348-
if(CUGRAPH_COMPILE_RAFT_LIB)
343+
set(COMPILED_RAFT_LIB )
344+
if(CUGRAPH_COMPILE_RAFT_LIB)
345+
set(COMPILED_RAFT_LIB raft::compiled)
346+
if(USE_RAFT_STATIC)
349347
set(COMPILED_RAFT_LIB raft::compiled_static)
350348
endif()
351-
else()
352-
if(CUGRAPH_COMPILE_RAFT_LIB)
353-
set(COMPILED_RAFT_LIB raft::compiled)
354-
endif()
355349
endif()
356350

357351
################################################################################
358352
# - link libraries -------------------------------------------------------------
359-
if (USE_CUGRAPH_OPS)
360-
target_link_libraries(cugraph
361-
PUBLIC
362-
rmm::rmm
363-
cugraph-ops::cugraph-ops++
364-
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:raft::raft>
365-
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:${COMPILED_RAFT_LIB}>
366-
PRIVATE
367-
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::raft>
368-
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:${COMPILED_RAFT_LIB}>
369-
cuco::cuco
370-
NCCL::NCCL
371-
)
372-
else()
373-
target_link_libraries(cugraph
374-
PUBLIC
375-
rmm::rmm
376-
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:raft::raft>
377-
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:${COMPILED_RAFT_LIB}>
378-
PRIVATE
379-
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::raft>
380-
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:${COMPILED_RAFT_LIB}>
381-
cuco::cuco
382-
NCCL::NCCL
353+
target_link_libraries(cugraph
354+
PUBLIC
355+
rmm::rmm
356+
raft::raft
357+
$<BUILD_LOCAL_INTERFACE:CUDA::toolkit>
358+
$<TARGET_NAME_IF_EXISTS:cugraph-ops::cugraph-ops++>
359+
PRIVATE
360+
${COMPILED_RAFT_LIB}
361+
cuco::cuco
383362
)
384-
endif()
385363

386364
################################################################################
387365
# - C-API library --------------------------------------------------------------
@@ -468,30 +446,9 @@ target_include_directories(cugraph_c
468446
"$<INSTALL_INTERFACE:include>"
469447
)
470448

471-
if(CUDA_STATIC_RUNTIME)
472-
get_target_property(_includes raft::raft INTERFACE_INCLUDE_DIRECTORIES)
473-
target_include_directories(cugraph_c PUBLIC ${_includes})
474-
# Add CTK include paths because we make our CTK library links private below
475-
target_include_directories(cugraph_c SYSTEM PUBLIC ${CUDAToolkit_INCLUDE_DIRS})
476-
set(_ctk_static_suffix "_static")
477-
endif()
478-
479449
################################################################################
480450
# - C-API link libraries -------------------------------------------------------
481-
target_link_libraries(cugraph_c
482-
PUBLIC
483-
CUDA::curand${_ctk_static_suffix}
484-
CUDA::cusolver${_ctk_static_suffix}
485-
CUDA::cusparse${_ctk_static_suffix}
486-
rmm::rmm
487-
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:raft::raft>
488-
$<$<NOT:$<BOOL:${CUDA_STATIC_RUNTIME}>>:${COMPILED_RAFT_LIB}>
489-
PRIVATE
490-
cuco::cuco
491-
cugraph::cugraph
492-
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::raft>
493-
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:${COMPILED_RAFT_LIB}>
494-
)
451+
target_link_libraries(cugraph_c PRIVATE cugraph::cugraph)
495452

496453
################################################################################
497454
# - generate tests -------------------------------------------------------------

cpp/src/prims/per_v_transform_reduce_dst_key_aggregated_outgoing_e.cuh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,8 @@ void per_v_transform_reduce_dst_key_aggregated_outgoing_e(
356356

357357
auto edge_partition_src_value_input =
358358
edge_partition_src_input_device_view_t(edge_src_value_input, i);
359-
auto edge_partition_e_value_input = edge_partition_e_input_device_view_t(edge_value_input, i);
359+
[[maybe_unused]] auto edge_partition_e_value_input =
360+
edge_partition_e_input_device_view_t(edge_value_input, i);
360361

361362
std::optional<rmm::device_uvector<edge_t>> offsets_with_mask{std::nullopt};
362363
if (edge_partition_e_mask) {
@@ -452,7 +453,7 @@ void per_v_transform_reduce_dst_key_aggregated_outgoing_e(
452453
rmm::device_uvector<vertex_t> unreduced_majors(max_chunk_size, handle.get_stream());
453454
rmm::device_uvector<vertex_t> unreduced_minor_keys(unreduced_majors.size(),
454455
handle.get_stream());
455-
auto unreduced_key_aggregated_edge_values =
456+
[[maybe_unused]] auto unreduced_key_aggregated_edge_values =
456457
detail::allocate_optional_dataframe_buffer<optional_edge_value_buffer_value_type>(
457458
unreduced_majors.size(), handle.get_stream());
458459
rmm::device_uvector<std::byte> d_tmp_storage(0, handle.get_stream());
@@ -761,7 +762,7 @@ void per_v_transform_reduce_dst_key_aggregated_outgoing_e(
761762

762763
rmm::device_uvector<vertex_t> rx_majors(0, handle.get_stream());
763764
rmm::device_uvector<vertex_t> rx_minor_keys(0, handle.get_stream());
764-
auto rx_key_aggregated_edge_values =
765+
[[maybe_unused]] auto rx_key_aggregated_edge_values =
765766
detail::allocate_optional_dataframe_buffer<optional_edge_value_buffer_value_type>(
766767
0, handle.get_stream());
767768
auto mem_frugal_flag =

0 commit comments

Comments
 (0)