-
Notifications
You must be signed in to change notification settings - Fork 302
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
C API for renumbering the samples #3724
Merged
Merged
Changes from 2 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
6263b9f
define sampling output renumbering function API
seunghwak 6c88e86
update the API (remove multi_gpu flag)
seunghwak 055496f
initial draft implementation
seunghwak 27fe4f0
Merge branch 'branch-23.08' of github.com:rapidsai/cugraph into fea_mfg
seunghwak 2211d24
add test code
seunghwak 9fe5e13
bug fixes
seunghwak 9ad3c8f
minor tweaks
seunghwak dfbc196
define API for MFG renumbering in the C API
ChuckHastings bc5d3e1
define API for MFG renumbering in the C API
ChuckHastings 012d392
memory footprint cut
seunghwak 63759b8
code improvemnt
seunghwak e21bcd0
bug fix and memory footprint optimization
seunghwak 7010081
bug fix
seunghwak d4d5407
clang-format
seunghwak a746701
Merge branch 'branch-23.08' of github.com:rapidsai/cugraph into fea_mfg
seunghwak cf7dff8
clang-format
seunghwak 948ad11
remove unnecessary template parameter
seunghwak b26523b
clang-format
seunghwak 37c08e8
Merge branch 'branch-23.08' into mfg_capi
alexbarghi-nv 8222c18
Merge remote-tracking branch 'seunghwa/fea_mfg' into mfg_capi
ChuckHastings 51a05bf
Merge branch 'mfg_capi' of github.com:chuckhastings/cugraph into mfg_…
ChuckHastings 1e4174e
Testing with Seunghwa's branch merged in
ChuckHastings db77c16
Merge branch 'branch-23.08' into mfg_capi
ChuckHastings File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -37,6 +37,7 @@ struct cugraph_sampling_options_t { | |||||
bool_t return_hops_{FALSE}; | ||||||
prior_sources_behavior_t prior_sources_behavior_{prior_sources_behavior_t::DEFAULT}; | ||||||
bool_t dedupe_sources_{FALSE}; | ||||||
bool_t renumber_results_{FALSE}; | ||||||
}; | ||||||
|
||||||
struct cugraph_sample_result_t { | ||||||
|
@@ -48,6 +49,8 @@ struct cugraph_sample_result_t { | |||||
cugraph_type_erased_device_array_t* hop_{nullptr}; | ||||||
cugraph_type_erased_device_array_t* label_{nullptr}; | ||||||
cugraph_type_erased_device_array_t* offsets_{nullptr}; | ||||||
cugraph_type_erased_device_array_t* renumber_map_{nullptr}; | ||||||
cugraph_type_erased_device_array_t* renumber_map_offsets_{nullptr}; | ||||||
}; | ||||||
|
||||||
} // namespace c_api | ||||||
|
@@ -226,6 +229,22 @@ struct uniform_neighbor_sampling_functor : public cugraph::c_api::abstract_funct | |||||
vertex_partition_lasts, | ||||||
do_expensive_check_); | ||||||
|
||||||
std::optional<rmm::device_uvector<vertex_t>> renumber_map{std::nullopt}; | ||||||
std::optional<rmm::device_uvector<size_t>> renumber_map_offsets{std::nullopt}; | ||||||
|
||||||
#if 0 | ||||||
std::tie(src, dst, renumber_map, renumber_map_offsets) = | ||||||
cugraph::renumber_sampled_edgelist(handle_, | ||||||
std::move(src), | ||||||
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()})) | ||||||
do_expensive_check); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed once I debugged :-) |
||||||
#endif | ||||||
|
||||||
result_ = new cugraph::c_api::cugraph_sample_result_t{ | ||||||
new cugraph::c_api::cugraph_type_erased_device_array_t(src, graph_->vertex_type_), | ||||||
new cugraph::c_api::cugraph_type_erased_device_array_t(dst, graph_->vertex_type_), | ||||||
|
@@ -242,7 +261,13 @@ struct uniform_neighbor_sampling_functor : public cugraph::c_api::abstract_funct | |||||
? new cugraph::c_api::cugraph_type_erased_device_array_t(edge_label.value(), INT32) | ||||||
: nullptr, | ||||||
(offsets) ? new cugraph::c_api::cugraph_type_erased_device_array_t(offsets.value(), SIZE_T) | ||||||
: nullptr}; | ||||||
: nullptr, | ||||||
(renumber_map) ? new cugraph::c_api::cugraph_type_erased_device_array_t( | ||||||
renumber_map.value(), graph_->vertex_type_) | ||||||
: nullptr, | ||||||
(renumber_map_offsets) ? new cugraph::c_api::cugraph_type_erased_device_array_t( | ||||||
renumber_map_offsets.value(), SIZE_T) | ||||||
: nullptr}; | ||||||
} | ||||||
} | ||||||
}; | ||||||
|
@@ -263,6 +288,13 @@ extern "C" cugraph_error_code_t cugraph_sampling_options_create( | |||||
return CUGRAPH_SUCCESS; | ||||||
} | ||||||
|
||||||
extern "C" void cugraph_sampling_set_renumber_results(cugraph_sampling_options_t* options, | ||||||
bool_t value) | ||||||
{ | ||||||
auto internal_pointer = reinterpret_cast<cugraph::c_api::cugraph_sampling_options_t*>(options); | ||||||
internal_pointer->renumber_results_ = value; | ||||||
} | ||||||
|
||||||
extern "C" void cugraph_sampling_set_with_replacement(cugraph_sampling_options_t* options, | ||||||
bool_t value) | ||||||
{ | ||||||
|
@@ -386,6 +418,22 @@ extern "C" cugraph_type_erased_device_array_view_t* cugraph_sample_result_get_of | |||||
internal_pointer->offsets_->view()); | ||||||
} | ||||||
|
||||||
extern "C" cugraph_type_erased_device_array_view_t* cugraph_sample_result_get_renumber_map( | ||||||
const cugraph_sample_result_t* result) | ||||||
{ | ||||||
auto internal_pointer = reinterpret_cast<cugraph::c_api::cugraph_sample_result_t const*>(result); | ||||||
return reinterpret_cast<cugraph_type_erased_device_array_view_t*>( | ||||||
internal_pointer->renumber_map_->view()); | ||||||
} | ||||||
|
||||||
extern "C" cugraph_type_erased_device_array_view_t* cugraph_sample_result_get_renumber_map_offsets( | ||||||
const cugraph_sample_result_t* result) | ||||||
{ | ||||||
auto internal_pointer = reinterpret_cast<cugraph::c_api::cugraph_sample_result_t const*>(result); | ||||||
return reinterpret_cast<cugraph_type_erased_device_array_view_t*>( | ||||||
internal_pointer->renumber_map_offsets_->view()); | ||||||
} | ||||||
|
||||||
extern "C" cugraph_error_code_t cugraph_test_uniform_neighborhood_sample_result_create( | ||||||
const cugraph_resource_handle_t* handle, | ||||||
const cugraph_type_erased_device_array_view_t* srcs, | ||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this is disabled pending Seunghwa's PR getting merged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Just pushed an update with a version of Seunghwa's branch merged in (not the latest).