Skip to content

Commit

Permalink
Merge pull request #3774 from nv-rliu/branch-23.10-merge-23.08
Browse files Browse the repository at this point in the history
Forward-merge branch-23.08 to branch-23.10
  • Loading branch information
raydouglass authored Aug 10, 2023
2 parents d1c5343 + 5204c36 commit c55151c
Show file tree
Hide file tree
Showing 212 changed files with 5,459 additions and 1,991 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
branch: ${{ inputs.branch }}
date: ${{ inputs.date }}
sha: ${{ inputs.sha }}
node_type: cpu32
python-build:
needs: [cpp-build]
secrets: inherit
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: rapidsai/shared-action-workflows/.github/workflows/[email protected]
with:
build_type: pull-request
node_type: cpu16
node_type: cpu32
conda-cpp-tests:
needs: conda-cpp-build
secrets: inherit
Expand Down
34 changes: 33 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ if hasArg --cmake_default_generator; then
CMAKE_GENERATOR_OPTION=""
fi
if hasArg --pydevelop; then
PYTHON_ARGS_FOR_INSTALL="-m pip install --no-build-isolation --no-deps -e ."
PYTHON_ARGS_FOR_INSTALL="-m pip install --no-build-isolation --no-deps -e"
fi

# Append `-DFIND_RAFT_CPP=ON` to EXTRA_CMAKE_ARGS unless a user specified the option.
Expand Down Expand Up @@ -302,6 +302,22 @@ if buildAll || hasArg pylibcugraph; then
if hasArg --clean; then
cleanPythonDir ${REPODIR}/python/pylibcugraph
else
# FIXME: skbuild with setuptools>=64 has a bug when called from a "pip
# install -e" command, resulting in a broken editable wheel. Continue
# to use "setup.py bdist_ext --inplace" for a develop build until
# https://github.com/scikit-build/scikit-build/issues/981 is closed.
if hasArg --pydevelop; then
cd ${REPODIR}/python/pylibcugraph
python setup.py build_ext \
--inplace \
-- \
-DFIND_CUGRAPH_CPP=ON \
-DUSE_CUGRAPH_OPS=${BUILD_WITH_CUGRAPHOPS} \
-Dcugraph_ROOT=${LIBCUGRAPH_BUILD_DIR} \
-- \
-j${PARALLEL_LEVEL:-1}
cd -
fi
SKBUILD_CONFIGURE_OPTIONS="${SKBUILD_EXTRA_CMAKE_ARGS} -DUSE_CUGRAPH_OPS=${BUILD_WITH_CUGRAPHOPS}" \
SKBUILD_BUILD_OPTIONS="-j${PARALLEL_LEVEL}" \
python ${PYTHON_ARGS_FOR_INSTALL} ${REPODIR}/python/pylibcugraph
Expand All @@ -313,6 +329,22 @@ if buildAll || hasArg cugraph; then
if hasArg --clean; then
cleanPythonDir ${REPODIR}/python/cugraph
else
# FIXME: skbuild with setuptools>=64 has a bug when called from a "pip
# install -e" command, resulting in a broken editable wheel. Continue
# to use "setup.py bdist_ext --inplace" for a develop build until
# https://github.com/scikit-build/scikit-build/issues/981 is closed.
if hasArg --pydevelop; then
cd ${REPODIR}/python/cugraph
python setup.py build_ext \
--inplace \
-- \
-DFIND_CUGRAPH_CPP=ON \
-DUSE_CUGRAPH_OPS=${BUILD_WITH_CUGRAPHOPS} \
-Dcugraph_ROOT=${LIBCUGRAPH_BUILD_DIR} \
-- \
-j${PARALLEL_LEVEL:-1}
cd -
fi
SKBUILD_CONFIGURE_OPTIONS="${SKBUILD_EXTRA_CMAKE_ARGS} -DUSE_CUGRAPH_OPS=${BUILD_WITH_CUGRAPHOPS}" \
SKBUILD_BUILD_OPTIONS="-j${PARALLEL_LEVEL}" \
python ${PYTHON_ARGS_FOR_INSTALL} ${REPODIR}/python/cugraph
Expand Down
2 changes: 1 addition & 1 deletion ci/test_wheel_cugraph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RAPIDS_PY_WHEEL_NAME="pylibcugraph_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-whe
python -m pip install --no-deps ./local-pylibcugraph-dep/pylibcugraph*.whl

# Always install latest dask for testing
python -m pip install git+https://github.com/dask/dask.git@main git+https://github.com/dask/distributed.git@main git+https://github.com/rapidsai/[email protected]
python -m pip install git+https://github.com/dask/dask.git@2023.7.1 git+https://github.com/dask/distributed.git@2023.7.1 git+https://github.com/rapidsai/[email protected]

