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

graph primitive transform_e #3548

Merged
merged 13 commits into from
May 11, 2023

Conversation

seunghwak
Copy link
Contributor

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.

@seunghwak seunghwak added feature request New feature or request non-breaking Non-breaking change labels May 8, 2023
@seunghwak seunghwak added this to the 23.06 milestone May 8, 2023
@seunghwak seunghwak self-assigned this May 8, 2023
@seunghwak seunghwak requested review from a team as code owners May 8, 2023 22:51
Comment on lines +103 to +120
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));
}
Copy link
Contributor

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?

Copy link
Contributor Author

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).

Comment on lines +133 to +145
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());
Copy link
Contributor

@naimnv naimnv May 9, 2023

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

Copy link
Contributor Author

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.

Comment on lines +327 to +334
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)));
Copy link
Contributor

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)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, correct.

Copy link
Collaborator

@ChuckHastings ChuckHastings left a 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.

@@ -0,0 +1,367 @@
/*
* Copyright (c) 2021-2023, NVIDIA CORPORATION.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just 2023

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@@ -0,0 +1,342 @@
/*
* Copyright (c) 2020-2023, NVIDIA CORPORATION.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just 2023?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed as well.

@BradReesWork
Copy link
Member

/merge

@rapids-bot rapids-bot bot merged commit 009b089 into rapidsai:branch-23.06 May 11, 2023
@seunghwak seunghwak deleted the update_edge_property branch August 22, 2023 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants