loki.transformations.single_column.annotate

Classes

SCCAnnotateTransformation(directive, block_dim)

A set of utilities to insert offload directives.

class SCCAnnotateTransformation(directive, block_dim)

Bases: Transformation

A set of utilities to insert offload directives. This includes both Loop and Subroutine level annotations.

Parameters:
  • 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.

annotate_vector_loops(routine)

Insert !$acc loop vector for previously marked loops, including addition of the necessary private variable declarations.

Parameters:

routine (Subroutine) – The subroutine in the vector loops should be removed.

annotate_sequential_loops(routine)

Insert !$acc loop seq annotations for all loops previously marked with !$loki loop seq.

Parameters:

routine (Subroutine) – The subroutine in which to annotate sequential loops

annotate_kernel_routine(routine)

Insert !$acc routine seq/vector directives and wrap subroutine body in !$acc data present directives.

Parameters:

routine (Subroutine) – The subroutine to which annotations will be added

transform_subroutine(routine, **kwargs)

Apply OpenACC annotations according to !$loki placeholder directives.

This routine effectively converts neutral !$loki loop and !$loki routine annotations into the corresponding !$acc equivalent directives. It also adds !$acc data present clauses around kernel routine bodies and adds private clauses to loop annotations.

If the directive provided is not openacc, no change is applied. In the future, we aim to support OpenMP equivalent directives here.

Parameters:
  • routine (Subroutine) – Subroutine to apply this transformation to.

  • role (string) – Role of the subroutine in the call tree; should be "kernel"

find_acc_vars(routine, targets)

Find variables already specified in acc data clauses.

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

annotate_driver_loop(loop, acc_vars)

Annotate driver block loop with 'openacc' pragmas.

Parameters:
  • loop (Loop) – Driver Loop to wrap in 'openacc' pragmas.

  • acc_vars (list) – Variables already declared in 'openacc' data directives.