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

Remove edge renumber map from the homogeneous sampling API #4775

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
95c5ba2
homogeneous neighborhood sampling doesn't support edge renumber_map a…
jnke2016 Nov 19, 2024
af465f9
update docstrings
jnke2016 Nov 19, 2024
61a0926
fix bug in heterogeneous renumbering
jnke2016 Nov 20, 2024
707cf3d
fix style
jnke2016 Nov 20, 2024
ef848e9
handle case where there is no sampling result prior to renumbering
jnke2016 Nov 22, 2024
535df5d
expose 'label_type_hop_offsets'
jnke2016 Nov 22, 2024
3501a45
fix style
jnke2016 Nov 22, 2024
288b8fc
remove debug print and properly compute the 'result_offsets'
jnke2016 Nov 22, 2024
9f459de
update docstrings
jnke2016 Nov 22, 2024
fc0426d
directly return the result
jnke2016 Nov 22, 2024
d997656
fix illegal memory access
jnke2016 Nov 22, 2024
b7405e0
Merge remote-tracking branch 'upstream/branch-24.12' into branch-24.1…
jnke2016 Nov 22, 2024
fc70811
rename variable for consistency
jnke2016 Nov 22, 2024
463f12b
fix style
jnke2016 Nov 22, 2024
3767b94
rename variable for consistency
jnke2016 Nov 22, 2024
6aeee28
add support for vertex type
jnke2016 Nov 22, 2024
223a73b
add support for vertex type at the plc layer
jnke2016 Nov 22, 2024
061c8cc
properly handle missing edge types
jnke2016 Nov 22, 2024
ed4c069
fix style
jnke2016 Nov 22, 2024
900a3fe
Merge remote-tracking branch 'upstream/branch-24.12' into branch-24.1…
jnke2016 Nov 23, 2024
61504a9
Merge remote-tracking branch 'upstream/branch-24.12' into branch-24.1…
jnke2016 Nov 25, 2024
4d3f8c1
properly handle sampling with multiple edge types
jnke2016 Nov 26, 2024
d88eebd
remove debug print
jnke2016 Nov 27, 2024
77a28c2
undo changes to 'prepare_next_frontier'
jnke2016 Nov 27, 2024
b760a61
properly handle sampling with multiple edge types
jnke2016 Nov 27, 2024
580d3e9
properly compute the number of hops for heterogeneous renumbering
jnke2016 Nov 27, 2024
529955a
fix style
jnke2016 Nov 27, 2024
c3a58a0
Merge remote-tracking branch 'upstream/branch-24.12' into branch-24.1…
jnke2016 Nov 27, 2024
bf17251
update docstrings
jnke2016 Nov 27, 2024
88b35ba
simplify code and re-order statements
jnke2016 Nov 27, 2024
f8c576a
fix style
jnke2016 Nov 27, 2024
9648d69
update docstrings
jnke2016 Nov 27, 2024
9d84558
fix bug when creating struct
jnke2016 Nov 30, 2024
a7a224c
fix style
jnke2016 Nov 30, 2024
d64dc66
add missing arguments
jnke2016 Dec 1, 2024
bcfc99c
update label list if some are missing from the result
jnke2016 Dec 1, 2024
19c37a8
fix style
jnke2016 Dec 1, 2024
3a0bf57
properly handle the case where hop is 0
jnke2016 Dec 2, 2024
08a37cf
reduce variable score and reorder instructions
jnke2016 Dec 3, 2024
6a61d9b
Merge remote-tracking branch 'upstream/branch-24.12' into branch-24.1…
jnke2016 Dec 3, 2024
f23df9a
remove unnecessary code
jnke2016 Dec 3, 2024
2797559
fix style
jnke2016 Dec 3, 2024
1c70abc
undo changes
jnke2016 Dec 3, 2024
6ca87be
remove unsued variables
jnke2016 Dec 3, 2024
62b3b69
undo changes
jnke2016 Dec 3, 2024
a737fbc
remove unsed variables
jnke2016 Dec 3, 2024
c434eae
fix style
jnke2016 Dec 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions cpp/src/c_api/neighbor_sampling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1220,13 +1220,16 @@ struct neighbor_sampling_functor : public cugraph::c_api::abstract_functor {

} else { // heterogeneous renumbering

rmm::device_uvector<vertex_t> vertex_type_offsets(
graph_view.local_vertex_partition_range_size(), handle_.get_stream());
// FIXME: If no 'vertex_type_offsets' is provided, all vertices are assumed to have
// a vertex type of value 1. Update the API once 'vertex_type_offsets' is supported
rmm::device_uvector<vertex_t> vertex_type_offsets(2, handle_.get_stream());

cugraph::detail::stride_fill(handle_.get_stream(),
vertex_type_offsets.begin(),
vertex_type_offsets.size(),
vertex_t{0},
vertex_t{graph_view.local_vertex_partition_range_size()}

cugraph::detail::sequence_fill(handle_.get_stream(),
vertex_type_offsets.begin(),
vertex_type_offsets.size(),
vertex_t{0} // FIXME: Update array
);

rmm::device_uvector<vertex_t> output_majors(0, handle_.get_stream());
Expand All @@ -1240,7 +1243,7 @@ struct neighbor_sampling_functor : public cugraph::c_api::abstract_functor {
edge_id,
label_type_hop_offsets, // Contains information about the type and hop offsets
output_renumber_map,
(*renumber_map_offsets),
renumber_map_offsets,
renumbered_and_sorted_edge_id_renumber_map,
renumbered_and_sorted_edge_id_renumber_map_label_type_offsets) =
cugraph::heterogeneous_renumber_and_sort_sampled_edgelist<vertex_t>(
Expand All @@ -1267,7 +1270,9 @@ struct neighbor_sampling_functor : public cugraph::c_api::abstract_functor {

edge_label ? (*offsets).size() - 1 : size_t{1},
hop ? fan_out_->size_ : size_t{1},
size_t{1},

vertex_type_offsets.size() -
1, // num_vertex_type is by default 1 if 'vertex_type_offsets' is not provided
num_edge_types_,
src_is_major,
do_expensive_check_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def homogeneous_biased_neighbor_sample(ResourceHandle resource_handle,
>>> sampling_results = pylibcugraph.homogeneous_biased_neighbor_sample(
... resource_handle, G, start_vertices, starting_vertex_label_offsets,
... h_fan_out, False, True)
>>> >>> sampling_results
>>> sampling_results
{'majors': array([2, 2, 5, 5, 1, 1], dtype=int32),
'minors': array([1, 3, 3, 4, 3, 4], dtype=int32),
'weight': array([3.1, 4.1, 7.2, 3.2, 2.1, 1.1], dtype=float32)}
Expand Down Expand Up @@ -383,8 +383,6 @@ def homogeneous_biased_neighbor_sample(ResourceHandle resource_handle,
if renumber:
cupy_renumber_map = result.get_renumber_map()
cupy_renumber_map_offsets = result.get_renumber_map_offsets()
cupy_edge_renumber_map = result.get_edge_renumber_map()
cupy_edge_renumber_map_offsets = result.get_edge_renumber_map_offsets()

sampling_results = {
'major_offsets': cupy_major_offsets,
Expand All @@ -397,9 +395,7 @@ def homogeneous_biased_neighbor_sample(ResourceHandle resource_handle,
'label_hop_offsets': cupy_label_hop_offsets,
'hop_id': None,
'renumber_map': cupy_renumber_map,
'renumber_map_offsets': cupy_renumber_map_offsets,
'edge_renumber_map' : cupy_edge_renumber_map,
'edge_renumber_map_offsets' : cupy_edge_renumber_map_offsets
'renumber_map_offsets': cupy_renumber_map_offsets
}

else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def homogeneous_uniform_neighbor_sample(ResourceHandle resource_handle,
>>> sampling_results = pylibcugraph.homogeneous_uniform_neighbor_sample(
... resource_handle, G, start_vertices, starting_vertex_label_offsets,
... h_fan_out, False, True)
>>> >>> sampling_results
>>> sampling_results
{'majors': array([2, 2, 5, 5, 1, 1], dtype=int32),
'minors': array([1, 3, 3, 4, 3, 4], dtype=int32),
'weight': array([3.1, 4.1, 7.2, 3.2, 2.1, 1.1], dtype=float32)}
Expand Down Expand Up @@ -378,8 +378,6 @@ def homogeneous_uniform_neighbor_sample(ResourceHandle resource_handle,
if renumber:
cupy_renumber_map = result.get_renumber_map()
cupy_renumber_map_offsets = result.get_renumber_map_offsets()
cupy_edge_renumber_map = result.get_edge_renumber_map()
cupy_edge_renumber_map_offsets = result.get_edge_renumber_map_offsets()

sampling_results = {
'major_offsets': cupy_major_offsets,
Expand All @@ -392,9 +390,7 @@ def homogeneous_uniform_neighbor_sample(ResourceHandle resource_handle,
'label_hop_offsets': cupy_label_hop_offsets,
'hop_id': None,
'renumber_map': cupy_renumber_map,
'renumber_map_offsets': cupy_renumber_map_offsets,
'edge_renumber_map' : cupy_edge_renumber_map,
'edge_renumber_map_offsets' : cupy_edge_renumber_map_offsets
'renumber_map_offsets': cupy_renumber_map_offsets
}

else:
Expand Down
Loading