legate.core.task.PyTask#

class legate.core.task.PyTask(func: UserFunction, *, variants: Sequence[VariantCode], constraints: Sequence[ConstraintProxy] | None = None, options: TaskConfig | VariantOptions | None = None, invoker: object = None, library: object = None, bool register: bool = True)#

A Legate task constructed from a Python callable.

__init__()#

Construct a PyTask.

Parameters:
  • func – The base user function to invoke in the task.

  • variants – The list of variants for which func is applicable.

  • constraints – The list of constraints which are to be applied to the arguments of func, if any. Defaults to no constraints.

  • invoker – The invoker used to store the signature and marshall arguments to and manage invoking the user variants. Defaults to constructing the invoker from func.

  • library – The library context under which to register the new task. Defaults to the core context.

  • register – Whether to immediately register the task with library. If False, the user must manually register the task (via PyTask.complete_registration()) before use.

Attributes

library

Library

registered

bool

task_id

_LocalTaskID

Methods

__call__(self, *args, **kwargs)

Invoke the task.

complete_registration(self)

Complete registration for a task.

cpu_variant(self, func)

Register a CPU variant for this task

gpu_variant(self, func)

Register a GPU variant for this task

omp_variant(self, func)

Register an OpenMP variant for this task

prepare_call(self, *args, **kwargs)

Prepare a task instance for execution.