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()(default:false): When thestreaming()istruein 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(bool streaming)#
Sets the flag that indicates whether tasks in a given scope should be streamed.
- Parameters:
streaming – A boolean value to set to the streaming flag.
- 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.
-
inline bool streaming() const#
Returns the streaming flag.
- Returns:
true If the streaming is enabled.
- Returns:
false If the streaming is not enabled.
-
inline std::uint32_t overdecompose_factor() const#
Returns the over-decomposing factor.
- Returns:
The over-decomposing factor.
-
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.