Skip to content

Commit

Permalink
Merge branch 'branch-24.06' of https://github.com/rapidsai/cugraph in…
Browse files Browse the repository at this point in the history
…to enh_tc_with_mask
  • Loading branch information
seunghwak committed Apr 2, 2024
2 parents 7ebab44 + 528910e commit 2411bd4
Show file tree
Hide file tree
Showing 23 changed files with 1,729 additions and 346 deletions.
2 changes: 1 addition & 1 deletion ci/build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rapids-dependency-file-generator \
--file_key docs \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" | tee env.yaml

rapids-mamba-retry env create --force -f env.yaml -n docs
rapids-mamba-retry env create --yes -f env.yaml -n docs
conda activate docs

rapids-print-env
Expand Down
4 changes: 2 additions & 2 deletions ci/check_style.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2020-2022, NVIDIA CORPORATION.
# Copyright (c) 2020-2024, NVIDIA CORPORATION.

set -euo pipefail

Expand All @@ -11,7 +11,7 @@ rapids-dependency-file-generator \
--file_key checks \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" | tee env.yaml

rapids-mamba-retry env create --force -f env.yaml -n checks
rapids-mamba-retry env create --yes -f env.yaml -n checks
conda activate checks

# Run pre-commit checks
Expand Down
2 changes: 1 addition & 1 deletion ci/test_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rapids-dependency-file-generator \
--file_key test_cpp \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch)" | tee env.yaml

rapids-mamba-retry env create --force -f env.yaml -n test
rapids-mamba-retry env create --yes -f env.yaml -n test

# Temporarily allow unbound variables for conda activation.
set +u
Expand Down
4 changes: 2 additions & 2 deletions ci/test_notebooks.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2020-2023, NVIDIA CORPORATION.
# Copyright (c) 2020-2024, NVIDIA CORPORATION.

set -Eeuo pipefail

Expand All @@ -11,7 +11,7 @@ rapids-dependency-file-generator \
--file_key test_notebooks \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" | tee env.yaml

rapids-mamba-retry env create --force -f env.yaml -n test
rapids-mamba-retry env create --yes -f env.yaml -n test

# Temporarily allow unbound variables for conda activation.
set +u
Expand Down
10 changes: 7 additions & 3 deletions ci/test_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

set -euo pipefail

# TODO: Enable dask query planning (by default) once some bugs are fixed.
# xref: https://github.com/rapidsai/cudf/issues/15027
export DASK_DATAFRAME__QUERY_PLANNING=False

# Support invoking test_python.sh outside the script directory
cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../

Expand All @@ -14,7 +18,7 @@ rapids-dependency-file-generator \
--file_key test_python \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" | tee env.yaml

rapids-mamba-retry env create --force -f env.yaml -n test
rapids-mamba-retry env create --yes -f env.yaml -n test

# Temporarily allow unbound variables for conda activation.
set +u
Expand Down Expand Up @@ -141,7 +145,7 @@ if [[ "${RAPIDS_CUDA_VERSION}" == "11.8.0" ]]; then
if [[ "${RUNNER_ARCH}" != "ARM64" ]]; then
# we are only testing in a single cuda version
# because of pytorch and rapids compatibilty problems
rapids-mamba-retry env create --force -f env.yaml -n test_cugraph_dgl
rapids-mamba-retry env create --yes -f env.yaml -n test_cugraph_dgl

# activate test_cugraph_dgl environment for dgl
set +u
Expand Down Expand Up @@ -187,7 +191,7 @@ fi

if [[ "${RAPIDS_CUDA_VERSION}" == "11.8.0" ]]; then
if [[ "${RUNNER_ARCH}" != "ARM64" ]]; then
rapids-mamba-retry env create --force -f env.yaml -n test_cugraph_pyg
rapids-mamba-retry env create --yes -f env.yaml -n test_cugraph_pyg

# Temporarily allow unbound variables for conda activation.
set +u
Expand Down
4 changes: 4 additions & 0 deletions ci/test_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

set -eoxu pipefail

# TODO: Enable dask query planning (by default) once some bugs are fixed.
# xref: https://github.com/rapidsai/cudf/issues/15027
export DASK_DATAFRAME__QUERY_PLANNING=False

package_name=$1
package_dir=$2

Expand Down
32 changes: 3 additions & 29 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
message(FATAL_ERROR "GCC compiler must be at least 9.3")
endif()

# Remove the following archs from CMAKE_CUDA_ARCHITECTURES that
# cuhornet currently doesn't support
#
# >= 90
set(supported_archs "70" "72" "75" "80" "86" "89" "90")
foreach( arch IN LISTS CMAKE_CUDA_ARCHITECTURES)
string(REPLACE "-real" "" arch ${arch})
if( arch IN_LIST supported_archs )
list(APPEND usable_arch_values ${arch})
endif()
endforeach()
# Make sure everything but the 'newest' arch
# is marked as `-real` so we only generate PTX for
# arch > 86
list(POP_BACK usable_arch_values latest_arch)
list(TRANSFORM usable_arch_values APPEND "-real")
if (usable_arch_values)
list(APPEND usable_arch_values ${latest_arch})
else()
list(APPEND usable_arch_values ${latest_arch}-real)
endif()

set(CMAKE_CUDA_ARCHITECTURES ${usable_arch_values})

# Write the version header
rapids_cmake_write_version_file(include/cugraph/version_config.hpp)
rapids_cmake_write_version_file(include/cugraph_c/version_config.hpp)
Expand Down Expand Up @@ -168,7 +144,6 @@ if(USE_CUGRAPH_OPS)
endif()

include(cmake/thirdparty/get_nccl.cmake)
include(cmake/thirdparty/get_cuhornet.cmake)

