#include <UT_ParallelUtil.h>
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 77 of file UT_ParallelUtil.h.
Definition at line 85 of file UT_ParallelUtil.h.
Definition at line 93 of file UT_ParallelUtil.h.
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 682 of file UT_ParallelUtil.h.
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:
rinto two sub-ranges (i.e. modify
rand *this)
Example:
Definition at line 252 of file UT_ParallelUtil.h.
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:
rinto two sub-ranges (i.e. modify
rand *this)
Example:
Definition at line 633 of file UT_ParallelUtil.h.