Reference Guide  2.5.0
psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective Class Reference
Inheritance diagram for psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective:
Collaboration diagram for psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective:

Public Member Functions

def __init__ (self, grainsize=None, num_tasks=None, nogroup=False, **kwargs)
 
def nogroup (self)
 
def validate_global_constraints (self)
 
def gen_code (self, parent)
 
def begin_string (self)
 
def end_string (self)
 
- Public Member Functions inherited from psyclone.psyir.nodes.directive.RegionDirective
def __init__ (self, ast=None, children=None, parent=None)
 
def dir_body (self)
 
def clauses (self)
 
def gen_post_region_code (self, parent)
 
- Public Member Functions inherited from psyclone.psyir.nodes.directive.Directive
def create_data_movement_deep_copy_refs (self)
 
- Public Member Functions inherited from psyclone.psyir.nodes.node.Node
def __init__ (self, ast=None, children=None, parent=None, annotations=None)
 
def __eq__ (self, other)
 
def coloured_name (self, colour=True)
 
def node_str (self, colour=True)
 
def __str__ (self)
 
def ast (self)
 
def ast_end (self)
 
def ast (self, ast)
 
def ast_end (self, ast_end)
 
def annotations (self)
 
def dag (self, file_name='dag', file_format='svg')
 
def dag_gen (self, graph)
 
def dag_name (self)
 
def args (self)
 
def backward_dependence (self)
 
def forward_dependence (self)
 
def is_valid_location (self, new_node, position="before")
 
def depth (self)
 
def view (self, depth=0, colour=True, indent=" ", _index=None)
 
def addchild (self, child, index=None)
 
def children (self)
 
def children (self, my_children)
 
def parent (self)
 
def siblings (self)
 
def has_constructor_parent (self)
 
def position (self)
 
def abs_position (self)
 
def root (self)
 
def sameParent (self, node_2)
 
def walk (self, my_type, stop_type=None, depth=None)
 
def get_sibling_lists (self, my_type, stop_type=None)
 
def ancestor (self, my_type, excluding=None, include_self=False, limit=None, shared_with=None)
 
def kernels (self)
 
def following (self, routine=True)
 
def preceding (self, reverse=False, routine=True)
 
def immediately_precedes (self, node_2)
 
def immediately_follows (self, node_1)
 
def coded_kernels (self)
 
def loops (self)
 
def reductions (self, reprod=None)
 
def is_openmp_parallel (self)
 
def lower_to_language_level (self)
 
def reference_accesses (self, var_accesses)
 
def scope (self)
 
def replace_with (self, node, keep_name_in_context=True)
 
def pop_all_children (self)
 
def detach (self)
 
def copy (self)
 
def debug_string (self)
 
def origin_string (self)
 
def update_signal (self)
 
def path_from (self, ancestor)
 
- Public Member Functions inherited from psyclone.psyir.nodes.commentable_mixin.CommentableMixin
def preceding_comment (self)
 
def preceding_comment (self, comment)
 
def inline_comment (self)
 
def inline_comment (self, comment)
 

Additional Inherited Members

- Public Attributes inherited from psyclone.psyir.nodes.node.Node
 position
 
- Static Public Attributes inherited from psyclone.psyir.nodes.node.Node
int START_DEPTH = 0
 
int START_POSITION = 0
 
 valid_annotations = tuple()
 

Detailed Description

Class representing an OpenMP TASKLOOP directive in the PSyIR.

:param grainsize: The grainsize value used to specify the grainsize \
                  clause on this OpenMP directive. If this is None \
                  the grainsize clause is not applied. Default \
                  value is None.
:type grainsize: int or None.
:param num_tasks: The num_tasks value used to specify the num_tasks \
                  clause on this OpenMP directive. If this is None \
                  the num_tasks clause is not applied. Default value \
                  is None.
:type num_tasks: int or None.
:param nogroup: Whether the nogroup clause should be used for this node. \
                Default value is False
:type nogroup: bool
:param kwargs: additional keyword arguments provided to the PSyIR node.
:type kwargs: unwrapped dict.

:raises GenerationError: if this OMPTaskloopDirective has both \
                         a grainsize and num_tasks value \
                         specified.

Definition at line 1708 of file omp_directives.py.

Member Function Documentation

◆ begin_string()

def psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective.begin_string (   self)
Returns the beginning statement of this directive, i.e.
"omp taskloop ...". The visitor is responsible for adding the
correct directive beginning (e.g. "!$").

:returns: the beginning statement for this directive.
:rtype: str

Definition at line 1862 of file omp_directives.py.

1862  def begin_string(self):
1863  '''Returns the beginning statement of this directive, i.e.
1864  "omp taskloop ...". The visitor is responsible for adding the
1865  correct directive beginning (e.g. "!$").
1866 
1867  :returns: the beginning statement for this directive.
1868  :rtype: str
1869 
1870  '''
1871  return "omp taskloop"
1872 
Here is the caller graph for this function:

◆ end_string()

def psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective.end_string (   self)
Returns the end (or closing) statement of this directive, i.e.
"omp end taskloop". The visitor is responsible for adding the
correct directive beginning (e.g. "!$").

:returns: the end statement for this directive.
:rtype: str

Definition at line 1873 of file omp_directives.py.

1873  def end_string(self):
1874  '''Returns the end (or closing) statement of this directive, i.e.
1875  "omp end taskloop". The visitor is responsible for adding the
1876  correct directive beginning (e.g. "!$").
1877 
1878  :returns: the end statement for this directive.
1879  :rtype: str
1880 
1881  '''
1882  return "omp end taskloop"
1883 
1884 
Here is the caller graph for this function:

◆ gen_code()

def psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective.gen_code (   self,
  parent 
)
Generate the f2pygen AST entries in the Schedule for this OpenMP
taskloop directive.

:param parent: the parent Node in the Schedule to which to add our \
               content.
:type parent: sub-class of :py:class:`psyclone.f2pygen.BaseGen`
:raises GenerationError: if this "!$omp taskloop" is not enclosed \
                         within an OMP Parallel region and an OMP \
                         Serial region.

Definition at line 1825 of file omp_directives.py.

1825  def gen_code(self, parent):
1826  '''
1827  Generate the f2pygen AST entries in the Schedule for this OpenMP
1828  taskloop directive.
1829 
1830  :param parent: the parent Node in the Schedule to which to add our \
1831  content.
1832  :type parent: sub-class of :py:class:`psyclone.f2pygen.BaseGen`
1833  :raises GenerationError: if this "!$omp taskloop" is not enclosed \
1834  within an OMP Parallel region and an OMP \
1835  Serial region.
1836 
1837  '''
1838  self.validate_global_constraints()
1839 
1840  extra_clauses = ""
1841  # Find the specified clauses
1842  clause_list = []
1843  if self._grainsize is not None:
1844  clause_list.append(f"grainsize({self._grainsize})")
1845  if self._num_tasks is not None:
1846  clause_list.append(f"num_tasks({self._num_tasks})")
1847  if self._nogroup:
1848  clause_list.append("nogroup")
1849  # Generate the string containing the required clauses
1850  extra_clauses = ", ".join(clause_list)
1851 
1852  parent.add(DirectiveGen(parent, "omp", "begin", "taskloop",
1853  extra_clauses))
1854 
1855  self.dir_body.gen_code(parent)
1856 
1857  # make sure the directive occurs straight after the loop body
1858  position = parent.previous_loop()
1859  parent.add(DirectiveGen(parent, "omp", "end", "taskloop", ""),
1860  position=["after", position])
1861 

References psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective._grainsize, psyclone.transformations.OMPTaskloopTrans._grainsize, psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective._nogroup, psyclone.transformations.OMPTaskloopTrans._nogroup, psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective._num_tasks, psyclone.transformations.OMPTaskloopTrans._num_tasks, psyclone.psyir.nodes.directive.RegionDirective.dir_body(), psyclone.domain.lfric.lfric_kern.LFRicKern.validate_global_constraints(), psyclone.psyir.nodes.acc_directives.ACCRegionDirective.validate_global_constraints(), psyclone.psyir.nodes.acc_directives.ACCLoopDirective.validate_global_constraints(), psyclone.psyir.nodes.acc_directives.ACCAtomicDirective.validate_global_constraints(), psyclone.psyir.nodes.node.Node.validate_global_constraints(), psyclone.psyir.nodes.omp_directives.OMPDeclareTargetDirective.validate_global_constraints(), psyclone.psyir.nodes.omp_directives.OMPTaskwaitDirective.validate_global_constraints(), psyclone.psyir.nodes.omp_directives.OMPSerialDirective.validate_global_constraints(), psyclone.psyir.nodes.omp_directives.OMPParallelDirective.validate_global_constraints(), psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective.validate_global_constraints(), psyclone.psyir.nodes.omp_directives.OMPDoDirective.validate_global_constraints(), psyclone.psyir.nodes.omp_directives.OMPParallelDoDirective.validate_global_constraints(), psyclone.psyir.nodes.omp_directives.OMPLoopDirective.validate_global_constraints(), psyclone.psyir.nodes.omp_directives.OMPAtomicDirective.validate_global_constraints(), psyclone.psyir.nodes.omp_directives.OMPSimdDirective.validate_global_constraints(), and psyclone.psyir.nodes.omp_task_directive.OMPTaskDirective.validate_global_constraints().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nogroup()

def psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective.nogroup (   self)
:returns: the nogroup clause status of this node.
:rtype: bool

Definition at line 1789 of file omp_directives.py.

1789  def nogroup(self):
1790  '''
1791  :returns: the nogroup clause status of this node.
1792  :rtype: bool
1793  '''
1794  return self._nogroup
1795 

References psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective._nogroup, and psyclone.transformations.OMPTaskloopTrans._nogroup.

◆ validate_global_constraints()

def psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective.validate_global_constraints (   self)
Perform validation checks that can only be done at code-generation
time.

:raises GenerationError: if this OMPTaskloopDirective is not \
                         enclosed within an OpenMP serial region.
:raises GenerationError: if this OMPTaskloopDirective has two
                         Nogroup clauses as children.

Reimplemented from psyclone.psyir.nodes.node.Node.

Definition at line 1796 of file omp_directives.py.

1796  def validate_global_constraints(self):
1797  '''
1798  Perform validation checks that can only be done at code-generation
1799  time.
1800 
1801  :raises GenerationError: if this OMPTaskloopDirective is not \
1802  enclosed within an OpenMP serial region.
1803  :raises GenerationError: if this OMPTaskloopDirective has two
1804  Nogroup clauses as children.
1805  '''
1806  # It is only at the point of code generation that we can check for
1807  # correctness (given that we don't mandate the order that a user
1808  # can apply transformations to the code). A taskloop directive, we must
1809  # have an OMPSerialDirective as an ancestor back up the tree.
1810  if not self.ancestor(OMPSerialDirective):
1811  raise GenerationError(
1812  "OMPTaskloopDirective must be inside an OMP Serial region "
1813  "but could not find an ancestor node")
1814 
1815  # Check children are well formed.
1816  # _validate_child will ensure position 0 and 1 are valid.
1817  if len(self._children) == 3 and isinstance(self._children[1],
1818  OMPNogroupClause):
1819  raise GenerationError(
1820  "OMPTaskloopDirective has two Nogroup clauses as children "
1821  "which is not allowed.")
1822 
1823  super().validate_global_constraints()
1824 

References psyclone.f2pygen.BaseGen._children, psyclone.psyir.nodes.node.Node._children, psyclone.psyir.nodes.omp_directives.OMPParallelDirective._children, and psyclone.psyir.nodes.node.Node.ancestor().

Here is the call graph for this function:
Here is the caller graph for this function:

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