Skip to content

Commit

Permalink
#2451 Renamed to LFRicInvokeSchedule
Browse files Browse the repository at this point in the history
  • Loading branch information
oakleybrunt committed Jan 3, 2024
1 parent aa8c728 commit 9c0591f
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion doc/user_guide/dynamo0p3_topclasses.dot
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ charset="utf-8"
rankdir=BT

"20" [label="{LFRicInvoke|\l|arg_for_funcspace()\lfield_on_space()\lgen_code()\lis_coloured()\lunique_fss()\lunique_proxy_declarations()\l}", shape="record"];
"21" [label="{DynInvokeSchedule|\l|view()\l}", shape="record"];
"21" [label="{LFRicInvokeSchedule|\l|view()\l}", shape="record"];
"35" [label="{DynamoInvokes|\l|}", shape="record"];
"36" [label="{DynamoPSy|\l|}", shape="record"];
"45" [label="{Invoke|\l|first_access()\lgen()\lgen_code()\lunique_declarations()\lunique_declns_by_intent()\l}", shape="record", style=filled, fillcolor="antiquewhite"];
Expand Down
2 changes: 1 addition & 1 deletion doc/user_guide/dynamo0p3_topclasses.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/psyclone/domain/lfric/lfric_builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def create(call, parent=None):
:type call: :py:class:`psyclone.parse.algorithm.BuiltInCall`
:param parent: the schedule instance to which the built-in call \
belongs.
:type parent: :py:class:`psyclone.dynamo0p3.DynInvokeSchedule`
:type parent: :py:class:`psyclone.dynamo0p3.LFRicInvokeSchedule`
:raises ParseError: if the name of the function being called is \
not a recognised built-in.
Expand Down
6 changes: 3 additions & 3 deletions src/psyclone/domain/lfric/lfric_invoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ def __init__(self, alg_invocation, idx, invokes):
return
# Import here to avoid circular dependency
# pylint: disable=import-outside-toplevel
from psyclone.dynamo0p3 import DynInvokeSchedule
self._schedule = DynInvokeSchedule('name', None) # for pyreverse
from psyclone.dynamo0p3 import LFRicInvokeSchedule
self._schedule = LFRicInvokeSchedule('name', None) # for pyreverse
reserved_names_list = []
const = LFRicConstants()
reserved_names_list.extend(const.STENCIL_MAPPING.values())
reserved_names_list.extend(const.VALID_STENCIL_DIRECTIONS)
reserved_names_list.extend(["omp_get_thread_num",
"omp_get_max_threads"])
Invoke.__init__(self, alg_invocation, idx, DynInvokeSchedule,
Invoke.__init__(self, alg_invocation, idx, LFRicInvokeSchedule,
invokes, reserved_names=reserved_names_list)

# The base class works out the algorithm code's unique argument
Expand Down
2 changes: 1 addition & 1 deletion src/psyclone/domain/lfric/lfric_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ def stop_expr(self):
if self.upper_bound_name in const.HALO_ACCESS_LOOP_BOUNDS:
if self._upper_bound_halo_depth:
# TODO: #696 Add kind (precision) once the
# DynInvokeSchedule constructor has been extended to
# LFRicInvokeSchedule constructor has been extended to
# create the necessary symbols.
halo_depth = Literal(str(self._upper_bound_halo_depth),
INTEGER_TYPE)
Expand Down
6 changes: 3 additions & 3 deletions src/psyclone/dynamo0p3.py
Original file line number Diff line number Diff line change
Expand Up @@ -3441,7 +3441,7 @@ class DynBasisFunctions(LFRicCollection):
:param node: either the schedule of an Invoke or a single Kernel object \
for which to extract information on all required \
basis/diff-basis functions.
:type node: :py:class:`psyclone.dynamo0p3.DynInvokeSchedule` or \
:type node: :py:class:`psyclone.dynamo0p3.LFRicInvokeSchedule` or \
:py:class:`psyclone.domain.lfric.LFRicKern`
:raises InternalError: if a call has an unrecognised evaluator shape.
Expand Down Expand Up @@ -4438,7 +4438,7 @@ def initialise(self, parent):
"get_boundary_dofs()"])))


