Skip to content

Commit ca6d36e

Browse files
committed
Remove unused code
1 parent 1263f38 commit ca6d36e

4 files changed

Lines changed: 1 addition & 96 deletions

File tree

‎src/psyclone/domain/lfric/transformations/lfric_alg_invoke_2_psy_call_trans.py‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ def validate(self, node: LFRicAlgorithmInvokeCall,
6565
"A dictionary containing LFRic kernel PSyIR must be passed "
6666
"into the LFRicAlgInvoke2PSyCallTrans transformation but "
6767
"this was not found.")
68-
if not isinstance(kernels, dict):
69-
raise TransformationError(
70-
f"The value of 'kernels' in the options argument must be a "
71-
f"dictionary but found '{type(kernels).__name__}'.")
7268
for kern_call in node.arguments:
7369
if isinstance(kern_call, LFRicBuiltinFunctor):
7470
# Skip builtins as their metadata is stored internally

‎src/psyclone/psyir/transformations/psy_data_trans.py‎

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
import warnings
1313

1414
from psyclone.configuration import Config
15-
from psyclone.errors import InternalError
16-
from psyclone.psyGen import InvokeSchedule, Kern
1715
from psyclone.psyir.nodes import Node, PSyDataNode, Schedule, Return, \
1816
OMPDoDirective, ACCDirective, ACCLoopDirective, Routine
1917
from psyclone.psyir.transformations.region_trans import RegionTrans
@@ -84,62 +82,6 @@ class name as a string, which means that the same function can
8482

8583
return self.__class__.__name__
8684

87-
# ------------------------------------------------------------------------
88-
def get_unique_region_name(self, nodes, options):
89-
'''This function returns the region and module name. If they are
90-
specified in the user options, these names will just be returned (it
91-
is then up to the user to guarantee uniqueness). Otherwise a name
92-
based on the module and invoke will be created using indices to
93-
make sure the name is unique.
94-
95-
:param nodes: a list of nodes.
96-
:type nodes: list of :py:obj:`psyclone.psyir.nodes.Node`
97-
:param options: a dictionary with options for transformations.
98-
:type options: Dict[str, Any]
99-
:param (str,str) options["region_name"]: an optional name to \
100-
use for this PSyData area, provided as a 2-tuple containing a \
101-
location name followed by a local name. The pair of strings \
102-
should uniquely identify a region unless aggregate information \
103-
is required (and is supported by the runtime library).
104-
105-
'''
106-
# We don't use a static method here since it might be useful to
107-
# overwrite this functions in derived classes
108-
name = options.get("region_name", None)
109-
if name:
110-
# pylint: disable=too-many-boolean-expressions
111-
if not isinstance(name, tuple) or not len(name) == 2 or \
112-
not name[0] or not isinstance(name[0], str) or \
113-
not name[1] or not isinstance(name[1], str):
114-
raise InternalError(
115-
"Error in PSyDataTrans. The name must be a "
116-
"tuple containing two non-empty strings.")
117-
# pylint: enable=too-many-boolean-expressions
118-
# Valid PSyData names have been provided by the user.
119-
return name
120-
121-
invoke = nodes[0].ancestor(InvokeSchedule).invoke
122-
module_name = invoke.invokes.psy.name
123-
124-
# Use the invoke name as a starting point.
125-
region_name = invoke.name
126-
kerns = []
127-
for node in nodes:
128-
kerns.extend(node.walk(Kern))
129-
130-
if len(kerns) == 1:
131-
# This PSyData region only has one kernel within it,
132-
# so append the kernel name.
133-
region_name += f"-{kerns[0].name}"
134-
135-
# Add a region index to ensure uniqueness when there are
136-
# multiple regions in an invoke.
137-
key = module_name + "|" + region_name
138-
idx = PSyDataTrans._used_kernel_names.get(key, 0)
139-
PSyDataTrans._used_kernel_names[key] = idx + 1
140-
region_name += f"-r{idx}"
141-
return (module_name, region_name)
142-
14385
# ------------------------------------------------------------------------
14486
def validate(self, nodes: Union[Node, list[Node]],
14587
options: Optional[dict[str, Any]] = None,

‎src/psyclone/tests/domain/lfric/transformations/lfric_alg_invoke_2_psy_call_trans_test.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def test_lfai2psycall_get_arguments():
262262
[Reference(Symbol("arg1")), Reference(Symbol("arg2"))])
263263
call = LFRicAlgorithmInvokeCall.create(
264264
RoutineSymbol("mysub"), [builtin_functor], 0)
265-
args = trans.get_arguments(call, kernels={})
265+
args = trans.get_arguments(call)
266266
assert len(args) == 2
267267
assert isinstance(args[0], Reference)
268268
assert args[0].name == "arg1"

‎src/psyclone/tests/psyir/transformations/psy_data_trans_test.py‎

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import pytest
1111

1212
from psyclone.configuration import Config
13-
from psyclone.errors import InternalError
1413
from psyclone.psyir.nodes import Assignment, Loop, PSyDataNode, Routine
1514
from psyclone.psyir.transformations import (
1615
OMPLoopTrans, PSyDataTrans, ReadOnlyVerifyTrans, TransformationError)
@@ -162,38 +161,6 @@ def test_class_definitions(fortran_writer):
162161
assert "as defined in /" in str(err.value)
163162

164163

165-
# -----------------------------------------------------------------------------
166-
def test_psy_data_get_unique_region_names():
167-
'''Tests the get_unique_region_names function.'''
168-
data_trans = PSyDataTrans()
169-
region_name = data_trans.\
170-
get_unique_region_name([], {"region_name": ("a", "b")})
171-
assert region_name == ("a", "b")
172-
173-
with pytest.raises(InternalError) as err:
174-
region_name = data_trans.\
175-
get_unique_region_name([], {"region_name": 1})
176-
assert "The name must be a tuple containing two non-empty strings." \
177-
in str(err.value)
178-
179-
with pytest.raises(InternalError) as err:
180-
region_name = data_trans.\
181-
get_unique_region_name([], {"region_name": ("a", "")})
182-
assert "The name must be a tuple containing two non-empty strings." \
183-
in str(err.value)
184-
185-
_, invoke = get_invoke("test11_different_iterates_over_one_invoke.f90",
186-
"gocean", idx=0)
187-
region_name = data_trans.get_unique_region_name(invoke.schedule, {})
188-
assert region_name == ('psy_single_invoke_different_iterates_over',
189-
'invoke_0-r0')
190-
191-
region_name = data_trans.\
192-
get_unique_region_name([invoke.schedule[0]], {})
193-
assert region_name == ('psy_single_invoke_different_iterates_over',
194-
'invoke_0-compute_cv_code-r0')
195-
196-
197164
# -----------------------------------------------------------------------------
198165
def test_trans_with_shape_function(monkeypatch, fortran_reader,
199166
fortran_writer):

0 commit comments

Comments
 (0)