loki.transformations.pragma_model module

class PragmaModelTransformation(directive=False, keep_loki_pragmas=True)

Bases: Transformation

Transformation to map Loki generic pragmas to a specific pragma model using a child class of GenericPragmaMapper.

For the mapping between Loki directives and programming model-specific annotations, see Loki directives.

Parameters:
  • directive (False, str) – The directive(s) to be used, used to determine which child class of GenericPragmaMapper is used. Use False to suppress the directive translation entirely.

  • keep_loki_pragmas (bool) – Keep or remove generic Loki pragmas that are not mapped.

item_filter = (<class 'loki.batch.item.ProcedureItem'>, <class 'loki.batch.item.ModuleItem'>)
transform_module(module, **kwargs)

Defines the transformation to apply to Module items.

For transformations that modify Module objects, this method should be implemented. It gets called via the dispatch method apply().

Parameters:
  • module (Module) – The module to be transformed.

  • **kwargs (optional) – Keyword arguments for the transformation.

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 method apply().

Parameters:
  • routine (Subroutine) – The subroutine to be transformed.

  • **kwargs (optional) – Keyword arguments for the transformation.