class DynInvokeSchedule(InvokeSchedule):
class LFRicInvokeSchedule(InvokeSchedule):
''' The Dynamo specific InvokeSchedule sub-class. This passes the Dynamo-
specific factories for creating kernel and infrastructure calls
to the base class so it creates the ones we require.
Expand Down Expand Up @@ -7010,7 +7010,7 @@ def data_on_device(self, _):
'DynInterGrid',
'DynBasisFunctions',
'DynBoundaryConditions',
'DynInvokeSchedule',
'LFRicInvokeSchedule',
'DynGlobalSum',
'LFRicHaloExchange',
'LFRicHaloExchangeStart',
Expand Down
4 changes: 2 additions & 2 deletions src/psyclone/psyir/nodes/acc_directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ def signatures(self):
'''

# pylint: disable=import-outside-toplevel
from psyclone.dynamo0p3 import DynInvokeSchedule
from psyclone.dynamo0p3 import LFRicInvokeSchedule
from psyclone.gocean1p0 import GOInvokeSchedule
from psyclone.psyir.tools import DependencyTools

if self.ancestor((DynInvokeSchedule, GOInvokeSchedule)):
if self.ancestor((LFRicInvokeSchedule, GOInvokeSchedule)):
# Look-up the kernels that are children of this node
sig_set = set()
for call in self.kernels():
Expand Down
10 changes: 5 additions & 5 deletions src/psyclone/tests/domain/lfric/dyn_invoke_schedule_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
# -----------------------------------------------------------------------------
# Author: A. R. Porter, STFC Daresbury Lab

''' This module contains pytest tests for the DynInvokeSchedule class. '''
''' This module contains pytest tests for the LFRicInvokeSchedule class. '''

import os
from psyclone.domain.lfric import LFRicSymbolTable
from psyclone.dynamo0p3 import DynInvokeSchedule
from psyclone.dynamo0p3 import LFRicInvokeSchedule
from psyclone.parse.algorithm import parse
from psyclone.psyir.nodes import Container

Expand All @@ -49,15 +49,15 @@


def test_dyninvsched_parent():
''' Check the setting of the parent of a DynInvokeSchedule. '''
''' Check the setting of the parent of a LFRicInvokeSchedule. '''
_, invoke_info = parse(os.path.join(BASE_PATH,
"1.0.1_single_named_invoke.f90"),
api=TEST_API)
kcalls = invoke_info.calls[0].kcalls
# With no parent specified
dsched = DynInvokeSchedule("my_sched", kcalls)
dsched = LFRicInvokeSchedule("my_sched", kcalls)
assert dsched.parent is None
# With a parent
fake_parent = Container("my_mod", symbol_table=LFRicSymbolTable())
dsched2 = DynInvokeSchedule("my_sched", kcalls, parent=fake_parent)
dsched2 = LFRicInvokeSchedule("my_sched", kcalls, parent=fake_parent)
assert dsched2.parent is fake_parent
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def test_colouring_not_a_loop(dist_mem):
with pytest.raises(TransformationError) as excinfo:
ctrans.apply(schedule)
assert ("Target of Dynamo0p3ColourTrans transformation must be a "
"sub-class of Loop but got 'DynInvokeSchedule'" in
"sub-class of Loop but got 'LFRicInvokeSchedule'" in
str(excinfo.value))


Expand Down Expand Up @@ -502,7 +502,7 @@ def test_omp_not_a_loop(dist_mem):
otrans.apply(schedule)

assert ("Target of Dynamo0p3OMPLoopTrans transformation must be a sub-"
"class of Loop but got 'DynInvokeSchedule'" in str(excinfo.value))
"class of Loop but got 'LFRicInvokeSchedule'" in str(excinfo.value))


def test_omp_parallel_not_a_loop(dist_mem):
Expand All @@ -519,7 +519,7 @@ def test_omp_parallel_not_a_loop(dist_mem):
with pytest.raises(TransformationError) as excinfo:
otrans.apply(schedule)
assert ("Error in DynamoOMPParallelLoopTrans transformation. The "
"supplied node must be a LFRicLoop but got 'DynInvokeSchedule'"
"supplied node must be a LFRicLoop but got 'LFRicInvokeSchedule'"
in str(excinfo.value))


