loki.transformations.dependency
Classes
|
Duplicate subroutines which includes the creation of new :any:`Item`s as well as the addition of the corresponding new dependencies. |
|
Remove subroutines which includes the removal of the relevant :any:`Item`s as well as the removal of the corresponding dependencies. |
- class DuplicateKernel(duplicate_kernels=None, duplicate_suffix='duplicated', duplicate_module_suffix=None)
Bases:
Transformation
Duplicate subroutines which includes the creation of new :any:`Item`s as well as the addition of the corresponding new dependencies.
Therefore, this transformation creates a new item and also implements the relevant routines for dry-run pipeline planning runs.
- Parameters:
duplicate_kernels (str|tuple|list, optional) – Kernel name(s) to be duplicated.
duplicate_suffix (str, optional) – Suffix to be used to append the original kernel name(s).
duplicate_module_suffix (str, optional) – Suffix to be used to append the original module name(s), if defined, otherwise duplicate_suffix
- creates_items = True
- reverse_traversal = True
- transform_subroutine(routine, **kwargs)
Defines the transformation to apply to
Subroutine
items.For transformations that modify
Subroutine
objects, this method should be implemented. It gets called via the dispatch methodapply()
.- Parameters:
routine (
Subroutine
) – The subroutine to be transformed.**kwargs (optional) – Keyword arguments for the transformation.
- plan_subroutine(routine, **kwargs)
Define the planning steps to apply for
Subroutine
items.For transformations that modify the dependencies of
routine
(e.g., adding new procedure calls, inlining calls, renaming the interface) this should be implemented. It gets called via the dispatch methodapply()
if the optionalplan_mode
argument is set to True.- Parameters:
routine (
Subroutine
) – The subroutine to be transformed.**kwargs (optional) – Keyword arguments for the transformation.
- class RemoveKernel(remove_kernels=None)
Bases:
Transformation
Remove subroutines which includes the removal of the relevant :any:`Item`s as well as the removal of the corresponding dependencies.
Therefore, this transformation creates a new item and also implements the relevant routines for dry-run pipeline planning runs.
- creates_items = True
- transform_subroutine(routine, **kwargs)
Defines the transformation to apply to
Subroutine
items.For transformations that modify
Subroutine
objects, this method should be implemented. It gets called via the dispatch methodapply()
.- Parameters:
routine (
Subroutine
) – The subroutine to be transformed.**kwargs (optional) – Keyword arguments for the transformation.
- plan_subroutine(routine, **kwargs)
Define the planning steps to apply for
Subroutine
items.For transformations that modify the dependencies of
routine
(e.g., adding new procedure calls, inlining calls, renaming the interface) this should be implemented. It gets called via the dispatch methodapply()
if the optionalplan_mode
argument is set to True.- Parameters:
routine (
Subroutine
) – The subroutine to be transformed.**kwargs (optional) – Keyword arguments for the transformation.