Operations#
Operations in Legate are by default automatically parallelized. Legate extracts parallelism from an operation by partitioning its store arguments. Operations usually require the partitions to be aligned in some way; e.g., partitioning vectors across multiple addition tasks requires the vectors to be partitioned in the same way. Legate provides APIs for developers to control how stores are partitioned via partitioning constraints.
When an operation needs a store to be partitioned more than one way, the operation can create partition symbols and use them in partitioning constraints. In that case, a partition symbol must be passed along with the store when the store is added. Stores can be partitioned in multiple ways when they are used only for read accesses or reductions.
AutoTask#
AutoTask
is a type of tasks that are automatically parallelized. Each
Legate task is associated with a task id that uniquely names a task to invoke.
The actual task implementation resides on the C++ side.
|
Adds a logical array/store as input to the task |
|
Adds a logical array/store as output to the task |
|
Adds a logical array/store to the task for reduction |
|
Adds a by-value argument to the task |
Declare a partition symbol for this task. |
|
|
Add a partitioning constraint to the task. |
|
Sets an alignment between stores. |
|
Sets a broadcasting constraint on the logical_array. |
|
Set which exception is thrown by the task. |
Adds a NCCL communicator to the task |
|
Adds a CPU communicator to the task |
|
|
Set whether a task requires a concurrent task launch. |
|
Set whether a task has side effects. |
|
Submits the operation to the runtime. |
Manually Parallelized Tasks#
In some occassions, tasks are unnatural or even impossible to write in the
auto-parallelized style. For those occassions, Legate provides explicit control
on how tasks are parallelized via ManualTask
. Each manual task requires the
caller to provide a launch domain that determines the degree of parallelism
and also names task instances initiaed by the task. Direct store arguments to a
manual task are assumed to be replicated across task instances, and it’s the
developer’s responsibility to partition stores. Mapping between points in the
launch domain and colors in the color space of a store partition is assumed to
be an identity mapping by default, but it can be configured with a projection
function, a Python function on tuples of coordinates. (See
StorePartition for definitions of color,
color space, and store partition.)
|
Set whether a task requires a concurrent task launch. |
|
Set whether a task has side effects. |
|
Adds an input to the task. |
|
Adds an output to the task. |
|
|
|
Adds a by-value argument to the task |
|
Set which exception is thrown by the task. |
Adds a NCCL communicator to the task |
|
Adds a CPU communicator to the task |
|
|
Submits the operation to the runtime. |