legate::ParallelPolicy#

class ParallelPolicy#

A helper class that describes parallelization policies for tasks.

A ParallelPolicy consists of knobs to control the parallelization policy for tasks in a given scope. To change the parallelization policy of the scope, a new Scope must be created with a ParallelPolicy. Currently, the ParallelPolicy class provides the following parameters:

  • streaming(StreamingMode) (default: OFF): When the streaming() is not OFF in a scope, the runtime executes the tasks in a streaming fashion. For example, if there are two tasks T1 and T2 in the scope, the normal execution would run all parallel instances of T1 before it would move on to T2’s, whereas the streaming execution would alternative between T1 and T2, launching a subset of parallel instances at a time that would fit to the memory. The granularity of tasks can be configured by the overdecompose_factor() (see below), and if the overdecompose_factor() is 1, no streaming would happen even if the streaming() is true.

  • overdecompose_factor() (default: 1): When the value is greater than 1, the auto-partitioner will over-decompose the stores when partitioning them; by default, the auto-partitioner creates N chunks in a store partition when there are N processors, but if the overdecompose_factor() is k in the scope, it would create kN chunks in the partition.

Public Functions

ParallelPolicy &with_streaming(StreamingMode mode)#

Sets the flag that indicates whether tasks in a given scope should be streamed.

See also

StreamingMode.

Parameters:

mode – An enum of type StreamingMode that determines the mode of streaming.

ParallelPolicy &with_overdecompose_factor(
std::uint32_t overdecompose_factor
)#

Sets the over-decomposing factor.

See also

set_overdecompose_factor.

Parameters:

overdecompose_factor – An over-decomposing factor.

ParallelPolicy &with_partitioning_threshold(
mapping::TaskTarget target,
std::uint64_t threshold
)#

Sets partitioning threshold for target processor kind.

This knob signals to the runtime that all stores whose volume is greater than the threshold should be partitioned for the specified target processor kind. Users may specify different thresholds for different task targets at the same time.

Parameters:
  • target – Task target processor kind.

  • threshold – partitioning threshold.

inline bool streaming() const#

Returns the streaming flag.

Returns:

true If the streaming is enabled.

Returns:

false If the streaming is not enabled.

inline StreamingMode streaming_mode() const#

Returns the streaming mode.

Returns:

enum value of type StreamingMode.

inline std::uint32_t overdecompose_factor() const#

Returns the over-decomposing factor.

Returns:

The over-decomposing factor.

std::uint64_t partitioning_threshold(
mapping::TaskTarget target
) const#

Read the partitioning threshold for a give TaskTarget.

Parameters:

target – The target processor kind.

Returns:

Partitioning threshold.

bool operator==(const ParallelPolicy &other) const#

Checks equality between ParallelPolicys.

Parameters:

other – A ParallelPolicy to compare this with.

Returns:

true If *this is the same as other

Returns:

false Otherwise.

bool operator!=(const ParallelPolicy &other) const#

Checks inequality between ParallelPolicys.

Parameters:

other – A ParallelPolicy to compare this with.

Returns:

true If *this is different from other

Returns:

false Otherwise.

ParallelPolicy()#

Initialize ParallelPolicy to system defined defaults.

Initializes the ParallelPolicy members to default values defined by the system configuration, which can be controlled via LEGATE_CONFIG environment variable. Details:

Note

Legate runtime must be initialized before creating any ParallelPolicy instance.

ParallelPolicy(const detail::Config &config, PrivateKey)#

Initialize ParallelPolicy using config parameters.

Parameters:

config – Legate configuration.

class PrivateKey#