Skip to content
2 changes: 1 addition & 1 deletion doc/user_guide/lfric.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4160,7 +4160,7 @@ transformations have not yet been migrated to this directory.
:members:
:noindex:

.. autoclass:: psyclone.transformations.LFRicRedundantComputationTrans
.. autoclass:: psyclone.domain.lfric.transformations.LFRicRedundantComputationTrans
:members:
:noindex:

Expand Down
14 changes: 7 additions & 7 deletions examples/lfric/eg11/async_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@

'''

from psyclone.domain.lfric.transformations import (
LFRicRedundantComputationTrans)
from psyclone.psyir.nodes import FileContainer
from psyclone.psyir.transformations import MoveTrans
from psyclone.transformations import LFRicAsyncHaloExchangeTrans

def trans(psyir):

def trans(psyir: FileContainer) -> None:
'''A sample transformation script to demonstrate the use of asynchronous
halo exchanges with overlapping compute and communication for the
most costly halo exchanges in the (current version of the) LFRic model.

:param psyir: the PSyIR of the PSy-layer.
:type psyir: :py:class:`psyclone.psyir.nodes.FileContainer`

'''
from psyclone.transformations import \
LFRicRedundantComputationTrans, \
LFRicAsyncHaloExchangeTrans
from psyclone.psyir.transformations import MoveTrans

# Get first subroutine of the first module
schedule = psyir.children[0].children[0]
print(schedule.view())
Expand Down
10 changes: 6 additions & 4 deletions examples/lfric/eg8/redundant_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,20 @@
repository but an operator has been replaced with a field in one of
the kernels to allow redundant computation'''

from psyclone.domain.lfric.transformations import (
LFRicRedundantComputationTrans)
from psyclone.psyir.nodes import FileContainer
from psyclone.psyir.transformations import MoveTrans

def trans(psyir):

def trans(psyir: FileContainer) -> None:
'''Removes the grad_p halo exchanges by redundant computation then
moves the remaining halo exchanges to the beginning of the invoke
call.

:param psyir: the PSyIR of the PSy-layer.
:type psyir: :py:class:`psyclone.psyir.nodes.FileContainer`

'''
from psyclone.transformations import LFRicRedundantComputationTrans
from psyclone.psyir.transformations import MoveTrans
rc_trans = LFRicRedundantComputationTrans()
m_trans = MoveTrans()

Expand Down
8 changes: 4 additions & 4 deletions examples/lfric/scripts/everything_everywhere_all_at_once.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@
'''
from psyclone.domain.common.transformations import KernelModuleInlineTrans
from psyclone.domain.lfric import LFRicConstants
from psyclone.domain.lfric.transformations import (
LFRicRedundantComputationTrans)
from psyclone.lfric import LFRicHaloExchange, LFRicHaloExchangeStart
from psyclone.psyir.transformations import Matmul2CodeTrans, OMPParallelTrans
from psyclone.psyir.nodes import IntrinsicCall, KernelSchedule
from psyclone.psyGen import InvokeSchedule
from psyclone.transformations import LFRicColourTrans, \
LFRicOMPLoopTrans, \
LFRicRedundantComputationTrans, \
LFRicAsyncHaloExchangeTrans
from psyclone.transformations import (
LFRicColourTrans, LFRicOMPLoopTrans, LFRicAsyncHaloExchangeTrans)
from psyclone.psyir.transformations import MoveTrans, TransformationError

ENABLE_REDUNDANT_COMPUTATION = True
Expand Down
7 changes: 3 additions & 4 deletions examples/lfric/scripts/extract_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
# Author: J. Henrichs, Bureau of Meteorology

'''
PSyclone transformation script for the LFRic (Dynamo0p3) API to apply
PSyclone transformation script for the LFRic API to apply
redundant computation and then extract all kernels.

'''

from psyclone.domain.lfric import LFRicLoop
from psyclone.domain.lfric.transformations import LFRicExtractTrans

from psyclone.transformations import LFRicRedundantComputationTrans
from psyclone.domain.lfric.transformations import (
LFRicExtractTrans, LFRicRedundantComputationTrans)

SETVAL_BUILTINS = ["setval_c"]

Expand Down
3 changes: 2 additions & 1 deletion examples/lfric/scripts/gpu_offloading.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@
from psyclone.domain.common.transformations import KernelModuleInlineTrans
from psyclone.domain.lfric import LFRicConstants
from psyclone.domain.lfric.lfric_builtins import LFRicBuiltIn
from psyclone.domain.lfric.transformations import (
LFRicRedundantComputationTrans)
from psyclone.psyir.nodes import (
Call, Directive, IntrinsicCall, Loop, Routine, Schedule)
from psyclone.psyir.transformations import (
ACCKernelsTrans, Matmul2CodeTrans, OMPTargetTrans, TransformationError,
OMPDeclareTargetTrans, OMPParallelTrans)
from psyclone.transformations import (
LFRicColourTrans, LFRicOMPLoopTrans,
LFRicRedundantComputationTrans,
ACCParallelTrans, ACCLoopTrans, ACCRoutineTrans,
OMPLoopTrans)

Expand Down
3 changes: 2 additions & 1 deletion examples/lfric/scripts/redundant_dofs.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
iterate over dofs and do not contain a reduction.

'''
from psyclone.transformations import LFRicRedundantComputationTrans
from psyclone.domain.lfric.transformations import (
LFRicRedundantComputationTrans)

ITERATION_SPACES = ["dofs"]
DEPTH = 1
Expand Down
3 changes: 2 additions & 1 deletion examples/lfric/scripts/redundant_setval_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
of loops that iterate over dofs and contain the setval_c builtin.

'''
from psyclone.transformations import LFRicRedundantComputationTrans
from psyclone.domain.lfric.transformations import (
LFRicRedundantComputationTrans)

# We don't include "owned_dofs" here as we only want loops that
# are permitted to perform redundant computation.
Expand Down
2 changes: 2 additions & 0 deletions src/psyclone/domain/lfric/transformations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@
import RaisePSyIR2LFRicAlgTrans
from psyclone.domain.lfric.transformations.lfric_loop_fuse_trans \
import LFRicLoopFuseTrans
from psyclone.domain.lfric.transformations.lfric_redundant_computation_trans \
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use parentheses here instead of \. You don't need to change the whole file unless you want.

import LFRicRedundantComputationTrans
from psyclone.domain.lfric.transformations.raise_psyir_2_lfric_kern_trans \
import RaisePSyIR2LFRicKernTrans
Loading
Loading