if (BUILD_CUGRAPH_MTMG_TESTS)
include(cmake/thirdparty/get_ucp.cmake)
Expand Down Expand Up @@ -197,6 +172,7 @@ set(CUGRAPH_SOURCES
src/community/detail/common_methods_sg.cu
src/community/detail/refine_sg.cu
src/community/detail/refine_mg.cu
src/community/edge_triangle_count_sg.cu
src/community/detail/maximal_independent_moves_sg.cu
src/community/detail/maximal_independent_moves_mg.cu
src/detail/utility_wrappers.cu
Expand All @@ -222,10 +198,10 @@ set(CUGRAPH_SOURCES
src/community/ecg_sg.cu
src/community/ecg_mg.cu
src/community/legacy/louvain.cu
src/community/legacy/ktruss.cu
src/community/legacy/ecg.cu
src/community/egonet_sg.cu
src/community/egonet_mg.cu
src/community/k_truss_sg.cu
src/sampling/random_walks.cu
src/sampling/random_walks_sg.cu
src/sampling/detail/prepare_next_frontier_sg.cu
Expand Down Expand Up @@ -391,7 +367,6 @@ if (USE_CUGRAPH_OPS)
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::raft>
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:${COMPILED_RAFT_LIB}>
cuco::cuco
cugraph::cuHornet
NCCL::NCCL
)
else()
Expand All @@ -404,7 +379,6 @@ else()
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:raft::raft>
$<$<BOOL:${CUDA_STATIC_RUNTIME}>:${COMPILED_RAFT_LIB}>
cuco::cuco
cugraph::cuHornet
NCCL::NCCL
)
endif()
Expand All @@ -427,6 +401,7 @@ add_library(cugraph_c
src/c_api/eigenvector_centrality.cpp
src/c_api/betweenness_centrality.cpp
src/c_api/core_number.cpp
src/c_api/k_truss.cpp
src/c_api/core_result.cpp
src/c_api/extract_ego.cpp
src/c_api/ecg.cpp
Expand Down Expand Up @@ -455,7 +430,6 @@ add_library(cugraph_c
src/c_api/weakly_connected_components.cpp
src/c_api/strongly_connected_components.cpp
src/c_api/allgather.cpp
src/c_api/legacy_k_truss.cpp
)
add_library(cugraph::cugraph_c ALIAS cugraph_c)

Expand Down
45 changes: 0 additions & 45 deletions cpp/cmake/thirdparty/get_cuhornet.cmake

This file was deleted.

73 changes: 32 additions & 41 deletions cpp/include/cugraph/algorithms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,41 +427,6 @@ void connected_components(legacy::GraphCSRView<VT, ET, WT> const& graph,
cugraph_cc_t connectivity_type,
VT* labels);

/**
* @brief Compute k truss for a graph ** temporary
*
* K Truss is the maximal subgraph of a graph which contains at least three
* vertices where every edge is incident to at least k-2 triangles.
*
* This version is a temporary solution to clean up python integration through the C API.
*
* This version is only supported SG.
*
* @throws cugraph::logic_error with a custom message when an error
* occurs.
*
* @tparam vertex_t Type of vertex identifiers. Supported value : int (signed, 32-bit)
* @tparam weight_t Type of edge weights. Supported values : float or double.
*
* @param[in] handle Library handle (RAFT).
* @param[in] src Source vertices from COO
* @param[in] dst Destination vertices from COO
* @param[in] wgt Optional edge weights from COO
* @param[in] k The order of the truss
* @return Tuple containing extracted src, dst and optional weights for the
* subgraph
*/
template <typename vertex_t, typename weight_t>
std::tuple<rmm::device_uvector<vertex_t>,
rmm::device_uvector<vertex_t>,
std::optional<rmm::device_uvector<weight_t>>>
k_truss_subgraph(raft::handle_t const& handle,
raft::device_span<vertex_t> src,
raft::device_span<vertex_t> dst,
std::optional<raft::device_span<weight_t>> wgt,
size_t number_of_vertices,
int k);

/**
* @brief Compute Hungarian algorithm on a weighted bipartite graph
*
Expand Down Expand Up @@ -1842,7 +1807,7 @@ void weakly_connected_components(raft::handle_t const& handle,
enum class k_core_degree_type_t { IN = 0, OUT = 1, INOUT = 2 };

/**
* @brief Compute core numbers of individual vertices from K-core decomposition.
* @brief Compute core numbers of individual vertices from K-Core decomposition.
*
* The input graph should not have self-loops nor multi-edges. Currently, only undirected graphs are
* supported.
Expand All @@ -1855,11 +1820,11 @@ enum class k_core_degree_type_t { IN = 0, OUT = 1, INOUT = 2 };
* handles to various CUDA libraries) to run graph algorithms.
* @param graph_view Graph view object.
* @param core_numbers Pointer to the output core number array.
* @param degree_type Dictate whether to compute the K-core decomposition based on in-degrees,
* @param degree_type Dictate whether to compute the K-Core decomposition based on in-degrees,
* out-degrees, or in-degrees + out_degrees.
* @param k_first Find K-cores from K = k_first. Any vertices that do not belong to k_first-core
* @param k_first Find K-Cores from K = k_first. Any vertices that do not belong to k_first-core
* will have core numbers of 0.
* @param k_last Find K-cores to K = k_last. Any vertices that belong to (k_last)-core will have
* @param k_last Find K-Cores to K = k_last. Any vertices that belong to (k_last)-core will have
* their core numbers set to their degrees on k_last-core.
* @param do_expensive_check A flag to run expensive checks for input arguments (if set to `true`).
*/
Expand All @@ -1873,7 +1838,7 @@ void core_number(raft::handle_t const& handle,
bool do_expensive_check = false);

/**
* @brief Extract K Core of a graph
* @brief Extract K-Core of a graph
*
* @throws cugraph::logic_error when an error occurs.
*
Expand All @@ -1884,7 +1849,7 @@ void core_number(raft::handle_t const& handle,
* @param graph_view Graph view object.
* @param edge_weight_view Optional view object holding edge weights for @p graph_view.
* @param k Order of the core. This value must not be negative.
* @param degree_type Optional parameter to dictate whether to compute the K-core decomposition
* @param degree_type Optional parameter to dictate whether to compute the K-Core decomposition
* based on in-degrees, out-degrees, or in-degrees + out_degrees. One of @p
* degree_type and @p core_numbers must be specified.
* @param core_numbers Optional output from core_number algorithm. If not specified then
Expand Down Expand Up @@ -2040,6 +2005,32 @@ void triangle_count(raft::handle_t const& handle,
raft::device_span<edge_t> counts,
bool do_expensive_check = false);

/*
* @brief Compute K-Truss.
*
* Extract the K-Truss subgraph of a graph
*
* @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.
* @param edge_weight_view Optional view object holding edge weights for @p graph_view.
* @param k The desired k to be used for extracting the K-Truss subgraph
* @param do_expensive_check A flag to run expensive checks for input arguments (if set to `true`).
* @return edge list of the K-Truss subgraph
*/
template <typename vertex_t, typename edge_t, typename weight_t, bool multi_gpu>
std::tuple<rmm::device_uvector<vertex_t>,
rmm::device_uvector<vertex_t>,
std::optional<rmm::device_uvector<weight_t>>>
k_truss(raft::handle_t const& handle,
graph_view_t<vertex_t, edge_t, false, multi_gpu> const& graph_view,
std::optional<edge_property_view_t<edge_t, weight_t const*>> edge_weight_view,
edge_t k,
bool do_expensive_check = false);

/**
* @brief Compute Jaccard similarity coefficient
*
Expand Down
6 changes: 3 additions & 3 deletions cpp/include/cugraph/utilities/graph_traits.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2023, NVIDIA CORPORATION.
* Copyright (c) 2021-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.
Expand Down Expand Up @@ -67,8 +67,8 @@ struct is_candidate {
};

// meta-function that constrains
// all 3 template param candidates where vertex_t and edge_t
// are restricted to int32_t:
// vertex_t and edge_t are restricted to int32_t:
// FIXME: Drop this functor as it was only used by legacy K-Truss
//
template <typename vertex_t, typename edge_t, typename weight_t>
struct is_candidate_legacy {
Expand Down
Loading

0 comments on commit 2411bd4

Please sign in to comment.