Skip to content

Commit

Permalink
Move edge triangle count to the stable API (#4382)
Browse files Browse the repository at this point in the history
This PR

1. Performs edge triangle count in chunk
2. Enables k - 1 core optimization
3. Add C++ tests for edge triangle count
4. Move edge triangle count to the stable API
5. Implement MG edge triangle count and add tests
6. Update 'mg_graph_to_sg_graph' to support 'edge_ids' along with tests

closes #4370
closes #4371

Authors:
  - Joseph Nke (https://github.com/jnke2016)
  - Rick Ratzel (https://github.com/rlratzel)

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

URL: #4382
  • Loading branch information
jnke2016 authored May 28, 2024
1 parent 30465c2 commit 1c3f3a8
Show file tree
Hide file tree
Showing 54 changed files with 1,448 additions and 514 deletions.
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ set(CUGRAPH_SOURCES
src/community/detail/refine_sg.cu
src/community/detail/refine_mg.cu
src/community/edge_triangle_count_sg.cu
src/community/edge_triangle_count_mg.cu
src/community/detail/maximal_independent_moves_sg.cu
src/community/detail/maximal_independent_moves_mg.cu
src/detail/utility_wrappers.cu
Expand Down
18 changes: 18 additions & 0 deletions cpp/include/cugraph/algorithms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2007,6 +2007,24 @@ void triangle_count(raft::handle_t const& handle,
raft::device_span<edge_t> counts,
bool do_expensive_check = false);

/*
* @brief Compute edge triangle counts.
*
* Compute edge triangle counts for the entire set of edges.
*
* @tparam vertex_t Type of vertex identifiers. Needs to be an integral type.
* @tparam edge_t Type of edge identifiers. Needs to be an integral type.
* @tparam multi_gpu Flag indicating whether template instantiation should target single-GPU (false)
* @param handle RAFT handle object to encapsulate resources (e.g. CUDA stream, communicator, and
* handles to various CUDA libraries) to run graph algorithms.
* @param graph_view Graph view object.
*
* @return edge_property_t containing the edge triangle count
*/
template <typename vertex_t, typename edge_t, bool multi_gpu>
edge_property_t<graph_view_t<vertex_t, edge_t, false, multi_gpu>, edge_t> edge_triangle_count(
raft::handle_t const& handle, graph_view_t<vertex_t, edge_t, false, multi_gpu> const& graph_view);

/*
* @brief Compute K-Truss.
*
Expand Down
361 changes: 290 additions & 71 deletions cpp/src/community/edge_triangle_count_impl.cuh

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions cpp/src/community/edge_triangle_count_mg.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2024, 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.
*/
#include "community/edge_triangle_count_impl.cuh"

namespace cugraph {

// SG instantiation
template edge_property_t<graph_view_t<int32_t, int32_t, false, true>, int32_t> edge_triangle_count(
raft::handle_t const& handle,
cugraph::graph_view_t<int32_t, int32_t, false, true> const& graph_view);

template edge_property_t<graph_view_t<int32_t, int64_t, false, true>, int64_t> edge_triangle_count(
raft::handle_t const& handle,
cugraph::graph_view_t<int32_t, int64_t, false, true> const& graph_view);

template edge_property_t<graph_view_t<int64_t, int64_t, false, true>, int64_t> edge_triangle_count(
raft::handle_t const& handle,
cugraph::graph_view_t<int64_t, int64_t, false, true> const& graph_view);

} // namespace cugraph
18 changes: 6 additions & 12 deletions cpp/src/community/edge_triangle_count_sg.cu
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,16 @@
namespace cugraph {

// SG instantiation
template rmm::device_uvector<int32_t> edge_triangle_count(
template edge_property_t<graph_view_t<int32_t, int32_t, false, false>, int32_t> edge_triangle_count(
raft::handle_t const& handle,
cugraph::graph_view_t<int32_t, int32_t, false, false> const& graph_view,
raft::device_span<int32_t> edgelist_srcs,
raft::device_span<int32_t> edgelist_dsts);
cugraph::graph_view_t<int32_t, int32_t, false, false> const& graph_view);

template rmm::device_uvector<int64_t> edge_triangle_count(
template edge_property_t<graph_view_t<int32_t, int64_t, false, false>, int64_t> edge_triangle_count(
raft::handle_t const& handle,
cugraph::graph_view_t<int32_t, int64_t, false, false> const& graph_view,
raft::device_span<int32_t> edgelist_srcs,
raft::device_span<int32_t> edgelist_dsts);
cugraph::graph_view_t<int32_t, int64_t, false, false> const& graph_view);

template rmm::device_uvector<int64_t> edge_triangle_count(
template edge_property_t<graph_view_t<int64_t, int64_t, false, false>, int64_t> edge_triangle_count(
raft::handle_t const& handle,
cugraph::graph_view_t<int64_t, int64_t, false, false> const& graph_view,
raft::device_span<int64_t> edgelist_srcs,
raft::device_span<int64_t> edgelist_dsts);
cugraph::graph_view_t<int64_t, int64_t, false, false> const& graph_view);

} // namespace cugraph
Loading

0 comments on commit 1c3f3a8

Please sign in to comment.