HDK
|
#include <UT_ParallelUtil.h>
Public Member Functions | |
UT_CoarsenedRange (UT_CoarsenedRange &range, tbb::split spl) | |
bool | is_divisible () const |
Friends | |
template<typename Range , typename Body > | |
void | UTparallelFor (const Range &range, const Body &body, const int subscribe_ratio, const int min_grain_size, const bool force_use_task_scope) |
template<typename Range , typename Body > | |
void | UTparallelReduce (const Range &range, Body &body, const int subscribe_ratio, const int min_grain_size, const bool force_use_taskscope) |
template<typename Range , typename Body > | |
void | UTparallelDeterministicReduce (const Range &range, Body &body, const int grain_size, const bool force_use_taskscope) |
UT_CoarsenedRange: This should be used only inside UT_ParallelFor and UT_ParallelReduce This class wraps an existing range with a new range. This allows us to use simple_partitioner, rather than auto_partitioner, which has disastrous performance with the default grain size in ttb 4.
Definition at line 100 of file UT_ParallelUtil.h.
|
inline |
Definition at line 108 of file UT_ParallelUtil.h.
|
inline |
Definition at line 116 of file UT_ParallelUtil.h.
|
friend |
This is a simple wrapper for deterministic reduce that uses tbb. It works in the same manner as UTparallelReduce, with the following differences:
Definition at line 776 of file UT_ParallelUtil.h.
|
friend |
Run the body
function over a range in parallel. UTparallelFor attempts to spread the range out over at most subscribe_ratio * num_processor tasks. The factor subscribe_ratio can be used to help balance the load. UTparallelFor() uses tbb for its implementation. The used grain size is the maximum of min_grain_size and if UTestimatedNumItems(range) / (subscribe_ratio * num_processor). If subscribe_ratio == 0, then a grain size of min_grain_size will be used. A range can be split only when UTestimatedNumItems(range) exceeds the grain size the range is divisible. Requirements for the Range functor are:
Requirements for the Body function are:
The requirements for a Range object are:
r
into two sub-ranges (i.e. modify r
and *this)Example:
Definition at line 292 of file UT_ParallelUtil.h.
|
friend |
UTparallelReduce() is a simple wrapper that uses tbb for its implementation. Run the body
function over a range in parallel.
WARNING: The operator()()
and join()
functions MUST NOT initialize data! Both of these functions MUST ONLY accumulate data! This is because TBB may re-use body objects for multiple ranges. Effectively, operator()() must act as an in-place join operation for data as it comes in. Initialization must be kept to the constructors of Body.
Requirements for the Body function are:
r.operator()()
and r.join()
, so this should not copy values accumulating in r.The requirements for a Range object are:
r
into two sub-ranges (i.e. modify r
and *this)Example:
Definition at line 716 of file UT_ParallelUtil.h.