loki.transformations.single_column.annotate

Classes

SCCAnnotateTransformation(horizontal, ...)

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 and Subroutine 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) – Optional Dimension 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' or None.

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 loops

  • horizontal (Dimension) – The dimension object specifying the horizontal vector dimension

  • block_dim – The dimension object specifying the blocking dimension

  • ignore (list or tuple) – Loops to be ignored for annotation

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 the Loop and Subroutine 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' or None.

  • driver_loop (Loop) – Driver Loop to wrap in 'opencc' pragmas.

  • kernel_loops (list of Loop) – Vector Loop to wrap in 'opencc' pragmas if hoisting is enabled.

  • block_dim (Dimension) – Optional Dimension 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