legate.core.task.PyTask#
- class legate.core.task.PyTask(
- func: UserFunction,
- *,
- VariantList variants: VariantList,
- constraints: Sequence[ConstraintProxy] | None = None,
- bool throws_exception: bool = False,
- bool has_side_effect: bool = False,
- invoker: VariantInvoker | None = None,
- library: Library | None = 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.throws_exception – True if any variants of
func
throws an exception, False otherwise.has_side_effect (bool, False) – Whether the task has any global side-effects. See
AutoTask.set_side_effect()
for further information.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
context
. IfFalse
, the user must manually register the task (viaPyTask.complete_registration()
) before use.
Attributes
bool Query whether a
PyTask
has completed registration._LocalTaskID Return the context-local task ID for this task.
Methods
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.