Skip to content

num::omp::parallel_reduce

Defined in header <omp/parallel_ops.hpp>

template <class T, class Block>
T parallel_reduce(idx n, Block block);

Sum block(offset, length) over a blocked decomposition of [0, n).

block is expected to be a raw kernel call over the slice, returning its partial. Runs on one thread below parallel_threshold, or when the build has no OpenMP. The summation order of the partials is fixed regardless.