Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor MG neighborhood sampling and add SG implementation #2285

Conversation

jnke2016
Copy link
Contributor

@jnke2016 jnke2016 commented May 18, 2022

A new implementation of neighborhood sampling meeting the new C API was merged.

This PR

  1. Moves the old implementation to the dir proto
  2. Refactor MG neighborhood sampling bindings based on the new implementation
  3. Add bindings for SG neighborhood sampling
  4. Refactor tests

DO NOT MERGE YET: PENDING fix for missing vertices in start_list
closes #2272

@jnke2016 jnke2016 requested a review from a team as a code owner May 18, 2022 20:41
@codecov-commenter
Copy link

codecov-commenter commented May 18, 2022

Codecov Report

Merging #2285 (1af8e7b) into branch-22.06 (38be932) will decrease coverage by 7.78%.
The diff coverage is n/a.

@@               Coverage Diff                @@
##           branch-22.06    #2285      +/-   ##
================================================
- Coverage         70.82%   63.03%   -7.79%     
================================================
  Files               170      104      -66     
  Lines             11036     4805    -6231     
================================================
- Hits               7816     3029    -4787     
+ Misses             3220     1776    -1444     
Impacted Files Coverage Δ
python/cugraph/cugraph/__init__.py 100.00% <ø> (ø)
python/cugraph/cugraph/centrality/__init__.py 100.00% <ø> (ø)
...graph/cugraph/centrality/betweenness_centrality.py 89.65% <ø> (ø)
...on/cugraph/cugraph/centrality/degree_centrality.py 81.81% <ø> (ø)
...graph/cugraph/centrality/eigenvector_centrality.py 93.93% <ø> (ø)
...thon/cugraph/cugraph/centrality/katz_centrality.py 89.79% <ø> (+0.32%) ⬆️
python/cugraph/cugraph/community/egonet.py 97.36% <ø> (ø)
...ython/cugraph/cugraph/community/ktruss_subgraph.py 88.23% <ø> (+2.94%) ⬆️
python/cugraph/cugraph/community/leiden.py 100.00% <ø> (+7.69%) ⬆️
python/cugraph/cugraph/community/louvain.py 100.00% <ø> (+7.69%) ⬆️
... and 139 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 861cef0...1af8e7b. Read the comment docs.

@jnke2016 jnke2016 requested a review from a team as a code owner May 19, 2022 14:25
@rlratzel rlratzel added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change python labels May 23, 2022
@BradReesWork BradReesWork added this to the 22.06 milestone May 23, 2022
Copy link
Contributor

@betochimas betochimas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to create a deprecation warning wrapper, but found the deprecation message you used worked better for my PRs, so I appreciated that addition here. Overall, the PR LGTM, I only had a few minor comments

@@ -19,3 +19,6 @@
from .community.louvain import louvain
from .centrality.katz_centrality import katz_centrality
from .components.connectivity import weakly_connected_components
from .sampling.uniform_neighbor_sample import uniform_neighbor_sample
# FIXME: This call is deprecated and will be removed next release
from .sampling.neighborhood_sampling import neighborhood_sampling
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you make a FIXME for the deprecation warning of the old neighborhood_sampling, then this only lets the developers of cuGraph know that it's going away to be replaced by uniform_neighbor_sample. Wouldn't it be better to wrap neighborhood_sampling with a deprecation warning similar to some pylibcugraph calls?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did add a warning in pylibcugraph/neighborhood_sampling and this FIXME is indeed for the cuGraph developers

@@ -0,0 +1,3 @@
24-05-2022 11:57:57:955 [pid=3446 tid=3446] ERROR cufio-drv:632 nvidia-fs.ko driver not loaded
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not be left in, I can relate though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. I already have it removed locally but I am yet to push the changes

import dask_cudf
import cudf

from pylibcugraph.experimental import (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is super minor thing, but all of these except for uniform_neighbor_sample can be taken out of the experimental namespace

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

cupy_sources = copy_to_cupy_array(c_resource_handle_ptr, src_ptr)
cupy_destinations = copy_to_cupy_array(c_resource_handle_ptr, dst_ptr)
cupy_indices = copy_to_cupy_array_ids(c_resource_handle_ptr, index_ptr)
#print("indices are \n", cupy_indices)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a few print debug lines left over

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

import cudf


def uniform_neighbor_sample(G,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to add both this SG and the MG uniform_neighbor_sample to the API docs

Copy link
Contributor

@rlratzel rlratzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, and a lot of the feedback I have is already posted by others. I just have one request below.

Comment on lines 16 to 19
from cugraph.dask.sampling.uniform_neighbor_sample import \
uniform_neighbor_sample
uniform_neighbor_sample = \
experimental_warning_wrapper(uniform_neighbor_sample)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can immediately promote this to stable too, which means we'll be replacing the current MG neighborhood sampling algo with this one (a breaking change). We think this is okay though, since this was mainly added for DGL and the DGL effort is just starting to use cugraph MG neighbor sampling (IOW, we don't think this will actually break anyone).
Of course, since the old version was released in 22.04, there's no way to guarantee a community member isn't using it, but we still think the chance is small enough not to warrant the extra expense of maintaining two versions to support our normal deprecation process. I'll add a "breaking" label to this PR though too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I concur

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. It didn't make it into the 22.04 release html docs, so a community member who used it had to have followed development closely.

@rlratzel rlratzel added breaking Breaking change and removed non-breaking Non-breaking change labels May 26, 2022
Copy link
Contributor

@betochimas betochimas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests LGTM, everything else looked good before, so I think this can be merged soon

@BradReesWork
Copy link
Member

@gpucibot merge

@rapids-bot rapids-bot bot merged commit addb9d7 into rapidsai:branch-22.06 Jun 1, 2022
@jnke2016 jnke2016 deleted the branch-22.06-fea_neighborhood_sampling branch September 24, 2022 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking change improvement Improvement / enhancement to an existing function
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update neighborhood sampling in pylibcugraph and cugraph to match latest C API
8 participants