Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2091: renaming and moving DynKern to LFRicKern #2100

Merged
merged 68 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 65 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
e62aa0a
#2091: renaming DynKern to LFRicKern in most files
mo-lottieturner Apr 5, 2023
47f541b
#2091: and the rest of the occurrences of DynKern
mo-lottieturner Apr 5, 2023
5d97779
#2091: reverting an unintentional DynKernMetadata -> LFRicKernMetadat…
mo-lottieturner Apr 5, 2023
e86c3b3
#2091: missed some dynkern instances
mo-lottieturner Apr 5, 2023
c9c0ff3
#2091: missed some dynkern_op
mo-lottieturner Apr 5, 2023
0446ec3
#2091: moving LFRicKern out of dynamo0p3
mo-lottieturner Apr 6, 2023
7162522
#2091: changing some import locations
mo-lottieturner Apr 6, 2023
58b1415
#2091: changing more import locations
mo-lottieturner Apr 6, 2023
5535fcf
#2091: hopefully the rest of the import locations
mo-lottieturner Apr 6, 2023
b66f271
#2091: correcting error in imports
mo-lottieturner Apr 11, 2023
488ab59
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner Apr 13, 2023
7ee6fc7
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner Apr 18, 2023
ad9feda
#2091: correcting path to LFRicKern in new file
mo-lottieturner Apr 18, 2023
f7858fb
#2091: hopefully fixing import error
mo-lottieturner Apr 18, 2023
aff6c35
#2091: hopefully fixing circular dependency issue
mo-lottieturner Apr 18, 2023
47c0c23
#2091: tidying up
mo-lottieturner Apr 20, 2023
ce20e1e
#2091 tidying up a bit that I accidentally untidied
mo-lottieturner Apr 20, 2023
2091921
#2091 changing names in the docs
mo-lottieturner Apr 20, 2023
225ff40
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner Apr 25, 2023
2ee1f9a
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner May 22, 2023
bf0e3d5
#2091 renaming dynkern_test to lfrickern_test and correcting some err…
mo-lottieturner May 22, 2023
e36e28c
2091 adding test for LFRicKern.local_vars
mo-lottieturner May 22, 2023
807f3c6
2091 adding test for kernel argument with INC access when OpenMP
mo-lottieturner May 22, 2023
9db26c5
2091 working on last bit of test coverage, not working yet
mo-lottieturner May 23, 2023
66e51f9
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner Jun 2, 2023
dbae330
#2091 commenting out failed attempt at test to get python tests passing
mo-lottieturner Jun 5, 2023
04ad8d0
#2091: more changes from LFRicCollection that didnt get picked up in …
mo-lottieturner Jun 5, 2023
b8445f4
#2091: wrong brackets!
mo-lottieturner Jun 5, 2023
951594b
PR #2091: Added coverage for 'continue' statement
TeranIvy Jul 24, 2023
7b37ac1
#2091 moving and renaming test file
mo-lottieturner Jul 25, 2023
f4c1982
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner Jul 25, 2023
85db552
#2091 merging in master and resolving conflicts
mo-lottieturner Jul 25, 2023
06297f7
#2091 correcting BASE_PATH in moved test file
mo-lottieturner Jul 26, 2023
d236f67
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner Aug 1, 2023
cf500e5
#2091 re-adding some tests that somehow got removed
mo-lottieturner Aug 2, 2023
c0ca2f5
Merge branch '2091_renaming_and_moving_dynkern' of github.com:stfc/PS…
mo-lottieturner Aug 2, 2023
c42e103
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner Aug 2, 2023
96c66d2
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner Aug 14, 2023
764d303
Merge branch 'master' into 2091_renaming_and_moving_dynkern
arporter Aug 14, 2023
06d3cc3
#2091 catching some DynKern -> LFRicKern comments
mo-lottieturner Aug 15, 2023
f18a1f7
Merge branch '2091_renaming_and_moving_dynkern' of github.com:stfc/PS…
mo-lottieturner Aug 15, 2023
7c08888
#2091 corrections from review
mo-lottieturner Aug 15, 2023
a05eeab
#2091 rest of changes from review
mo-lottieturner Aug 15, 2023
4a5afc0
#2091 removing local_vars from LFRicKern
mo-lottieturner Aug 16, 2023
d50e722
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner Aug 16, 2023
e6ba478
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner Sep 19, 2023
ecd83a6
#2091 correcting docstring for fs_descriptors
mo-lottieturner Sep 19, 2023
0bebfd5
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner Sep 21, 2023
430e0a2
#2091 moving DynKern in __init__.py
mo-lottieturner Sep 25, 2023
2a91d86
Merge branch '2091_renaming_and_moving_dynkern' of github.com:stfc/PS…
mo-lottieturner Sep 25, 2023
e6175f9
#2091 replacing accidentally removed LFRicKern import from merge and …
mo-lottieturner Sep 25, 2023
f803bdd
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner Sep 25, 2023
10301eb
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner Sep 26, 2023
5cff290
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner Oct 30, 2023
7853810
#2091 correcting wonky merging
mo-lottieturner Oct 30, 2023
882d890
#2091 more wonky merging
mo-lottieturner Oct 30, 2023
f82f1ad
#2091 hopefully the last of the wonky merging
mo-lottieturner Oct 30, 2023
29a6333
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner Oct 30, 2023
ba8b6dd
#2091 even more wonky merging
mo-lottieturner Oct 30, 2023
cb68c6c
Merge branch '2091_renaming_and_moving_dynkern' of github.com:stfc/PS…
mo-lottieturner Oct 30, 2023
0babc06
#2091: still some more wonky merging
mo-lottieturner Oct 30, 2023
e59a8f1
#2091 still on the wonky merging
mo-lottieturner Oct 31, 2023
990cf82
#2091 some tidying up and more wonky merge corrections
mo-lottieturner Oct 31, 2023
dba6859
#2091: hopefully fixing merge bug
mo-lottieturner Nov 8, 2023
f210802
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner Nov 8, 2023
f3fcdd7
#2091: final touches on review comments
mo-lottieturner Nov 8, 2023
3492a1d
Merge branch 'master' into 2091_renaming_and_moving_dynkern
mo-lottieturner Nov 9, 2023
eac784a
#2100 update changelog and UG
arporter Nov 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions doc/developer_guide/APIs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ requires a check that any loop which includes a kernel that reads from
an operator is limited to iterating in the halo up to
depth-1. PSyclone will raise an exception if an optimisation attempts
to increase the iteration space beyond this (see the ``gen_code()``
method in the ``DynKern`` class).
method in the ``LFRicKern`` class).

