loki.transformations.single_column.claw
Transformations to extract single-column Fortran code adhering to the Single Column Abstraction (SCA), as defined by CLAW (Clement et al., 2018)
Classes
|
Transformation to extract SCA Fortran and apply the necessary CLAW annotations. |
|
Transformation to convert vectorized Fortran kernels into SCA format by removing horizontal vector loops. |
- class ExtractSCATransformation(horizontal)
Bases:
TransformationTransformation to convert vectorized Fortran kernels into SCA format by removing horizontal vector loops.
This will remove all “vector loops” as determined by the
horizontalDimensionobject from “kernel” subroutines, and adjust variable and argument declarations accordingly. In “driver” subroutines, the call signature will be adjusted accordingly, and a single hoisted loop across the horizontal dimension inserted around the first-level kernel invocation.Note, this requires preprocessing with the DerivedTypeArgumentsTransformation, if “array-of-struct”-type derived type arguments are present.
- Parameters:
horizontal (
Dimension) –Dimensionobject describing the variable conventions used in existing code to define the horizontal data dimension and iteration space.
- transform_subroutine(routine, **kwargs)
Apply transformation to convert a
Subroutineto SCA code format.- Parameters:
routine (
Subroutine) – Subroutine to apply this transformation to.role (string) – Role of the subroutine in the call tree; either
"driver"or"kernel"
- remove_dimension(routine)
Remove all loops and variable indices of the stored horizontal dimension from the given routine.
- Parameters:
routine (
Subroutine) – Subroutine to apply this transformation to.
- hoist_dimension_from_call(caller, wrap=True)
Remove all indices and variables of the horzontal dimension from caller (driver) and callee (kernel) routines, and insert the necessary loop over the target dimension into the driver.
Note: In order for this routine to see the horizontal dimension in the argument declarations of the kernel, it must be applied before they are stripped from the kernel itself.
- Parameters:
routine (
Subroutine) – Subroutine to apply this transformation to.wrap (bool) – Flag to trigger the creation of a loop to wrap the kernel call in.
- class CLAWTransformation(**kwargs)
Bases:
ExtractSCATransformationTransformation to extract SCA Fortran and apply the necessary CLAW annotations.
This transformation builds on the SCA extraction of the ExtractSCATransformation by inserting additional CLAW SCA directives into the “kernel” and “driver” routines.
The following CLAW directives are inserted by the transformation: *
!$claw sca forwardmarkers in the “driver” routine *!$claw scaandclaw model-configregions in the first-level “kernel” routine *!$claw sca routinein any “kernel” routines beyond first-levelNote, this requires preprocessing with the DerivedTypeArgumentsTransformation, if “array-of-struct”-type derived type arguments are present.
- Parameters:
claw_data_offload (bool) – Flag triggering the addition of
createandupdate` clauses to the ``!$claw sca forwarddirective, causing CLAW to tightly wrap the kernel invocation in OpenACC offload directives.
- transform_subroutine(routine, **kwargs)
Apply transformation to convert a
Subroutineto SCA code format.- Parameters:
routine (
Subroutine) – Subroutine to apply this transformation to.role (string) – Role of the subroutine in the call tree; either
"driver"or"kernel"