Skip to content

Commit

Permalink
Merge branch 'branch-23.10-cugraph_nx_benchmarks' of https://github.c…
Browse files Browse the repository at this point in the history
…om/rlratzel/cugraph into branch-23.10-cugraph_nx_benchmarks
  • Loading branch information
rlratzel committed Oct 6, 2023
2 parents 8f00bbd + 2ec390e commit 9955b7c
Show file tree
Hide file tree
Showing 31 changed files with 976 additions and 331 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/cuda11.8-conda/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"args": {
"CUDA": "11.8",
"PYTHON_PACKAGE_MANAGER": "conda",
"BASE": "rapidsai/devcontainers:23.10-cpp-llvm16-cuda11.8-mambaforge-ubuntu22.04"
"BASE": "rapidsai/devcontainers:23.12-cpp-llvm16-cuda11.8-mambaforge-ubuntu22.04"
}
},
"hostRequirements": {"gpu": "optional"},
"features": {
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:23.10": {}
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:23.12": {}
},
"overrideFeatureInstallOrder": [
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils"
Expand Down
6 changes: 3 additions & 3 deletions .devcontainer/cuda11.8-pip/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"args": {
"CUDA": "11.8",
"PYTHON_PACKAGE_MANAGER": "pip",
"BASE": "rapidsai/devcontainers:23.10-cpp-llvm16-cuda11.8-ubuntu22.04"
"BASE": "rapidsai/devcontainers:23.12-cpp-llvm16-cuda11.8-ubuntu22.04"
}
},
"hostRequirements": {"gpu": "optional"},
"features": {
"ghcr.io/rapidsai/devcontainers/features/ucx:23.10": {"version": "1.14.1"},
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:23.10": {}
"ghcr.io/rapidsai/devcontainers/features/ucx:23.12": {"version": "1.14.1"},
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:23.12": {}
},
"overrideFeatureInstallOrder": [
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils"
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/cuda12.0-conda/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"args": {
"CUDA": "12.0",
"PYTHON_PACKAGE_MANAGER": "conda",
"BASE": "rapidsai/devcontainers:23.10-cpp-mambaforge-ubuntu22.04"
"BASE": "rapidsai/devcontainers:23.12-cpp-mambaforge-ubuntu22.04"
}
},
"hostRequirements": {"gpu": "optional"},
"features": {
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:23.10": {}
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:23.12": {}
},
"overrideFeatureInstallOrder": [
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils"
Expand Down
6 changes: 3 additions & 3 deletions .devcontainer/cuda12.0-pip/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"args": {
"CUDA": "12.0",
"PYTHON_PACKAGE_MANAGER": "pip",
"BASE": "rapidsai/devcontainers:23.10-cpp-llvm16-cuda12.0-ubuntu22.04"
"BASE": "rapidsai/devcontainers:23.12-cpp-llvm16-cuda12.0-ubuntu22.04"
}
},
"hostRequirements": {"gpu": "optional"},
"features": {
"ghcr.io/rapidsai/devcontainers/features/ucx:23.10": {"version": "1.14.1"},
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:23.10": {}
"ghcr.io/rapidsai/devcontainers/features/ucx:23.12": {"version": "1.14.1"},
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:23.12": {}
},
"overrideFeatureInstallOrder": [
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
wheel-build-nx-cugraph:
needs: wheel-publish-pylibcugraph
secrets: inherit
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-build.yaml@branch-23.10
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-build.yaml@branch-23.12
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand All @@ -125,7 +125,7 @@ jobs:
wheel-publish-nx-cugraph:
needs: wheel-build-nx-cugraph
secrets: inherit
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-publish.yaml@branch-23.10
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-publish.yaml@branch-23.12
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,23 +115,23 @@ jobs:
wheel-build-nx-cugraph:
needs: wheel-tests-pylibcugraph
secrets: inherit
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-build.yaml@branch-23.10
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-build.yaml@branch-23.12
with:
build_type: pull-request
script: ci/build_wheel_nx-cugraph.sh
wheel-tests-nx-cugraph:
needs: wheel-build-nx-cugraph
secrets: inherit
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-test.yaml@branch-23.10
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-test.yaml@branch-23.12
with:
build_type: pull-request
script: ci/test_wheel_nx-cugraph.sh
devcontainer:
secrets: inherit
uses: rapidsai/shared-action-workflows/.github/workflows/build-in-devcontainer.yaml@branch-23.10
uses: rapidsai/shared-action-workflows/.github/workflows/build-in-devcontainer.yaml@branch-23.12
with:
extra-repo-deploy-key: CUGRAPH_OPS_SSH_PRIVATE_DEPLOY_KEY
build_command: |
sccache -z;
build-all --verbose;
build-all --verbose -j$(nproc --ignore=1);
sccache -s;
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
script: ci/test_wheel_cugraph.sh
wheel-tests-nx-cugraph:
secrets: inherit
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-test.yaml@branch-23.10
uses: rapidsai/shared-action-workflows/.github/workflows/wheels-test.yaml@branch-23.12
with:
build_type: nightly
branch: ${{ inputs.branch }}
Expand Down
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ add_library(cugraph_c
src/c_api/labeling_result.cpp
src/c_api/weakly_connected_components.cpp
src/c_api/strongly_connected_components.cpp
src/c_api/legacy_k_truss.cpp
)
add_library(cugraph::cugraph_c ALIAS cugraph_c)

Expand Down
43 changes: 24 additions & 19 deletions cpp/include/cugraph/algorithms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,34 +430,39 @@ void connected_components(legacy::GraphCSRView<VT, ET, WT> const& graph,
VT* labels);

/**
* @brief Compute k truss for a graph
* @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.
*
* Note that current implementation does not support a weighted graph.
* This version is a temporary solution to clean up python integration through the C API.
*
* @throws cugraph::logic_error with a custom message when an error
* occurs.
* This version is only supported SG.
*
* @tparam VT Type of vertex identifiers. Supported value : int (signed,
* 32-bit)
* @tparam ET Type of edge identifiers. Supported value : int (signed,
* 32-bit)
* @tparam WT Type of edge weights. Supported values : float or double.
* @throws cugraph::logic_error with a custom message when an error
* occurs.
*
* @param[in] graph cuGraph graph descriptor, should contain the connectivity
* information as a COO
* @param[in] k The order of the truss
* @param[in] mr Memory resource used to allocate the returned graph
* @return Unique pointer to K Truss subgraph in COO format
* @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 VT, typename ET, typename WT>
std::unique_ptr<legacy::GraphCOO<VT, ET, WT>> k_truss_subgraph(
legacy::GraphCOOView<VT, ET, WT> const& graph,
int k,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
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);

// FIXME: Internally distances is of int (signed 32-bit) data type, but current
// template uses data from VT, ET, WT from the legacy::GraphCSR View even if weights
Expand Down
22 changes: 21 additions & 1 deletion cpp/include/cugraph/utilities/graph_traits.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-2023, 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 @@ -47,6 +47,16 @@ struct is_vertex_edge_combo {
(sizeof(vertex_t) <= sizeof(edge_t));
};

// meta-function that constrains
// vertex_t and edge_t template param candidates to only int32_t:
//
template <typename vertex_t, typename edge_t>
struct is_vertex_edge_combo_legacy {
static constexpr bool value = is_one_of<vertex_t, int32_t>::value &&
is_one_of<edge_t, int32_t>::value &&
(sizeof(vertex_t) <= sizeof(edge_t));
};

// meta-function that constrains
// all 3 template param candidates:
//
Expand All @@ -56,4 +66,14 @@ struct is_candidate {
is_vertex_edge_combo<vertex_t, edge_t>::value && is_one_of<weight_t, float, double>::value;
};

// meta-function that constrains
// all 3 template param candidates where vertex_t and edge_t
// are restricted to int32_t:
//
template <typename vertex_t, typename edge_t, typename weight_t>
struct is_candidate_legacy {
static constexpr bool value = is_vertex_edge_combo_legacy<vertex_t, edge_t>::value &&
is_one_of<weight_t, float, double>::value;
};

} // namespace cugraph
21 changes: 21 additions & 0 deletions cpp/include/cugraph_c/community_algorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,27 @@ cugraph_error_code_t cugraph_extract_ego(
cugraph_induced_subgraph_result_t** result,
cugraph_error_t** error);

/**
* @brief Extract k truss for a graph
*
* @param [in] handle Handle for accessing resources
* @param [in] graph Pointer to graph. NOTE: Graph might be modified if the storage
* needs to be transposed
* @param [in] k The order of the truss
* @param [in] do_expensive_check
* A flag to run expensive checks for input arguments (if set to true)
* @param [out] result Opaque object containing the extracted subgraph
* @param [out] error Pointer to an error object storing details of any error. Will
* be populated if error code is not CUGRAPH_SUCCESS
* @return error code
*/
cugraph_error_code_t cugraph_k_truss_subgraph(const cugraph_resource_handle_t* handle,
cugraph_graph_t* graph,
size_t k,
bool_t do_expensive_check,
cugraph_induced_subgraph_result_t** result,
cugraph_error_t** error);

/**
* @brief Opaque clustering output
*/
Expand Down
Loading

0 comments on commit 9955b7c

Please sign in to comment.