7#ifndef PXR_BASE_WORK_REDUCE_H
8#define PXR_BASE_WORK_REDUCE_H
12#include "pxr/base/work/api.h"
13#include "pxr/base/work/impl.h"
16PXR_NAMESPACE_OPEN_SCOPE
78template <
typename Fn,
typename Rn,
typename V>
84 Rn &&reductionCallback,
92 PXR_WORK_IMPL_NAMESPACE_USING_DIRECTIVE;
93 return WorkImpl_ParallelReduceN(
96 std::forward<Fn>(loopCallback),
97 std::forward<Rn>(reductionCallback),
102 return std::forward<Fn>(loopCallback)(0, n, identity);
113template <
typename Fn,
typename Rn,
typename V>
119 Rn &&reductionCallback)
124PXR_NAMESPACE_CLOSE_SCOPE
V WorkParallelReduceN(const V &identity, size_t n, Fn &&loopCallback, Rn &&reductionCallback, size_t grainSize)
Recursively splits the range [0, n) into subranges, which are then reduced by invoking loopCallback i...
WORK_API bool WorkHasConcurrency()
Return true if WorkGetPhysicalConcurrencyLimit() returns a number greater than 1 and PXR_WORK_THREAD_...