To alleviate the above restriction one could add a configurable depth with
which to compute operators e.g. operators are always computed up to
Expand Down Expand Up @@ -883,8 +883,8 @@ target spaces.
When constructing a ``DynKernMetadata`` object from the parsed kernel
metadata, the list of target function-space names (as they appear in
the meta-data) is stored in ``DynKernMetadata._eval_targets``. This
information is then used in the ``DynKern._setup()`` method which
populates ``DynKern._eval_targets``. This is an ``OrderedDict`` which has
information is then used in the ``LFRicKern._setup()`` method which
populates ``LFRicKern._eval_targets``. This is an ``OrderedDict`` which has
the (mangled) names of the target function spaces as keys and 2-tuples
consisting of ``FunctionSpace`` and ``DynKernelArgument`` objects as
values. The ``DynKernelArgument`` object provides the kernel argument
Expand All @@ -894,7 +894,7 @@ holds full information on the target function space.
The ``DynInvokeBasisFunctions`` class is responsible for managing the
evaluators required by all of the kernels called from an Invoke.
``DynInvokeBasisFunctions._eval_targets`` collects all of the unique target
function spaces from the ``DynKern._eval_targets`` of each kernel.
function spaces from the ``LFRicKern._eval_targets`` of each kernel.

``DynInvokeBasisFunctions._basis_fns`` is a list holding information on
each basis/differential basis function required by a kernel within the
Expand Down
2 changes: 1 addition & 1 deletion doc/developer_guide/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,6 @@ This class is then sub-classed in order to support the generation of
argument lists when *calling* kernels (``KernCallArgList``) and when
*creating* kernel stubs (``KernStubArgList``). ``KernCallArgList`` is
only used in ``DynKernelArguments.raw_arg_list()``.
``KernStubArgList`` is only used in ``DynKern.gen_stub()``. These
``KernStubArgList`` is only used in ``LFRicKern.gen_stub()``. These
classes make use of ``LFRicCollection`` sub-classes in order
to ensure that argument naming is consistent.
2 changes: 1 addition & 1 deletion doc/developer_guide/psyir.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ correspond to and how the arguments relate to each other (they just
output strings).

