loki.transformations.single_column.annotate
Classes
|
A set of utilities to insert offload directives. |
- class SCCAnnotateTransformation(horizontal, directive, block_dim)
Bases:
Transformation
A set of utilities to insert offload directives. This includes both
Loop
andSubroutine
level annotations.- Parameters:
horizontal (
Dimension
) –Dimension
object describing the variable conventions used in code to define the horizontal data dimension and iteration space.block_dim (
Dimension
) – OptionalDimension
object to define the blocking dimension to use for hoisted column arrays if hoisting is enabled.directive (string or None) – Directives flavour to use for parallelism annotations; either
'openacc'
orNone
.
- classmethod kernel_annotate_vector_loops_openacc(routine, horizontal)
Insert
!$acc loop vector
annotations around horizontal vector loops, including the necessary private variable declarations.- Parameters:
routine (
Subroutine
) – The subroutine in the vector loops should be removed.horizontal (
Dimension
) – The dimension object specifying the horizontal vector dimension
- classmethod kernel_annotate_sequential_loops_openacc(routine, horizontal, block_dim=None, ignore=())
Insert
!$acc loop seq
annotations around all loops that are not horizontal vector loops.- Parameters:
routine (
Subroutine
) – The subroutine in which to annotate sequential loopshorizontal (
Dimension
) – The dimension object specifying the horizontal vector dimensionblock_dim – The dimension object specifying the blocking dimension
- classmethod kernel_annotate_subroutine_present_openacc(routine)
Insert
!$acc data present
annotations around the body of a subroutine.- Parameters:
routine (
Subroutine
) – The subroutine to which annotations will be added
- classmethod insert_annotations(routine, horizontal)
- transform_subroutine(routine, **kwargs)
Apply SCCAnnotate utilities to a
Subroutine
.- Parameters:
routine (
Subroutine
) – Subroutine to apply this transformation to.role (string) – Role of the subroutine in the call tree; should be
"kernel"
- process_kernel(routine)
Applies the SCCAnnotate utilities to a “kernel”. This consists of inserting the relevant
'openacc'
annotations at theLoop
andSubroutine
level.- Parameters:
routine (
Subroutine
) – Subroutine to apply this transformation to.
- process_driver(routine, targets=None)
Apply the relevant
'openacc'
annotations to the driver loop.- Parameters:
routine (
Subroutine
) – Subroutine to apply this transformation to.targets (list or string) – List of subroutines that are to be considered as part of the transformation call tree.
- classmethod device_alloc_column_locals(routine, column_locals)
Add explicit OpenACC statements for creating device variables for hoisted column locals.
- Parameters:
routine (
Subroutine
) – Subroutine to apply this transformation to.column_locals (list) – List of column locals to be hoisted to driver layer
- classmethod annotate_driver(directive, driver_loop, kernel_loops, block_dim, num_threads)
Annotate driver block loop with
'openacc'
pragmas.- Parameters:
directive (string or None) – Directives flavour to use for parallelism annotations; either
'openacc'
orNone
.driver_loop (
Loop
) – DriverLoop
to wrap in'opencc'
pragmas.kernel_loops (list of
Loop
) – VectorLoop
to wrap in'opencc'
pragmas if hoisting is enabled.block_dim (
Dimension
) – OptionalDimension
object to define the blocking dimension to detect hoisted temporary arrays and excempt them from marking.num_threads (str) – The size expression that determines the number of threads per thread block