Reference Guide  2.5.0
psyclone.psyir.nodes.acc_directives.ACCParallelDirective Class Reference
Inheritance diagram for psyclone.psyir.nodes.acc_directives.ACCParallelDirective:
Collaboration diagram for psyclone.psyir.nodes.acc_directives.ACCParallelDirective:

Public Member Functions

def __init__ (self, default_present=True, **kwargs)
 
def gen_code (self, parent)
 
def begin_string (self)
 
def end_string (self)
 
def default_present (self)
 
def default_present (self, value)
 
def fields (self)
 
- Public Member Functions inherited from psyclone.psyir.nodes.acc_directives.ACCRegionDirective
def validate_global_constraints (self)
 
def signatures (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)
 

Public Attributes

 default_present
 
- Public Attributes inherited from psyclone.psyir.nodes.node.Node
 position
 

Additional Inherited Members

- 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 the !$ACC PARALLEL directive of OpenACC
in the PSyIR. By default it includes the 'DEFAULT(PRESENT)' clause which
means this node must either come after an EnterDataDirective or within
a DataDirective.

:param bool default_present: whether this directive includes the
    'DEFAULT(PRESENT)' clause.

Definition at line 280 of file acc_directives.py.

Constructor & Destructor Documentation

◆ __init__()

def psyclone.psyir.nodes.acc_directives.ACCParallelDirective.__init__ (   self,
  default_present = True,
**  kwargs 
)
Class representing the !$ACC PARALLEL directive of OpenACC
in the PSyIR. By default it includes the 'DEFAULT(PRESENT)' clause which
means this node must either come after an EnterDataDirective or within
a DataDirective.

:param bool default_present: whether this directive includes the
    'DEFAULT(PRESENT)' clause.

Definition at line 291 of file acc_directives.py.

291  def __init__(self, default_present=True, **kwargs):
292  super().__init__(**kwargs)
293  self.default_present = default_present
294 

References psyclone.psyir.nodes.acc_directives.ACCParallelDirective.default_present, and psyclone.psyir.nodes.acc_directives.ACCKernelsDirective.default_present.

Member Function Documentation

◆ begin_string()

def psyclone.psyir.nodes.acc_directives.ACCParallelDirective.begin_string (   self)
Returns the beginning statement of this directive, i.e.
"acc parallel" plus any qualifiers. The backend is responsible for
adding the correct characters to mark this as a directive (e.g. "!$").

:returns: the opening statement of this directive.
:rtype: str

Definition at line 315 of file acc_directives.py.

315  def begin_string(self):
316  '''
317  Returns the beginning statement of this directive, i.e.
318  "acc parallel" plus any qualifiers. The backend is responsible for
319  adding the correct characters to mark this as a directive (e.g. "!$").
320 
321  :returns: the opening statement of this directive.
322  :rtype: str
323 
324  '''
325  if self._default_present:
326  # "default(present)" means that the compiler is to assume that
327  # all data required by the parallel region is already present
328  # on the device. If we've made a mistake and it isn't present
329  # then we'll get a run-time error.
330  return "acc parallel default(present)"
331  return "acc parallel"
332 

References psyclone.psyir.nodes.acc_directives.ACCParallelDirective._default_present, psyclone.psyir.nodes.acc_directives.ACCKernelsDirective._default_present, and psyclone.transformations.ACCParallelTrans._default_present.

Here is the caller graph for this function:

◆ default_present() [1/2]

def psyclone.psyir.nodes.acc_directives.ACCParallelDirective.default_present (   self)
:returns: whether the directive includes the 'default(present)' clause.
:rtype: bool

Definition at line 341 of file acc_directives.py.

341  def default_present(self):
342  '''
343  :returns: whether the directive includes the 'default(present)' clause.
344  :rtype: bool
345  '''
346  return self._default_present
347 

References psyclone.psyir.nodes.acc_directives.ACCParallelDirective._default_present, psyclone.psyir.nodes.acc_directives.ACCKernelsDirective._default_present, and psyclone.transformations.ACCParallelTrans._default_present.

Here is the caller graph for this function:

◆ default_present() [2/2]

def psyclone.psyir.nodes.acc_directives.ACCParallelDirective.default_present (   self,
  value 
)
:param bool value: whether the directive should include the
    'default(present)' clause.

:raises TypeError: if the given value is not a boolean.

Definition at line 349 of file acc_directives.py.

349  def default_present(self, value):
350  '''
351  :param bool value: whether the directive should include the
352  'default(present)' clause.
353 
354  :raises TypeError: if the given value is not a boolean.
355 
356  '''
357  if not isinstance(value, bool):
358  raise TypeError(
359  f"The ACCParallelDirective default_present property must be "
360  f"a boolean but value '{value}' has been given.")
361  self._default_present = value
362 

References psyclone.psyir.nodes.acc_directives.ACCParallelDirective._default_present, psyclone.psyir.nodes.acc_directives.ACCKernelsDirective._default_present, and psyclone.transformations.ACCParallelTrans._default_present.

Here is the caller graph for this function:

◆ end_string()

def psyclone.psyir.nodes.acc_directives.ACCParallelDirective.end_string (   self)
:returns: the closing statement for this directive.
:rtype: str

Definition at line 333 of file acc_directives.py.

