Reference Guide  2.5.0
psyclone.dynamo0p3.DynGlobalSum Class Reference
Inheritance diagram for psyclone.dynamo0p3.DynGlobalSum:
Collaboration diagram for psyclone.dynamo0p3.DynGlobalSum:

Public Member Functions

def __init__ (self, scalar, parent=None)
 
def gen_code (self, parent)
 
- Public Member Functions inherited from psyclone.psyGen.GlobalSum
def scalar (self)
 
def dag_name (self)
 
def args (self)
 
def node_str (self, colour=True)
 

Detailed Description

Dynamo specific global sum class which can be added to and
manipulated in a schedule.

:param scalar: the kernel argument for which to perform a global sum.
:type scalar: :py:class:`psyclone.dynamo0p3.DynKernelArgument`
:param parent: the parent node of this node in the PSyIR.
:type parent: :py:class:`psyclone.psyir.nodes.Node`

:raises GenerationError: if distributed memory is not enabled.
:raises InternalError: if the supplied argument is not a scalar.
:raises GenerationError: if the scalar is not of "real" intrinsic type.

Definition at line 3632 of file dynamo0p3.py.

Member Function Documentation

◆ gen_code()

def psyclone.dynamo0p3.DynGlobalSum.gen_code (   self,
  parent 
)
Dynamo-specific code generation for this class.

:param parent: f2pygen node to which to add AST nodes.
:type parent: :py:class:`psyclone.f2pygen.SubroutineGen`

Definition at line 3668 of file dynamo0p3.py.

3668  def gen_code(self, parent):
3669  '''
3670  Dynamo-specific code generation for this class.
3671 
3672  :param parent: f2pygen node to which to add AST nodes.
3673  :type parent: :py:class:`psyclone.f2pygen.SubroutineGen`
3674 
3675  '''
3676  name = self._scalar.name
3677  # Use InvokeSchedule SymbolTable to share the same symbol for all
3678  # GlobalSums in the Invoke.
3679  sum_name = self.ancestor(InvokeSchedule).symbol_table.\
3680  find_or_create_tag("global_sum").name
3681  sum_type = self._scalar.data_type
3682  sum_mod = self._scalar.module_name
3683  parent.add(UseGen(parent, name=sum_mod, only=True,
3684  funcnames=[sum_type]))
3685  parent.add(TypeDeclGen(parent, datatype=sum_type,
3686  entity_decls=[sum_name]))
3687  parent.add(AssignGen(parent, lhs=sum_name+"%value", rhs=name))
3688  parent.add(AssignGen(parent, lhs=name, rhs=sum_name+"%get_sum()"))
3689 
3690 

References psyclone.domain.lfric.arg_index_to_metadata_index.ArgIndexToMetadataIndex._scalar(), psyclone.domain.lfric.metadata_to_arguments_rules.MetadataToArgumentsRules._scalar(), psyclone.psyGen.GlobalSum._scalar, 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: