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

Public Member Functions

def __init__ (self, kernel_args, arg_meta_data, arg_info, call, check=True)
 
def ref_name (self, function_space=None)
 
def is_scalar (self)
 
def is_field (self)
 
def is_operator (self)
 
def descriptor (self)
 
def argument_type (self)
 
def intrinsic_type (self)
 
def mesh (self)
 
def vector_size (self)
 
def name_indexed (self)
 
def psyir_expression (self)
 
def declaration_name (self)
 
def proxy_name (self)
 
def proxy_name_indexed (self)
 
def proxy_declaration_name (self)
 
def proxy_data_type (self)
 
def function_space (self)
 
def function_space_to (self)
 
def function_space_from (self)
 
def function_spaces (self)
 
def function_space_names (self)
 
def intent (self)
 
def discontinuous (self)
 
def stencil (self)
 
def stencil (self, value)
 
def infer_datatype (self, proxy=False)
 
- Public Member Functions inherited from psyclone.psyGen.KernelArgument
def __init__ (self, arg, arg_info, call)
 
def space (self)
 
def metadata_index (self)
 
- Public Member Functions inherited from psyclone.psyGen.Argument
def infer_datatype (self)
 
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

 intrinsic_type
 
 argument_type
 
 access
 

Detailed Description

This class provides information about individual LFRic kernel call
arguments as specified by the kernel argument metadata and the
kernel invocation in the Algorithm layer.

:param kernel_args: object encapsulating all arguments to the \
                    kernel call.
:type kernel_args: :py:class:`psyclone.dynamo0p3.DynKernelArguments`
:param arg_meta_data: information obtained from the metadata for \
                      this kernel argument.
:type arg_meta_data: :py:class:`psyclone.domain.lfric.LFRicArgDescriptor`
:param arg_info: information on how this argument is specified in \
                 the Algorithm layer.
:type arg_info: :py:class:`psyclone.parse.algorithm.Arg`
:param call: the kernel object with which this argument is associated.
:type call: :py:class:`psyclone.domain.lfric.LFRicKern`
:param bool check: whether to check for consistency between the \
    kernel metadata and the algorithm layer. Defaults to True.

:raises InternalError: for an unsupported metadata in the argument \
                       descriptor data type.

Definition at line 5351 of file dynamo0p3.py.

Member Function Documentation

◆ argument_type()

def psyclone.dynamo0p3.DynKernelArgument.argument_type (   self)
:returns: the API type of this argument, as specified in \
          the metadata.
:rtype: str

Reimplemented from psyclone.psyGen.Argument.

Definition at line 5816 of file dynamo0p3.py.

5816  def argument_type(self):
5817  '''
5818  :returns: the API type of this argument, as specified in \
5819  the metadata.
5820  :rtype: str
5821  '''
5822  return self._argument_type
5823 

References psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._argument_type, psyclone.dynamo0p3.DynKernelArgument._argument_type, psyclone.gocean1p0.GOKernelGridArgument._argument_type, psyclone.gocean1p0.GO1p0Descriptor._argument_type, and psyclone.parse.kernel.Descriptor._argument_type.

Here is the caller graph for this function:

◆ declaration_name()

def psyclone.dynamo0p3.DynKernelArgument.declaration_name (   self)
:returns: the name for this argument with the array dimensions \
          added if required.
:rtype: str

Definition at line 5919 of file dynamo0p3.py.

5919  def declaration_name(self):
5920  '''
5921  :returns: the name for this argument with the array dimensions \
5922  added if required.
5923  :rtype: str
5924  '''
5925  if self._vector_size > 1:
5926  return self._name+"("+str(self._vector_size)+")"
5927  return self._name
5928 

References psyclone.domain.common.algorithm.psyir.AlgorithmInvokeCall._name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata._name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.GridArg._name, psyclone.domain.lfric.kernel.lfric_kernel_metadata.LFRicKernelMetadata._name, psyclone.dynamo0p3.DynFuncDescriptor03._name, psyclone.expression.NamedArg._name, psyclone.gocean1p0.GOKernelGridArgument._name, psyclone.gocean1p0.GOStencil._name, psyclone.nemo.NemoInvoke._name, psyclone.nemo.NemoPSy._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.psyGen.PSy._name, psyclone.psyGen.Invoke._name, psyclone.psyGen.Kern._name, psyclone.psyGen.Argument._name, psyclone.psyir.nodes.container.Container._name, psyclone.psyir.nodes.routine.Routine._name, psyclone.psyir.symbols.symbol.Symbol._name, psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._vector_size, and psyclone.dynamo0p3.DynKernelArgument._vector_size.

◆ descriptor()

def psyclone.dynamo0p3.DynKernelArgument.descriptor (   self)
:returns: a descriptor object which contains Kernel metadata \
          about this argument.
:rtype: :py:class:`psyclone.domain.lfric.LFRicArgDescriptor`

Definition at line 5807 of file dynamo0p3.py.

5807  def descriptor(self):
5808  '''
5809  :returns: a descriptor object which contains Kernel metadata \
5810  about this argument.
5811  :rtype: :py:class:`psyclone.domain.lfric.LFRicArgDescriptor`
5812  '''
5813  return self._arg
5814 

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

