Name

Partitioner Concept — Requirements for a type that decides whether a range should be operated on by a task body or further split. Table 3-4 lists the requirements for a partitioner type P.

Synopsis

Table 3-4. Partitioner Concept

Pseudosignature

Semantics

P::~P()

Destructor.

template <typename Range> bool P::should_execute_range( const Range &r, const task &t)

True if r should be passed to the body of t.False if r should instead be split.

P::P( P& p, split )

Split pinto two partitioners.

Description

The partitioner implements rules for deciding when a given range should no longer be subdivided, but should be operated over as a whole by a task’s body.

The default behavior of the algorithms parallel_for, parallel_reduce, and parallel_scan is to recursively split a range until no subrange remains that is divisible, as decided by the function is_divisible of the Range Concept. The Partitioner Concept models rules for the early termination of the recursive splitting of a range, providing the ability to change the default behavior. A Partitioner object’s decision making is implemented using two functions: a splitting constructor and the function should_execute_range.

Within the parallel algorithms, each Range object is associated with a Partitioner object. Whenever a Range object is split using its splitting constructor to create two subranges, the associated Partitioner object is likewise split to create two matching Partitioner objects.

When a parallel_for, parallel_reduce ...

Get Intel Threading Building Blocks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.