psyclone.psyir.transformations.metatransformations.omp_cpu_routine_trans#

This module contains the OpenMPCPURoutineTrans metatransformation.

Classes#

class psyclone.psyir.transformations.metatransformations.omp_cpu_routine_trans.OMPCPURoutineTrans[source]#

This metatransformation applies the OMPLoopTrans, the MaximalOMPParallelRegionTrans, and (optionally) the OMPMinimiseSyncTrans to the supplied Routine.

This metatransformation can be used as an all-in-one method to parallelise routines with OpenMP CPU parallelism, and will attempt to maximise the amount of parallelism available. If the nowait option is set to True, it will also attempt to minimise the number of synchronisation points added into the parallel region.

Inheritance

Inheritance diagram of OMPCPURoutineTrans
apply(node, **kwargs)[source]#

Applies the OMPLoopTrans, MaximalOMPParallelRegionTrans and OMPMinimiseSyncTrans to the relevant parts of the input node.

Parameters:
  • node (Routine) – The Routine node to transform

  • reprod (bool) – (Option provided for OMPLoopTrans) indicating whether reproducible reductions should be used. By default the value from the config file will be used.

  • enable_reductions (bool) – (Option provided for OMPLoopTrans) whether to attempt to infer reduction clauses or not.

  • collapse (int | bool) – (Option provided for OMPLoopTrans) if it’s a bool and is False (default), it won’t collapse. If it’s a bool and is True, it will collapse as much as possible. If it’s an integer, it will attempt to collapse until the specified number of loops (if they exist and are safe to collapse them). The options ‘ignore_dependencies_for’ and ‘force’ also affect the collapse applicability analysis.

  • force (bool) – (Option provided for OMPLoopTrans) whether to force parallelisation of the target loop (i.e. ignore any dependence analysis).

  • force_private (collections.abc.Iterable[str]) – (Option provided for OMPLoopTrans) specify a list of symbol names explicitly requested to be private.

  • ignore_dependencies_for (None | List[str]) – (Option provided for OMPLoopTrans) specify a list of symbol names to ignore for the dependence analysis checks.

  • sequential (bool) – (Option provided for OMPLoopTrans) whether this is a sequential loop.

  • verbose (bool) – (Option provided for OMPLoopTrans) whether to report the reasons the validate and collapse steps have failed.

  • nowait (bool) – (Option provided for OMPLoopTrans) whether to add a nowait clause and a corresponding barrier (or equivalent) to enable asynchronous execution.

  • privatise_arrays (bool) – (Option provided for OMPLoopTrans) whether to make the write after write dependency symbols declared as private.

  • reduction_ops (List[psyclone.psyir.nodes.operation.Operator | psyclone.psyir.nodes.intrinsic_call.IntrinsicCall.Intrinsic]) – (Option provided for OMPLoopTrans) if non-empty, attempt parallelisation of loops by inferring reduction clauses involving any of the reduction operators in the list.

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

  • node_type_check – (Option provided for MaximalOMPParallelRegionTrans) (Option provided for OMPParallelTrans) whether or not the type of the nodes enclosed in the region should be tested to avoid using unsupported nodes inside a region.

  • force_private – (Option provided for MaximalOMPParallelRegionTrans) (Option provided for OMPParallelTrans) list of symbols explicitly requested to be private.

validate(node, **kwargs)[source]#

Validates the input options of the OpenMPCPURoutineTrans.

Parameters:
  • node (Routine) – The Routine node to validate.

  • reprod (bool) – (Option provided for OMPLoopTrans) indicating whether reproducible reductions should be used. By default the value from the config file will be used.

  • enable_reductions (bool) – (Option provided for OMPLoopTrans) whether to attempt to infer reduction clauses or not.

  • collapse (int | bool) – (Option provided for OMPLoopTrans) if it’s a bool and is False (default), it won’t collapse. If it’s a bool and is True, it will collapse as much as possible. If it’s an integer, it will attempt to collapse until the specified number of loops (if they exist and are safe to collapse them). The options ‘ignore_dependencies_for’ and ‘force’ also affect the collapse applicability analysis.

  • force (bool) – (Option provided for OMPLoopTrans) whether to force parallelisation of the target loop (i.e. ignore any dependence analysis).

  • force_private (collections.abc.Iterable[str]) – (Option provided for MaximalOMPParallelRegionTrans) (Option provided for OMPParallelTrans) list of symbols explicitly requested to be private.

  • ignore_dependencies_for (None | List[str]) – (Option provided for OMPLoopTrans) specify a list of symbol names to ignore for the dependence analysis checks.

  • sequential (bool) – (Option provided for OMPLoopTrans) whether this is a sequential loop.

  • verbose (bool) – (Option provided for OMPLoopTrans) whether to report the reasons the validate and collapse steps have failed.

  • nowait (bool) – (Option provided for OMPLoopTrans) whether to add a nowait clause and a corresponding barrier (or equivalent) to enable asynchronous execution.

  • privatise_arrays (bool) – (Option provided for OMPLoopTrans) whether to make the write after write dependency symbols declared as private.

  • reduction_ops (List[psyclone.psyir.nodes.operation.Operator | psyclone.psyir.nodes.intrinsic_call.IntrinsicCall.Intrinsic]) – (Option provided for OMPLoopTrans) if non-empty, attempt parallelisation of loops by inferring reduction clauses involving any of the reduction operators in the list.

  • node_type_check (bool) – (Option provided for MaximalOMPParallelRegionTrans) (Option provided for OMPParallelTrans) whether or not the type of the nodes enclosed in the region should be tested to avoid using unsupported nodes inside a region.