Reference Guide  2.5.0
psyclone.transformations.OMPParallelLoopTrans Class Reference
Inheritance diagram for psyclone.transformations.OMPParallelLoopTrans:
Collaboration diagram for psyclone.transformations.OMPParallelLoopTrans:

Public Member Functions

def __str__ (self)
 
def apply (self, node, options=None)
 
- Public Member Functions inherited from psyclone.psyir.transformations.omp_loop_trans.OMPLoopTrans
def __init__ (self, omp_directive="do", omp_schedule="auto")
 
def omp_directive (self)
 
def omp_directive (self, value)
 
def omp_schedule (self)
 
def omp_schedule (self, value)
 
- Public Member Functions inherited from psyclone.psyir.transformations.parallel_loop_trans.ParallelLoopTrans
def validate (self, node, options=None)
 
- Public Member Functions inherited from psyclone.psyir.transformations.loop_trans.LoopTrans
def name (self)
 

Additional Inherited Members

- Public Attributes inherited from psyclone.psyir.transformations.omp_loop_trans.OMPLoopTrans
 omp_schedule
 
 omp_directive
 
- Static Public Attributes inherited from psyclone.psyir.transformations.parallel_loop_trans.ParallelLoopTrans
tuple excluded_node_types = (nodes.Return, psyGen.HaloExchange, nodes.CodeBlock)
 
- Static Public Attributes inherited from psyclone.psyir.transformations.loop_trans.LoopTrans
tuple excluded_node_types = ()
 

Detailed Description

 Adds an OpenMP PARALLEL DO directive to a loop.

    For example:

    >>> from psyclone.parse.algorithm import parse
    >>> from psyclone.psyGen import PSyFactory
    >>> ast, invokeInfo = parse("dynamo.F90")
    >>> psy = PSyFactory("dynamo0.3").create(invokeInfo)
    >>> schedule = psy.invokes.get('invoke_v3_kernel_type').schedule
    >>> # Uncomment the following line to see a text view of the schedule
    >>> # print(schedule.view())
    >>>
    >>> from psyclone.transformations import OMPParallelLoopTrans
    >>> trans = OMPParallelLoopTrans()
    >>> trans.apply(schedule.children[0])
    >>> # Uncomment the following line to see a text view of the schedule
    >>> # print(schedule.view())

Definition at line 681 of file transformations.py.

Member Function Documentation

◆ apply()

def psyclone.transformations.OMPParallelLoopTrans.apply (   self,
  node,
  options = None 
)
 Apply an OMPParallelLoop Transformation to the supplied node
(which must be a Loop). In the generated code this corresponds to
wrapping the Loop with directives:

.. code-block:: fortran

  !$OMP PARALLEL DO ...
  do ...
    ...
  end do
  !$OMP END PARALLEL DO

:param node: the node (loop) to which to apply the transformation.
:type node: :py:class:`psyclone.f2pygen.DoGen`
:param options: a dictionary with options for transformations\
                and validation.
:type options: Optional[Dict[str, Any]]

Reimplemented from psyclone.psyir.transformations.omp_loop_trans.OMPLoopTrans.

Reimplemented in psyclone.transformations.GOceanOMPParallelLoopTrans.

Definition at line 705 of file transformations.py.

705  def apply(self, node, options=None):
706  ''' Apply an OMPParallelLoop Transformation to the supplied node
707  (which must be a Loop). In the generated code this corresponds to
708  wrapping the Loop with directives:
709 
710  .. code-block:: fortran
711 
712  !$OMP PARALLEL DO ...
713  do ...
714  ...
715  end do
716  !$OMP END PARALLEL DO
717 
718  :param node: the node (loop) to which to apply the transformation.
719  :type node: :py:class:`psyclone.f2pygen.DoGen`
720  :param options: a dictionary with options for transformations\
721  and validation.
722  :type options: Optional[Dict[str, Any]]
723  '''
724  self.validate(node, options=options)
725 
726  # keep a reference to the node's original parent and its index as these
727  # are required and will change when we change the node's location
728  node_parent = node.parent
729  node_position = node.position
730 
731  # add our OpenMP loop directive setting its parent to the node's
732  # parent and its children to the node
733  directive = OMPParallelDoDirective(children=[node.detach()],
734  omp_schedule=self.omp_schedule)
735 
736  # add the OpenMP loop directive as a child of the node's parent
737  node_parent.addchild(directive, index=node_position)
738 
739 

References psyclone.psyir.nodes.omp_directives.OMPDoDirective.omp_schedule, psyclone.psyir.transformations.omp_loop_trans.OMPLoopTrans.omp_schedule, psyclone.domain.lfric.kernel.lfric_kernel_metadata.LFRicKernelMetadata.validate(), psyclone.transformations.MoveTrans.validate(), psyclone.transformations.Dynamo0p3AsyncHaloExchangeTrans.validate(), psyclone.domain.common.transformations.alg_invoke_2_psy_call_trans.AlgInvoke2PSyCallTrans.validate(), psyclone.domain.common.transformations.alg_trans.AlgTrans.validate(), psyclone.domain.common.transformations.kernel_module_inline_trans.KernelModuleInlineTrans.validate(), psyclone.domain.common.transformations.raise_psyir_2_alg_trans.RaisePSyIR2AlgTrans.validate(), psyclone.domain.gocean.transformations.gocean_const_loop_bounds_trans.GOConstLoopBoundsTrans.validate(), psyclone.domain.gocean.transformations.gocean_move_iteration_boundaries_inside_kernel_trans.GOMoveIterationBoundariesInsideKernelTrans.validate(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans.validate(), psyclone.domain.gocean.transformations.raise_psyir_2_gocean_kern_trans.RaisePSyIR2GOceanKernTrans.validate(), psyclone.domain.lfric.transformations.lfric_alg_invoke_2_psy_call_trans.LFRicAlgInvoke2PSyCallTrans.validate(), psyclone.domain.lfric.transformations.raise_psyir_2_lfric_kern_trans.RaisePSyIR2LFRicKernTrans.validate(), psyclone.domain.nemo.transformations.create_nemo_invoke_schedule_trans.CreateNemoInvokeScheduleTrans.validate(), psyclone.domain.nemo.transformations.create_nemo_psy_trans.CreateNemoPSyTrans.validate(), psyclone.domain.nemo.transformations.nemo_allarrayrange2loop_trans.NemoAllArrayRange2LoopTrans.validate(), psyclone.domain.nemo.transformations.nemo_arrayrange2loop_trans.NemoArrayRange2LoopTrans.validate(), psyclone.domain.nemo.transformations.nemo_outerarrayrange2loop_trans.NemoOuterArrayRange2LoopTrans.validate(), psyclone.psyad.transformations.assignment_trans.AssignmentTrans.validate(), psyclone.psyGen.Transformation.validate(), psyclone.psyir.transformations.acc_update_trans.ACCUpdateTrans.validate(), psyclone.psyir.transformations.allarrayaccess2loop_trans.AllArrayAccess2LoopTrans.validate(), psyclone.psyir.transformations.arrayaccess2loop_trans.ArrayAccess2LoopTrans.validate(), psyclone.psyir.transformations.arrayrange2loop_trans.ArrayRange2LoopTrans.validate(), psyclone.psyir.transformations.chunk_loop_trans.ChunkLoopTrans.validate(), psyclone.psyir.transformations.fold_conditional_return_expressions_trans.FoldConditionalReturnExpressionsTrans.validate(), psyclone.psyir.transformations.hoist_local_arrays_trans.HoistLocalArraysTrans.validate(), psyclone.psyir.transformations.hoist_loop_bound_expr_trans.HoistLoopBoundExprTrans.validate(), psyclone.psyir.transformations.hoist_trans.HoistTrans.validate(), psyclone.psyir.transformations.inline_trans.InlineTrans.validate(), psyclone.psyir.transformations.intrinsics.array_reduction_base_trans.ArrayReductionBaseTrans.validate(), psyclone.psyir.transformations.intrinsics.dotproduct2code_trans.DotProduct2CodeTrans.validate(), psyclone.psyir.transformations.intrinsics.intrinsic2code_trans.Intrinsic2CodeTrans.validate(), psyclone.psyir.transformations.intrinsics.matmul2code_trans.Matmul2CodeTrans.validate(), psyclone.psyir.transformations.loop_swap_trans.LoopSwapTrans.validate(), psyclone.psyir.transformations.loop_tiling_2d_trans.LoopTiling2DTrans.validate(), psyclone.psyir.transformations.loop_trans.LoopTrans.validate(), psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans.validate(), psyclone.psyir.transformations.omp_taskwait_trans.OMPTaskwaitTrans.validate(), psyclone.psyir.transformations.parallel_loop_trans.ParallelLoopTrans.validate(), psyclone.psyir.transformations.reference2arrayrange_trans.Reference2ArrayRangeTrans.validate(), psyclone.psyir.transformations.replace_induction_variables_trans.ReplaceInductionVariablesTrans.validate(), psyclone.transformations.OMPDeclareTargetTrans.validate(), psyclone.transformations.DynamoOMPParallelLoopTrans.validate(), psyclone.transformations.Dynamo0p3OMPLoopTrans.validate(), psyclone.transformations.GOceanOMPLoopTrans.validate(), psyclone.transformations.Dynamo0p3RedundantComputationTrans.validate(), psyclone.transformations.Dynamo0p3KernelConstTrans.validate(), psyclone.transformations.ACCRoutineTrans.validate(), psyclone.transformations.KernelImportsToArguments.validate(), psyclone.domain.gocean.transformations.gocean_loop_fuse_trans.GOceanLoopFuseTrans.validate(), psyclone.domain.lfric.transformations.lfric_loop_fuse_trans.LFRicLoopFuseTrans.validate(), psyclone.psyir.transformations.loop_fuse_trans.LoopFuseTrans.validate(), psyclone.domain.gocean.transformations.gocean_extract_trans.GOceanExtractTrans.validate(), psyclone.domain.lfric.transformations.lfric_extract_trans.LFRicExtractTrans.validate(), psyclone.psyir.transformations.extract_trans.ExtractTrans.validate(), psyclone.psyir.transformations.nan_test_trans.NanTestTrans.validate(), psyclone.psyir.transformations.read_only_verify_trans.ReadOnlyVerifyTrans.validate(), psyclone.transformations.ParallelRegionTrans.validate(), psyclone.transformations.OMPParallelTrans.validate(), psyclone.transformations.ACCParallelTrans.validate(), psyclone.transformations.ACCKernelsTrans.validate(), psyclone.transformations.ACCDataTrans.validate(), psyclone.psyir.transformations.psy_data_trans.PSyDataTrans.validate(), psyclone.psyir.transformations.region_trans.RegionTrans.validate(), and psyclone.transformations.ACCEnterDataTrans.validate().

Here is the call graph for this function:

The documentation for this class was generated from the following file: