Add Val class similar to ValLoc
MrBurmark opened this issue · 3 comments
MrBurmark commented
Add Val class similar to ValLoc so we can have a .min method like what the legacy reducers have.
MrBurmark commented
Through discussion we have decided to move toward changes to the API to bring the operator into the lambda argument to improve type safety.
DATA_TYPE maxinit = big_max;
DATA_TYPE max(max_init);
// RefOp<DATA_TYPE, OPERATION>;
// using RefLocOp<DATA_TYPE, Index_Type, OPERATION> = RefOp<ValLoc<DATA_TYPE, Index_Type>, OPERATION>;
template < typename DATA_TYPE >
using MaxRef = RefOp<DATA_TYPE, RAJA::operators::maximum>;
RAJA::forall<EXEC_POLICY>(seg,
RAJA::expt::Reduce(MaxRef(maxinit)),
RAJA::expt::Reduce<RAJA::operators::maximum>(&max),
[=] RAJA_HOST_DEVICE(IDX_TYPE idx, MaxRef<DATA_TYPE> mi, DATA_TYPE &m) {
mi.max(working_array[idx]);
mi.min(...); // error (SFINAE)
m = RAJA_MAX(working_array[idx], m);
});
MrBurmark commented
We might want to unify the ValLoc and ValueLoc classes.
MrBurmark commented
We might want to SFINAE out the operators based on an operator template arg. For example Val<double, RAJA::min>
only has the min
operator and +=
is disabled.