-
Notifications
You must be signed in to change notification settings - Fork 315
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
graph primitive transform_e #3548
graph primitive transform_e #3548
Conversation
if (majors_.size() > 0) { | ||
rmm::device_scalar<vertex_t> tmp_src(src, handle_ptr_->get_stream()); | ||
rmm::device_scalar<vertex_t> tmp_dst(dst, handle_ptr_->get_stream()); | ||
auto pair_first = | ||
thrust::make_zip_iterator(thrust::make_tuple(tmp_src.data(), tmp_dst.data())); | ||
insert(tmp_src.data(), tmp_src.data() + 1, tmp_dst.data()); | ||
} else { | ||
auto major = src_major ? src : dst; | ||
auto minor = src_major ? dst : src; | ||
majors_.resize(1, handle_ptr_->get_stream()); | ||
minors_.resize(1, handle_ptr_->get_stream()); | ||
auto pair_first = | ||
thrust::make_zip_iterator(thrust::make_tuple(majors_.data(), minors_.data())); | ||
thrust::fill(handle_ptr_->get_thrust_policy(), | ||
pair_first, | ||
pair_first + 1, | ||
thrust::make_tuple(major, minor)); | ||
} |
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.
Couldn't the checks for size and resizing be avoided here as they are done in
void insert(VertexIterator src_first, VertexIterator src_last, VertexIterator dst_first)
anyway?
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.
This is to avoid creating temporary buffers (tmp_src
and tmp_dst
).
if (majors_.size() > 0) { | ||
rmm::device_scalar<vertex_t> tmp_src(src, handle_ptr_->get_stream()); | ||
rmm::device_scalar<vertex_t> tmp_dst(dst, handle_ptr_->get_stream()); | ||
rmm::device_scalar<tag_t> tmp_tag(tag, handle_ptr_->get_stream()); | ||
auto triplet_first = thrust::make_zip_iterator( | ||
thrust::make_tuple(tmp_src.data(), tmp_dst.data(), tmp_tag.data())); | ||
insert(tmp_src.data(), tmp_src.data() + 1, tmp_dst.data(), tmp_tag.data()); | ||
} else { | ||
auto major = src_major ? src : dst; | ||
auto minor = src_major ? dst : src; | ||
majors_.resize(1, handle_ptr_->get_stream()); | ||
minors_.resize(1, handle_ptr_->get_stream()); | ||
tags_.resize(1, handle_ptr_->get_stream()); |
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.
Same here, checks for size and resizing is done inside
void insert(VertexIterator src_first, VertexIterator src_last, VertexIterator dst_first, TagIterator tag_first)
as well
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.
Same here, we don't need to create temporary buffers in the else case.
for (auto it = lower_it; it != upper_it; ++it) { | ||
assert(*it == minor); | ||
auto e_op_result = | ||
e_op(src, | ||
dst, | ||
edge_partition_src_value_input.get(src_offset), | ||
edge_partition_dst_value_input.get(dst_offset), | ||
edge_partition_e_value_input.get(edge_offset + thrust::distance(indices, it))); |
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.
General question:
It would results in a multiple iteration only if there are multiple edges between (major, minor)?
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, correct.
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.
A couple of minor copyright edits. Otherwise looks good.
cpp/tests/prims/mg_transform_e.cu
Outdated
@@ -0,0 +1,367 @@ | |||
/* | |||
* Copyright (c) 2021-2023, NVIDIA CORPORATION. |
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.
Just 2023
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.
Fixed.
cpp/src/prims/transform_e.cuh
Outdated
@@ -0,0 +1,342 @@ | |||
/* | |||
* Copyright (c) 2020-2023, NVIDIA CORPORATION. |
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.
Just 2023?
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.
Fixed as well.
/merge |
Add a new primitive to update edge property values (for a given set of edges, haven't implemented a case for all edges). This is necessary to implement K-truss.