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.

AutoTask.add_input(self, array_or_store[, ...])

Adds a logical array/store as input to the task

AutoTask.add_output(self, array_or_store[, ...])

Adds a logical array/store as output to the task

AutoTask.add_reduction(self, array_or_store, ...)

Adds a logical array/store to the task for reduction

AutoTask.add_scalar_arg(self, value[, dtype])

Adds a by-value argument to the task

AutoTask.declare_partition(self)

AutoTask.add_constraint(self, ...)

AutoTask.add_alignment(self, ...)

Sets an alignment between stores.

AutoTask.add_broadcast(self, array_or_store)

Sets a broadcasting constraint on the logical_array.

AutoTask.throws_exception(self, ...)

AutoTask.add_nccl_communicator(self)

Adds a NCCL communicator to the task

AutoTask.add_cpu_communicator(self)

Adds a CPU communicator to the task

AutoTask.set_concurrent(self, bool concurrent)

AutoTask.set_side_effect(self, ...)

AutoTask.execute(self)

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.)

ManualTask.set_concurrent(self, bool concurrent)

ManualTask.set_side_effect(self, ...)

ManualTask.add_input(self, arg[, projection])

ManualTask.add_output(self, arg[, projection])

ManualTask.add_reduction(self, arg, ...)

ManualTask.add_scalar_arg(self, value[, dtype])

Adds a by-value argument to the task

ManualTask.throws_exception(self, ...)

ManualTask.add_nccl_communicator(self)

Adds a NCCL communicator to the task

ManualTask.add_cpu_communicator(self)

Adds a CPU communicator to the task

ManualTask.execute(self)

Submits the operation to the runtime.