Expand Down Expand Up @@ -5310,7 +5310,7 @@ def test_rc_wrong_parent(monkeypatch):
# Apply redundant computation to the loop
with pytest.raises(TransformationError) as excinfo:
rc_trans.apply(schedule.children[4], {"depth": 1})
assert ("the parent of the supplied loop must be the DynInvokeSchedule, "
assert ("the parent of the supplied loop must be the LFRicInvokeSchedule, "
"or a Loop") in str(excinfo.value)


Expand Down Expand Up @@ -5350,7 +5350,7 @@ def test_rc_parent_loop_colour(monkeypatch):
with pytest.raises(TransformationError) as excinfo:
rc_trans.apply(schedule.children[4].loop_body[0], {"depth": 1})
assert ("if the parent of the supplied Loop is also a Loop then the "
"parent's parent must be the DynInvokeSchedule"
"parent's parent must be the LFRicInvokeSchedule"
in str(excinfo.value))

# Make the outermost loop iterate over cells (it should be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def check_schedule(schedule):
write-to-gh_inc dependence.
:param schedule: a dynamo0.3 API schedule object
:type schedule: :py:class:`psyclone.dynamo0p3.DynInvokeSchedule`.
:type schedule: :py:class:`psyclone.dynamo0p3.LFRicInvokeSchedule`.
'''
assert len(schedule.children) == 3
Expand Down Expand Up @@ -250,7 +250,7 @@ def check(schedule, f1depth, f2depth):
field 'f1' is what we are expecting
:param schedule: a dynamo0.3 API schedule object
:type schedule: :py:class:`psyclone.dynamo0p3.DynInvokeSchedule`.
:type schedule: :py:class:`psyclone.dynamo0p3.LFRicInvokeSchedule`.
:param int f1depth: The expected depth of the halo exchange \
associated with field f1
:param int f2depth: The expected depth of the halo exchange \
Expand Down Expand Up @@ -316,7 +316,7 @@ def check(schedule, f1depth, f2depth):
field 'f1' is what we are expecting
:param schedule: a dynamo0.3 API schedule object
:type schedule: :py:class:`psyclone.dynamo0p3.DynInvokeSchedule`.
:type schedule: :py:class:`psyclone.dynamo0p3.LFRicInvokeSchedule`.
:param int f1depth: The expected depth of the halo exchange \
associated with field f1
:param int f2depth: The expected depth of the halo exchange \
Expand Down
10 changes: 5 additions & 5 deletions src/psyclone/tests/psyGen_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
from psyclone.domain.common.psylayer import PSyLoop
from psyclone.domain.lfric import lfric_builtins, LFRicKern, LFRicKernMetadata
from psyclone.domain.lfric.transformations import LFRicLoopFuseTrans
from psyclone.dynamo0p3 import (DynInvokeSchedule, DynGlobalSum,
from psyclone.dynamo0p3 import (LFRicInvokeSchedule, DynGlobalSum,
DynKernelArguments)
from psyclone.errors import FieldNotFoundError, GenerationError, InternalError
from psyclone.generator import generate
Expand Down Expand Up @@ -294,12 +294,12 @@ def test_invokes_can_always_be_printed():
assert inv.__str__() == "invoke()"

invoke_call = InvokeCall([], "TestName")
inv = Invoke(invoke_call, 12, DynInvokeSchedule, None)
inv = Invoke(invoke_call, 12, LFRicInvokeSchedule, None)
# Name is converted to lower case if set in constructor of InvokeCall:
assert inv.__str__() == "invoke_testname()"

invoke_call._name = None
inv = Invoke(invoke_call, 12, DynInvokeSchedule, None)
inv = Invoke(invoke_call, 12, LFRicInvokeSchedule, None)
assert inv.__str__() == "invoke_12()"

# Last test case: one kernel call - to avoid constructing
Expand All @@ -310,7 +310,7 @@ def test_invokes_can_always_be_printed():
api="dynamo0.3")

alg_invocation = invoke.calls[0]
inv = Invoke(alg_invocation, 0, DynInvokeSchedule, None)
inv = Invoke(alg_invocation, 0, LFRicInvokeSchedule, None)
assert inv.__str__() == \
"invoke_0_testkern_type(a, f1_my_field, f1 % my_field, m1, m2)"

Expand All @@ -322,7 +322,7 @@ def test_invoke_container():
api="dynamo0.3")
alg_invocation = invoke.calls[0]
# An isolated Invoke object has no associated Container
inv = Invoke(alg_invocation, 0, DynInvokeSchedule, None)
inv = Invoke(alg_invocation, 0, LFRicInvokeSchedule, None)
assert inv._schedule.parent is None
# Creating an Invokes object requires a PSy object but the construction of
# the latter also creates the former. Therefore, we just create a PSy
Expand Down
18 changes: 9 additions & 9 deletions src/psyclone/transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
from psyclone.domain.lfric import (KernCallArgList, LFRicConstants, LFRicKern,
LFRicLoop)
from psyclone.dynamo0p3 import (LFRicHaloExchangeEnd, LFRicHaloExchangeStart,
DynInvokeSchedule)
LFRicInvokeSchedule)
from psyclone.errors import InternalError
from psyclone.gocean1p0 import GOInvokeSchedule
from psyclone.nemo import NemoInvokeSchedule
Expand Down Expand Up @@ -1702,7 +1702,7 @@ def validate(self, node, options=None):
:py:class:`psyclone.psyir.nodes.Directive`.
:raises TransformationError: if the parent of the loop is not a\
:py:class:`psyclone.psyir.nodes.Loop` or a\
:py:class:`psyclone.psyGen.DynInvokeSchedule`.
:py:class:`psyclone.psyGen.LFRicInvokeSchedule`.
:raises TransformationError: if the parent of the loop is a\
:py:class:`psyclone.psyir.nodes.Loop` but the original loop does\
not iterate over 'colour'.
Expand All @@ -1711,7 +1711,7 @@ def validate(self, node, options=None):
iterate over 'colours'.
:raises TransformationError: if the parent of the loop is a\
:py:class:`psyclone.psyir.nodes.Loop` but the parent's parent is\
not a :py:class:`psyclone.psyGen.DynInvokeSchedule`.
not a :py:class:`psyclone.psyGen.LFRicInvokeSchedule`.
:raises TransformationError: if this transformation is applied\
when distributed memory is not switched on.
:raises TransformationError: if the loop does not iterate over\
Expand Down Expand Up @@ -1756,12 +1756,12 @@ def validate(self, node, options=None):
f"method the supplied loop is sits beneath a directive of "
f"type {type(dir_node)}. Redundant computation must be applied"
f" before directives are added.")
if not (isinstance(node.parent, DynInvokeSchedule) or
if not (isinstance(node.parent, LFRicInvokeSchedule) or
isinstance(node.parent.parent, Loop)):
raise TransformationError(
f"In the Dynamo0p3RedundantComputation transformation "
f"apply method the parent of the supplied loop must be the "
f"DynInvokeSchedule, or a Loop, but found {type(node.parent)}")
f"LFRicInvokeSchedule, or a Loop, but found {type(node.parent)}")
if isinstance(node.parent.parent, Loop):
if node.loop_type != "colour":
raise TransformationError(
Expand All @@ -1775,12 +1775,12 @@ def validate(self, node, options=None):
f"apply method, if the parent of the supplied Loop is "
f"also a Loop then the parent must iterate over "
f"'colours', but found '{node.parent.parent.loop_type}'")
if not isinstance(node.parent.parent.parent, DynInvokeSchedule):
if not isinstance(node.parent.parent.parent, LFRicInvokeSchedule):
raise TransformationError(
f"In the Dynamo0p3RedundantComputation transformation "
f"apply method, if the parent of the supplied Loop is "
f"also a Loop then the parent's parent must be the "
f"DynInvokeSchedule, but found {type(node.parent)}")
f"LFRicInvokeSchedule, but found {type(node.parent)}")
if not Config.get().distributed_memory:
raise TransformationError(
"In the Dynamo0p3RedundantComputation transformation apply "
Expand Down Expand Up @@ -2345,7 +2345,7 @@ def apply(self, sched, options=None):
self.validate(sched, options)

# pylint: disable=import-outside-toplevel
if isinstance(sched, DynInvokeSchedule):
if isinstance(sched, LFRicInvokeSchedule):
from psyclone.dynamo0p3 import DynACCEnterDataDirective as \
AccEnterDataDir
elif isinstance(sched, GOInvokeSchedule):
Expand Down Expand Up @@ -2676,7 +2676,7 @@ def validate(self, nodes, options):
node_list = self.get_node_list(nodes)

# Check that the front-end is valid
sched = node_list[0].ancestor((NemoInvokeSchedule, DynInvokeSchedule))
sched = node_list[0].ancestor((NemoInvokeSchedule, LFRicInvokeSchedule))
if not sched:
raise NotImplementedError(
"OpenACC kernels regions are currently only supported for the "
Expand Down

0 comments on commit 9c0591f

Please sign in to comment.