The logic and declaration of kernel variables is handled separately by
the ``gen_stub`` method in ``DynKern`` and the ``gen_code`` method in
the ``gen_stub`` method in ``LFRicKern`` and the ``gen_code`` method in
``LFRicInvoke``. In both cases these methods make use of the subclasses
of ``LFRicCollection`` to declare variables.

Expand Down
5 changes: 4 additions & 1 deletion src/psyclone/domain/lfric/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
from psyclone.domain.lfric.kern_call_acc_arg_list import KernCallAccArgList
from psyclone.domain.lfric.kern_call_invoke_arg_list import \
KernCallInvokeArgList
from psyclone.domain.lfric.lfric_kern_call_factory import LFRicKernCallFactory
from psyclone.domain.lfric.kernel_interface import KernelInterface
from psyclone.domain.lfric.lfric_extract_driver_creator import \
LFRicExtractDriverCreator
Expand All @@ -62,6 +61,8 @@
MetadataToArgumentsRules
from psyclone.domain.lfric.arg_index_to_metadata_index import \
ArgIndexToMetadataIndex
from psyclone.domain.lfric.lfric_kern import LFRicKern
from psyclone.domain.lfric.lfric_kern_call_factory import LFRicKernCallFactory
from psyclone.domain.lfric.lfric_collection import LFRicCollection
arporter marked this conversation as resolved.
Show resolved Hide resolved
from psyclone.domain.lfric.lfric_run_time_checks import LFRicRunTimeChecks
from psyclone.domain.lfric.lfric_invokes import LFRicInvokes
Expand All @@ -82,6 +83,8 @@
'LFRicExtractDriverCreator',
'LFRicInvoke',
'LFRicInvokes',
'LFRicKern',
'LFRicKernCallFactory',
'LFRicLoopBounds',
'LFRicRunTimeChecks',
'LFRicScalarArgs',
Expand Down
17 changes: 9 additions & 8 deletions src/psyclone/domain/lfric/algorithm/lfric_alg.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
# -----------------------------------------------------------------------------
# Author: A. R. Porter, STFC Daresbury Laboratory.
# Modified by: R. W. Ford, STFC Daresbury Laboratory.
# L. Turner, Met Office

'''This module contains the LFRicAlg class which encapsulates tools for
creating standalone LFRic algorithm-layer code.
Expand All @@ -43,7 +44,7 @@
LFRicSymbolTable, LFRicTypes)
from psyclone.domain.lfric.algorithm.psyir import (
LFRicAlgorithmInvokeCall, LFRicBuiltinFunctorFactory, LFRicKernelFunctor)
from psyclone.dynamo0p3 import DynKern
from psyclone.domain.lfric import LFRicKern
from psyclone.errors import InternalError
from psyclone.parse.kernel import get_kernel_parse_tree, KernelTypeFactory
from psyclone.parse.utils import ParseError
Expand Down Expand Up @@ -406,15 +407,15 @@ def initialise_quadrature(prog, qr_sym, shape):
def kernel_from_metadata(parse_tree, kernel_name):
'''
Given an fparser1 parse tree for an LFRic kernel, creates and returns
a DynKern object.
a LFRicKern object.

:param parse_tree: the fparser1 parse tree for the LFRic kernel.
:type parse_tree: :py:class:`fparser.one.block_statements.BeginSource`
:param str kernel_name: the name of the kernel contained in the \
supplied parse tree for which a DynKern is to be created.
supplied parse tree for which a LFRicKern is to be created.

