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

Add strided copy function for ParVectors #1054

Merged
merged 11 commits into from
Feb 1, 2024
Merged

Add strided copy function for ParVectors #1054

merged 11 commits into from
Feb 1, 2024

Conversation

victorapm
Copy link
Contributor

@victorapm victorapm commented Jan 17, 2024

Add hypre_ParVectorStridedCopy for performing a strided copy operation from a source data array to the data array of a hypre_Vector structure (x->data).

The source and destination arrays can be accessed with different strides.

A strided copy means that elements are copied from the source to the destination at regular stride intervals.

To be used in MGR

#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_HIP)
auto counting_iter = thrust::make_counting_iterator(0);

HYPRE_THRUST_CALL( transform_if, counting_iter, counting_iter + size, v_data, v_data,
Copy link
Contributor

Choose a reason for hiding this comment

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

This call has the complexity of O(size). There should be a more efficient implementation of O(size/stride), I assume.

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, done in b507d9c

I've also generalized the new code to accept different strides for the source and destination arrays

Copy link
Contributor

@liruipeng liruipeng left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks!

Copy link
Contributor

@rfalgout rfalgout left a comment

Choose a reason for hiding this comment

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

Looks good to me too

@victorapm victorapm merged commit 19cbc1f into master Feb 1, 2024
@victorapm victorapm deleted the strided-copy branch February 1, 2024 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants