psyclone.domain.lfric.transformations.lfric_redundant_computation_trans#

This module provides the LFRic redundant-computation transformation.

Classes#

class psyclone.domain.lfric.transformations.lfric_redundant_computation_trans.LFRicRedundantComputationTrans[source]#

This transformation allows the user to modify a loop’s bounds so that redundant computation will be performed. Redundant computation can result in halo exchanges being modified, new halo exchanges being added or existing halo exchanges being removed.

  • This transformation should be performed before any parallelisation transformations (e.g. for OpenMP) to the loop in question and will raise an exception if this is not the case.

  • This transformation can not be applied to a loop containing a reduction and will again raise an exception if this is the case.

  • This transformation can only be used to add redundant computation to a loop, not to remove it.

  • This transformation allows a loop that is already performing redundant computation to be modified, but only if the depth is increased.

Inheritance

Inheritance diagram of LFRicRedundantComputationTrans
apply(node, options=None, depth=None, **kwargs)[source]#

Apply the redundant computation transformation to the loop node. This transformation can be applied to loops iterating over ‘cells or ‘dofs’. if depth is set to a value then the value will be the depth of the field’s halo over which redundant computation will be performed. If depth is not set to a value then redundant computation will be performed to the full depth of the field’s halo.

Parameters:
  • node (Loop) – the loop to transform.

  • options (Optional[dict[str, Any]]) – a dictionary with options for transformations.

  • depth (Union[int, DataNode, None]) – the depth to which to perform redundant computation. Default is None in which case the full halo depth is used.

  • node_type_check (bool) – If the type of nodes enclosed in the loop should be tested to avoid including unsupported nodes in the transformation.

  • verbose (bool) – whether to log the reason the validation failed, at the moment with a comment in the provided PSyIR node.

validate(node, options=None, **kwargs)[source]#

Perform various checks to ensure that it is valid to apply the RedundantComputation transformation to the supplied node

Parameters:
  • node (Loop) – the supplied node on which we are performing validity checks.

  • options (dict[str, Any] | None) – a dictionary with options for transformations.

  • depth (int | psyclone.psyir.nodes.datanode.DataNode | None) – the depth to which to perform redundant computation. Default is None in which case the full halo depth is used.

  • node_type_check (bool) – If the type of nodes enclosed in the loop should be tested to avoid including unsupported nodes in the transformation.

  • verbose (bool) – whether to log the reason the validation failed, at the moment with a comment in the provided PSyIR node.

Raises: