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 inconsistency in team_member.reduce sample code snippet #634

Merged
merged 3 commits into from
Feb 26, 2025

Conversation

mabruzzo
Copy link
Contributor

This commit modifies the snippet illustrating how to use a method of the member_type type to trigger a reduction. There were 3 adjustments:

  1. The name of the triggered method was invalid: the TeamHandleConcept concept doesn't specify a reduce method. I adjusted the name to instead reference the team_reduce method. (maybe the way it was written was correct at some point in an earlier version?)
  2. Consequently, I also needed to adjust how the reduction was called
  3. I fixed some inconsistent indentation within the snippet

There were 2 areas where I was a little uncertain on what to do:

  • I couldn't tell if whether it was idiomatic to include the using Kokkos::Sum; statement. Let me know if I should remove it
  • I was tempted to rewrite a() += team_sum; as the following snippet (inspired by the other code-snippet in the subsection), but I decided to ask before doing that
    if( team_member.team_rank() == 0 ) {
      a() += team_sum;
    }

This commit modifies the snippet illustrating how to use a method of the
``member_type`` type to trigger a reduction. There were 3 adjustments:
1. The name of the triggered method was wrong. The concept doesn't
   specify a ``reduce`` method. I adjusted the name to instead reference
   the ``team_reduce`` method.
2. I needed to adjust how the method was called
3. I fixed some inconsistent indentation within the snippet
Copy link
Contributor

@masterleinad masterleinad left a comment

Choose a reason for hiding this comment

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

Thanks!

@masterleinad
Copy link
Contributor

masterleinad commented Feb 24, 2025

I was tempted to rewrite a() += team_sum; as the following snippet (inspired by the other code-snippet in the subsection), but I decided to ask before doing that

Would you mind adding that as well, possibly using Kokkos::single or actually calling Kokkos::atomic_add?

@mabruzzo
Copy link
Contributor Author

I was tempted to rewrite a() += team_sum; as the following snippet (inspired by the other code-snippet in the subsection), but I decided to ask before doing that

Would you mind adding that as well, possibly using Kokkos::single or actually calling Kokkos::atomic_add?

Done. Let me know if you want any other changes.

@masterleinad masterleinad merged commit 8b5a09f into kokkos:main Feb 26, 2025
3 checks passed
@mabruzzo mabruzzo deleted the snippet-fix-team_member_reduce branch March 3, 2025 06:25
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.

2 participants