legate::ParallelPolicy#
-
class ParallelPolicy#
A helper class that describes parallelization policies for tasks.
A
ParallelPolicyconsists of knobs to control the parallelization policy for tasks in a given scope. To change the parallelization policy of the scope, a newScopemust be created with aParallelPolicy. Currently, theParallelPolicyclass provides the following parameters:streaming(StreamingMode)(default:OFF): When thestreaming()is notOFFin a scope, the runtime executes the tasks in a streaming fashion. For example, if there are two tasksT1andT2in the scope, the normal execution would run all parallel instances ofT1before it would move on toT2’s, whereas the streaming execution would alternative betweenT1andT2, launching a subset of parallel instances at a time that would fit to the memory. The granularity of tasks can be configured by theoverdecompose_factor()(see below), and if theoverdecompose_factor()is1, no streaming would happen even if thestreaming()istrue.overdecompose_factor()(default:1): When the value is greater than1, the auto-partitioner will over-decompose the stores when partitioning them; by default, the auto-partitioner createsNchunks in a store partition when there areNprocessors, but if theoverdecompose_factor()iskin the scope, it would createkNchunks 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
- 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
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
ParallelPolicyto compare this with.- Returns:
true If
*thisis the same asother- Returns:
false Otherwise.
-
bool operator!=(const ParallelPolicy &other) const#
Checks inequality between
ParallelPolicys.- Parameters:
other – A
ParallelPolicyto compare this with.- Returns:
true If
*thisis different fromother- 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_CONFIGenvironment variable. Details:partitioning_threshold(CPU) :
--cpu_chunk_sizeinLEGATE_CONFIGpartitioning_threshold(GPU) :
gpu_chunk_sizeinLEGATE_CONFIGpartitioning_threshold(OMP) :
omp_chunk_sizeinLEGATE_CONFIG
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#