Reference Guide  2.5.0
psyclone.psyGen.InvokeSchedule Class Reference
Inheritance diagram for psyclone.psyGen.InvokeSchedule:
Collaboration diagram for psyclone.psyGen.InvokeSchedule:

Public Member Functions

def __init__ (self, name, KernFactory, BuiltInFactory, alg_calls=None, reserved_names=None, **kwargs)
 
def symbol_table (self)
 
def invoke (self)
 
def invoke (self, my_invoke)
 
def node_str (self, colour=True)
 
def __str__ (self)
 
def gen_code (self, parent)
 

Detailed Description

Stores schedule information for an invocation call. Schedules can be
optimised using transformations.

>>> from psyclone.parse.algorithm import parse
>>> ast, info = parse("algorithm.f90")
>>> from psyclone.psyGen import PSyFactory
>>> api = "..."
>>> psy = PSyFactory(api).create(info)
>>> invokes = psy.invokes
>>> invokes.names
>>> invoke = invokes.get("name")
>>> schedule = invoke.schedule
>>> print(schedule.view())

:param str name: name of the Invoke.
:param type KernFactory: class instance of the factory to use when \
 creating Kernels. e.g. \
 :py:class:`psyclone.domain.lfric.LFRicKernCallFactory`.
:param type BuiltInFactory: class instance of the factory to use when \
 creating built-ins. e.g. \
 :py:class:`psyclone.domain.lfric.lfric_builtins.LFRicBuiltInCallFactory`.
:param alg_calls: list of Kernel calls in the schedule.
:type alg_calls: list of :py:class:`psyclone.parse.algorithm.KernelCall`
:param kwargs: additional keyword arguments provided to the super class.
:type kwargs: unwrapped dict.

Definition at line 665 of file psyGen.py.

Member Function Documentation

◆ gen_code()

def psyclone.psyGen.InvokeSchedule.gen_code (   self,
  parent 
)
Generate the Nodes in the f2pygen AST for this schedule.

:param parent: the parent Node (i.e. the enclosing subroutine) to \
               which to add content.
:type parent: :py:class:`psyclone.f2pygen.SubroutineGen`

Definition at line 754 of file psyGen.py.

754  def gen_code(self, parent):
755  '''
756  Generate the Nodes in the f2pygen AST for this schedule.
757 
758  :param parent: the parent Node (i.e. the enclosing subroutine) to \
759  which to add content.
760  :type parent: :py:class:`psyclone.f2pygen.SubroutineGen`
761 
762  '''
763  # Imported symbols promoted from Kernel imports are in the SymbolTable.
764  # First aggregate all variables imported from the same module in a map.
765  module_map = {}
766  for imported_var in self.symbol_table.imported_symbols:
767  module_name = imported_var.interface.container_symbol.name
768  if module_name in module_map:
769  module_map[module_name].append(imported_var.name)
770  else:
771  module_map[module_name] = [imported_var.name]
772 
773  # Then we can produce the UseGen statements without repeating modules
774  for module_name, var_list in module_map.items():
775  parent.add(UseGen(parent, name=module_name, only=True,
776  funcnames=var_list))
777 
778  for entity in self.children:
779  entity.gen_code(parent)
780 
781 

References psyclone.f2pygen.BaseGen.children(), psyclone.psyGen.InlinedKern.children, psyclone.psyir.nodes.node.Node.children(), psyclone.psyGen.InvokeSchedule.symbol_table(), and psyclone.psyir.nodes.scoping_node.ScopingNode.symbol_table.

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

◆ node_str()

def psyclone.psyGen.InvokeSchedule.node_str (   self,
  colour = True 
)
Returns the name of this node with appropriate control codes
to generate coloured output in a terminal that supports it.

:param bool colour: whether or not to include colour control codes.

:returns: description of this node, possibly coloured.
:rtype: str

Reimplemented in psyclone.domain.lfric.lfric_invoke_schedule.LFRicInvokeSchedule.

Definition at line 735 of file psyGen.py.

735  def node_str(self, colour=True):
736  '''
737  Returns the name of this node with appropriate control codes
738  to generate coloured output in a terminal that supports it.
739 
740  :param bool colour: whether or not to include colour control codes.
741 
742  :returns: description of this node, possibly coloured.
743  :rtype: str
744  '''
745  return f"{self.coloured_name(colour)}[invoke='{self.name}']"
746 

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

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

◆ symbol_table()

def psyclone.psyGen.InvokeSchedule.symbol_table (   self)
:returns: Table containing symbol information for the schedule.
:rtype: :py:class:`psyclone.psyir.symbols.SymbolTable`

Definition at line 720 of file psyGen.py.

720  def symbol_table(self):
721  '''
722  :returns: Table containing symbol information for the schedule.
723  :rtype: :py:class:`psyclone.psyir.symbols.SymbolTable`
724  '''
725  return self._symbol_table
726 

References psyclone.domain.lfric.lfric_collection.LFRicCollection._invoke, psyclone.nemo.NemoInvokeSchedule._invoke, psyclone.psyGen.InvokeSchedule._invoke, psyclone.domain.lfric.lfric_collection.LFRicCollection._symbol_table, psyclone.dynamo0p3.DynMeshes._symbol_table, psyclone.dynamo0p3.HaloDepth._symbol_table, psyclone.psyGen.HaloExchange._symbol_table, psyclone.psyir.backend.sympy_writer.SymPyWriter._symbol_table, and psyclone.psyir.nodes.scoping_node.ScopingNode._symbol_table.

Here is the caller graph for this function:

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