333  def end_string(self):
334  '''
335  :returns: the closing statement for this directive.
336  :rtype: str
337  '''
338  return "acc end parallel"
339 
Here is the caller graph for this function:

◆ fields()

def psyclone.psyir.nodes.acc_directives.ACCParallelDirective.fields (   self)
Returns a list of the names of field objects required by the Kernel
call(s) that are children of this directive.

:returns: list of names of field arguments.
:rtype: List[str]

Definition at line 364 of file acc_directives.py.

364  def fields(self):
365  '''
366  Returns a list of the names of field objects required by the Kernel
367  call(s) that are children of this directive.
368 
369  :returns: list of names of field arguments.
370  :rtype: List[str]
371  '''
372  # Look-up the kernels that are children of this node
373  fld_list = []
374  for call in self.kernels():
375  for arg in call.arguments.fields:
376  if arg not in fld_list:
377  fld_list.append(arg)
378  return fld_list
379 
380 

References psyclone.psyir.nodes.node.Node.kernels().

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

◆ gen_code()

def psyclone.psyir.nodes.acc_directives.ACCParallelDirective.gen_code (   self,
  parent 
)
Generate the elements of the f2pygen AST for this Node in the Schedule.

:param parent: node in the f2pygen AST to which to add node(s).
:type parent: :py:class:`psyclone.f2pygen.BaseGen`

Definition at line 295 of file acc_directives.py.

295  def gen_code(self, parent):
296  '''
297  Generate the elements of the f2pygen AST for this Node in the Schedule.
298 
299  :param parent: node in the f2pygen AST to which to add node(s).
300  :type parent: :py:class:`psyclone.f2pygen.BaseGen`
301 
302  '''
303  self.validate_global_constraints()
304 
305  parent.add(DirectiveGen(parent, "acc", "begin",
306  *self.begin_string().split()[1:]))
307 
308  for child in self.children:
309  child.gen_code(parent)
310 
311  parent.add(DirectiveGen(parent, *self.end_string().split()))
312 
313  self.gen_post_region_code(parent)
314 

References psyclone.psyir.nodes.acc_directives.ACCRoutineDirective.begin_string(), psyclone.psyir.nodes.acc_directives.ACCEnterDataDirective.begin_string(), psyclone.psyir.nodes.acc_directives.ACCParallelDirective.begin_string(), psyclone.psyir.nodes.acc_directives.ACCKernelsDirective.begin_string(), psyclone.psyir.nodes.acc_directives.ACCDataDirective.begin_string(), psyclone.psyir.nodes.acc_directives.ACCUpdateDirective.begin_string(), psyclone.psyir.nodes.acc_directives.ACCAtomicDirective.begin_string(), psyclone.psyir.nodes.omp_directives.OMPDeclareTargetDirective.begin_string(), psyclone.psyir.nodes.omp_directives.OMPTaskwaitDirective.begin_string(), psyclone.psyir.nodes.omp_directives.OMPSingleDirective.begin_string(), psyclone.psyir.nodes.omp_directives.OMPMasterDirective.begin_string(), psyclone.psyir.nodes.omp_directives.OMPParallelDirective.begin_string(), psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective.begin_string(), psyclone.psyir.nodes.omp_directives.OMPDoDirective.begin_string(), psyclone.psyir.nodes.omp_directives.OMPParallelDoDirective.begin_string(), psyclone.psyir.nodes.omp_directives.OMPTargetDirective.begin_string(), psyclone.psyir.nodes.omp_directives.OMPLoopDirective.begin_string(), psyclone.psyir.nodes.omp_directives.OMPAtomicDirective.begin_string(), psyclone.psyir.nodes.omp_directives.OMPSimdDirective.begin_string(), psyclone.psyir.nodes.omp_task_directive.OMPTaskDirective.begin_string(), psyclone.psyir.nodes.acc_directives.ACCLoopDirective.begin_string(), psyclone.f2pygen.BaseGen.children(), psyclone.psyGen.InlinedKern.children, psyclone.psyir.nodes.node.Node.children(), psyclone.psyir.nodes.acc_directives.ACCParallelDirective.end_string(), psyclone.psyir.nodes.acc_directives.ACCLoopDirective.end_string(), psyclone.psyir.nodes.acc_directives.ACCKernelsDirective.end_string(), psyclone.psyir.nodes.acc_directives.ACCDataDirective.end_string(), psyclone.psyir.nodes.acc_directives.ACCAtomicDirective.end_string(), psyclone.psyir.nodes.omp_directives.OMPSingleDirective.end_string(), psyclone.psyir.nodes.omp_directives.OMPMasterDirective.end_string(), psyclone.psyir.nodes.omp_directives.OMPParallelDirective.end_string(), psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective.end_string(), psyclone.psyir.nodes.omp_directives.OMPDoDirective.end_string(), psyclone.psyir.nodes.omp_directives.OMPParallelDoDirective.end_string(), psyclone.psyir.nodes.omp_directives.OMPTargetDirective.end_string(), psyclone.psyir.nodes.omp_directives.OMPLoopDirective.end_string(), psyclone.psyir.nodes.omp_directives.OMPAtomicDirective.end_string(), psyclone.psyir.nodes.omp_directives.OMPSimdDirective.end_string(), psyclone.psyir.nodes.omp_task_directive.OMPTaskDirective.end_string(), psyclone.psyir.nodes.directive.RegionDirective.gen_post_region_code(), 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:

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