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, or parallel_scan algorithm needs to decide whether to further subdivide a range, it invokes the function should_execute_range for the Partitioner object associated with the range. If the function returns true for the given range and task, no further splits are performed on the range and the current task applies its body over the entire range.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.13.201