LLNL / RAJA

RAJA Performance Portability Layer (C++)
BSD 3-Clause "New" or "Revised" License
450 stars 102 forks source link

Require explicit initialization values for reductions #1674

Open rhornung67 opened 3 weeks ago

rhornung67 commented 3 weeks ago

In our "old" reduction interface (where a user creates a reduction object which is puled into a kernel via lambda capture), we provide a default initial value for a reduction if a user does not explicitly provide one by passing a value to the reduction object ctor. The default value is chosen based on the type of the reduction value (template parameter to reduction object) and the reduction (object) type.

It would be more consistent with other parallel programming models (e.g., OpenMP) if we required users to explicitly provide reduction initialization values. It may also ensure the user gets what they want in some cases. Since this could potentially be a breaking change for some users, we'll do a major release after implementing this change.