Reference Guide  2.5.0
psyclone.gocean1p0.GOInvoke Class Reference
Inheritance diagram for psyclone.gocean1p0.GOInvoke:
Collaboration diagram for psyclone.gocean1p0.GOInvoke:

Public Member Functions

def __init__ (self, alg_invocation, idx, invokes)
 
def unique_args_arrays (self)
 
def unique_args_iscalars (self)
 
def gen_code (self, parent)
 
- Public Member Functions inherited from psyclone.psyGen.Invoke
def __init__ (self, alg_invocation, idx, schedule_class, invokes, reserved_names=None)
 
def __str__ (self)
 
def invokes (self)
 
def name (self)
 
def alg_unique_args (self)
 
def psy_unique_vars (self)
 
def psy_unique_var_names (self)
 
def schedule (self)
 
def schedule (self, obj)
 
def unique_declarations (self, argument_types, access=None, intrinsic_type=None)
 
def first_access (self, arg_name)
 
def unique_declns_by_intent (self, argument_types, intrinsic_type=None)
 
def gen (self)
 

Detailed Description

The GOcean specific invoke class. This passes the GOcean specific
schedule class to the base class so it creates the one we require.
A set of GOcean infrastructure reserved names are also passed to
ensure that there are no name clashes. Also overrides the gen_code
method so that we generate GOcean specific invocation code and
provides three methods which separate arguments that are arrays from
arguments that are {integer, real} scalars.

:param alg_invocation: Node in the AST describing the invoke call.
:type alg_invocation: :py:class:`psyclone.parse.InvokeCall`
:param int idx: The position of the invoke in the list of invokes \
    contained in the Algorithm.
:param invokes: the Invokes object containing this GOInvoke \
    object.
:type invokes: :py:class:`psyclone.gocean1p0.GOInvokes`

Definition at line 199 of file gocean1p0.py.

Member Function Documentation

◆ gen_code()

def psyclone.gocean1p0.GOInvoke.gen_code (   self,
  parent 
)
Generates GOcean specific invocation code (the subroutine called
by the associated invoke call in the algorithm layer). This
consists of the PSy invocation subroutine and the declaration of
its arguments.

:param parent: the node in the generated AST to which to add content.
:type parent: :py:class:`psyclone.f2pygen.ModuleGen`

Reimplemented from psyclone.psyGen.Invoke.

Definition at line 255 of file gocean1p0.py.

255  def gen_code(self, parent):
256  # pylint: disable=too-many-locals
257  '''
258  Generates GOcean specific invocation code (the subroutine called
259  by the associated invoke call in the algorithm layer). This
260  consists of the PSy invocation subroutine and the declaration of
261  its arguments.
262 
263  :param parent: the node in the generated AST to which to add content.
264  :type parent: :py:class:`psyclone.f2pygen.ModuleGen`
265 
266  '''
267  # TODO 1010: GOcean doesn't use this method anymore and it can be
268  # deleted, but some tests still call it directly.
269 
270  # Create the subroutine
271  invoke_sub = SubroutineGen(parent, name=self.name,
272  args=self.psy_unique_var_names)
273  parent.add(invoke_sub)
274 
275  # Generate the code body of this subroutine
276  self.schedule.gen_code(invoke_sub)
277 
278  # Add the subroutine argument declarations for fields
279  if self.unique_args_arrays:
280  my_decl_arrays = TypeDeclGen(invoke_sub, datatype="r2d_field",
281  intent="inout",
282  entity_decls=self.unique_args_arrays)
283  invoke_sub.add(my_decl_arrays)
284 
285  # Add the subroutine argument declarations for integer and real scalars
286  i_args = []
287  for argument in self.schedule.symbol_table.argument_datasymbols:
288  if argument.name in self.unique_args_iscalars:
289  i_args.append(argument.name)
290 
291  if i_args:
292  my_decl_iscalars = DeclGen(invoke_sub, datatype="INTEGER",
293  intent="inout",
294  entity_decls=i_args)
295  invoke_sub.add(my_decl_iscalars)
296 
297  # Add remaining local scalar symbols using the symbol table
298  for symbol in self.schedule.symbol_table.automatic_datasymbols:
299  if isinstance(symbol.datatype, ScalarType):
300  invoke_sub.add(DeclGen(
301  invoke_sub,
302  datatype=symbol.datatype.intrinsic.name,
303  entity_decls=[symbol.name]))
304 
305 

References psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.GridArg.name, psyclone.domain.gocean.transformations.gocean_const_loop_bounds_trans.GOConstLoopBoundsTrans.name(), psyclone.domain.gocean.transformations.gocean_move_iteration_boundaries_inside_kernel_trans.GOMoveIterationBoundariesInsideKernelTrans.name(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans.name(), psyclone.domain.lfric.kernel.lfric_kernel_metadata.LFRicKernelMetadata.name, psyclone.domain.nemo.transformations.create_nemo_invoke_schedule_trans.CreateNemoInvokeScheduleTrans.name(), psyclone.domain.nemo.transformations.create_nemo_psy_trans.CreateNemoPSyTrans.name(), psyclone.domain.nemo.transformations.nemo_allarrayrange2loop_trans.NemoAllArrayRange2LoopTrans.name(), psyclone.domain.nemo.transformations.nemo_arrayrange2loop_trans.NemoArrayRange2LoopTrans.name(), psyclone.domain.nemo.transformations.nemo_outerarrayrange2loop_trans.NemoOuterArrayRange2LoopTrans.name(), psyclone.dynamo0p3.DynamoPSy.name(), psyclone.expression.FunctionVar.name, psyclone.expression.NamedArg.name(), psyclone.gocean1p0.GOKernelGridArgument.name(), psyclone.gocean1p0.GOStencil.name(), psyclone.parse.algorithm.FileInfo.name(), psyclone.parse.algorithm.InvokeCall.name(), psyclone.parse.kernel.KernelProcedure.name(), psyclone.parse.kernel.KernelType.name(), psyclone.parse.module_info.ModuleInfo.name(), psyclone.psyad.transformations.assignment_trans.AssignmentTrans.name(), psyclone.psyGen.PSy.name(), psyclone.psyGen.Invoke.name(), psyclone.psyGen.Kern.name(), psyclone.psyGen.CodedKern.name, psyclone.psyGen.Argument.name(), psyclone.psyGen.Transformation.name(), psyclone.psyGen.DummyTransformation.name(), psyclone.psyir.nodes.container.Container.name, psyclone.psyir.nodes.member.Member.name, psyclone.psyir.nodes.reference.Reference.name(), psyclone.psyir.nodes.routine.Routine.name, psyclone.psyir.symbols.symbol.Symbol.name(), psyclone.psyir.transformations.allarrayaccess2loop_trans.AllArrayAccess2LoopTrans.name(), psyclone.psyir.transformations.arrayrange2loop_trans.ArrayRange2LoopTrans.name(), psyclone.psyir.transformations.fold_conditional_return_expressions_trans.FoldConditionalReturnExpressionsTrans.name(), psyclone.psyir.transformations.loop_trans.LoopTrans.name(), psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans.name(), psyclone.psyir.transformations.psy_data_trans.PSyDataTrans.name(), psyclone.transformations.OMPSingleTrans.name(), psyclone.transformations.OMPMasterTrans.name(), psyclone.transformations.OMPParallelTrans.name(), psyclone.transformations.MoveTrans.name(), psyclone.transformations.Dynamo0p3AsyncHaloExchangeTrans.name(), psyclone.transformations.Dynamo0p3KernelConstTrans.name(), psyclone.transformations.ACCEnterDataTrans.name(), psyclone.transformations.ACCRoutineTrans.name(), psyclone.transformations.ACCKernelsTrans.name(), psyclone.transformations.ACCDataTrans.name(), psyclone.transformations.KernelImportsToArguments.name(), psyclone.psyGen.Invoke.psy_unique_var_names(), psyclone.psyGen.Invoke.schedule(), psyclone.psyir.nodes.omp_clauses.OMPScheduleClause.schedule, psyclone.gocean1p0.GOInvoke.unique_args_arrays(), and psyclone.gocean1p0.GOInvoke.unique_args_iscalars().

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

◆ unique_args_arrays()

def psyclone.gocean1p0.GOInvoke.unique_args_arrays (   self)
 find unique arguments that are arrays (defined as those that are
    field objects as opposed to scalars or properties of the grid). 

Definition at line 228 of file gocean1p0.py.

228  def unique_args_arrays(self):
229  ''' find unique arguments that are arrays (defined as those that are
230  field objects as opposed to scalars or properties of the grid). '''
231  result = []
232  for call in self._schedule.kernels():
233  for arg in call.arguments.args:
234  if arg.argument_type == 'field' and arg.name not in result:
235  result.append(arg.name)
236  return result
237 

References psyclone.domain.lfric.lfric_invoke.LFRicInvoke._schedule, psyclone.dynamo0p3.DynMeshes._schedule, psyclone.gocean1p0.GOInvoke._schedule, psyclone.nemo.NemoInvoke._schedule, psyclone.psyGen.Invoke._schedule, and psyclone.psyir.nodes.omp_clauses.OMPScheduleClause._schedule.

Here is the caller graph for this function:

◆ unique_args_iscalars()

def psyclone.gocean1p0.GOInvoke.unique_args_iscalars (   self)
:returns: the unique arguments that are scalars of type integer \
          (defined as those that are i_scalar 'space').
:rtype: list of str.

Definition at line 239 of file gocean1p0.py.

239  def unique_args_iscalars(self):
240  '''
241  :returns: the unique arguments that are scalars of type integer \
242  (defined as those that are i_scalar 'space').
243  :rtype: list of str.
244 
245  '''
246  result = []
247  for call in self._schedule.kernels():
248  for arg in args_filter(call.arguments.args, arg_types=["scalar"],
249  include_literals=False):
250  if arg.space.lower() == "go_i_scalar" and \
251  arg.name not in result:
252  result.append(arg.name)
253  return result
254 

References psyclone.domain.lfric.lfric_invoke.LFRicInvoke._schedule, psyclone.dynamo0p3.DynMeshes._schedule, psyclone.gocean1p0.GOInvoke._schedule, psyclone.nemo.NemoInvoke._schedule, psyclone.psyGen.Invoke._schedule, and psyclone.psyir.nodes.omp_clauses.OMPScheduleClause._schedule.

Here is the caller graph for this function:

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