Template Function concore::v1::conc_scan(It, It, It2, Value, const BinaryOp&, task_group, partition_hints)¶
Defined in File conc_scan.hpp
Function Documentation¶
-
template<typename
It, typenameIt2, typenameValue, typenameBinaryOp>
Valueconcore::v1::conc_scan(It first, It last, It2 d_first, Value identity, const BinaryOp &op, task_group grp, partition_hints hints)¶ A concurrent scan algorithm.
This implements the prefix sum algorithm. Assuming the given operation is summation, this will write in the destination corresponding to each element, the sum of the previous elements, including itself. Similar to std::inclusive_sum.
- Return
The result value after applying the operation to the input collection
- Parameters
first: Iterator pointing to the first element in the collectionlast: Iterator pointing to the last element in the collection (1 past the end)d_first: Iterator pointing to the first element in the destination collectionidentity: The identity element (i.e., 0)op: The operation to be applied (i.e., summation)grp: Group in which to execute the taskshints: Hints that may be passed to the algorithm
- Template Parameters
It: The type of the iterator in the input collectionIt2: The type of the output iteratorValue: The type of the values we are operating onBinaryOp: The type of the binary operation (i.e., summation)
This will try to parallelize the prefix sum algorithm. It will try to create enough task to make all the sums in parallel. In the process of parallelizing, this will create twice as much work as the serial algorithm
One can also provide hints to the implementation to fine-tune the algorithms to better fit the data it operates on. Please note however that the implementation may completely ignore all the hints it was provided.
The operation needs to be able to be called in parallel.