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

Public Member Functions

def __init__ (self, arg, arg_info, call)
 
def psyir_expression (self)
 
def infer_datatype (self)
 
def intrinsic_type (self)
 
def argument_type (self)
 
def function_space (self)
 
def is_scalar (self)
 
- Public Member Functions inherited from psyclone.psyGen.KernelArgument
def space (self)
 
def stencil (self)
 
def metadata_index (self)
 
- Public Member Functions inherited from psyclone.psyGen.Argument
def __str__ (self)
 
def name (self)
 
def text (self)
 
def form (self)
 
def is_literal (self)
 
def access (self)
 
def access (self, value)
 
def precision (self)
 
def data_type (self)
 
def module_name (self)
 
def call (self)
 
def call (self, value)
 
def backward_dependence (self)
 
def forward_write_dependencies (self, ignore_halos=False)
 
def backward_write_dependencies (self, ignore_halos=False)
 
def forward_dependence (self)
 
def forward_read_dependencies (self)
 

Public Attributes

 argument_type
 

Detailed Description

 Provides information about individual GOcean kernel call arguments
    as specified by the kernel argument metadata. 

Definition at line 1434 of file gocean1p0.py.

Member Function Documentation

◆ argument_type()

def psyclone.gocean1p0.GOKernelArgument.argument_type (   self)
Return the type of this kernel argument - whether it is a field,
a scalar or a grid_property (to be supplied by the PSy layer).
If it has no type it defaults to scalar.

:returns: the type of the argument.
:rtype: str

Reimplemented from psyclone.psyGen.Argument.

Definition at line 1535 of file gocean1p0.py.

1535  def argument_type(self):
1536  '''
1537  Return the type of this kernel argument - whether it is a field,
1538  a scalar or a grid_property (to be supplied by the PSy layer).
1539  If it has no type it defaults to scalar.
1540 
1541  :returns: the type of the argument.
1542  :rtype: str
1543 
1544  '''
1545  if self._arg.argument_type:
1546  return self._arg.argument_type
1547  return "scalar"
1548 

References psyclone.gocean1p0.GOKernelArgument._arg, psyclone.psyGen.DataAccess._arg, and psyclone.psyGen.KernelArgument._arg.

Here is the caller graph for this function:

◆ function_space()

def psyclone.gocean1p0.GOKernelArgument.function_space (   self)
 Returns the expected finite difference space for this
    argument as specified by the kernel argument metadata.

Definition at line 1550 of file gocean1p0.py.

1550  def function_space(self):
1551  ''' Returns the expected finite difference space for this
1552  argument as specified by the kernel argument metadata.'''
1553  return self._arg.function_space
1554 

References psyclone.gocean1p0.GOKernelArgument._arg, psyclone.psyGen.DataAccess._arg, and psyclone.psyGen.KernelArgument._arg.

Here is the caller graph for this function:

◆ infer_datatype()

def psyclone.gocean1p0.GOKernelArgument.infer_datatype (   self)
 Infer the datatype of this argument using the API rules.

:returns: the datatype of this argument.
:rtype: :py:class::`psyclone.psyir.symbols.DataType`

:raises InternalError: if this Argument type is not "field" or \
                       "scalar".
:raises InternalError: if this argument is scalar but its space \
                       property is not 'go_r_scalar' or 'go_i_scalar'.

Reimplemented from psyclone.psyGen.Argument.

Definition at line 1481 of file gocean1p0.py.

1481  def infer_datatype(self):
1482  ''' Infer the datatype of this argument using the API rules.
1483 
1484  :returns: the datatype of this argument.
1485  :rtype: :py:class::`psyclone.psyir.symbols.DataType`
1486 
1487  :raises InternalError: if this Argument type is not "field" or \
1488  "scalar".
1489  :raises InternalError: if this argument is scalar but its space \
1490  property is not 'go_r_scalar' or 'go_i_scalar'.
1491 
1492  '''
1493  # All GOcean fields are r2d_field
1494  if self.argument_type == "field":
1495  # r2d_field can have UnresolvedType and UnresolvedInterface because
1496  # it is an unnamed import from a module.
1497  type_symbol = self._call.root.symbol_table.find_or_create_tag(
1498  "r2d_field", symbol_type=DataTypeSymbol,
1499  datatype=UnresolvedType(), interface=UnresolvedInterface())
1500  return type_symbol
1501 
1502  # Gocean scalars can be REAL or INTEGER
1503  if self.argument_type == "scalar":
1504  if self.space.lower() == "go_r_scalar":
1505  go_wp = self._call.root.symbol_table.find_or_create_tag(
1506  "go_wp", symbol_type=DataSymbol, datatype=UnresolvedType(),
1507  interface=UnresolvedInterface())
1508  return ScalarType(ScalarType.Intrinsic.REAL, go_wp)
1509  if self.space.lower() == "go_i_scalar":
1510  return INTEGER_TYPE
1511  raise InternalError(f"GOcean expects scalar arguments to be of "
1512  f"'go_r_scalar' or 'go_i_scalar' type but "
1513  f"found '{self.space.lower()}'.")
1514 
1515  raise InternalError(f"GOcean expects the Argument.argument_type() "
1516  f"to be 'field' or 'scalar' but found "
1517  f"'{self.argument_type}'.")
1518 

References psyclone.f2pygen.CallGen._call, psyclone.gocean1p0.GOKernelGridArgument._call, psyclone.psyGen.DataAccess._call, psyclone.psyGen.Argument._call, psyclone.dynamo0p3.DynKernelArgument.argument_type, psyclone.gocean1p0.GOKernelArgument.argument_type, psyclone.gocean1p0.GOKernelGridArgument.argument_type(), psyclone.parse.kernel.Descriptor.argument_type(), psyclone.psyGen.Argument.argument_type(), and psyclone.psyGen.KernelArgument.space().

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

◆ intrinsic_type()

def psyclone.gocean1p0.GOKernelArgument.intrinsic_type (   self)
:returns: the intrinsic type of this argument. If it's not a scalar \
    integer or real it will return an empty string.
:rtype: str

Reimplemented from psyclone.psyGen.Argument.

Definition at line 1520 of file gocean1p0.py.

1520  def intrinsic_type(self):
1521  '''
1522  :returns: the intrinsic type of this argument. If it's not a scalar \
1523  integer or real it will return an empty string.
1524  :rtype: str
1525 
1526  '''
1527  if self.argument_type == "scalar":
1528  if self.space.lower() == "go_r_scalar":
1529  return "real"
1530  if self.space.lower() == "go_i_scalar":
1531  return "integer"
1532  return ""
1533 

References psyclone.dynamo0p3.DynKernelArgument.argument_type, psyclone.gocean1p0.GOKernelArgument.argument_type, psyclone.gocean1p0.GOKernelGridArgument.argument_type(), psyclone.parse.kernel.Descriptor.argument_type(), psyclone.psyGen.Argument.argument_type(), and psyclone.psyGen.KernelArgument.space().

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

◆ is_scalar()

def psyclone.gocean1p0.GOKernelArgument.is_scalar (   self)
:return: whether this variable is a scalar variable or not.
:rtype: bool

Reimplemented from psyclone.psyGen.KernelArgument.

Definition at line 1556 of file gocean1p0.py.

1556  def is_scalar(self):
1557  ''':return: whether this variable is a scalar variable or not.
1558  :rtype: bool'''
1559  return self.argument_type == "scalar"
1560 
1561 

References psyclone.dynamo0p3.DynKernelArgument.argument_type, psyclone.gocean1p0.GOKernelArgument.argument_type, psyclone.gocean1p0.GOKernelGridArgument.argument_type(), psyclone.parse.kernel.Descriptor.argument_type(), and psyclone.psyGen.Argument.argument_type().

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

◆ psyir_expression()

def psyclone.gocean1p0.GOKernelArgument.psyir_expression (   self)
:returns: the PSyIR expression represented by this Argument.
:rtype: :py:class:`psyclone.psyir.nodes.Node`

:raises InternalError: if this Argument type is not "field" or \
                       "scalar".

Reimplemented from psyclone.psyGen.Argument.

Definition at line 1445 of file gocean1p0.py.

1445  def psyir_expression(self):
1446  '''
1447  :returns: the PSyIR expression represented by this Argument.
1448  :rtype: :py:class:`psyclone.psyir.nodes.Node`
1449 
1450  :raises InternalError: if this Argument type is not "field" or \
1451  "scalar".
1452 
1453  '''
1454  # If the argument name is just a number (e.g. '0') we return a
1455  # constant Literal expression
1456  if self.name.isnumeric():
1457  return Literal(self.name, INTEGER_TYPE)
1458 
1459  # Now try for a real value. The constructor will raise an exception
1460  # if the string is not a valid floating point number.
1461  try:
1462  return Literal(self.name, REAL_TYPE)
1463  except ValueError:
1464  pass
1465 
1466  # Otherwise it's some form of Reference
1467  symbol = self._call.scope.symbol_table.lookup(self.name)
1468 
1469  # Gocean field arguments are StructureReferences to the %data attribute
1470  if self.argument_type == "field":
1471  return StructureReference.create(symbol, ["data"])
1472 
1473  # Gocean scalar arguments are References to the variable
1474  if self.argument_type == "scalar":
1475  return Reference(symbol)
1476 
1477  raise InternalError(f"GOcean expects the Argument.argument_type() to "
1478  f"be 'field' or 'scalar' but found "
1479  f"'{self.argument_type}'.")
1480 

References psyclone.f2pygen.CallGen._call, psyclone.gocean1p0.GOKernelGridArgument._call, psyclone.psyGen.DataAccess._call, psyclone.psyGen.Argument._call, psyclone.dynamo0p3.DynKernelArgument.argument_type, psyclone.gocean1p0.GOKernelArgument.argument_type, psyclone.gocean1p0.GOKernelGridArgument.argument_type(), psyclone.parse.kernel.Descriptor.argument_type(), psyclone.psyGen.Argument.argument_type(), 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(), and psyclone.transformations.KernelImportsToArguments.name().

Here is the call graph for this function:

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