Reference Guide
2.5.0
|
Public Member Functions | |
def | __init__ (self, parent, loop_type="", field_name="", field_space="", iteration_space="", index_offset="") |
def | field_space (self) |
def | field_space (self, my_field_space) |
def | iteration_space (self) |
def | iteration_space (self, it_space) |
def | bounds_lookup (self) |
def | independent_iterations (self, test_all_variables=False, signatures_to_ignore=None, dep_tools=None) |
def | create_halo_exchanges (self) |
def | get_custom_bound_string (self, side) |
def | upper_bound (self) |
def | lower_bound (self) |
def | gen_code (self, parent) |
Public Member Functions inherited from psyclone.domain.common.psylayer.psyloop.PSyLoop | |
def | __init__ (self, valid_loop_types=None, **kwargs) |
def | __eq__ (self, other) |
def | dag_name (self) |
def | valid_loop_types (self) |
def | loop_type (self) |
def | loop_type (self, value) |
def | node_str (self, colour=True) |
def | field_name (self) |
def | field (self) |
def | field_name (self, my_field_name) |
def | kernel (self) |
def | kernel (self, kern) |
def | __str__ (self) |
def | has_inc_arg (self) |
def | unique_modified_args (self, arg_type) |
def | unique_fields_with_halo_reads (self) |
def | args_filter (self, arg_types=None, arg_accesses=None, unique=False) |
def | gen_mark_halos_clean_dirty (self, parent) |
Static Public Member Functions | |
def | create (parent, loop_type, field_name="", field_space="", iteration_space="", index_offset="") |
def | setup_bounds () |
def | add_bounds (bound_info) |
Public Attributes | |
loop_type | |
field_name | |
field_space | |
iteration_space | |
index_offset | |
variable | |
Public Attributes inherited from psyclone.domain.common.psylayer.psyloop.PSyLoop | |
loop_type | |
field | |
field_name | |
field_space | |
iteration_space | |
kernel | |
The GOcean specific PSyLoop class. This passes the GOcean specific single loop information to the base class so it creates the one we require. Adds a GOcean specific setBounds method which tells the loop what to iterate over. Need to harmonise with the topology_name method in the Dynamo api. :param parent: optional parent node (default None). :type parent: :py:class:`psyclone.psyir.nodes.Node` :param str loop_type: loop type - must be 'inner' or 'outer'. :param str field_name: name of the field this loop iterates on. :param str field_space: space of the field this loop iterates on. :param str iteration_space: iteration space of the loop. :raises GenerationError: if the loop is not inserted inside a \ GOInvokeSchedule region.
Definition at line 331 of file gocean1p0.py.
|
static |
Adds a new iteration space to PSyclone. An iteration space in the gocean1.0 API is for a certain offset type and field type. It defines the loop boundaries for the outer and inner loop. The format is a ":" separated tuple: >>> bound_info = offset-type:field-type:iteration-space:outer-start: outer-stop:inner-start:inner-stop Example: >>> bound_info = go_offset_ne:go_ct:go_all_pts: {start}-1:{stop}+1:{start}:{stop} The expressions {start} and {stop} will be replaced with the loop indices that correspond to the inner points (i.e. non-halo or boundary points) of the field. So the index {start}-1 is actually on the halo / boundary. :param str bound_info: A string that contains a ":" separated \ tuple with the iteration space definition. :raises ValueError: if bound_info is not a string. :raises ConfigurationError: if bound_info is not formatted correctly.
Definition at line 696 of file gocean1p0.py.
References psyclone.gocean1p0.GOLoop.create().
def psyclone.gocean1p0.GOLoop.bounds_lookup | ( | self | ) |
:returns: the GOcean loop bounds lookup table. This is a \ 5-dimensional dictionary with index-offset, field-space, \ iteration-space, loop-type, and boundary-side lookup keys \ which provides information about how to construct the \ loop boundaries for a kernel with such parameters. :rtype: dict
Definition at line 506 of file gocean1p0.py.
References psyclone.gocean1p0.GOLoop._bounds_lookup.
|
static |
Create a new instance of a GOLoop with the expected children to represent the bounds given by the loop properties. :param parent: parent node of this GOLoop. :type parent: :py:class:`psyclone.psyir.nodes.Node` :param str loop_type: loop type - must be 'inner' or 'outer'. :param str field_name: name of the field this loop iterates on. :param str field_space: space of the field this loop iterates on. :param str iteration_space: iteration space of the loop. :param str index_offset: the grid index offset used by the kernel(s) \ within this loop. :returns: a new GOLoop node (with appropriate child nodes). :rtype: :py:class:`psyclone.gocean1p0.GOLoop`
Definition at line 402 of file gocean1p0.py.
def psyclone.gocean1p0.GOLoop.create_halo_exchanges | ( | self | ) |
Add halo exchanges before this loop as required by fields within this loop. The PSyIR insertion logic is coded in the _add_halo_exchange helper method.
Definition at line 576 of file gocean1p0.py.
References psyclone.domain.lfric.lfric_loop.LFRicLoop._add_halo_exchange(), psyclone.gocean1p0.GOLoop._add_halo_exchange(), psyclone.f2pygen.BaseGen.parent(), psyclone.psyir.nodes.node.Node.parent(), psyclone.f2pygen.Directive.position(), psyclone.psyir.nodes.node.Node.position, and psyclone.domain.common.psylayer.psyloop.PSyLoop.unique_fields_with_halo_reads().
def psyclone.gocean1p0.GOLoop.field_space | ( | self | ) |
:returns: the loop's field space (e.g. CU, CV...). :rtype: str
Reimplemented from psyclone.domain.common.psylayer.psyloop.PSyLoop.
Definition at line 435 of file gocean1p0.py.
References psyclone.domain.common.psylayer.psyloop.PSyLoop._field_space, psyclone.domain.lfric.lfric_loop.LFRicLoop._field_space, and psyclone.gocean1p0.GOLoop._field_space.
def psyclone.gocean1p0.GOLoop.field_space | ( | self, | |
my_field_space | |||
) |
Sets new value for the field_space and updates the Loop bounds, if these exist, to match the given field_space. :param str my_field_space: new field_space value. :raises TypeError: if the provided field_space is not a string. :raises ValueError: if the provided field_space is not a valid GOcean \ field_space.
Reimplemented from psyclone.domain.common.psylayer.psyloop.PSyLoop.
Definition at line 443 of file gocean1p0.py.
References psyclone.domain.common.psylayer.psyloop.PSyLoop._field_space, psyclone.domain.lfric.lfric_loop.LFRicLoop._field_space, psyclone.gocean1p0.GOLoop._field_space, psyclone.f2pygen.BaseGen.children(), psyclone.psyGen.InlinedKern.children, psyclone.psyir.nodes.node.Node.children(), psyclone.gocean1p0.GOLoop.lower_bound(), psyclone.psyir.backend.sympy_writer.SymPyWriter.lower_bound(), psyclone.domain.lfric.lfric_loop.LFRicLoop.start_expr(), psyclone.psyir.nodes.loop.Loop.start_expr(), psyclone.domain.lfric.lfric_loop.LFRicLoop.stop_expr(), psyclone.psyir.nodes.loop.Loop.stop_expr(), psyclone.gocean1p0.GOLoop.upper_bound(), and psyclone.psyir.backend.sympy_writer.SymPyWriter.upper_bound().
def psyclone.gocean1p0.GOLoop.gen_code | ( | self, | |
parent | |||
) |
Create the f2pygen AST for this loop (and update the PSyIR representing the loop bounds if necessary). :param parent: the node in the f2pygen AST to which to add content. :type parent: :py:class:`psyclone.f2pygen.SubroutineGen`
Definition at line 992 of file gocean1p0.py.
References psyclone.gocean1p0.GOLoop._validate_loop().
def psyclone.gocean1p0.GOLoop.get_custom_bound_string | ( | self, | |
side | |||
) |
Get the string that represents a customized custom bound for this GOLoop (provided by the add_bounds() method). It can provide the 'start' or 'stop' side of the bounds. :param str side: 'start' or 'stop' side of the bound. :returns: the string that represents the loop bound. :rtype: str :raises GenerationError: if this node can not find a field in \ the Invoke to be the base of the infrastructure call. :raises GenerationError: if no expression is known to obtain the \ boundaries for a loop of this characteristics, because they \ are not in the GOcean lookup table or the loop type is not \ `inner` or `outer`.
Definition at line 795 of file gocean1p0.py.
References psyclone.psyir.nodes.node.Node.ancestor(), psyclone.gocean1p0.GOLoop.bounds_lookup(), psyclone.domain.common.psylayer.psyloop.PSyLoop.field_name, psyclone.gocean1p0.GOLoop.field_name, psyclone.domain.common.psylayer.psyloop.PSyLoop.field_space, psyclone.gocean1p0.GOLoop.field_space, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.index_offset, psyclone.gocean1p0.GOLoop.index_offset, psyclone.gocean1p0.GOKern.index_offset(), psyclone.gocean1p0.GOKernelType1p0.index_offset(), psyclone.domain.common.psylayer.psyloop.PSyLoop.iteration_space, psyclone.gocean1p0.GOLoop.iteration_space, psyclone.domain.common.psylayer.psyloop.PSyLoop.loop_type, psyclone.domain.lfric.lfric_loop.LFRicLoop.loop_type, psyclone.gocean1p0.GOLoop.loop_type, psyclone.psyir.nodes.loop.Loop.loop_type(), psyclone.psyir.nodes.node.Node.scope(), and psyclone.psyir.symbols.symbol_table.SymbolTable.scope().
def psyclone.gocean1p0.GOLoop.independent_iterations | ( | self, | |
test_all_variables = False , |
|||
signatures_to_ignore = None , |
|||
dep_tools = None |
|||
) |
This function is a GOcean-specific override of the default method in the Loop class. It allows domain-specific rules to be applied when determining whether or not loop iterations are independent. :param bool test_all_variables: if True, it will test if all variable accesses are independent, otherwise it will stop after the first variable access is found that isn't. :param signatures_to_ignore: list of signatures for which to skip the access checks. :type signatures_to_ignore: Optional[ List[:py:class:`psyclone.core.Signature`]] :param dep_tools: an optional instance of DependencyTools so that the caller can access any diagnostic messages detailing why the loop iterations are not independent. :type dep_tools: Optional[ :py:class:`psyclone.psyir.tools.DependencyTools`] :returns: True if the loop iterations are independent, False otherwise. :rtype: bool
Definition at line 517 of file gocean1p0.py.
def psyclone.gocean1p0.GOLoop.iteration_space | ( | self | ) |
:returns: the loop's iteration space (e.g. 'go_internal_pts', \ 'go_all_pts', ...). :rtype: str
Reimplemented from psyclone.domain.common.psylayer.psyloop.PSyLoop.
Definition at line 473 of file gocean1p0.py.
References psyclone.domain.common.psylayer.psyloop.PSyLoop._iteration_space, psyclone.domain.lfric.lfric_loop.LFRicLoop._iteration_space, and psyclone.gocean1p0.GOLoop._iteration_space.
def psyclone.gocean1p0.GOLoop.iteration_space | ( | self, | |
it_space | |||
) |
Sets new value for the iteration_space and updates the Loop bounds, if these exist, to match the given iteration_space. :param str it_space: new iteration_space value. :raises TypeError: if the provided it_space is not a string.
Reimplemented from psyclone.domain.common.psylayer.psyloop.PSyLoop.
Definition at line 482 of file gocean1p0.py.
References psyclone.domain.common.psylayer.psyloop.PSyLoop._iteration_space, psyclone.domain.lfric.lfric_loop.LFRicLoop._iteration_space, psyclone.gocean1p0.GOLoop._iteration_space, psyclone.f2pygen.BaseGen.children(), psyclone.psyGen.InlinedKern.children, psyclone.psyir.nodes.node.Node.children(), psyclone.gocean1p0.GOLoop.lower_bound(), psyclone.psyir.backend.sympy_writer.SymPyWriter.lower_bound(), psyclone.domain.lfric.lfric_loop.LFRicLoop.start_expr(), psyclone.psyir.nodes.loop.Loop.start_expr(), psyclone.domain.lfric.lfric_loop.LFRicLoop.stop_expr(), psyclone.psyir.nodes.loop.Loop.stop_expr(), psyclone.gocean1p0.GOLoop.upper_bound(), and psyclone.psyir.backend.sympy_writer.SymPyWriter.upper_bound().
def psyclone.gocean1p0.GOLoop.lower_bound | ( | self | ) |
Returns the lower bound of this loop as a string. :returns: root of PSyIR sub-tree describing this lower bound. :rtype: :py:class:`psyclone.psyir.nodes.Node`
Definition at line 928 of file gocean1p0.py.
References psyclone.gocean1p0.GOLoop._grid_property_psyir_expression(), psyclone.psyir.nodes.node.Node.ancestor(), psyclone.domain.common.psylayer.psyloop.PSyLoop.field_space, psyclone.gocean1p0.GOLoop.field_space, psyclone.gocean1p0.GOLoop.get_custom_bound_string(), psyclone.domain.common.psylayer.psyloop.PSyLoop.iteration_space, psyclone.gocean1p0.GOLoop.iteration_space, and psyclone.psyir.nodes.node.Node.walk().
|
static |
Populates the GOLoop._bounds_lookup dictionary. This is used by PSyclone to look up the loop boundaries for each loop it creates.
Definition at line 616 of file gocean1p0.py.
def psyclone.gocean1p0.GOLoop.upper_bound | ( | self | ) |
Creates the PSyIR of the upper bound of this loop. :returns: the PSyIR for the upper bound of this loop. :rtype: :py:class:`psyclone.psyir.nodes.Node`
Definition at line 888 of file gocean1p0.py.
References psyclone.gocean1p0.GOLoop._grid_property_psyir_expression(), psyclone.domain.common.psylayer.psyloop.PSyLoop._loop_type, psyclone.domain.lfric.lfric_loop.LFRicLoop._loop_type, psyclone.gocean1p0.GOLoop._loop_type, psyclone.psyir.nodes.node.Node.ancestor(), psyclone.domain.common.psylayer.psyloop.PSyLoop.field_space, psyclone.gocean1p0.GOLoop.field_space, psyclone.gocean1p0.GOLoop.get_custom_bound_string(), psyclone.domain.common.psylayer.psyloop.PSyLoop.iteration_space, and psyclone.gocean1p0.GOLoop.iteration_space.