-
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
Custom init() function for parallel_reduce with array value_type #210
Comments
Can you try init(value_type& dat), I believe we expect a reference to the value_type. |
The value_type is a dynamic length array, so appears to be a bug in the 'is there an init function' introspection. |
Changing it to a reference doesn't work, and in fact introduces a compiler error:
|
My belief is the introspection is wrong and it should be
instead of
since value_type is already a pointer. |
Not so sure. It looks like we need to test for both. If your value_type is a "double" then the signature is |
Carter can you do this? |
Btw, changing it to a static-length array doesn't make it work either. |
Yeah I wouldn't expect it too. |
You actually do all of that stuff already. My point was the test for when value_type is an array is wrong. The separate test for when value_type is not an array is correct. |
Oh ok. So it should be easy to fix 👍 |
Yes, I think I told you how to fix it 😃 |
has a user supplied initialization functor.
Pushed to master, closing the issue |
I have a functor that does reduction on an array that requires a non-trivial init() function, however I am finding that my functor's init function is not getting called. Here are the relevant parts of the declaration:
By adding print and assert statements I can verify init() is not getting called. Looking at the Kokkos source code, I see this:
and this
Shouldn't that be:
KOKKOS_INLINE_FUNCTION static void enable_if( void (FunctorType::*)( value_type ) const );
given that reference_type for an array is value_type *?
If I add an empty overload of "void init(double**) const {}" to my functor it works and the correct init function is called. This seems like a bug, or am I just doing something stupid?
The text was updated successfully, but these errors were encountered: