psyclone.psyir.transformations.omp_parallel_trans#
This module provides the OMPParallelTrans transformation.
Classes#
OMPParallelTrans: Create an OpenMP PARALLEL region by inserting directives. For
- class psyclone.psyir.transformations.omp_parallel_trans.OMPParallelTrans[source]#
Create an OpenMP PARALLEL region by inserting directives. For example:
>>> from psyclone.tests.utilities import get_psylayer_schedule >>> filename = "nemolite2d_alg_mod.f90" >>> schedule = get_psylayer_schedule(filename, api="gocean") >>> >>> from psyclone.psyGen import TransInfo >>> t = TransInfo() >>> ltrans = t.get_trans_name('GOceanOMPLoopTrans') >>> from psyclone.psyir.transformations import OMPParallelTrans >>> rtrans = OMPParallelTrans() >>> >>> # Apply the OpenMP Loop transformation to *every* loop >>> # in the schedule >>> for child in schedule.children: ... ltrans.apply(child) >>> >>> # Enclose all of these loops within a single OpenMP >>> # PARALLEL region >>> rtrans.apply(schedule.children)
Inheritance

- apply(nodes, options=None, force_private=(), **kwargs)[source]#
Surrounds the provided node list with an OpenMP Parallel region.
- Parameters:
nodes (
list[Node]) – list of Nodes to put within parallel region.force_private (
Iterable[str]) – list of symbols explicitly requested to be private.node_type_check (bool) – whether or not the type of the nodes enclosed in the region should be tested to avoid using unsupported nodes inside a region.
- property name: str#
- Returns:
the name of this transformation as a string.
- validate(nodes, options=None, **kwargs)[source]#
Perform OpenMP-specific validation checks.
- Parameters:
nodes (
list[Node]) – list of Nodes to put within parallel region.options (Optional[Dict[str, Any]]) – a dictionary with options for transformations.
force_private (collections.abc.Iterable[str]) – list of symbols explicitly requested to be private.
node_type_check (bool) – whether or not the type of the nodes enclosed in the region should be tested to avoid using unsupported nodes inside a region.
- Raises:
TransformationError – if the target Nodes are already within some OMP parallel region.