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

Neighborhood sampling C API implementation #2156

Conversation

ChuckHastings
Copy link
Collaborator

@ChuckHastings ChuckHastings commented Mar 23, 2022

Provide the implementation for the C API for neighborhood sampling.

Currently needs some debugging.

merge after 2150

@ChuckHastings ChuckHastings requested review from a team as code owners March 23, 2022 21:25
@ChuckHastings ChuckHastings self-assigned this Mar 23, 2022
@ChuckHastings ChuckHastings added 2 - In Progress improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Mar 23, 2022
@ChuckHastings ChuckHastings added this to the 22.04 milestone Mar 23, 2022
rmm::device_uvector<vertex_t>& d_vertices,
rmm::device_uvector<value_t>& d_values,
rmm::device_uvector<value_t>& d_local_values,
vertex_t local_vertex_first)
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks same to the code added in PR #2150 and the same comment applies here.

std::unique_ptr<std::byte[]> data_;
size_t size_;
size_t num_bytes_;
// NOTE: size must be first here because the device buffer is released
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this comment, and could you elaborate this comment? It seems like there is more context to this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment was copied from above. In the type_erased_device_buffer we do a release from the rmm::device_uvector which changes the size of the vector to 0. It is important in that case that we copy the size before we call release.

Should delete this comment, std::vector doesn't support release, we do a copy instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha, I can see that from the code of cugraph_type_erased_device_array_t. No idea why this is necessary (because it is not...)for cugraph_type_erased_host_array_t reading the code. Better delete the comment to avoid confusion.

do_expensive_check_);

cugraph::detail::collect_vertex_values_to_local<vertex_t, weight_t, multi_gpu>(
handle_, guess_vertices, guess_values, hubs, graph_view.get_local_vertex_first());
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this PR pulling updates from PR #2150??? If that's the case, this PR should better be reviewed after PR #2150 gets merged (to avoid reviewing the same code twice).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. I mentioned this in the slack thread.

@@ -332,8 +335,12 @@ uniform_nbr_sample_impl(

if constexpr (graph_view_t::is_multi_gpu) {
size_t num_starting_vs = d_in.size();
#if 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this meant to be removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. I will remove it.


// resize accumulators:
// FIXME: Need to call collective operations from all threads
// if (in_sz > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

So, is this a remaining bug to be fixed later?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nope. I will delete the FIXME, I fixed that problem in order to get the unit tests to pass.

d_in,
d_ranks,
gpu_t{});
//}
Copy link
Contributor

Choose a reason for hiding this comment

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

Better delete?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will clean up some of the commented out bits in the code. Part of my work to get things running.

d_ranks,
gpu_t{});
//}

//}
Copy link
Contributor

Choose a reason for hiding this comment

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

Better delete?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Cleaned up in next push

C_CUDA_TRY(cudaGetDeviceCount(&num_gpus_per_node));
C_CUDA_TRY(cudaSetDevice(comm_rank % num_gpus_per_node));

#if 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we keep this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Deleted in next push

ret_code != CUGRAPH_SUCCESS,
"cugraph_uniform_neighbor_sample expected to fail in SG test");

#if 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we keep this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm hoping to add support for SG in the next release. This should be the code to do the test once SG is working (although it will need to be debugged). I can delete it and recreate it from the MG version next release if we want to keep this clean, although I'm inclined to keep it for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, no problem.

@codecov-commenter
Copy link

codecov-commenter commented Mar 29, 2022

Codecov Report

Merging #2156 (bf99d28) into branch-22.04 (87be0b3) will increase coverage by 0.04%.
The diff coverage is n/a.

❗ Current head bf99d28 differs from pull request most recent head 27c7895. Consider uploading reports for the commit 27c7895 to get more accurate results

@@               Coverage Diff                @@
##           branch-22.04    #2156      +/-   ##
================================================
+ Coverage         73.95%   73.99%   +0.04%     
================================================
  Files               157      157              
  Lines             10496    10496              
================================================
+ Hits               7762     7767       +5     
+ Misses             2734     2729       -5     
Impacted Files Coverage Δ
.../cugraph/tests/test_edge_betweenness_centrality.py 84.93% <0.00%> (+0.60%) ⬆️
...graph/cugraph/tests/test_betweenness_centrality.py 83.01% <0.00%> (+0.62%) ⬆️
python/cugraph/cugraph/tests/test_graph_store.py 100.00% <0.00%> (+1.56%) ⬆️
python/cugraph/cugraph/tests/test_utils.py 75.55% <0.00%> (+4.44%) ⬆️

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 87be0b3...27c7895. Read the comment docs.

@BradReesWork
Copy link
Member

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 62993ef into rapidsai:branch-22.04 Mar 29, 2022
rapids-bot bot pushed a commit that referenced this pull request Mar 31, 2022
Closes #2108 when merged. Requires both #2088 and #2156 to be merged before, the former because this uses MGGraph, and the later because of the C implementation of neighborhood sampling.

Authors:
  - https://github.com/betochimas
  - Joseph Nke (https://github.com/jnke2016)
  - Rick Ratzel (https://github.com/rlratzel)

Approvers:
  - Don Acosta (https://github.com/acostadon)
  - Rick Ratzel (https://github.com/rlratzel)
  - Joseph Nke (https://github.com/jnke2016)
  - Chuck Hastings (https://github.com/ChuckHastings)
  - Jordan Jacobelli (https://github.com/Ethyling)

URL: #2118
@ChuckHastings ChuckHastings deleted the fea_neighborhood_sampling_capi_implementation branch March 31, 2022 14:49
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
Development

Successfully merging this pull request may close these issues.

5 participants