:returns: a DynKern object describing the LFRic kernel.
:rtype: :py:class:`psyclone.dynamo0p3.DynKern`
:returns: a LFRicKern object describing the LFRic kernel.
:rtype: :py:class:`psyclone.domain.lfric.LFRicKern`

:raises ValueError: if an LFRic kernel with the specified name cannot \
be found in the supplied parse tree.
Expand All @@ -427,8 +428,8 @@ def kernel_from_metadata(parse_tree, kernel_name):
f"Failed to find kernel '{kernel_name}' in supplied "
f"code: '{parse_tree}'. Is it a valid LFRic kernel? Original "
f"error was '{err}'.") from err
# Construct a DynKern using the metadata.
kern = DynKern()
# Construct a LFRicKern using the metadata.
kern = LFRicKern()
kern.load_meta(ktype)
return kern

Expand All @@ -440,7 +441,7 @@ def construct_kernel_args(self, prog, kern):
:param prog: the routine to which to add the declarations etc.
:type prog: :py:class:`psyclone.psyir.nodes.Routine`
:param kern: the kernel for which we are to create arguments.
:type kern: :py:class:`psyclone.dynamo0p3.DynKern`
:type kern: :py:class:`psyclone.domain.lfric.LFRicKern`

:returns: object capturing all of the kernel arguments.
:rtype: :py:class:`psyclone.domain.lfric.KernCallInvokeArgList`
Expand Down
4 changes: 2 additions & 2 deletions src/psyclone/domain/lfric/arg_ordering.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# POSSIBILITY OF SUCH DAMAGE.
# -----------------------------------------------------------------------------
# Authors R. W. Ford, A. R. Porter and S. Siso, STFC Daresbury Lab
# Modified I. Kavcic and A. Coughtrie, Met Office
# Modified I. Kavcic, A. Coughtrie and L. Turner, Met Office
# Modified J. Henrichs, Bureau of Meteorology

'''This module implements the base class for managing arguments to
Expand Down Expand Up @@ -65,7 +65,7 @@ class ArgOrdering:
a list.

:param kern: the kernel call object to use.
:type kern: :py:class:`psyclone.dynamo0p3.DynKern`
:type kern: :py:class:`psyclone.domain.lfric.LFRicKern`

'''
def __init__(self, kern):
Expand Down
4 changes: 2 additions & 2 deletions src/psyclone/domain/lfric/kern_call_arg_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# POSSIBILITY OF SUCH DAMAGE.
# -----------------------------------------------------------------------------
# Authors R. W. Ford, A. R. Porter and S. Siso, STFC Daresbury Lab
# Modified I. Kavcic and A. Coughtrie, Met Office
# Modified I. Kavcic, A. Coughtrie and L. Turner, Met Office
# Modified J. Henrichs, Bureau of Meteorology

'''This module implements a class that manages the argument for a kernel
Expand Down Expand Up @@ -70,7 +70,7 @@ class KernCallArgList(ArgOrdering):
captured by the base class.

:param kern: The kernel that is being called.
:type kern: :py:class:`psyclone.dynamo0p3.DynKern`
:type kern: :py:class:`psyclone.domain.lfric.LFRicKern`

'''
NdfInfo = namedtuple("NdfInfo", ["position", "function_space"])
Expand Down
4 changes: 2 additions & 2 deletions src/psyclone/domain/lfric/kern_call_invoke_arg_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# POSSIBILITY OF SUCH DAMAGE.
# -----------------------------------------------------------------------------
# Authors R. W. Ford, A. R. Porter and S. Siso, STFC Daresbury Lab
# Modified I. Kavcic and A. Coughtrie, Met Office
# Modified I. Kavcic, A. Coughtrie and L. Turner, Met Office
# Modified J. Henrichs, Bureau of Meteorology