# Only download test data for x86
arch=$(uname -m)
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/cugraph-pyg/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ requirements:
- python
- scikit-build >=0.13.1
run:
- distributed >=2023.5.1
- distributed ==2023.7.1
- numba >=0.57
- numpy >=1.21
- python
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/cugraph-service/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ outputs:
- cupy >=12.0.0
- dask-cuda ={{ minor_version }}
- dask-cudf ={{ minor_version }}
- distributed >=2023.5.1
- distributed ==2023.7.1
- numba >=0.57
- numpy >=1.21
- python
Expand Down
6 changes: 3 additions & 3 deletions conda/recipes/cugraph/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ requirements:
- cupy >=12.0.0
- dask-cuda ={{ minor_version }}
- dask-cudf ={{ minor_version }}
- dask >=2023.5.1
- dask-core >=2023.5.1
- distributed >=2023.5.1
- dask ==2023.7.1
- dask-core ==2023.7.1
- distributed ==2023.7.1
- libcugraph ={{ version }}
- pylibcugraph ={{ version }}
- pylibraft ={{ minor_version }}
Expand Down
25 changes: 13 additions & 12 deletions cpp/include/cugraph/graph_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,15 +922,16 @@ rmm::device_uvector<vertex_t> select_random_vertices(
* This function renumbers sampling function (e.g. uniform_neighbor_sample) outputs satisfying the
* following requirements.
*
* 1. Say @p edgelist_srcs has N unique vertices. These N unique vertices will be mapped to [0, N).
* 2. Among the N unique vertices, an original vertex with a smaller attached hop number will be
* renumbered to a smaller vertex ID than any other original vertices with a larger attached hop
* number (if @p edgelist_hops.has_value() is true). If a single vertex is attached to multiple hop
* numbers, the minimum hop number is used.
* 3. Say @p edgelist_dsts has M unique vertices that appear only in @p edgelist_dsts (the set of M
* unique vertices does not include any vertices that appear in @p edgelist_srcs). Then, these M
* unique vertices will be mapped to [N, N + M).
* 4. If label_offsets.has_value() is ture, edge lists for different labels will be renumbered
* 1. If @p edgelist_hops is valid, we can consider (vertex ID, flag=src, hop) triplets for each
* vertex ID in @p edgelist_srcs and (vertex ID, flag=dst, hop) triplets for each vertex ID in @p
* edgelist_dsts. From these triplets, we can find the minimum (hop, flag) pairs for every unique
* vertex ID (hop is the primary key and flag is the secondary key, flag=src is considered smaller
* than flag=dst if hop numbers are same). Vertex IDs with smaller (hop, flag) pairs precede vertex
* IDs with larger (hop, flag) pairs in renumbering. Ordering can be arbitrary among the vertices
* with the same (hop, flag) pairs.
* 2. If @p edgelist_hops is invalid, unique vertex IDs in @p edgelist_srcs precede vertex IDs that
* appear only in @p edgelist_dsts.
* 3. If label_offsets.has_value() is ture, edge lists for different labels will be renumbered
* separately.
*
* This function is single-GPU only (we are not aware of any practical multi-GPU use cases).
Expand All @@ -940,10 +941,10 @@ rmm::device_uvector<vertex_t> select_random_vertices(
* @param handle RAFT handle object to encapsulate resources (e.g. CUDA stream, communicator, and
* handles to various CUDA libraries) to run graph algorithms.
* @param edgelist_srcs A vector storing original edgelist source vertices.
* @param edgelist_hops An optional pointer to the array storing hops for each edge list source
* vertices (size = @p edgelist_srcs.size()).
* @param edgelist_dsts A vector storing original edgelist destination vertices (size = @p
* edgelist_srcs.size()).
* @param edgelist_hops An optional pointer to the array storing hops for each edge list (source,
* destination) pairs (size = @p edgelist_srcs.size() if valid).
* @param label_offsets An optional tuple of unique labels and the input edge list (@p
* edgelist_srcs, @p edgelist_hops, and @p edgelist_dsts) offsets for the labels (siez = # unique
* labels + 1).
Expand All @@ -962,8 +963,8 @@ std::tuple<rmm::device_uvector<vertex_t>,
renumber_sampled_edgelist(
raft::handle_t const& handle,
rmm::device_uvector<vertex_t>&& edgelist_srcs,
std::optional<raft::device_span<int32_t const>> edgelist_hops,
rmm::device_uvector<vertex_t>&& edgelist_dsts,
std::optional<raft::device_span<int32_t const>> edgelist_hops,
std::optional<std::tuple<raft::device_span<label_t const>, raft::device_span<size_t const>>>
label_offsets,
bool do_expensive_check = false);
Expand Down
11 changes: 6 additions & 5 deletions cpp/src/c_api/graph_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ struct two_hop_neighbors_functor : public cugraph::c_api::abstract_functor {
start_vertices_->size_,
handle_.get_stream());

if constexpr (multi_gpu) {
start_vertices =
cugraph::detail::shuffle_ext_vertices_to_local_gpu_by_vertex_partitioning(
handle_, std::move(start_vertices));
}

cugraph::renumber_ext_vertices<vertex_t, multi_gpu>(
handle_,
start_vertices.data(),
Expand All @@ -155,11 +161,6 @@ struct two_hop_neighbors_functor : public cugraph::c_api::abstract_functor {
graph_view.local_vertex_partition_range_last(),
do_expensive_check_);

if constexpr (multi_gpu) {
start_vertices =
cugraph::detail::shuffle_ext_vertices_to_local_gpu_by_vertex_partitioning(
handle_, std::move(start_vertices));
}
} else {
start_vertices.resize(graph_view.local_vertex_partition_range_size(), handle_.get_stream());
cugraph::detail::sequence_fill(handle_.get_stream(),
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/c_api/similarity.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, NVIDIA CORPORATION.
* Copyright (c) 2022-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
2 changes: 1 addition & 1 deletion cpp/src/c_api/uniform_neighbor_sampling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ struct uniform_neighbor_sampling_functor : public cugraph::c_api::abstract_funct
std::tie(src, dst, renumber_map, renumber_map_offsets) = cugraph::renumber_sampled_edgelist(
handle_,
std::move(src),
std::move(dst),
hop ? std::make_optional(raft::device_span<int32_t const>{hop->data(), hop->size()})
: std::nullopt,
std::move(dst),
std::make_optional(std::make_tuple(
raft::device_span<label_t const>{edge_label->data(), edge_label->size()},
raft::device_span<size_t const>{offsets->data(), offsets->size()})),
Expand Down
37 changes: 11 additions & 26 deletions cpp/src/link_prediction/jaccard_impl.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,15 @@ namespace cugraph {
namespace detail {

struct jaccard_functor_t {
template <typename weight_t>
weight_t __device__ compute_score(weight_t cardinality_a,
weight_t cardinality_b,
weight_t cardinality_a_intersect_b) const
{
return cardinality_a_intersect_b / (cardinality_a + cardinality_b - cardinality_a_intersect_b);
}
};

struct weighted_jaccard_functor_t {
template <typename weight_t>
weight_t __device__ compute_score(weight_t weight_a,
weight_t weight_b,
weight_t min_weight_a_intersect_b) const
weight_t weight_a_intersect_b,
weight_t weight_a_union_b) const
{
return min_weight_a_intersect_b / (weight_a + weight_b - min_weight_a_intersect_b);
return weight_a_union_b <= std::numeric_limits<weight_t>::min()
? weight_t{0}
: weight_a_intersect_b / weight_a_union_b;
}
};

Expand All @@ -55,20 +48,12 @@ rmm::device_uvector<weight_t> jaccard_coefficients(
{
CUGRAPH_EXPECTS(!graph_view.has_edge_mask(), "unimplemented.");

if (!edge_weight_view)
return detail::similarity(handle,
graph_view,
edge_weight_view,
vertex_pairs,
detail::jaccard_functor_t{},
do_expensive_check);
else
return detail::similarity(handle,
graph_view,
edge_weight_view,
vertex_pairs,
detail::weighted_jaccard_functor_t{},
do_expensive_check);
return detail::similarity(handle,
graph_view,
edge_weight_view,
vertex_pairs,
detail::jaccard_functor_t{},
do_expensive_check);
}

} // namespace cugraph
37 changes: 11 additions & 26 deletions cpp/src/link_prediction/overlap_impl.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,15 @@ namespace cugraph {
namespace detail {

struct overlap_functor_t {
template <typename weight_t>
weight_t __device__ compute_score(weight_t cardinality_a,
weight_t cardinality_b,
weight_t cardinality_a_intersect_b) const
{
return cardinality_a_intersect_b / std::min(cardinality_a, cardinality_b);
}
};

struct weighted_overlap_functor_t {
template <typename weight_t>
weight_t __device__ compute_score(weight_t weight_a,
weight_t weight_b,
weight_t min_weight_a_intersect_b) const
weight_t weight_a_intersect_b,
weight_t weight_a_union_b) const
{
return min_weight_a_intersect_b / std::min(weight_a, weight_b);
return std::min(weight_a, weight_b) <= std::numeric_limits<weight_t>::min()
? weight_t{0}
: weight_a_intersect_b / std::min(weight_a, weight_b);
}
};

Expand All @@ -55,20 +48,12 @@ rmm::device_uvector<weight_t> overlap_coefficients(
{
CUGRAPH_EXPECTS(!graph_view.has_edge_mask(), "unimplemented.");

if (!edge_weight_view)
return detail::similarity(handle,
graph_view,
edge_weight_view,
vertex_pairs,
detail::overlap_functor_t{},
do_expensive_check);
else
return detail::similarity(handle,
graph_view,
edge_weight_view,
vertex_pairs,
detail::weighted_overlap_functor_t{},
do_expensive_check);
return detail::similarity(handle,
graph_view,
edge_weight_view,
vertex_pairs,
detail::overlap_functor_t{},
do_expensive_check);
}

} // namespace cugraph
Loading

0 comments on commit c55151c

Please sign in to comment.