Reference Guide
2.5.0
|
Public Member Functions | |
def | __init__ (self, loop_type="", **kwargs) |
def | lower_to_language_level (self) |
def | node_str (self, colour=True) |
def | load (self, kern) |
def | set_lower_bound (self, name, index=None) |
def | set_upper_bound (self, name, index=None) |
def | upper_bound_name (self) |
def | upper_bound_halo_depth (self) |
def | update_halo_exchanges (self) |
def | create_halo_exchanges (self) |
def | start_expr (self) |
def | stop_expr (self) |
def | gen_code (self, parent) |
def | gen_mark_halos_clean_dirty (self, parent) |
def | independent_iterations (self, test_all_variables=False, signatures_to_ignore=None, dep_tools=None) |
Public Member Functions inherited from psyclone.domain.common.psylayer.psyloop.PSyLoop | |
def | __eq__ (self, other) |
def | dag_name (self) |
def | valid_loop_types (self) |
def | loop_type (self) |
def | loop_type (self, value) |
def | field_space (self) |
def | field_space (self, my_field_space) |
def | field_name (self) |
def | field (self) |
def | field_name (self, my_field_name) |
def | iteration_space (self) |
def | iteration_space (self, it_space) |
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) |
Public Attributes | |
loop_type | |
variable | |
Public Attributes inherited from psyclone.domain.common.psylayer.psyloop.PSyLoop | |
loop_type | |
field | |
field_name | |
field_space | |
iteration_space | |
kernel | |
The LFRic-specific PSyLoop class. This passes the LFRic-specific loop information to the base class so it creates the one we require. Creates LFRic-specific loop bounds when the code is being generated. :param str loop_type: the type (iteration space) of this loop. :param kwargs: additional keyword arguments provided to the PSyIR node. :type kwargs: unwrapped dict. :raises InternalError: if an unrecognised loop_type is specified.
Definition at line 58 of file lfric_loop.py.
def psyclone.domain.lfric.lfric_loop.LFRicLoop.create_halo_exchanges | ( | self | ) |
Add halo exchanges before this loop as required by fields within this loop. To keep the logic simple we assume that any field that accesses the halo will require a halo exchange and then remove the halo exchange if this is not the case (when previous writers perform sufficient redundant computation). It is implemented this way as the halo exchange class determines whether it is required or not so a halo exchange needs to exist in order to find out. The appropriate logic is coded in the _add_halo_exchange helper method. In some cases a new halo exchange will replace an existing one. In this situation that routine also removes the old one.
Definition at line 704 of file lfric_loop.py.
References psyclone.domain.lfric.lfric_loop.LFRicLoop._add_halo_exchange(), psyclone.gocean1p0.GOLoop._add_halo_exchange(), and psyclone.domain.common.psylayer.psyloop.PSyLoop.unique_fields_with_halo_reads().
def psyclone.domain.lfric.lfric_loop.LFRicLoop.gen_code | ( | self, | |
parent | |||
) |
Call the base class to generate the code and then add any required halo exchanges. :param parent: an f2pygen object that will be the parent of \ f2pygen objects created in this method. :type parent: :py:class:`psyclone.f2pygen.BaseGen`
Definition at line 838 of file lfric_loop.py.
References 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.gen_mark_halos_clean_dirty(), psyclone.domain.lfric.lfric_loop.LFRicLoop.gen_mark_halos_clean_dirty(), psyclone.psyir.nodes.node.Node.is_openmp_parallel(), and psyclone.domain.common.psylayer.psyloop.PSyLoop.unique_modified_args().
def psyclone.domain.lfric.lfric_loop.LFRicLoop.gen_mark_halos_clean_dirty | ( | self, | |
parent | |||
) |
Generates the necessary code to mark halo regions for all modified fields as clean or dirty following execution of this loop. :param parent: the node in the f2pygen AST to which to add content. :type parent: :py:class:`psyclone.f2pygen.BaseGen`
Reimplemented from psyclone.domain.common.psylayer.psyloop.PSyLoop.
Definition at line 891 of file lfric_loop.py.
References psyclone.psyir.nodes.node.Node.ancestor(), and psyclone.domain.common.psylayer.psyloop.PSyLoop.unique_modified_args().
def psyclone.domain.lfric.lfric_loop.LFRicLoop.independent_iterations | ( | self, | |
test_all_variables = False , |
|||
signatures_to_ignore = None , |
|||
dep_tools = None |
|||
) |
This function is an LFRic-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 967 of file lfric_loop.py.
References psyclone.domain.common.psylayer.psyloop.PSyLoop.has_inc_arg(), psyclone.domain.common.psylayer.psyloop.PSyLoop.kernel, psyclone.domain.common.psylayer.psyloop.PSyLoop.loop_type, psyclone.domain.lfric.lfric_loop.LFRicLoop.loop_type, psyclone.gocean1p0.GOLoop.loop_type, and psyclone.psyir.nodes.loop.Loop.loop_type().
def psyclone.domain.lfric.lfric_loop.LFRicLoop.load | ( | self, | |
kern | |||
) |
Load the state of this Loop using the supplied Kernel object. This method is provided so that we can individually construct Loop objects for a given kernel call. :param kern: Kernel object to use to populate state of Loop :type kern: :py:class:`psyclone.domain.lfric.LFRicKern` :raises GenerationError: if the field updated by the kernel has an \ unexpected function space or if the kernel's 'operates-on' is \ not consistent with the loop type.
Definition at line 198 of file lfric_loop.py.
References psyclone.domain.common.psylayer.psyloop.PSyLoop._field, psyclone.domain.lfric.arg_index_to_metadata_index.ArgIndexToMetadataIndex._field(), psyclone.domain.lfric.lfric_loop.LFRicLoop._field, psyclone.domain.lfric.metadata_to_arguments_rules.MetadataToArgumentsRules._field(), psyclone.psyGen.HaloExchange._field, psyclone.domain.common.psylayer.psyloop.PSyLoop._field_name, psyclone.domain.lfric.lfric_loop.LFRicLoop._field_name, psyclone.domain.common.psylayer.psyloop.PSyLoop._field_space, psyclone.domain.lfric.lfric_loop.LFRicLoop._field_space, psyclone.gocean1p0.GOLoop._field_space, psyclone.domain.common.psylayer.psyloop.PSyLoop._iteration_space, psyclone.domain.lfric.lfric_loop.LFRicLoop._iteration_space, psyclone.gocean1p0.GOLoop._iteration_space, psyclone.domain.common.psylayer.psyloop.PSyLoop._kern, psyclone.domain.lfric.arg_ordering.ArgOrdering._kern, psyclone.domain.lfric.lfric_loop.LFRicLoop._kern, psyclone.domain.common.psylayer.psyloop.PSyLoop.field_space, psyclone.gocean1p0.GOLoop.field_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.domain.lfric.lfric_loop.LFRicLoop.set_lower_bound(), and psyclone.domain.lfric.lfric_loop.LFRicLoop.set_upper_bound().
def psyclone.domain.lfric.lfric_loop.LFRicLoop.lower_to_language_level | ( | self | ) |
In-place replacement of DSL or high-level concepts into generic PSyIR constructs. This function replaces a LFRicLoop with a PSyLoop and inserts the loop boundaries into the new PSyLoop, or removes the loop node in case of a domain kernel. Once TODO #1731 is done (which should fix the loop boundaries, which atm rely on index of the loop in the schedule, i.e. can change when transformations are applied), this function can likely be removed. :returns: the lowered version of this node. :rtype: :py:class:`psyclone.psyir.node.Node`
Definition at line 119 of file lfric_loop.py.
References 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._variable, psyclone.psyir.nodes.loop.Loop.loop_body(), psyclone.psyir.nodes.while_loop.WhileLoop.loop_body(), psyclone.psyir.nodes.node.Node.replace_with(), psyclone.domain.lfric.lfric_loop.LFRicLoop.start_expr(), psyclone.psyir.nodes.loop.Loop.start_expr(), psyclone.psyir.nodes.loop.Loop.step_expr(), psyclone.domain.lfric.lfric_loop.LFRicLoop.stop_expr(), and psyclone.psyir.nodes.loop.Loop.stop_expr().
def psyclone.domain.lfric.lfric_loop.LFRicLoop.node_str | ( | self, | |
colour = True |
|||
) |
Creates a text summary of this loop node. We override this method from the Loop class because, in Dynamo0.3, the function space is now an object and we need to call orig_name on it. We also include the upper loop bound as this can now be modified. :param bool colour: whether or not to include control codes for colour. :returns: text summary of this node, optionally with control codes \ for colour highlighting. :rtype: str
Reimplemented from psyclone.domain.common.psylayer.psyloop.PSyLoop.
Definition at line 172 of file lfric_loop.py.
References psyclone.domain.common.psylayer.psyloop.PSyLoop._loop_type, psyclone.domain.lfric.lfric_loop.LFRicLoop._loop_type, psyclone.gocean1p0.GOLoop._loop_type, psyclone.domain.lfric.lfric_loop.LFRicLoop._upper_bound_halo_depth, and psyclone.domain.lfric.lfric_loop.LFRicLoop._upper_bound_name.
def psyclone.domain.lfric.lfric_loop.LFRicLoop.set_lower_bound | ( | self, | |
name, | |||
index = None |
|||
) |
Set the lower bounds of this loop
Definition at line 280 of file lfric_loop.py.
References psyclone.domain.lfric.lfric_loop.LFRicLoop._lower_bound_index, and psyclone.domain.lfric.lfric_loop.LFRicLoop._lower_bound_name.
def psyclone.domain.lfric.lfric_loop.LFRicLoop.set_upper_bound | ( | self, | |
name, | |||
index = None |
|||
) |
Set the upper bound of this loop :param name: A loop upper bound name. This should be a supported name. :type name: String :param index: An optional argument indicating the depth of halo :type index: int
Definition at line 293 of file lfric_loop.py.
References psyclone.domain.lfric.lfric_loop.LFRicLoop._upper_bound_halo_depth, and psyclone.domain.lfric.lfric_loop.LFRicLoop._upper_bound_name.
def psyclone.domain.lfric.lfric_loop.LFRicLoop.start_expr | ( | self | ) |
:returns: the PSyIR for the lower bound of this loop. :rtype: :py:class:`psyclone.psyir.Node`
Definition at line 765 of file lfric_loop.py.
References psyclone.psyir.nodes.node.Node.ancestor(), psyclone.f2pygen.BaseGen.children(), psyclone.psyGen.InlinedKern.children, and psyclone.psyir.nodes.node.Node.children().
def psyclone.domain.lfric.lfric_loop.LFRicLoop.stop_expr | ( | self | ) |
:returns: the PSyIR for the upper bound of this loop. :rtype: :py:class:`psyclone.psyir.Node`
Definition at line 786 of file lfric_loop.py.
References psyclone.domain.common.psylayer.psyloop.PSyLoop._loop_type, psyclone.domain.lfric.lfric_loop.LFRicLoop._loop_type, psyclone.gocean1p0.GOLoop._loop_type, psyclone.domain.lfric.lfric_loop.LFRicLoop._upper_bound_halo_depth, psyclone.psyir.nodes.node.Node.ancestor(), psyclone.f2pygen.BaseGen.children(), psyclone.psyGen.InlinedKern.children, psyclone.psyir.nodes.node.Node.children(), psyclone.domain.common.psylayer.psyloop.PSyLoop.kernel, psyclone.psyir.nodes.node.Node.kernels(), and psyclone.domain.lfric.lfric_loop.LFRicLoop.upper_bound_name().
def psyclone.domain.lfric.lfric_loop.LFRicLoop.update_halo_exchanges | ( | self | ) |
add and/or remove halo exchanges due to changes in the loops bounds
Definition at line 675 of file lfric_loop.py.
References psyclone.domain.lfric.lfric_loop.LFRicLoop.create_halo_exchanges(), psyclone.gocean1p0.GOLoop.create_halo_exchanges(), and psyclone.psyir.nodes.node.Node.kernels().
def psyclone.domain.lfric.lfric_loop.LFRicLoop.upper_bound_halo_depth | ( | self | ) |
Returns the index of the upper loop bound. This is None if the upper bound name is not in HALO_ACCESS_LOOP_BOUNDS. :returns: the depth of the halo for a loops upper bound. If it \ is None then a depth has not been provided. The depth value is \ only valid when the upper-bound name is associated with a halo \ e.g. 'cell_halo'. :rtype: int
Definition at line 328 of file lfric_loop.py.
References psyclone.domain.lfric.lfric_loop.LFRicLoop._add_field_component_halo_exchange(), psyclone.domain.common.psylayer.psyloop.PSyLoop._field_name, psyclone.domain.lfric.lfric_loop.LFRicLoop._field_name, psyclone.domain.common.psylayer.psyloop.PSyLoop._kern, psyclone.domain.lfric.arg_ordering.ArgOrdering._kern, psyclone.domain.lfric.lfric_loop.LFRicLoop._kern, psyclone.domain.lfric.lfric_loop.LFRicLoop._lower_bound_index, psyclone.domain.lfric.lfric_loop.LFRicLoop._lower_bound_name, psyclone.domain.lfric.lfric_loop.LFRicLoop._upper_bound_halo_depth, psyclone.domain.lfric.lfric_loop.LFRicLoop._upper_bound_name, psyclone.psyir.nodes.node.Node.ancestor(), psyclone.domain.common.psylayer.psyloop.PSyLoop.kernel, psyclone.f2pygen.BaseGen.parent(), psyclone.psyir.nodes.node.Node.parent(), psyclone.f2pygen.Directive.position(), psyclone.psyir.nodes.node.Node.position, and psyclone.psyir.nodes.node.Node.walk().
def psyclone.domain.lfric.lfric_loop.LFRicLoop.upper_bound_name | ( | self | ) |
Returns the name of the upper loop bound
Definition at line 323 of file lfric_loop.py.
References psyclone.domain.lfric.lfric_loop.LFRicLoop._upper_bound_name.