-
Notifications
You must be signed in to change notification settings - Fork 407
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
Error out for const scalar return type in reduction #4645
Error out for const scalar return type in reduction #4645
Conversation
The linked example now gives
for me. |
core/src/Kokkos_Parallel_Reduce.hpp
Outdated
parallel_reduce(const std::string& label, const PolicyType& policy, | ||
const FunctorType& functor, ReturnType& return_value) { | ||
static_assert( | ||
!std::is_const<ReturnType>::value, | ||
"A const return type is only allowed for a View or reducer return type!"); |
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.
Did you check in our Wiki how we actually refer to the reducer argument? I feel like "return type" might be confusing
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.
I changed it to "reduction result type".
I needed to also allow pointers to be passed in as |
Fixes #2090. This pull request also makes sure that we are calling the intended overload for
parallel_reduce
, i.e., the return value is only copied if the return type is aView
or a reducer.