Here is the caller graph for this function:

◆ discontinuous()

def psyclone.dynamo0p3.DynKernelArgument.discontinuous (   self)
Returns True if this argument is known to be on a discontinuous
function space including any_discontinuous_space, otherwise
returns False.

:returns: whether the argument is discontinuous.
:rtype: bool

Definition at line 6057 of file dynamo0p3.py.

6057  def discontinuous(self):
6058  '''
6059  Returns True if this argument is known to be on a discontinuous
6060  function space including any_discontinuous_space, otherwise
6061  returns False.
6062 
6063  :returns: whether the argument is discontinuous.
6064  :rtype: bool
6065 
6066  '''
6067  const = LFRicConstants()
6068  if self.function_space.orig_name in \
6069  const.VALID_DISCONTINUOUS_NAMES:
6070  return True
6071  if self.function_space.orig_name in \
6072  const.VALID_ANY_SPACE_NAMES:
6073  # We will eventually look this up based on our dependence
6074  # analysis but for the moment we assume the worst
6075  return False
6076  return False
6077 

References psyclone.domain.lfric.kernel.field_arg_metadata.FieldArgMetadata.function_space, psyclone.domain.lfric.kernel.meta_funcs_arg_metadata.MetaFuncsArgMetadata.function_space, psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor.function_space(), psyclone.dynamo0p3.DynKernelArgument.function_space(), psyclone.gocean1p0.GOKernelArgument.function_space(), and psyclone.parse.kernel.Descriptor.function_space().

Here is the call graph for this function:

◆ function_space()

def psyclone.dynamo0p3.DynKernelArgument.function_space (   self)
Returns the expected finite element function space for a kernel
argument as specified by the kernel argument metadata: a single
function space for a field and function_space_from for an operator.

:returns: function space for this argument.
:rtype: :py:class:`psyclone.domain.lfric.FunctionSpace`

Definition at line 5971 of file dynamo0p3.py.

5971  def function_space(self):
5972  '''
5973  Returns the expected finite element function space for a kernel
5974  argument as specified by the kernel argument metadata: a single
5975  function space for a field and function_space_from for an operator.
5976 
5977  :returns: function space for this argument.
5978  :rtype: :py:class:`psyclone.domain.lfric.FunctionSpace`
5979  '''
5980  if self._argument_type == "gh_operator":
5981  # We return the 'from' space for an operator argument
5982  return self.function_space_from
5983  return self._function_spaces[0]
5984 

References psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._argument_type, psyclone.dynamo0p3.DynKernelArgument._argument_type, psyclone.gocean1p0.GOKernelGridArgument._argument_type, psyclone.gocean1p0.GO1p0Descriptor._argument_type, psyclone.parse.kernel.Descriptor._argument_type, psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._function_spaces, psyclone.dynamo0p3.DynFunctionSpaces._function_spaces, psyclone.dynamo0p3.DynKernelArgument._function_spaces, psyclone.domain.lfric.kernel.operator_arg_metadata.OperatorArgMetadata.function_space_from, psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor.function_space_from(), and psyclone.dynamo0p3.DynKernelArgument.function_space_from().

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

◆ function_space_from()

def psyclone.dynamo0p3.DynKernelArgument.function_space_from (   self)
:returns:  the 'from' function space of an operator.
:rtype: str

Definition at line 5994 of file dynamo0p3.py.

5994  def function_space_from(self):
5995  '''
5996  :returns: the 'from' function space of an operator.
5997  :rtype: str
5998  '''
5999  return self._function_spaces[1]
6000 

References psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._function_spaces, psyclone.dynamo0p3.DynFunctionSpaces._function_spaces, and psyclone.dynamo0p3.DynKernelArgument._function_spaces.

Here is the caller graph for this function:

◆ function_space_names()

def psyclone.dynamo0p3.DynKernelArgument.function_space_names (   self)
Returns a list of the names of the function spaces associated
with this argument. We have more than one function space when
dealing with operators.

:returns: list of function space names for this argument.
:rtype: list of str

Definition at line 6016 of file dynamo0p3.py.

6016  def function_space_names(self):
6017  '''
6018  Returns a list of the names of the function spaces associated
6019  with this argument. We have more than one function space when
6020  dealing with operators.
6021 
6022  :returns: list of function space names for this argument.
6023  :rtype: list of str
6024 
6025  '''
6026  fs_names = []
6027  for fspace in self._function_spaces:
6028  if fspace:
6029  fs_names.append(fspace.orig_name)
6030  return fs_names
6031 

References psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._function_spaces, psyclone.dynamo0p3.DynFunctionSpaces._function_spaces, and psyclone.dynamo0p3.DynKernelArgument._function_spaces.

◆ function_space_to()

def psyclone.dynamo0p3.DynKernelArgument.function_space_to (   self)
:returns: the 'to' function space of an operator.
:rtype: str

Definition at line 5986 of file dynamo0p3.py.

5986  def function_space_to(self):
5987  '''
5988  :returns: the 'to' function space of an operator.
5989  :rtype: str
5990  '''
5991  return self._function_spaces[0]
5992 

References psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._function_spaces, psyclone.dynamo0p3.DynFunctionSpaces._function_spaces, and psyclone.dynamo0p3.DynKernelArgument._function_spaces.

Here is the caller graph for this function:

◆ function_spaces()

def psyclone.dynamo0p3.DynKernelArgument.function_spaces (   self)
Returns the expected finite element function space for a kernel
argument as specified by the kernel argument metadata: a single
function space for a field and a list containing
function_space_to and function_space_from for an operator.

:returns: function space(s) for this argument.
:rtype: list of :py:class:`psyclone.domain.lfric.FunctionSpace`

Definition at line 6002 of file dynamo0p3.py.

6002  def function_spaces(self):
6003  '''
6004  Returns the expected finite element function space for a kernel
6005  argument as specified by the kernel argument metadata: a single
6006  function space for a field and a list containing
6007  function_space_to and function_space_from for an operator.
6008 
6009  :returns: function space(s) for this argument.
6010  :rtype: list of :py:class:`psyclone.domain.lfric.FunctionSpace`
6011 
6012  '''
6013  return self._function_spaces
6014 

References psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._function_spaces, psyclone.dynamo0p3.DynFunctionSpaces._function_spaces, and psyclone.dynamo0p3.DynKernelArgument._function_spaces.

Here is the caller graph for this function:

◆ infer_datatype()

def psyclone.dynamo0p3.DynKernelArgument.infer_datatype (   self,
  proxy = False 
)
Infer the datatype of this kernel argument in the PSy layer using
the LFRic API rules. If any LFRic infrastructure modules are required
but are not already present then suitable ContainerSymbols are added
to the outermost symbol table. Similarly, DataTypeSymbols are added for
any required LFRic derived types that are not already in the symbol
table.

TODO #1258 - ultimately this routine should not have to create any
DataTypeSymbols as that should already have been done.

:param bool proxy: whether or not we want the type of the proxy \
    object for this kernel argument. Defaults to False (i.e.
    return the type rather than the proxy type).

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

:raises NotImplementedError: if an unsupported argument type is found.

Definition at line 6097 of file dynamo0p3.py.

6097  def infer_datatype(self, proxy=False):
6098  '''
6099  Infer the datatype of this kernel argument in the PSy layer using
6100  the LFRic API rules. If any LFRic infrastructure modules are required
6101  but are not already present then suitable ContainerSymbols are added
6102  to the outermost symbol table. Similarly, DataTypeSymbols are added for
6103  any required LFRic derived types that are not already in the symbol
6104  table.
6105 
6106  TODO #1258 - ultimately this routine should not have to create any
6107  DataTypeSymbols as that should already have been done.
6108 
6109  :param bool proxy: whether or not we want the type of the proxy \
6110  object for this kernel argument. Defaults to False (i.e.
6111  return the type rather than the proxy type).
6112 
6113  :returns: the datatype of this argument.
6114  :rtype: :py:class:`psyclone.psyir.symbols.DataType`
6115 
6116  :raises NotImplementedError: if an unsupported argument type is found.
6117 
6118  '''
6119  # We want to put any Container symbols in the outermost scope so find
6120  # the corresponding symbol table.
6121  symbol_table = self._call.scope.symbol_table
6122  root_table = symbol_table
6123  while root_table.parent_symbol_table():
6124  root_table = root_table.parent_symbol_table()
6125 
6126  def _find_or_create_type(mod_name, type_name):
6127  '''
6128  Utility to find or create a DataTypeSymbol with the supplied name,
6129  imported from the named module.
6130 
6131  :param str mod_name: the name of the module from which the \
6132  DataTypeSymbol should be imported.
6133  :param str type_name: the name of the derived type for which to \
6134  create a DataTypeSymbol.
6135 
6136  :returns: the symbol for the requested type.
6137  :rtype: :py:class:`psyclone.psyir.symbols.DataTypeSymbol`
6138 
6139  '''
6140  return root_table.find_or_create(
6141  type_name,
6142  symbol_type=DataTypeSymbol,
6143  datatype=UnresolvedType(),
6144  interface=ImportInterface(root_table.find_or_create(
6145  mod_name,
6146  symbol_type=ContainerSymbol)
6147  ))
6148 
6149  if self.is_scalar:
6150  # Find or create the DataType for the appropriate scalar type.
6151  if self.intrinsic_type == "real":
6152  prim_type = ScalarType.Intrinsic.REAL
6153  elif self.intrinsic_type == "integer":
6154  prim_type = ScalarType.Intrinsic.INTEGER
6155  elif self.intrinsic_type == "logical":
6156  prim_type = ScalarType.Intrinsic.BOOLEAN
6157  else:
6158  raise NotImplementedError(
6159  f"Unsupported scalar type '{self.intrinsic_type}'")
6160 
6161  kind_name = self.precision
6162  try:
6163  kind_symbol = symbol_table.lookup(kind_name)
6164  except KeyError:
6165  mod_map = LFRicConstants().UTILITIES_MOD_MAP
6166  const_mod = mod_map["constants"]["module"]
6167  try:
6168  constants_container = symbol_table.lookup(const_mod)
6169  except KeyError:
6170  # TODO Once #696 is done, we should *always* have a
6171  # symbol for this container at this point so should
6172  # raise an exception if we haven't.
6173  constants_container = LFRicTypes(const_mod)
6174  root_table.add(constants_container)
6175  kind_symbol = DataSymbol(
6176  kind_name, INTEGER_TYPE,
6177  interface=ImportInterface(constants_container))
6178  root_table.add(kind_symbol)
6179  return ScalarType(prim_type, kind_symbol)
6180 
6181  if self.is_field or self.is_operator:
6182  # Find or create the DataTypeSymbol for the appropriate
6183  # field or operator type.
6184  mod_name = self._module_name
6185  if proxy:
6186  type_name = self._proxy_data_type
6187  else:
6188  type_name = self._data_type
6189  return _find_or_create_type(mod_name, type_name)
6190 
6191  raise NotImplementedError(
6192  f"'{str(self)}' is not a scalar, field or operator argument")
6193 
6194 

References psyclone.f2pygen.CallGen._call, psyclone.gocean1p0.GOKernelGridArgument._call, psyclone.psyGen.DataAccess._call, psyclone.psyGen.Argument._call, psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._data_type, psyclone.dynamo0p3.DynKernelArgument._data_type, psyclone.psyGen.Argument._data_type, psyclone.dynamo0p3.DynKernelArgument._module_name, psyclone.parse.algorithm.ParsedCall._module_name, psyclone.parse.algorithm.KernelCall._module_name, psyclone.psyGen.CodedKern._module_name, psyclone.psyGen.Argument._module_name, psyclone.psyir.nodes.psy_data_node.PSyDataNode._module_name, psyclone.dynamo0p3.DynKernelArgument._proxy_data_type, psyclone.dynamo0p3.DynKernelArgument.intrinsic_type, psyclone.gocean1p0.GOKernelArgument.intrinsic_type(), psyclone.gocean1p0.GOKernelGridArgument.intrinsic_type(), psyclone.psyGen.Argument.intrinsic_type(), psyclone.dynamo0p3.DynKernelArgument.is_field(), psyclone.dynamo0p3.DynKernelArgument.is_operator(), psyclone.dynamo0p3.DynKernelArgument.is_scalar(), psyclone.gocean1p0.GOKernelArgument.is_scalar(), psyclone.gocean1p0.GOKernelGridArgument.is_scalar(), psyclone.psyGen.KernelArgument.is_scalar(), psyclone.psyir.symbols.typed_symbol.TypedSymbol.is_scalar(), psyclone.psyGen.Argument.precision(), psyclone.psyir.symbols.datatypes.ScalarType.precision, and psyclone.psyir.symbols.datatypes.ArrayType.precision().

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

◆ intent()

def psyclone.dynamo0p3.DynKernelArgument.intent (   self)
Returns the Fortran intent of this argument as defined by the
valid access types for this API

:returns: the expected Fortran intent for this argument as \
          specified by the kernel argument metadata
:rtype: str

Definition at line 6033 of file dynamo0p3.py.

6033  def intent(self):
6034  '''
6035  Returns the Fortran intent of this argument as defined by the
6036  valid access types for this API
6037 
6038  :returns: the expected Fortran intent for this argument as \
6039  specified by the kernel argument metadata
6040  :rtype: str
6041 
6042  '''
6043  write_accesses = AccessType.all_write_accesses()
6044  if self.access == AccessType.READ:
6045  return "in"
6046  if self.access in write_accesses:
6047  return "inout"
6048  # An argument access other than the pure "read" or one of
6049  # the "write" accesses is invalid
6050  valid_accesses = [AccessType.READ.api_specific_name()] + \
6051  [access.api_specific_name() for access in write_accesses]
6052  raise GenerationError(
6053  f"In the LFRic API the argument access must be one of "
6054  f"{valid_accesses}, but found '{self.access}'.")
6055 

References psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.GridArg.access, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.FieldArg.access, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.ScalarArg.access(), psyclone.domain.lfric.kernel.common_meta_arg_metadata.CommonMetaArgMetadata.access, psyclone.dynamo0p3.DynKernelArgument.access, psyclone.parse.kernel.Descriptor.access(), psyclone.psyGen.Argument.access(), and psyclone.psyir.symbols.interfaces.ArgumentInterface.access.

Here is the call graph for this function:

◆ intrinsic_type()

def psyclone.dynamo0p3.DynKernelArgument.intrinsic_type (   self)
:returns: the intrinsic Fortran type of this argument for scalars \
          or of the argument's data for fields and operators.
:rtype: str

Reimplemented from psyclone.psyGen.Argument.

Definition at line 5825 of file dynamo0p3.py.

5825  def intrinsic_type(self):
5826  '''
5827  :returns: the intrinsic Fortran type of this argument for scalars \
5828  or of the argument's data for fields and operators.
5829  :rtype: str
5830  '''
5831  return self._intrinsic_type
5832 

References psyclone.dynamo0p3.DynKernelArgument._intrinsic_type.

Here is the caller graph for this function:

◆ is_field()

def psyclone.dynamo0p3.DynKernelArgument.is_field (   self)
:returns: True if this kernel argument represents a field, \
          False otherwise.
:rtype: bool

Definition at line 5787 of file dynamo0p3.py.

5787  def is_field(self):
5788  '''
5789  :returns: True if this kernel argument represents a field, \
5790  False otherwise.
5791  :rtype: bool
5792  '''
5793  const = LFRicConstants()
5794  return self._argument_type in const.VALID_FIELD_NAMES
5795 

References psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._argument_type, psyclone.dynamo0p3.DynKernelArgument._argument_type, psyclone.gocean1p0.GOKernelGridArgument._argument_type, psyclone.gocean1p0.GO1p0Descriptor._argument_type, and psyclone.parse.kernel.Descriptor._argument_type.

Here is the caller graph for this function:

◆ is_operator()

def psyclone.dynamo0p3.DynKernelArgument.is_operator (   self)
:returns: True if this kernel argument represents an operator, \
          False otherwise.
:rtype: bool

Definition at line 5797 of file dynamo0p3.py.

5797  def is_operator(self):
5798  '''
5799  :returns: True if this kernel argument represents an operator, \
5800  False otherwise.
5801  :rtype: bool
5802  '''
5803  const = LFRicConstants()
5804  return self._argument_type in const.VALID_OPERATOR_NAMES
5805 

References psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._argument_type, psyclone.dynamo0p3.DynKernelArgument._argument_type, psyclone.gocean1p0.GOKernelGridArgument._argument_type, psyclone.gocean1p0.GO1p0Descriptor._argument_type, and psyclone.parse.kernel.Descriptor._argument_type.

Here is the caller graph for this function:

◆ is_scalar()

def psyclone.dynamo0p3.DynKernelArgument.is_scalar (   self)
:returns: True if this kernel argument represents a scalar, \
          False otherwise.
:rtype: bool

Reimplemented from psyclone.psyGen.KernelArgument.

Definition at line 5777 of file dynamo0p3.py.

5777  def is_scalar(self):
5778  '''
5779  :returns: True if this kernel argument represents a scalar, \
5780  False otherwise.
5781  :rtype: bool
5782  '''
5783  const = LFRicConstants()
5784  return self._argument_type in const.VALID_SCALAR_NAMES
5785 

References psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._argument_type, psyclone.dynamo0p3.DynKernelArgument._argument_type, psyclone.gocean1p0.GOKernelGridArgument._argument_type, psyclone.gocean1p0.GO1p0Descriptor._argument_type, and psyclone.parse.kernel.Descriptor._argument_type.

Here is the caller graph for this function:

◆ mesh()

def psyclone.dynamo0p3.DynKernelArgument.mesh (   self)
:returns: mesh associated with argument ('GH_FINE' or 'GH_COARSE').
:rtype: str

Definition at line 5834 of file dynamo0p3.py.

5834  def mesh(self):
5835  '''
5836  :returns: mesh associated with argument ('GH_FINE' or 'GH_COARSE').
5837  :rtype: str
5838  '''
5839  return self._mesh
5840 

References psyclone.domain.lfric.kernel.meta_mesh_arg_metadata.MetaMeshArgMetadata._mesh, psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._mesh, psyclone.dynamo0p3.DynKernelArgument._mesh, and psyclone.parse.kernel.Descriptor._mesh.

◆ name_indexed()

def psyclone.dynamo0p3.DynKernelArgument.name_indexed (   self)
:returns: the name for this argument with an additional index \
          which accesses the first element for a vector argument.
:rtype: str

Definition at line 5851 of file dynamo0p3.py.

5851  def name_indexed(self):
5852  '''
5853  :returns: the name for this argument with an additional index \
5854  which accesses the first element for a vector argument.
5855  :rtype: str
5856  '''
5857  if self._vector_size > 1:
5858  return self._name+"(1)"
5859  return self._name
5860 

References psyclone.domain.common.algorithm.psyir.AlgorithmInvokeCall._name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata._name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.GridArg._name, psyclone.domain.lfric.kernel.lfric_kernel_metadata.LFRicKernelMetadata._name, psyclone.dynamo0p3.DynFuncDescriptor03._name, psyclone.expression.NamedArg._name, psyclone.gocean1p0.GOKernelGridArgument._name, psyclone.gocean1p0.GOStencil._name, psyclone.nemo.NemoInvoke._name, psyclone.nemo.NemoPSy._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.psyGen.PSy._name, psyclone.psyGen.Invoke._name, psyclone.psyGen.Kern._name, psyclone.psyGen.Argument._name, psyclone.psyir.nodes.container.Container._name, psyclone.psyir.nodes.routine.Routine._name, psyclone.psyir.symbols.symbol.Symbol._name, psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._vector_size, and psyclone.dynamo0p3.DynKernelArgument._vector_size.

◆ proxy_data_type()

def psyclone.dynamo0p3.DynKernelArgument.proxy_data_type (   self)
:returns: the type of this argument's proxy (if it exists) as \
          defined in LFRic infrastructure.
:rtype: str or NoneType

Definition at line 5961 of file dynamo0p3.py.

5961  def proxy_data_type(self):
5962  '''
5963  :returns: the type of this argument's proxy (if it exists) as \
5964  defined in LFRic infrastructure.
5965  :rtype: str or NoneType
5966 
5967  '''
5968  return self._proxy_data_type
5969 

References psyclone.dynamo0p3.DynKernelArgument._proxy_data_type.

◆ proxy_declaration_name()

def psyclone.dynamo0p3.DynKernelArgument.proxy_declaration_name (   self)
:returns: the proxy name for this argument with the array \
          dimensions added if required.
:rtype: str

Definition at line 5950 of file dynamo0p3.py.

5950  def proxy_declaration_name(self):
5951  '''
5952  :returns: the proxy name for this argument with the array \
5953  dimensions added if required.
5954  :rtype: str
5955  '''
5956  if self._vector_size > 1:
5957  return self.proxy_name+"("+str(self._vector_size)+")"
5958  return self.proxy_name
5959 

References psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._vector_size, psyclone.dynamo0p3.DynKernelArgument._vector_size, and psyclone.dynamo0p3.DynKernelArgument.proxy_name().

Here is the call graph for this function:

◆ proxy_name()

◆ proxy_name_indexed()

def psyclone.dynamo0p3.DynKernelArgument.proxy_name_indexed (   self)
:returns: the proxy name for this argument with an additional \
          index which accesses the first element for a vector \
          argument.
:rtype: str

Definition at line 5938 of file dynamo0p3.py.

5938  def proxy_name_indexed(self):
5939  '''
5940  :returns: the proxy name for this argument with an additional \
5941  index which accesses the first element for a vector \
5942  argument.
5943  :rtype: str
5944  '''
5945  if self._vector_size > 1:
5946  return self._name+"_proxy(1)"
5947  return self._name+"_proxy"
5948 

References psyclone.domain.common.algorithm.psyir.AlgorithmInvokeCall._name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata._name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.GridArg._name, psyclone.domain.lfric.kernel.lfric_kernel_metadata.LFRicKernelMetadata._name, psyclone.dynamo0p3.DynFuncDescriptor03._name, psyclone.expression.NamedArg._name, psyclone.gocean1p0.GOKernelGridArgument._name, psyclone.gocean1p0.GOStencil._name, psyclone.nemo.NemoInvoke._name, psyclone.nemo.NemoPSy._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.psyGen.PSy._name, psyclone.psyGen.Invoke._name, psyclone.psyGen.Kern._name, psyclone.psyGen.Argument._name, psyclone.psyir.nodes.container.Container._name, psyclone.psyir.nodes.routine.Routine._name, psyclone.psyir.symbols.symbol.Symbol._name, psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._vector_size, and psyclone.dynamo0p3.DynKernelArgument._vector_size.

◆ psyir_expression()

def psyclone.dynamo0p3.DynKernelArgument.psyir_expression (   self)
Looks up or creates a reference to a suitable Symbol for this kernel
argument. If the argument is a scalar that has been provided as a
literal (in the Algorithm layer) then the PSyIR of the expression
is returned.

:returns: the PSyIR for this kernel argument.
:rtype: :py:class:`psyclone.psyir.nodes.Node`

:raises InternalError: if this argument is a literal but we fail to \
                       construct PSyIR that is consistent with this.
:raises NotImplementedError: if this argument is not a literal, scalar
                             or field.

Reimplemented from psyclone.psyGen.Argument.

Definition at line 5861 of file dynamo0p3.py.

5861  def psyir_expression(self):
5862  '''
5863  Looks up or creates a reference to a suitable Symbol for this kernel
5864  argument. If the argument is a scalar that has been provided as a
5865  literal (in the Algorithm layer) then the PSyIR of the expression
5866  is returned.
5867 
5868  :returns: the PSyIR for this kernel argument.
5869  :rtype: :py:class:`psyclone.psyir.nodes.Node`
5870 
5871  :raises InternalError: if this argument is a literal but we fail to \
5872  construct PSyIR that is consistent with this.
5873  :raises NotImplementedError: if this argument is not a literal, scalar
5874  or field.
5875 
5876  '''
5877  symbol_table = self._call.scope.symbol_table
5878 
5879  if self.is_literal:
5880  reader = FortranReader()
5881  if self.precision:
5882  # Ensure any associated precision symbol is in the table.
5883  symbol_table.add_lfric_precision_symbol(self.precision)
5884  lit = reader.psyir_from_expression(self.name, symbol_table)
5885 
5886  # Sanity check that the resulting expression is a literal.
5887  if lit.walk(Reference):
5888  raise InternalError(
5889  f"Expected argument '{self.name}' to kernel "
5890  f"'{self.call.name}' to be a literal but the created "
5891  f"PSyIR contains one or more References.")
5892  return lit
5893 
5894  if self.is_scalar:
5895  try:
5896  scalar_sym = symbol_table.lookup(self.name)
5897  except KeyError:
5898  # TODO once #1258 is done the symbols should already exist
5899  # and therefore we should raise an exception if not.
5900  scalar_sym = symbol_table.new_symbol(
5901  self.name, symbol_type=DataSymbol,
5902  datatype=self.infer_datatype())
5903  return Reference(scalar_sym)
5904 
5905  const = LFRicConstants()
5906  try:
5907  suffix = const.ARG_TYPE_SUFFIX_MAPPING[self.argument_type]
5908  tag_name = f"{self.name}:{suffix}"
5909  sym = symbol_table.lookup_with_tag(tag_name)
5910  return Reference(sym)
5911 
5912  except KeyError as err:
5913  raise NotImplementedError(
5914  f"Unsupported kernel argument type: '{self.name}' is of type "
5915  f"'{self.argument_type}' which is not recognised as being a "
5916  f"literal, scalar or field.") from err
5917 

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.gocean1p0.GOKernelArgument.infer_datatype(), psyclone.psyGen.Argument.infer_datatype(), psyclone.dynamo0p3.DynKernelArgument.infer_datatype(), psyclone.parse.algorithm.Arg.is_literal(), psyclone.psyGen.Argument.is_literal(), psyclone.dynamo0p3.DynKernelArgument.is_scalar(), psyclone.gocean1p0.GOKernelArgument.is_scalar(), psyclone.gocean1p0.GOKernelGridArgument.is_scalar(), psyclone.psyGen.KernelArgument.is_scalar(), psyclone.psyir.symbols.typed_symbol.TypedSymbol.is_scalar(), 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.Argument.precision(), psyclone.psyir.symbols.datatypes.ScalarType.precision, and psyclone.psyir.symbols.datatypes.ArrayType.precision().

Here is the call graph for this function:

◆ ref_name()

def psyclone.dynamo0p3.DynKernelArgument.ref_name (   self,
  function_space = None 
)
Returns the name used to dereference this type of argument (depends
on whether it is a field or operator and, if the latter, whether it
is the to- or from-space that is specified).

:param function_space: the function space of this argument
:type function_space: :py:class:`psyclone.domain.lfric.FunctionSpace`

:returns: the name used to dereference this argument.
:rtype: str

:raises GenerationError: if the supplied function space is not one \
                         of the function spaces associated with \
                         this argument.
:raises GenerationError: if the supplied function space is not being \
                         returned by either 'function_space_from' or \
                         'function_space_to'.
:raises GenerationError: if the argument type is not supported.

Definition at line 5438 of file dynamo0p3.py.

5438  def ref_name(self, function_space=None):
5439  '''
5440  Returns the name used to dereference this type of argument (depends
5441  on whether it is a field or operator and, if the latter, whether it
5442  is the to- or from-space that is specified).
5443 
5444  :param function_space: the function space of this argument
5445  :type function_space: :py:class:`psyclone.domain.lfric.FunctionSpace`
5446 
5447  :returns: the name used to dereference this argument.
5448  :rtype: str
5449 
5450  :raises GenerationError: if the supplied function space is not one \
5451  of the function spaces associated with \
5452  this argument.
5453  :raises GenerationError: if the supplied function space is not being \
5454  returned by either 'function_space_from' or \
5455  'function_space_to'.
5456  :raises GenerationError: if the argument type is not supported.
5457 
5458  '''
5459  # pylint: disable=too-many-branches
5460  if not function_space:
5461  if self.is_operator:
5462  # For an operator we use the 'from' FS
5463  function_space = self._function_spaces[1]
5464  else:
5465  function_space = self._function_spaces[0]
5466  else:
5467  # Check that the supplied function space is valid for this
5468  # argument
5469  found = False
5470  for fspace in self.function_spaces:
5471  if fspace and fspace.orig_name == function_space.orig_name:
5472  found = True
5473  break
5474  if not found:
5475  raise GenerationError(
5476  f"DynKernelArgument.ref_name(fs): The supplied function "
5477  f"space (fs='{function_space.orig_name}') is not one of "
5478  f"the function spaces associated with this argument "
5479  f"(fss={self.function_space_names}).")
5480  if self.is_field:
5481  return "vspace"
5482  if self.is_operator:
5483  if function_space.orig_name == self.descriptor.function_space_from:
5484  return "fs_from"
5485  if function_space.orig_name == self.descriptor.function_space_to:
5486  return "fs_to"
5487  raise GenerationError(
5488  f"DynKernelArgument.ref_name(fs): Function space "
5489  f"'{function_space.orig_name}' is one of the 'gh_operator' "
5490  f"function spaces '{self.function_spaces}' but is not being "
5491  f"returned by either function_space_from "
5492  f"'{self.descriptor.function_space_from}' or "
5493  f"function_space_to '{self.descriptor.function_space_to}'.")
5494  raise GenerationError(
5495  f"DynKernelArgument.ref_name(fs): Found unsupported argument "
5496  f"type '{self._argument_type}'.")
5497 

References psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._data_type, psyclone.dynamo0p3.DynKernelArgument._data_type, psyclone.psyGen.Argument._data_type, psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._function_spaces, psyclone.dynamo0p3.DynFunctionSpaces._function_spaces, psyclone.dynamo0p3.DynKernelArgument._function_spaces, psyclone.dynamo0p3.DynKernelArgument._init_field_properties(), psyclone.dynamo0p3.DynKernelArgument._init_operator_properties(), psyclone.dynamo0p3.DynKernelArgument._init_scalar_properties(), psyclone.dynamo0p3.DynKernelArgument._module_name, psyclone.parse.algorithm.ParsedCall._module_name, psyclone.parse.algorithm.KernelCall._module_name, psyclone.psyGen.CodedKern._module_name, psyclone.psyGen.Argument._module_name, psyclone.psyir.nodes.psy_data_node.PSyDataNode._module_name, psyclone.dynamo0p3.DynKernelArgument._precision, psyclone.psyGen.Argument._precision, psyclone.psyir.symbols.datatypes.ScalarType._precision, psyclone.psyir.symbols.datatypes.ArrayType._precision, psyclone.dynamo0p3.DynKernelArgument._proxy_data_type, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.GridArg.access, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.FieldArg.access, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.ScalarArg.access(), psyclone.domain.lfric.kernel.common_meta_arg_metadata.CommonMetaArgMetadata.access, psyclone.dynamo0p3.DynKernelArgument.access, psyclone.parse.kernel.Descriptor.access(), psyclone.psyGen.Argument.access(), psyclone.psyir.symbols.interfaces.ArgumentInterface.access, 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.dynamo0p3.DynKernelArgument.descriptor(), psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor.function_spaces(), psyclone.domain.lfric.lfric_invoke.LFRicInvoke.function_spaces, psyclone.dynamo0p3.DynKernelArgument.function_spaces(), psyclone.dynamo0p3.DynKernelArgument.intrinsic_type, psyclone.gocean1p0.GOKernelArgument.intrinsic_type(), psyclone.gocean1p0.GOKernelGridArgument.intrinsic_type(), psyclone.psyGen.Argument.intrinsic_type(), psyclone.dynamo0p3.DynKernelArgument.is_field(), psyclone.parse.algorithm.Arg.is_literal(), psyclone.psyGen.Argument.is_literal(), psyclone.dynamo0p3.DynKernelArgument.is_operator(), psyclone.dynamo0p3.DynKernelArgument.is_scalar(), psyclone.gocean1p0.GOKernelArgument.is_scalar(), psyclone.gocean1p0.GOKernelGridArgument.is_scalar(), psyclone.psyGen.KernelArgument.is_scalar(), and psyclone.psyir.symbols.typed_symbol.TypedSymbol.is_scalar().

Here is the call graph for this function:

◆ stencil() [1/2]

def psyclone.dynamo0p3.DynKernelArgument.stencil (   self)
:returns: stencil information for this argument if it exists.
:rtype: :py:class:`psyclone.dynamo0p3.LFRicArgStencil`

Reimplemented from psyclone.psyGen.KernelArgument.

Definition at line 6079 of file dynamo0p3.py.

6079  def stencil(self):
6080  '''
6081  :returns: stencil information for this argument if it exists.
6082  :rtype: :py:class:`psyclone.dynamo0p3.LFRicArgStencil`
6083  '''
6084  return self._stencil
6085 

References psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.FieldArg._stencil, psyclone.domain.lfric.arg_index_to_metadata_index.ArgIndexToMetadataIndex._stencil(), psyclone.domain.lfric.kernel.field_arg_metadata.FieldArgMetadata._stencil, psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._stencil, psyclone.domain.lfric.metadata_to_arguments_rules.MetadataToArgumentsRules._stencil(), psyclone.dynamo0p3.DynKernelArgument._stencil, psyclone.gocean1p0.GOStencil._stencil, and psyclone.parse.kernel.Descriptor._stencil.

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

◆ stencil() [2/2]

def psyclone.dynamo0p3.DynKernelArgument.stencil (   self,
  value 
)
Sets stencil information for this kernel argument.

:param value: stencil information for this argument.
:type value: :py:class:`psyclone.dynamo0p3.LFRicArgStencil`

Definition at line 6087 of file dynamo0p3.py.

6087  def stencil(self, value):
6088  '''
6089  Sets stencil information for this kernel argument.
6090 
6091  :param value: stencil information for this argument.
6092  :type value: :py:class:`psyclone.dynamo0p3.LFRicArgStencil`
6093 
6094  '''
6095  self._stencil = value
6096 

References psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.FieldArg._stencil, psyclone.domain.lfric.arg_index_to_metadata_index.ArgIndexToMetadataIndex._stencil(), psyclone.domain.lfric.kernel.field_arg_metadata.FieldArgMetadata._stencil, psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._stencil, psyclone.domain.lfric.metadata_to_arguments_rules.MetadataToArgumentsRules._stencil(), psyclone.dynamo0p3.DynKernelArgument._stencil, psyclone.gocean1p0.GOStencil._stencil, psyclone.parse.kernel.Descriptor._stencil, and psyclone.dynamo0p3.DynKernelArgument.stencil().

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

◆ vector_size()

def psyclone.dynamo0p3.DynKernelArgument.vector_size (   self)
:returns: the vector size of this argument as specified in \
          the Kernel metadata.
:rtype: str

Definition at line 5842 of file dynamo0p3.py.

5842  def vector_size(self):
5843  '''
5844  :returns: the vector size of this argument as specified in \
5845  the Kernel metadata.
5846  :rtype: str
5847  '''
5848  return self._vector_size
5849 

References psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._vector_size, and psyclone.dynamo0p3.DynKernelArgument._vector_size.


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