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

Public Member Functions

def __init__ (self, omp_schedule="static")
 
def __str__ (self)
 
def validate (self, node, options=None)
 
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.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

 LFRic (Dynamo 0.3) specific orphan OpenMP loop transformation. Adds
Dynamo-specific validity checks.

:param str omp_schedule: the OpenMP schedule to use. Must be one of \
    'runtime', 'static', 'dynamic', 'guided' or 'auto'. Defaults to \
    'static'.

Definition at line 845 of file transformations.py.

Member Function Documentation

◆ apply()

def psyclone.transformations.Dynamo0p3OMPLoopTrans.apply (   self,
  node,
  options = None 
)
 Apply LFRic (Dynamo 0.3) specific OMPLoopTrans.

:param node: the Node in the Schedule to check.
:type node: :py:class:`psyclone.psyir.nodes.Node`
:param options: a dictionary with options for transformations \
                and validation.
:type options: Optional[Dict[str, Any]]
:param bool options["reprod"]: \
        indicating whether reproducible reductions should be used. \
        By default the value from the config file will be used.

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

Definition at line 901 of file transformations.py.

901  def apply(self, node, options=None):
902  ''' Apply LFRic (Dynamo 0.3) specific OMPLoopTrans.
903 
904  :param node: the Node in the Schedule to check.
905  :type node: :py:class:`psyclone.psyir.nodes.Node`
906  :param options: a dictionary with options for transformations \
907  and validation.
908  :type options: Optional[Dict[str, Any]]
909  :param bool options["reprod"]: \
910  indicating whether reproducible reductions should be used. \
911  By default the value from the config file will be used.
912 
913  '''
914  if not options:
915  options = {}
916 
917  # Since this function potentially modifies the user's option
918  # dictionary, create a copy:
919  options = options.copy()
920  # Make sure the default is set:
921  options["reprod"] = options.get("reprod",
922  Config.get().reproducible_reductions)
923 
924  # This transformation allows to parallelise loops with potential
925  # dependencies because we use cell colouring to guarantee that
926  # neighbours are not updated at the same time.
927  options["force"] = True
928 
929  super().apply(node, options)
930 
931 

◆ validate()

def psyclone.transformations.Dynamo0p3OMPLoopTrans.validate (   self,
  node,
  options = None 
)
 Perform LFRic (Dynamo 0.3) specific loop validity checks for the
OMPLoopTrans.

:param node: the Node in the Schedule to check
:type node: :py:class:`psyclone.psyir.nodes.Node`
:param options: a dictionary with options for transformations \
                and validation.
:type options: Optional[Dict[str, Any]]
:param bool options["reprod"]: \
    indicating whether reproducible reductions should be used. \
    By default the value from the config file will be used.

:raises TransformationError: if an OMP loop transform would create \
    incorrect code.

Reimplemented from psyclone.psyir.transformations.parallel_loop_trans.ParallelLoopTrans.

Definition at line 861 of file transformations.py.

861  def validate(self, node, options=None):
862  ''' Perform LFRic (Dynamo 0.3) specific loop validity checks for the
863  OMPLoopTrans.
864 
865  :param node: the Node in the Schedule to check
866  :type node: :py:class:`psyclone.psyir.nodes.Node`
867  :param options: a dictionary with options for transformations \
868  and validation.
869  :type options: Optional[Dict[str, Any]]
870  :param bool options["reprod"]: \
871  indicating whether reproducible reductions should be used. \
872  By default the value from the config file will be used.
873 
874  :raises TransformationError: if an OMP loop transform would create \
875  incorrect code.
876 
877  '''
878  if not options:
879  options = {}
880 
881  # Since this function potentially modifies the user's option
882  # dictionary, create a copy:
883  options = options.copy()
884  # Make sure the default is set:
885  options["reprod"] = options.get("reprod",
886  Config.get().reproducible_reductions)
887 
888  # This transformation allows to parallelise loops with potential
889  # dependencies because we use cell colouring to guarantee that
890  # neighbours are not updated at the same time.
891  options["force"] = True
892  super().validate(node, options=options)
893 
894  # If the loop is not already coloured then check whether or not
895  # it should be
896  if node.loop_type != 'colour' and node.has_inc_arg():
897  raise TransformationError(
898  f"Error in {self.name} transformation. The kernel has an "
899  f"argument with INC access. Colouring is required.")
900 
Here is the caller graph for this function:

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