Template Function concore::v1::conc_scan(It, It, It2, Value, const BinaryOp&, task_group, partition_hints)

Function Documentation

template<typename It, typename It2, typename Value, typename BinaryOp>
Value concore::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 collection

  • last: Iterator pointing to the last element in the collection (1 past the end)

  • d_first: Iterator pointing to the first element in the destination collection

  • identity: The identity element (i.e., 0)

  • op: The operation to be applied (i.e., summation)

  • grp: Group in which to execute the tasks

  • hints: Hints that may be passed to the algorithm

Template Parameters
  • It: The type of the iterator in the input collection

  • It2: The type of the output iterator

  • Value: The type of the values we are operating on

  • BinaryOp: 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.

See

conc_for(), conc_reduce(), task_group