Reference Guide  2.5.0
psyclone.gocean1p0.GOKernCallFactory Class Reference

Static Public Member Functions

def create (call, parent=None)
 

Detailed Description

 A GOcean-specific kernel-call factory. A standard kernel call in
GOcean consists of a doubly-nested loop (over i and j) and a call to
the user-supplied kernel routine. 

Definition at line 1021 of file gocean1p0.py.

Member Function Documentation

◆ create()

def psyclone.gocean1p0.GOKernCallFactory.create (   call,
  parent = None 
)
static
 Create a new instance of a call to a GO kernel. Includes the
looping structure as well as the call to the kernel itself.

:param parent: node where the kernel call structure will be inserted.
:type parent: :py:class:`psyclone.psyir.nodes.Node`

:returns: new PSyIR tree representing the kernel call loop.
:rtype: :py:class:`psyclone.gocean1p0.GOLoop`

Definition at line 1026 of file gocean1p0.py.

1026  def create(call, parent=None):
1027  ''' Create a new instance of a call to a GO kernel. Includes the
1028  looping structure as well as the call to the kernel itself.
1029 
1030  :param parent: node where the kernel call structure will be inserted.
1031  :type parent: :py:class:`psyclone.psyir.nodes.Node`
1032 
1033  :returns: new PSyIR tree representing the kernel call loop.
1034  :rtype: :py:class:`psyclone.gocean1p0.GOLoop`
1035 
1036  '''
1037  # Add temporary parent as the GOKern constructor needs to find its
1038  # way to the top-level InvokeSchedule but we still don't have the
1039  # PSyIR loops to place it in the appropriate place. We can't create
1040  # the loops first because those depend on information provided by
1041  # this kernel.
1042  gocall = GOKern(call, parent=parent)
1043 
1044  # Determine Loop information from the enclosed Kernel
1045  iteration_space = gocall.iterates_over
1046  field_space = gocall.arguments.iteration_space_arg().function_space
1047  field_name = gocall.arguments.iteration_space_arg().name
1048  index_offset = gocall.index_offset
1049 
1050  # Create the double loop structure
1051  outer_loop = GOLoop.create(loop_type="outer",
1052  iteration_space=iteration_space,
1053  field_space=field_space,
1054  field_name=field_name,
1055  index_offset=index_offset,
1056  parent=parent)
1057  inner_loop = GOLoop.create(loop_type="inner",
1058  iteration_space=iteration_space,
1059  field_space=field_space,
1060  field_name=field_name,
1061  index_offset=index_offset,
1062  parent=outer_loop.loop_body)
1063  outer_loop.loop_body.addchild(inner_loop)
1064  # Remove temporary parent
1065  # pylint: disable=protected-access
1066  gocall._parent = None
1067  inner_loop.loop_body.addchild(gocall)
1068  return outer_loop
1069 
1070 
Here is the caller graph for this function:

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