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

Define and implement C/C++ for MNMG Egonet #2864

Merged
merged 9 commits into from
Nov 11, 2022

Conversation

ChuckHastings
Copy link
Collaborator

@ChuckHastings ChuckHastings commented Oct 31, 2022

Define and implement C API for egonet. This will help us eliminate dependence on cython.cu.

Closes #2906
Closes #2907
Closes #2908
Closes #2909
Closes #2910
Closes #2911

@ChuckHastings ChuckHastings self-assigned this Oct 31, 2022
@ChuckHastings ChuckHastings added 2 - In Progress improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Oct 31, 2022
@ChuckHastings ChuckHastings added this to the 22.12 milestone Oct 31, 2022
@ChuckHastings ChuckHastings marked this pull request as ready for review November 10, 2022 06:31
@ChuckHastings ChuckHastings requested review from a team as code owners November 10, 2022 06:31
@ChuckHastings ChuckHastings changed the title [skip-ci] C api for egonet C api for egonet Nov 10, 2022
@ChuckHastings
Copy link
Collaborator Author

rerun tests

@ChuckHastings ChuckHastings changed the title C api for egonet Define and implement C/C++ for MNMG Egonet Nov 10, 2022
@@ -1380,6 +1384,37 @@ extract_ego(raft::handle_t const& handle,
vertex_t n_subgraphs,
vertex_t radius);

/**
* @brief returns induced EgoNet subgraph(s) of neighbors centered at nodes in source_vertex within
* a given radius.
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this identical to k-hop neighbors?

Copy link
Contributor

Choose a reason for hiding this comment

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

Umm... maybe not... I assume identical only when k=1.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Essentially the ego net for a vertex v1 and a radius of k is the following:

  • compute the distance of every vertex in the graph from v1
  • induce subgraph for the subset of vertices that are of distance <= k

So for radius = 1, that will include v1, all of its neighbors, the edges to its neighbors and the edges between its neighbors.
For radius = 2, that will include v1, all of its neighbors, all of its 2-hop neighbors, the edges to the 1-hop neighbors, the edges between the 1-hop neighbors, the edges from the 1-hop neighbors to the 2-hop neighbors and the edges between the 2-hop neighbors.
etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha, yeah... so this is basically finding [0, radius]-hop neighbors then running induced subgraph, so this can be a bit different from just running radius-hop neighbors then running induced subgraph.

1,
direction_optimizing,
radius,
do_expensive_check);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe just add a FIXME and address later, but this looks very inefficient (but not less efficient than what we had... so better kick out cython.cu first).

Sequentially running one BFS (with maximum distance of radius) per source vertex can largely under-utilize a GPU (or multiple GPUs in multi-GPU runs).

We may better either run multi-source BFS, or run 1-hop neighbors recursively (radius times).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is a FIXME on line 93 (about 20 lines higher) observing that this is likely slow. Is that sufficient to address this concern?

Copy link
Contributor

Choose a reason for hiding this comment

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

I saw that FIXME but wasn't sure about the until the frontiers are large enough to use this approach part. But we can defer this discussion to the future.

The reason I wasn't sure about the FIXME comment.

I think we'd better not use this approach (i.e. running single source BFS in a sequential loop). Running 1-hop neighbors recursively sounds like a simpler approach with optimal parallelism but we may revisit this in the future when we actually update this algorithm.

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (branch-22.12@4802b28). Click here to learn what that means.
Patch has no changes to coverable lines.

❗ Current head 72f9c22 differs from pull request most recent head 6e2a648. Consider uploading reports for the commit 6e2a648 to get more accurate results

Additional details and impacted files
@@               Coverage Diff               @@
##             branch-22.12    #2864   +/-   ##
===============================================
  Coverage                ?   60.72%           
===============================================
  Files                   ?      122           
  Lines                   ?     6880           
  Branches                ?        0           
===============================================
  Hits                    ?     4178           
  Misses                  ?     2702           
  Partials                ?        0           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ChuckHastings
Copy link
Collaborator Author

@gpucibot merge

@rapids-bot rapids-bot bot merged commit a950bd9 into rapidsai:branch-22.12 Nov 11, 2022
@ChuckHastings ChuckHastings deleted the c_api_for_egonet branch December 2, 2022 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function non-breaking Non-breaking change
Projects
None yet
4 participants