Reduce#
- group thread_reduce
Functions
-
template<int Length, typename T, typename ReductionOp, typename Prefix = std::monostate>
__device__ inline auto thread_reduce(T *input, ReductionOp reduction_op, Prefix prefix = {})# Carry out a reduction on an array of elements in one thread.
- Template Parameters:
Length – Length of the array to be reduced
T – the input/output type
ReductionOp – Binary Operation that used to carry out the reduction
- Parameters:
input – [in] Pointer to the first element of the array to be reduced
reduction_op – [in] Instance of the reduction operator functor
prefix – [in] Optional value to be used as prefix
- Returns:
Value obtained from reduction of input array
-
template<int Length, typename T, typename ReductionOp, typename Prefix = std::monostate>
__device__ inline T thread_reduce(T (&input)[Length], ReductionOp reduction_op, Prefix prefix = {})# Carry out a reduction on an array of elements in one thread.
- Template Parameters:
Length – Length of the array to be reduced
T – the input/output type
ReductionOp – Binary Operation that used to carry out the reduction
- Parameters:
input – [in] Pointer to the first element of the array to be reduced
reduction_op – [in] Instance of the reduction operator functor
prefix – [in] Optional value to be used as prefix
- Returns:
Value obtained from reduction of input array
-
template<int Length, typename T, typename ReductionOp, typename Prefix = std::monostate>