'''
Expand All @@ -53,7 +53,7 @@ class KernCallInvokeArgList(ArgOrdering):
kernel, according to that kernel's metadata.

:param kern: the kernel object for which to determine arguments.
:type kern: :py:class:`psyclone.dynamo0p3.DynKern`
:type kern: :py:class:`psyclone.domain.lfric.LFRicKern`
:param symbol_table: the symbol table associated with the routine that \
contains the `invoke` of this kernel.
:type symbol_table: :py:class:`psyclone.psyir.symbols.SymbolTable`
Expand Down
4 changes: 2 additions & 2 deletions src/psyclone/domain/lfric/kern_stub_arg_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# POSSIBILITY OF SUCH DAMAGE.
# -----------------------------------------------------------------------------
# Authors R. W. Ford, A. R. Porter and S. Siso, STFC Daresbury Lab
# Modified I. Kavcic and A. Coughtrie, Met Office
# Modified I. Kavcic, A. Coughtrie and L. Turner, Met Office
# Modified J. Henrichs, Bureau of Meteorology

'''This module implements a class that creates the argument list
Expand All @@ -51,7 +51,7 @@ class KernStubArgList(ArgOrdering):
of the arguments is captured by the base class.

:param kern: Kernel for which to create argument list.
:type kern: :py:class:`psyclone.dynamo0p3.DynKern`
:type kern: :py:class:`psyclone.domain.lfric.LFRicKern`

:raises NotImplementedError: if the kernel is inter-grid.
:raises NotImplementedError: if the kernel requires properties of the \
Expand Down
4 changes: 2 additions & 2 deletions src/psyclone/domain/lfric/kernel_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# POSSIBILITY OF SUCH DAMAGE.
# -----------------------------------------------------------------------------
# Author R. W. Ford, STFC Daresbury Lab
# Modified: I. Kavcic, Met Office
# Modified: I. Kavcic and L. Turner, Met Office
# A. R. Porter and N. Nobre, STFC Daresbury Lab
# Modified: J. Henrichs, Bureau of Meteorology

Expand Down Expand Up @@ -71,7 +71,7 @@ class KernelInterface(ArgOrdering):
code when all of its methods are implemented.

:param kern: the kernel for which to create arguments.
:type kern: :py:class:`psyclone.dynamo0p3.DynKern`
:type kern: :py:class:`psyclone.domain.lfric.LFRicKern`

'''
#: Mapping from a generic PSyIR datatype to the equivalent
Expand Down
16 changes: 7 additions & 9 deletions src/psyclone/domain/lfric/lfric_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@

# Imports
import abc
from psyclone.domain.lfric import LFRicSymbolTable, LFRicInvoke
from psyclone.domain.lfric import (LFRicSymbolTable, LFRicInvoke,
LFRicKern)
from psyclone.errors import InternalError


Expand All @@ -54,24 +55,21 @@ class LFRicCollection():
:param node: the Kernel or Invoke for which to manage variable \
declarations and initialisation.
:type node: :py:class:`psyclone.domain.lfric.LFRicInvoke` or \
:py:class:`psyclone.dynamo0p3.DynKern`
:py:class:`psyclone.domain.lfric.LFRicKern`

:raises InternalError: if the supplied node is not an LFRicInvoke or a \
DynKern.
:raises InternalError: if the supplied node is not an LFRicInvoke or an \
LFRicKern.

'''
def __init__(self, node):
# Import here to avoid circular dependency
# pylint: disable=import-outside-toplevel
arporter marked this conversation as resolved.
Show resolved Hide resolved
from psyclone.dynamo0p3 import DynKern
if isinstance(node, LFRicInvoke):
# We are handling declarations/initialisations for an Invoke
self._invoke = node
self._kernel = None
self._symbol_table = self._invoke.schedule.symbol_table
# The list of Kernel calls we are responsible for
self._calls = node.schedule.kernels()
elif isinstance(node, DynKern):
elif isinstance(node, LFRicKern):
# We are handling declarations for a Kernel stub
self._invoke = None
self._kernel = node
Expand All @@ -82,7 +80,7 @@ def __init__(self, node):
self._calls = [node]
else:
raise InternalError(f"LFRicCollection takes only an LFRicInvoke "
f"or a DynKern but got: {type(node)}")
f"or an LFRicKern but got: {type(node)}")

# Whether or not the associated Invoke contains only Kernels that
# operate on DoFs.
Expand Down
Loading
Loading