Reference Guide  2.5.0
psyclone.psyGen.Argument Class Reference
Inheritance diagram for psyclone.psyGen.Argument:

Public Member Functions

def __init__ (self, call, arg_info, access)
 
def psyir_expression (self)
 
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 argument_type (self)
 
def intrinsic_type (self)
 
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)
 

Detailed Description

Argument base class. Captures information on an argument that is passed
to a Kernel from an Invoke.

:param call: the kernel call that this argument is associated with.
:type call: :py:class:`psyclone.psyGen.Kern`
:param arg_info: Information about this argument collected by \
                 the parser.
:type arg_info: :py:class:`psyclone.parse.algorithm.Arg`
:param access: the way in which this argument is accessed in \
               the 'Kern'. Valid values are specified in the config \
               object of the current API.
:type access: str

Definition at line 2126 of file psyGen.py.

Member Function Documentation

◆ access()

def psyclone.psyGen.Argument.access (   self,
  value 
)
Set the access type for this argument.

:param value: new access type.
:type value: :py:class:`psyclone.core.access_type.AccessType`.

:raises InternalError: if value is not an AccessType.

Definition at line 2266 of file psyGen.py.

2266  def access(self, value):
2267  '''Set the access type for this argument.
2268 
2269  :param value: new access type.
2270  :type value: :py:class:`psyclone.core.access_type.AccessType`.
2271 
2272  :raises InternalError: if value is not an AccessType.
2273 
2274  '''
2275  if not isinstance(value, AccessType):
2276  raise InternalError(f"Invalid access type '{value}' of type "
2277  f"'{type(value)}.")
2278 
2279  self._access = value
2280 

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.parse.kernel.Descriptor._access, psyclone.psyGen.Argument._access, and psyclone.psyir.symbols.interfaces.ArgumentInterface._access.

Here is the caller graph for this function:

◆ argument_type()

def psyclone.psyGen.Argument.argument_type (   self)
Returns the type of the argument. APIs that do not have this
concept can use this base class version which just returns "field"
in all cases. APIs with this concept can override this method.

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

Reimplemented in psyclone.gocean1p0.GOKernelGridArgument, psyclone.gocean1p0.GOKernelArgument, and psyclone.dynamo0p3.DynKernelArgument.

Definition at line 2282 of file psyGen.py.

2282  def argument_type(self):
2283  '''
2284  Returns the type of the argument. APIs that do not have this
2285  concept can use this base class version which just returns "field"
2286  in all cases. APIs with this concept can override this method.
2287 
2288  :returns: the API type of the kernel argument.
2289  :rtype: str
2290 
2291  '''
2292  return "field"
2293 
Here is the caller graph for this function:

◆ backward_dependence()

def psyclone.psyGen.Argument.backward_dependence (   self)
Returns the preceding argument that this argument has a direct
dependence with, or None if there is not one. The argument may
exist in a call, a haloexchange, or a globalsum.

:returns: the first preceding argument that has a dependence \
    on this argument.
:rtype: :py:class:`psyclone.psyGen.Argument`

Reimplemented in psyclone.gocean1p0.GOKernelGridArgument.

Definition at line 2348 of file psyGen.py.

2348  def backward_dependence(self):
2349  '''Returns the preceding argument that this argument has a direct
2350  dependence with, or None if there is not one. The argument may
2351  exist in a call, a haloexchange, or a globalsum.
2352 
2353  :returns: the first preceding argument that has a dependence \
2354  on this argument.
2355  :rtype: :py:class:`psyclone.psyGen.Argument`
2356 
2357  '''
2358  nodes = self._call.preceding(reverse=True)
2359  return self._find_argument(nodes)
2360 

References psyclone.f2pygen.CallGen._call, psyclone.gocean1p0.GOKernelGridArgument._call, psyclone.psyGen.DataAccess._call, psyclone.psyGen.Argument._call, and psyclone.psyGen.Argument._find_argument().

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

◆ backward_write_dependencies()

def psyclone.psyGen.Argument.backward_write_dependencies (   self,
  ignore_halos = False 
)
Returns a list of previous write arguments that this argument has
dependencies with. The arguments may exist in a call, a
haloexchange (unless `ignore_halos` is `True`), or a globalsum. If
none are found then return an empty list. If self is not a
reader then return an empty list.

:param ignore_halos: if `True` then any write dependencies \
    involving a halo exchange are ignored. Defaults to `False`.
:type ignore_halos: bool

:returns: a list of arguments that have a preceding write \
    dependence on this argument.
:rtype: list of :py:class:`psyclone.psyGen.Argument`

Definition at line 2380 of file psyGen.py.

2380  def backward_write_dependencies(self, ignore_halos=False):
2381  '''Returns a list of previous write arguments that this argument has
2382  dependencies with. The arguments may exist in a call, a
2383  haloexchange (unless `ignore_halos` is `True`), or a globalsum. If
2384  none are found then return an empty list. If self is not a
2385  reader then return an empty list.
2386 
2387  :param ignore_halos: if `True` then any write dependencies \
2388  involving a halo exchange are ignored. Defaults to `False`.
2389  :type ignore_halos: bool
2390 
2391  :returns: a list of arguments that have a preceding write \
2392  dependence on this argument.
2393  :rtype: list of :py:class:`psyclone.psyGen.Argument`
2394 
2395  '''
2396  nodes = self._call.preceding(reverse=True)
2397  results = self._find_write_arguments(nodes, ignore_halos=ignore_halos)
2398  return results
2399 

References psyclone.f2pygen.CallGen._call, psyclone.gocean1p0.GOKernelGridArgument._call, psyclone.psyGen.DataAccess._call, psyclone.psyGen.Argument._call, and psyclone.psyGen.Argument._find_write_arguments().

Here is the call graph for this function:

◆ call() [1/2]

def psyclone.psyGen.Argument.call (   self)
 Return the call that this argument is associated with 

Definition at line 2339 of file psyGen.py.

2339  def call(self):
2340  ''' Return the call that this argument is associated with '''
2341  return self._call
2342 

References psyclone.f2pygen.CallGen._call, psyclone.gocean1p0.GOKernelGridArgument._call, psyclone.psyGen.DataAccess._call, and psyclone.psyGen.Argument._call.

Here is the caller graph for this function:

◆ call() [2/2]

def psyclone.psyGen.Argument.call (   self,
  value 
)
 set the node that this argument is associated with 

Definition at line 2344 of file psyGen.py.

2344  def call(self, value):
2345  ''' set the node that this argument is associated with '''
2346  self._call = value
2347 

References psyclone.f2pygen.CallGen._call, psyclone.gocean1p0.GOKernelGridArgument._call, psyclone.psyGen.DataAccess._call, psyclone.psyGen.Argument._call, and psyclone.psyGen.Argument.call().

Here is the call graph for this function:

◆ data_type()

def psyclone.psyGen.Argument.data_type (   self)
:returns: the data type of this argument. Default value is None, \
          explicit implementation is left to a specific API.
:rtype: str or NoneType

Definition at line 2317 of file psyGen.py.

2317  def data_type(self):
2318  '''
2319  :returns: the data type of this argument. Default value is None, \
2320  explicit implementation is left to a specific API.
2321  :rtype: str or NoneType
2322 
2323  '''
2324  return self._data_type
2325 

References psyclone.domain.lfric.lfric_arg_descriptor.LFRicArgDescriptor._data_type, psyclone.dynamo0p3.DynKernelArgument._data_type, and psyclone.psyGen.Argument._data_type.

◆ forward_dependence()

def psyclone.psyGen.Argument.forward_dependence (   self)
Returns the following argument that this argument has a direct
dependence on, or `None` if there is not one. The argument may
exist in a call, a haloexchange, or a globalsum.

:returns: the first following argument that has a dependence \
    on this argument.
:rtype: :py:class:`psyclone.psyGen.Argument`

Reimplemented in psyclone.gocean1p0.GOKernelGridArgument.

Definition at line 2400 of file psyGen.py.

2400  def forward_dependence(self):
2401  '''Returns the following argument that this argument has a direct
2402  dependence on, or `None` if there is not one. The argument may
2403  exist in a call, a haloexchange, or a globalsum.
2404 
2405  :returns: the first following argument that has a dependence \
2406  on this argument.
2407  :rtype: :py:class:`psyclone.psyGen.Argument`
2408 
2409  '''
2410  nodes = self._call.following()
2411  return self._find_argument(nodes)
2412 

References psyclone.f2pygen.CallGen._call, psyclone.gocean1p0.GOKernelGridArgument._call, psyclone.psyGen.DataAccess._call, psyclone.psyGen.Argument._call, and psyclone.psyGen.Argument._find_argument().

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

◆ forward_read_dependencies()

def psyclone.psyGen.Argument.forward_read_dependencies (   self)
Returns a list of following read arguments that this argument has
dependencies with. The arguments may exist in a call, a
haloexchange, or a globalsum. If none are found then
return an empty list. If self is not a writer then return an
empty list.

:returns: a list of following arguments that have a read \
    dependence on this argument.
:rtype: list of :py:class:`psyclone.psyGen.Argument`

Definition at line 2413 of file psyGen.py.

2413  def forward_read_dependencies(self):
2414  '''Returns a list of following read arguments that this argument has
2415  dependencies with. The arguments may exist in a call, a
2416  haloexchange, or a globalsum. If none are found then
2417  return an empty list. If self is not a writer then return an
2418  empty list.
2419 
2420  :returns: a list of following arguments that have a read \
2421  dependence on this argument.
2422  :rtype: list of :py:class:`psyclone.psyGen.Argument`
2423 
2424  '''
2425  nodes = self._call.following()
2426  return self._find_read_arguments(nodes)
2427 

References psyclone.f2pygen.CallGen._call, psyclone.gocean1p0.GOKernelGridArgument._call, psyclone.psyGen.DataAccess._call, psyclone.psyGen.Argument._call, psyclone.psyGen.Argument._depends_on(), psyclone.psyGen.Argument._find_read_arguments(), 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.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:

◆ forward_write_dependencies()

def psyclone.psyGen.Argument.forward_write_dependencies (   self,
  ignore_halos = False 
)
Returns a list of following write arguments that this argument has
dependencies with. The arguments may exist in a call, a
haloexchange (unless `ignore_halos` is `True`), or a globalsum. If
none are found then return an empty list. If self is not a
reader then return an empty list.

:param bool ignore_halos: if `True` then any write dependencies \
    involving a halo exchange are ignored. Defaults to `False`.

:returns: a list of arguments that have a following write \
    dependence on this argument.
:rtype: list of :py:class:`psyclone.psyGen.Argument`

Definition at line 2361 of file psyGen.py.

2361  def forward_write_dependencies(self, ignore_halos=False):
2362  '''Returns a list of following write arguments that this argument has
2363  dependencies with. The arguments may exist in a call, a
2364  haloexchange (unless `ignore_halos` is `True`), or a globalsum. If
2365  none are found then return an empty list. If self is not a
2366  reader then return an empty list.
2367 
2368  :param bool ignore_halos: if `True` then any write dependencies \
2369  involving a halo exchange are ignored. Defaults to `False`.
2370 
2371  :returns: a list of arguments that have a following write \
2372  dependence on this argument.
2373  :rtype: list of :py:class:`psyclone.psyGen.Argument`
2374 
2375  '''
2376  nodes = self._call.following()
2377  results = self._find_write_arguments(nodes, ignore_halos=ignore_halos)
2378  return results
2379 

References psyclone.f2pygen.CallGen._call, psyclone.gocean1p0.GOKernelGridArgument._call, psyclone.psyGen.DataAccess._call, psyclone.psyGen.Argument._call, and psyclone.psyGen.Argument._find_write_arguments().

Here is the call graph for this function:

◆ infer_datatype()

def psyclone.psyGen.Argument.infer_datatype (   self)
 Infer the datatype of this argument using the API rules. If no
specialisation of this method has been provided make the type
UnresolvedType for now (it may be provided later in the execution).

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

Reimplemented in psyclone.gocean1p0.GOKernelArgument.

Definition at line 2231 of file psyGen.py.

2231  def infer_datatype(self):
2232  ''' Infer the datatype of this argument using the API rules. If no
2233  specialisation of this method has been provided make the type
2234  UnresolvedType for now (it may be provided later in the execution).
2235 
2236  :returns: the datatype of this argument.
2237  :rtype: :py:class::`psyclone.psyir.symbols.DataType`
2238 
2239  '''
2240  return UnresolvedType()
2241 
Here is the caller graph for this function:

◆ intrinsic_type()

def psyclone.psyGen.Argument.intrinsic_type (   self)
Abstract property for the intrinsic type of the argument with
specific implementations in different APIs.

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

Reimplemented in psyclone.gocean1p0.GOKernelGridArgument, psyclone.gocean1p0.GOKernelArgument, and psyclone.dynamo0p3.DynKernelArgument.

Definition at line 2296 of file psyGen.py.

2296  def intrinsic_type(self):
2297  '''
2298  Abstract property for the intrinsic type of the argument with
2299  specific implementations in different APIs.
2300 
2301  :returns: the intrinsic type of this argument.
2302  :rtype: str
2303 
2304  '''
2305 
Here is the caller graph for this function:

◆ module_name()

def psyclone.psyGen.Argument.module_name (   self)
:returns: the name of the Fortran module that contains definitions \
          for the argument data type. Default value is None, \
          explicit implementation is left to a specific API.
:rtype: str or NoneType

Definition at line 2327 of file psyGen.py.

2327  def module_name(self):
2328  '''
2329  :returns: the name of the Fortran module that contains definitions \
2330  for the argument data type. Default value is None, \
2331  explicit implementation is left to a specific API.
2332  :rtype: str or NoneType
2333 
2334 
2335  '''
2336  return self._module_name
2337 

References 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, and psyclone.psyir.nodes.psy_data_node.PSyDataNode._module_name.

Here is the caller graph for this function:

◆ precision()

def psyclone.psyGen.Argument.precision (   self)
:returns: the precision of this argument. Default value is None, \
          explicit implementation is left to a specific API.
:rtype: str or NoneType

Definition at line 2307 of file psyGen.py.

2307  def precision(self):
2308  '''
2309  :returns: the precision of this argument. Default value is None, \
2310  explicit implementation is left to a specific API.
2311  :rtype: str or NoneType
2312 
2313  '''
2314  return self._precision
2315 

References psyclone.dynamo0p3.DynKernelArgument._precision, psyclone.psyGen.Argument._precision, psyclone.psyir.symbols.datatypes.ScalarType._precision, and psyclone.psyir.symbols.datatypes.ArrayType._precision.

Here is the caller graph for this function:

◆ psyir_expression()

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

Reimplemented in psyclone.gocean1p0.GOKernelGridArgument, psyclone.gocean1p0.GOKernelArgument, and psyclone.dynamo0p3.DynKernelArgument.

Definition at line 2224 of file psyGen.py.

2224  def psyir_expression(self):
2225  '''
2226  :returns: the PSyIR expression represented by this Argument.
2227  :rtype: :py:class:`psyclone.psyir.nodes.Node`
2228 
2229  '''
2230 

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