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

Fix out of range check #146

Merged
merged 3 commits into from
Oct 3, 2024
Merged

Conversation

yasahi-hpc
Copy link
Collaborator

This PR aims at fixing a bug in is_out_of_range_value_included function.
Previous implementation would give a wrong result if axes variable is not sorted.

For example, it returns false (now returns true) in the previous implementation.

std::array<int> v2 = {0, 4, 1};
KokkosFFT::Impl::is_out_of_range_value_included(
      v2, static_cast<IntType>(2));

Following changes are made

  • Fix is_out_of_range_value_included function with std::max_element
  • Gives a runtime_error if a negative number is included
  • Add an unit_test for these cases

@yasahi-hpc yasahi-hpc self-assigned this Oct 2, 2024
@yasahi-hpc yasahi-hpc added bug Something isn't working cleanup labels Oct 2, 2024
@yasahi-hpc yasahi-hpc requested a review from tpadioleau October 2, 2024 12:27
tpadioleau
tpadioleau previously approved these changes Oct 2, 2024
Copy link
Member

@tpadioleau tpadioleau left a comment

Choose a reason for hiding this comment

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

LGTM

common/src/KokkosFFT_utils.hpp Outdated Show resolved Hide resolved
@yasahi-hpc
Copy link
Collaborator Author

I have updated accordingly.
@tpadioleau Can I have your second review please?

@yasahi-hpc yasahi-hpc force-pushed the fix-out-of-range-check branch from cab7636 to e6e87bd Compare October 3, 2024 08:05
Copy link
Member

@tpadioleau tpadioleau left a comment

Choose a reason for hiding this comment

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

Good to me

@yasahi-hpc yasahi-hpc merged commit 81ece5b into kokkos:main Oct 3, 2024
16 checks passed
@yasahi-hpc yasahi-hpc deleted the fix-out-of-range-check branch October 3, 2024 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants