psyclone.domain.gocean.kernel
Module to capture GOcean-specific PSyIR for the Kernel layer.
Submodules
psyclone.domain.gocean.kernel.psyir
- Classes
GOceanContainer
GOceanKernelMetadata
GOceanKernelMetadata.FieldArg
GOceanKernelMetadata.GridArg
GOceanKernelMetadata.ScalarArg
GOceanKernelMetadata.create_from_fortran_string()
GOceanKernelMetadata.create_from_psyir()
GOceanKernelMetadata.fortran_string()
GOceanKernelMetadata.index_offset
GOceanKernelMetadata.iterates_over
GOceanKernelMetadata.lower_to_psyir()
GOceanKernelMetadata.meta_args
GOceanKernelMetadata.name
GOceanKernelMetadata.procedure_name
- Classes
Classes
GOceanKernelMetadata
: Contains GOcean kernel metadata. This class supports kernel
- class psyclone.domain.gocean.kernel.GOceanKernelMetadata(iterates_over=None, index_offset=None, meta_args=None, procedure_name=None, name=None)
Contains GOcean kernel metadata. This class supports kernel metadata creation, modification, loading from a fortran string, writing to a fortran string, raising from existing language-level PSyIR and lowering to language-level psyir.
- Parameters:
iterates_over (Optional[str]) – the name of the quantity that this kernel is intended to iterate over.
index_offset (Optional[str]) – the name of the quantity that specifies the index offset (how different field indices relate to each other).
meta_args (Optional[List[
GridArg
|FieldArg
|ScalarArg
]]) – a list of ‘meta_arg’ objects which capture the metadata values of the kernel arguments.procedure_name (Optional[str]) – the name of the kernel procedure to call.
name (Optional[str]) – the name of the symbol to use for the metadata in language-level PSyIR.
Inheritance
- class FieldArg(meta_arg, parent)
Internal class to capture Kernel metadata information for a field argument.
- Parameters:
meta_arg (
fparser.two.Fortran2003.Part_Ref
) – an fparser2 tree representation of the metadata.parent (:py:class`psyclone.psyir.common.kernel. KernelMetadataSymbol`) – a KernelMetadataSymbol instance that captures other parts of the metadata and references this instance.
- Raises:
ParseError – if the metadata does not contain three arguments.
- property access
- Returns:
the access descriptor for this field argument.
- Return type:
str
- property form
- Returns:
the form of access for the field (pointwise, stencil, …).
- Return type:
str
- fortran_string()
- Returns:
the metadata represented by this class as a Fortran string.
- Return type:
str
- property grid_point_type
- Returns:
the value of the grid point type (go_ct, …) for the field argument.
- Return type:
str
- property stencil
- Returns:
the stencil value, or None if there is no stencil.
- Return type:
Optional[List[str]]
- class GridArg(meta_arg, parent)
Internal class to capture Kernel metadata argument information for a grid property.
- Parameters:
meta_arg (
fparser.two.Fortran2003.Part_Ref
) – an fparser2 tree representation of the metadata.parent (:py:class`psyclone.psyir.common.kernel. KernelMetadataSymbol`) – a KernelMetadataSymbol instance that captures other parts of the metadata and references this instance.
- Raises:
ParseError – if the metadata does not contain two arguments.
- property access
- Returns:
the value of the access descriptor. This specifies how the grid property is accessed (read, write, readwrite).
- Return type:
str
- fortran_string()
- Returns:
the metadata represented by this class as a Fortran string.
- Return type:
str
- property name
- Returns:
the grid property name as specified by the metadata.
- Return type:
str
- class ScalarArg(meta_arg, parent)
Internal class to capture Kernel metadata information for a scalar argument.
- Parameters:
meta_arg (
fparser.two.Fortran2003.Part_Ref
) – an fparser2 tree representation of the metadata.parent (:py:class`psyclone.psyir.common.kernel. KernelMetadataSymbol`) – a KernelMetadataSymbol instance that captures other parts of the metadata and references this instance.
- Raises:
ParseError – if the metadata does not contain three arguments.
- property access
- Returns:
the access descriptor for this scalar argument.
- Return type:
str
- property datatype
- Returns:
the datatype of the scalar argument.
- Return type:
str
- property form
- Returns:
the form of access for the scalar (pointwise …).
- Return type:
str
- fortran_string()
- Returns:
the metadata represented by this class as a Fortran string.
- Return type:
str
- static create_from_fortran_string(fortran_string)
Create a new instance of GOceanKernelMetadata populated with metadata stored in a fortran string.
- Parameters:
fortran_string (str) – the metadata stored as Fortran.
- Returns:
an instance of GOceanKernelMetadata.
- Return type:
psyclone.domain.gocean.kernel.psyir. GOceanKernelMetadata
- Raises:
ValueError – if the string does not contain a fortran derived type.
ParseError – if the metadata has an unexpected format.
- static create_from_psyir(symbol)
Create a new instance of GOceanKernelMetadata populated with metadata from a kernel in language-level PSyIR.
- Parameters:
symbol (
psyclone.psyir.symbols.DataTypeSymbol
) – the symbol in which the metadata is stored in language-level PSyIR.- Returns:
an instance of GOceanKernelMetadata.
- Return type:
psyclone.domain.gocean.kernel.psyir. GOceanKernelMetadata
- Raises:
TypeError – if the symbol argument is not the expected type.
InternalError – if the datatype of the provided symbol is not the expected type.
- fortran_string()
- Returns:
the metadata represented by this instance as Fortran.
- Return type:
str
- property index_offset
- Returns:
the name of the quantity that specifies the index offset (how different field indices relate to each other).
- Return type:
str
- property iterates_over
- Returns:
the name of the quantity that this kernel is intended to iterate over.
- Return type:
str
- lower_to_psyir()
Lower the metadata to language-level PSyIR.
- Returns:
metadata as stored in language-level PSyIR.
- Return type:
- property meta_args
- Returns:
a list of ‘meta_arg’ objects which capture the metadata values of the kernel arguments.
- Return type:
List[
psyclone.psyir.common.kernel. KernelMetadataSymbol.KernelMetadataArg
]
- property name
- Returns:
the name of the symbol that will contain the metadata when lowering.
- Return type:
str
- property procedure_name
- Returns:
the kernel procedure name specified by the metadata.
- Return type:
str