diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index d90b08417c..b1f75d3d6a 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -130,5 +130,5 @@ jobs: module load nvidia-hpcsdk/${NVFORTRAN_VERSION} module load hdf5/${HDF5_VERSION} netcdf_c/${NETCDF_C_VERSION} netcdf_fortran/${NETCDF_FORTRAN_VERSION} F90=nvfortran F90FLAGS="-acc -Minfo=all" make -C tutorial/practicals/LFRic compile - F90=nvfortran F90FLAGS="-acc -Minfo=all -Mnofma -O2" make -C tutorial/practicals/nemo run - make -C tutorial/practicals/nemo/4_nemo_openacc acc_test + F90=nvfortran F90FLAGS="-acc -Minfo=all -Mnofma -O2" make -C tutorial/practicals/generic run + make -C tutorial/practicals/generic/4_openacc acc_test diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 2979d39d1f..6ebc56ae5a 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -76,7 +76,7 @@ jobs: # Now we can check for warnings and broken links - run: cd doc/user_guide; make html SPHINXOPTS="-W --keep-going" - run: cd doc/developer_guide; make html SPHINXOPTS="-W --keep-going" - # TODO #1280: - run: cd doc/reference_guide; make html SPHINXOPTS="-W --keep-going" + - run: cd doc/reference_guide; make html SPHINXOPTS="-W --keep-going" - run: cd doc/psyad/user_guide; make html SPHINXOPTS="-W --keep-going" - run: cd doc/user_guide; make linkcheck - run: cd doc/developer_guide; make linkcheck diff --git a/changelog b/changelog index afd9d35c2a..b806b6b7c8 100644 --- a/changelog +++ b/changelog @@ -279,6 +279,8 @@ 106) PR #2770 towards #2543. Improve UG introduction. + 107) PR #2776 for #1280. Fixes ref_guide warnings. + release 2.5.0 14th of February 2024 1) PR #2199 for #2189. Fix bugs with missing maps in enter data diff --git a/doc/reference_guide/source/conf.py b/doc/reference_guide/source/conf.py index 2f1e8cf8db..6d6a424c08 100644 --- a/doc/reference_guide/source/conf.py +++ b/doc/reference_guide/source/conf.py @@ -16,8 +16,9 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -import subprocess +import enum import os +import subprocess # import sys # sys.path.insert(0, os.path.abspath('.')) @@ -204,9 +205,36 @@ epub_exclude_files = ['search.html'] -# -- Extension configuration ------------------------------------------------- +# -- Autodoc configuration --------------------------------------------------- + + +def remove_op_enum_attrib_docstring(app, what, name, obj, skip, options): + ''' + A handler that ensures any EnumType objects named 'Operator' are *not* + documented. This is required to avoid warnings of the form: + + psyclone/psyir/nodes/operation.py:docstring of + psyclone.psyir.nodes.operation.Operator:1: WARNING: duplicate object + description of psyclone.psyir.nodes.operation.Operator, other instance + in autogenerated/psyclone.psyir.nodes, use :no-index: for one of them + + ''' + # EnumMeta is used for compatibility with Python < 3.11. + if name.endswith("Operator") and isinstance(obj, enum.EnumMeta): + return True + return skip + + +def setup(app): + ''' + Add in our custom handler to avoid documentation warnings for the various + Operator members of psyir.nodes.*Operation. + + ''' + app.connect('autodoc-skip-member', remove_op_enum_attrib_docstring) + -# Generate the Doxygen documentation +# -- Generate the Doxygen documentation -------------------------------------- subprocess.call('cd ..; doxygen doxygen.config', shell=True) # If we want to completely replace the Sphinx-generated documentation # with that constructed by Doxygen then we uncomment the line below. diff --git a/examples/nemo/eg5/Makefile b/examples/nemo/eg5/Makefile index 29029b34aa..d0d252a52f 100644 --- a/examples/nemo/eg5/Makefile +++ b/examples/nemo/eg5/Makefile @@ -62,13 +62,13 @@ GENERATED_FILES += psy.f90 psy.o traadv-$(TYPE).exe output.dat # Pick up the right extraction library: PSYROOT=../../.. ifeq ($(TYPE), netcdf) - EXTRACT_DIR ?= $(PSYROOT)/lib/extract/netcdf/nemo + EXTRACT_DIR ?= $(PSYROOT)/lib/extract/netcdf/generic READ_DIR ?= $(PSYROOT)/lib/extract/netcdf F90FLAGS += $$(nf-config --fflags) LDFLAGS += $$(nf-config --flibs) $$(nc-config --libs) GENERATED_FILES += tra_adv-r?.nc else - EXTRACT_DIR ?= $(PSYROOT)/lib/extract/standalone/nemo + EXTRACT_DIR ?= $(PSYROOT)/lib/extract/standalone/generic READ_DIR ?= $(PSYROOT)/lib/extract/standalone GENERATED_FILES += tra_adv-r?.binary endif diff --git a/examples/nemo/eg5/README.md b/examples/nemo/eg5/README.md index 35d0157f80..fe9fe4d0e3 100644 --- a/examples/nemo/eg5/README.md +++ b/examples/nemo/eg5/README.md @@ -20,7 +20,7 @@ by supplying the `-l all` flag to PSyclone (as is done in the Makefile). The stand-alone extraction library in -``../../../lib/extract/standalone/nemo`` is used as default, and +``../../../lib/extract/standalone/generic`` is used as default, and will also be automatically compiled. You can also use the NetCDF based extraction library by setting the environment variable `TYPE` to `netcdf` when calling `make`, e.g.: @@ -29,7 +29,7 @@ when calling `make`, e.g.: This requires NetCDF to be available (including ``nf-config`` to detect installation-specific paths). The NetCDF-based extraction library in -``../../../../lib/extract/netcdf/nemo`` +``../../../../lib/extract/netcdf/generic`` will also be automatically compiled. The binary instrumented for extraction will either be called diff --git a/src/psyclone/domain/lfric/algorithm/psyir/__init__.py b/src/psyclone/domain/lfric/algorithm/psyir/__init__.py index 6b07b52734..e3c87e677e 100644 --- a/src/psyclone/domain/lfric/algorithm/psyir/__init__.py +++ b/src/psyclone/domain/lfric/algorithm/psyir/__init__.py @@ -46,11 +46,3 @@ LFRicKernelFunctor) from psyclone.domain.lfric.algorithm.psyir.lfric_kernel_functor import ( LFRicBuiltinFunctorFactory) - - -# For Sphinx AutoAPI -__all__ = [ - 'LFRicAlgorithmInvokeCall', - 'LFRicKernelFunctor', - 'LFRicBuiltinFunctor', - 'LFRicBuiltinFunctorFactory'] diff --git a/src/psyclone/domain/lfric/kern_call_arg_list.py b/src/psyclone/domain/lfric/kern_call_arg_list.py index 2f557d4ace..26c8729bc1 100644 --- a/src/psyclone/domain/lfric/kern_call_arg_list.py +++ b/src/psyclone/domain/lfric/kern_call_arg_list.py @@ -42,7 +42,7 @@ should be removed as we migrate to use PSyIR in LFRic. ''' -from collections import namedtuple +from dataclasses import dataclass from psyclone import psyGen from psyclone.core import AccessType, Signature @@ -75,7 +75,16 @@ class KernCallArgList(ArgOrdering): :type kern: :py:class:`psyclone.domain.lfric.LFRicKern` ''' - NdfInfo = namedtuple("NdfInfo", ["position", "function_space"]) + @dataclass(frozen=True) + class NdfInfo: + ''' + Holds information relating to the number-of-dofs kernel argument. + + :param position: the position of this argument in the argument list. + :param function_space: the function space that this argument is for. + ''' + position: int = None + function_space: str = None def __init__(self, kern): super().__init__(kern) diff --git a/src/psyclone/domain/lfric/lfric_kern.py b/src/psyclone/domain/lfric/lfric_kern.py index 82db36ad9a..e782a76263 100644 --- a/src/psyclone/domain/lfric/lfric_kern.py +++ b/src/psyclone/domain/lfric/lfric_kern.py @@ -39,8 +39,9 @@ ''' This module implements the PSyclone LFRic API by specialising the required base class Kern in psyGen.py ''' -# Imports -from collections import OrderedDict, namedtuple +from collections import OrderedDict +from dataclasses import dataclass +from typing import List from psyclone.configuration import Config from psyclone.core import AccessType @@ -69,16 +70,22 @@ class LFRicKern(CodedKern): ''' # pylint: disable=too-many-instance-attributes - # An instance of this `namedtuple` is used to store information on each of - # the quadrature rules required by a kernel. - # - # alg_name: The actual argument text specifying the QR object in the - # Alg. layer. - # psy_name: The PSy-layer variable name for the QR object. - # kernel_args: List of kernel arguments associated with this QR rule. - QRRule = namedtuple("QRRule", - ["alg_name", "psy_name", "kernel_args"]) + @dataclass(frozen=True) + class QRRule: + ''' + Used to store information on a quadrature rule required by + a kernel. + + :param alg_name: The actual argument text specifying the QR object in + the Alg. layer. + :param psy_name: The PSy-layer variable name for the QR object. + :param kernel_args: Kernel arguments associated with this QR rule. + + ''' + alg_name: str + psy_name: str + kernel_args: List[str] def __init__(self): # The super-init is called from the _setup() method which in turn @@ -635,8 +642,8 @@ def gen_stub(self): :rtype: :py:class:`fparser.one.block_statements.Module` :raises GenerationError: if the supplied kernel stub does not operate - on a supported subset of the domain (currently only - "*cell_column"). + on a supported subset of the domain (currently only those that + end with "cell_column"). ''' # The operates-on/iterates-over values supported by the stub generator. diff --git a/src/psyclone/psyad/adjoint_visitor.py b/src/psyclone/psyad/adjoint_visitor.py index 67a9f6b6e2..fb53a5a7f2 100644 --- a/src/psyclone/psyad/adjoint_visitor.py +++ b/src/psyclone/psyad/adjoint_visitor.py @@ -451,10 +451,10 @@ def _copy_and_process(self, node): if isinstance(symbol_obj, GenericInterfaceSymbol): new_routines = [] - for rsym, mod_pro in symbol_obj.routines: + for rinfo in symbol_obj.routines: new_routines.append(( - sym_tab.lookup(rsym.name), - mod_pro + sym_tab.lookup(rinfo.symbol.name), + rinfo.from_container )) symbol_obj.routines = new_routines diff --git a/src/psyclone/psyir/frontend/fparser2.py b/src/psyclone/psyir/frontend/fparser2.py index 88fc6cc512..b7df264cb9 100644 --- a/src/psyclone/psyir/frontend/fparser2.py +++ b/src/psyclone/psyir/frontend/fparser2.py @@ -396,9 +396,9 @@ def _find_or_create_psyclone_internal_cmp(node): routine_symbol3 = container.symbol_table.lookup(name_f_char) symbol = GenericInterfaceSymbol( sym.name, - [(routine_symbol1, sym.routines[0][1]), - (routine_symbol2, sym.routines[1][1]), - (routine_symbol3, sym.routines[2][1])], + [(routine_symbol1, sym.routines[0].from_container), + (routine_symbol2, sym.routines[1].from_container), + (routine_symbol3, sym.routines[2].from_container)], visibility=sym.visibility ) container.symbol_table.add(symbol) diff --git a/src/psyclone/psyir/nodes/container.py b/src/psyclone/psyir/nodes/container.py index f0ad98b245..e35b706063 100644 --- a/src/psyclone/psyir/nodes/container.py +++ b/src/psyclone/psyir/nodes/container.py @@ -307,7 +307,7 @@ def resolve_routine(self, name): except KeyError: return [] if isinstance(rsym, GenericInterfaceSymbol): - return [rt[0].name.lower() for rt in rsym.routines] + return [rt.symbol.name.lower() for rt in rsym.routines] if isinstance(rsym, RoutineSymbol): return [name] if type(rsym) is Symbol and rsym.is_import: diff --git a/src/psyclone/psyir/nodes/operation.py b/src/psyclone/psyir/nodes/operation.py index 77985560e8..c076d57544 100644 --- a/src/psyclone/psyir/nodes/operation.py +++ b/src/psyclone/psyir/nodes/operation.py @@ -64,10 +64,10 @@ class Operation(DataNode, metaclass=ABCMeta): self.Operator. ''' - # Must be overridden in sub-class to hold an Enumeration of the Operators - # that it can represent. + #: Must be overridden in sub-class to hold an Enumeration of the Operators + #: that it can represent. Operator = object - # Colour of the node in a view tree. + #: Colour of the node in a view tree. _colour = "blue" def __init__(self, operator, parent=None): @@ -140,6 +140,7 @@ class UnaryOperation(Operation): # Textual description of the node. _children_valid_format = "DataNode" + #: The Operators that a UnaryOperation can represent. Operator = Enum('Operator', [ # Arithmetic Operators 'MINUS', 'PLUS', @@ -209,6 +210,7 @@ class BinaryOperation(Operation): as children 0 and 1, and an attribute with the operator type. ''' + #: The Operators that a BinaryOperation can represent. Operator = Enum('Operator', [ # Arithmetic Operators. ('REM' is remainder AKA 'MOD' in Fortran.) 'ADD', 'SUB', 'MUL', 'DIV', 'REM', 'POW', diff --git a/src/psyclone/psyir/symbols/__init__.py b/src/psyclone/psyir/symbols/__init__.py index 9e93f39fbb..10271a2e58 100644 --- a/src/psyclone/psyir/symbols/__init__.py +++ b/src/psyclone/psyir/symbols/__init__.py @@ -56,7 +56,7 @@ ArrayType, BOOLEAN_TYPE, CHARACTER_TYPE, DataType, INTEGER4_TYPE, INTEGER8_TYPE, INTEGER_DOUBLE_TYPE, INTEGER_SINGLE_TYPE, INTEGER_TYPE, NoType, REAL4_TYPE, REAL8_TYPE, REAL_DOUBLE_TYPE, REAL_SINGLE_TYPE, - REAL_TYPE, ScalarType, StructureType, TYPE_MAP_TO_PYTHON, UnresolvedType, + REAL_TYPE, ScalarType, StructureType, UnresolvedType, UnsupportedType, UnsupportedFortranType) # For auto documentation generation. @@ -93,7 +93,6 @@ 'Symbol', 'SymbolError', 'SymbolTable', - 'TYPE_MAP_TO_PYTHON', 'TypedSymbol', 'UnsupportedFortranType', 'UnknownInterface', diff --git a/src/psyclone/psyir/symbols/datasymbol.py b/src/psyclone/psyir/symbols/datasymbol.py index 70d8c89ddc..c1ddb9e20d 100644 --- a/src/psyclone/psyir/symbols/datasymbol.py +++ b/src/psyclone/psyir/symbols/datasymbol.py @@ -243,11 +243,10 @@ def initial_value(self, new_value): f"{node}") new_initial_value = new_value else: - from psyclone.psyir.symbols.datatypes import TYPE_MAP_TO_PYTHON # No need to check that self.datatype has an intrinsic # attribute as we know it is a ScalarType or ArrayType # due to an earlier test. - lookup = TYPE_MAP_TO_PYTHON[self.datatype.intrinsic] + lookup = ScalarType.TYPE_MAP_TO_PYTHON[self.datatype.intrinsic] if not isinstance(new_value, lookup): raise ValueError( f"Error setting initial value for symbol " diff --git a/src/psyclone/psyir/symbols/datatypes.py b/src/psyclone/psyir/symbols/datatypes.py index 6815aa37bf..8c89c89dff 100644 --- a/src/psyclone/psyir/symbols/datatypes.py +++ b/src/psyclone/psyir/symbols/datatypes.py @@ -39,8 +39,10 @@ import abc import copy -from collections import OrderedDict, namedtuple +from collections import OrderedDict +from dataclasses import dataclass from enum import Enum +from typing import Any, Union from psyclone.errors import InternalError from psyclone.psyir.symbols.data_type_symbol import DataTypeSymbol @@ -310,6 +312,14 @@ class Precision(Enum): DOUBLE = 2 UNDEFINED = 3 + #: Mapping from PSyIR scalar data types to intrinsic Python types + #: ignoring precision. + TYPE_MAP_TO_PYTHON = { + Intrinsic.INTEGER: int, + Intrinsic.CHARACTER: str, + Intrinsic.BOOLEAN: bool, + Intrinsic.REAL: float} + def __init__(self, intrinsic, precision): if not isinstance(intrinsic, ScalarType.Intrinsic): raise TypeError( @@ -463,13 +473,24 @@ def copy(self): ''' return copy.copy(self) - #: namedtuple used to store lower and upper limits of an array dimension - ArrayBounds = namedtuple("ArrayBounds", ["lower", "upper"]) + @dataclass(frozen=True) + class ArrayBounds: + ''' + Class to store lower and upper limits of an array dimension. + + :param lower: the lower bound of the array dimension. + :type lower: :py:class:`psyclone.psyir.nodes.DataNode` + :param upper: the upper bound of the array dimension. + :type upper: :py:class:`psyclone.psyir.nodes.DataNode` + ''' + # Have to use Any here as using DataNode causes a circular dependence. + lower: Any + upper: Any def __init__(self, datatype, shape): # This import must be placed here to avoid circular dependencies. - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from psyclone.psyir.nodes import Literal, DataNode, Assignment def _node_from_int(var): @@ -699,6 +720,9 @@ def _validate_data_node(dim_node, is_lower_bound=False): f"'{dimension}' has {len(dimension)} entries.") _validate_data_node(dimension[0], is_lower_bound=True) _validate_data_node(dimension[1]) + elif isinstance(dimension, ArrayType.ArrayBounds): + _validate_data_node(dimension.lower, is_lower_bound=True) + _validate_data_node(dimension.upper) else: _validate_data_node(dimension) @@ -716,7 +740,9 @@ def _validate_data_node(dim_node, is_lower_bound=False): for dim in extents: if not (dim == ArrayType.Extent.ATTRIBUTE or (isinstance(dim, tuple) and - dim[-1] == ArrayType.Extent.ATTRIBUTE)): + dim[-1] == ArrayType.Extent.ATTRIBUTE) or + (isinstance(dim, ArrayType.ArrayBounds) and + dim.upper == ArrayType.Extent.ATTRIBUTE)): raise TypeError( f"An assumed-shape array must have every " f"dimension unspecified (either as 'ATTRIBUTE' or " @@ -802,7 +828,8 @@ def copy(self): ''' new_shape = [] - for dim in self.shape: + current_shape = self.shape + for dim in current_shape: if isinstance(dim, ArrayType.ArrayBounds): new_bounds = ArrayType.ArrayBounds(dim.lower.copy(), dim.upper.copy()) @@ -850,7 +877,7 @@ def replace_symbols_using(self, table): # Update any Symbols referenced in the array shape for dim in self.shape: if isinstance(dim, ArrayType.ArrayBounds): - exprns = dim + exprns = [dim.lower, dim.upper] else: exprns = [dim] for bnd in exprns: @@ -870,10 +897,22 @@ class StructureType(DataType): SymbolTable functionality then this decision could be revisited. ''' - # Each member of a StructureType is represented by a ComponentType - # (named tuple). - ComponentType = namedtuple("ComponentType", [ - "name", "datatype", "visibility", "initial_value"]) + @dataclass(frozen=True) + class ComponentType: + ''' + Represents a member of a StructureType. + + :param name: the name of the member. + :param datatype: the type of the member. + :param visibility: whether this member is public or private. + :param initial_value: the initial value of this member (if any). + :type initial_value: Optional[:py:class:`psyclone.psyir.nodes.Node`] + ''' + name: str + # Use Union for compatibility with Python < 3.10 + datatype: Union[DataType, DataTypeSymbol] + visibility: Symbol.Visibility + initial_value: Any def __init__(self): self._components = OrderedDict() @@ -1049,13 +1088,6 @@ def replace_symbols_using(self, table): CHARACTER_TYPE = ScalarType(ScalarType.Intrinsic.CHARACTER, ScalarType.Precision.UNDEFINED) -# Mapping from PSyIR scalar data types to intrinsic Python types -# ignoring precision. -TYPE_MAP_TO_PYTHON = {ScalarType.Intrinsic.INTEGER: int, - ScalarType.Intrinsic.CHARACTER: str, - ScalarType.Intrinsic.BOOLEAN: bool, - ScalarType.Intrinsic.REAL: float} - # For automatic documentation generation __all__ = ["UnsupportedType", "UnsupportedFortranType", "UnresolvedType", diff --git a/src/psyclone/psyir/symbols/generic_interface_symbol.py b/src/psyclone/psyir/symbols/generic_interface_symbol.py index 169ffca59b..0e90e79505 100644 --- a/src/psyclone/psyir/symbols/generic_interface_symbol.py +++ b/src/psyclone/psyir/symbols/generic_interface_symbol.py @@ -36,7 +36,8 @@ ''' This module contains the GenericInterfaceSymbol.''' -from collections import namedtuple +from dataclasses import dataclass + from psyclone.psyir.symbols.routinesymbol import RoutineSymbol @@ -54,7 +55,17 @@ class GenericInterfaceSymbol(RoutineSymbol): :type kwargs: unwrapped dict. ''' - RoutineInfo = namedtuple("RoutineInfo", ["symbol", "from_container"]) + @dataclass(frozen=True) + class RoutineInfo: + ''' + Holds information on a single routine member of an interface. + + :param symbol: the symbol representing the routine. + :param from_container: whether or not this routine is from a Container + (i.e. a 'module procedure' in Fortran). + ''' + symbol: RoutineSymbol + from_container: bool def __init__(self, name, routines, **kwargs): super().__init__(name, **kwargs) @@ -149,7 +160,8 @@ def copy(self): ''' # The constructors for all Symbol-based classes have 'name' as the # first positional argument. - return type(self)(self.name, self.routines[:], + rt_info = [(rt.symbol, rt.from_container) for rt in self.routines] + return type(self)(self.name, rt_info, datatype=self.datatype.copy(), visibility=self.visibility, interface=self.interface.copy()) diff --git a/src/psyclone/psyir/transformations/__init__.py b/src/psyclone/psyir/transformations/__init__.py index 60b55c1449..6b5df8ddc9 100644 --- a/src/psyclone/psyir/transformations/__init__.py +++ b/src/psyclone/psyir/transformations/__init__.py @@ -86,7 +86,8 @@ from psyclone.psyir.transformations.loop_tiling_2d_trans \ import LoopTiling2DTrans from psyclone.psyir.transformations.loop_trans import LoopTrans -from psyclone.psyir.transformations.value_range_check_trans import ValueRangeCheckTrans +from psyclone.psyir.transformations.value_range_check_trans import ( + ValueRangeCheckTrans) from psyclone.psyir.transformations.omp_loop_trans import OMPLoopTrans from psyclone.psyir.transformations.omp_target_trans import OMPTargetTrans from psyclone.psyir.transformations.omp_taskwait_trans import OMPTaskwaitTrans diff --git a/src/psyclone/psyir/transformations/omp_loop_trans.py b/src/psyclone/psyir/transformations/omp_loop_trans.py index b5d987eb7b..04c31b0485 100644 --- a/src/psyclone/psyir/transformations/omp_loop_trans.py +++ b/src/psyclone/psyir/transformations/omp_loop_trans.py @@ -43,12 +43,14 @@ from psyclone.psyir.transformations.parallel_loop_trans import \ ParallelLoopTrans +#: Mapping from simple string to actual directive class. MAP_STR_TO_LOOP_DIRECTIVES = { "do": OMPDoDirective, "paralleldo": OMPParallelDoDirective, "teamsdistributeparalleldo": OMPTeamsDistributeParallelDoDirective, "loop": OMPLoopDirective } +#: List containing the valid names for OMP directives. VALID_OMP_DIRECTIVES = list(MAP_STR_TO_LOOP_DIRECTIVES.keys()) diff --git a/src/psyclone/psyir/transformations/transformation_error.py b/src/psyclone/psyir/transformations/transformation_error.py index 8c650e8e38..f64e15f14f 100644 --- a/src/psyclone/psyir/transformations/transformation_error.py +++ b/src/psyclone/psyir/transformations/transformation_error.py @@ -44,12 +44,6 @@ class TransformationError(PSycloneError): code transformation operations. ''' def __init__(self, value): - PSycloneError.__init__(self, value) + super().__init__(value) self.value = LazyString( lambda: f"Transformation Error: {value}") - - -# TODO #1280: This currently causes 'more than one target for cross-reference' -# warnings when building the reference guide. -# For AutoAPI documentation generation -# __all__ = ["TransformationError"] diff --git a/src/psyclone/tests/dynamo0p3_test.py b/src/psyclone/tests/dynamo0p3_test.py index af8559acde..76721031e2 100644 --- a/src/psyclone/tests/dynamo0p3_test.py +++ b/src/psyclone/tests/dynamo0p3_test.py @@ -3704,9 +3704,12 @@ def test_kerncallarglist_positions_noquad(dist_mem): assert create_arg_list.nlayers_positions == [1] assert not create_arg_list.nqp_positions assert len(create_arg_list.ndf_positions) == 3 - assert create_arg_list.ndf_positions[0] == (7, "w1") - assert create_arg_list.ndf_positions[1] == (10, "w2") - assert create_arg_list.ndf_positions[2] == (13, "w3") + assert create_arg_list.ndf_positions[0].position == 7 + assert create_arg_list.ndf_positions[0].function_space == "w1" + assert create_arg_list.ndf_positions[1].position == 10 + assert create_arg_list.ndf_positions[1].function_space == "w2" + assert create_arg_list.ndf_positions[2].position == 13 + assert create_arg_list.ndf_positions[2].function_space == "w3" def test_kerncallarglist_positions_quad(dist_mem): @@ -3733,9 +3736,12 @@ def test_kerncallarglist_positions_quad(dist_mem): assert create_arg_list.nqp_positions[0]["horizontal"] == 21 assert create_arg_list.nqp_positions[0]["vertical"] == 22 assert len(create_arg_list.ndf_positions) == 3 - assert create_arg_list.ndf_positions[0] == (8, "w1") - assert create_arg_list.ndf_positions[1] == (12, "w2") - assert create_arg_list.ndf_positions[2] == (16, "w3") + assert create_arg_list.ndf_positions[0].position == 8 + assert create_arg_list.ndf_positions[0].function_space == "w1" + assert create_arg_list.ndf_positions[1].position == 12 + assert create_arg_list.ndf_positions[1].function_space == "w2" + assert create_arg_list.ndf_positions[2].position == 16 + assert create_arg_list.ndf_positions[2].function_space == "w3" # Class DynKernelArguments start diff --git a/src/psyclone/tests/psyir/backend/opencl_test.py b/src/psyclone/tests/psyir/backend/opencl_test.py index 549f7aeec9..03b33fa585 100644 --- a/src/psyclone/tests/psyir/backend/opencl_test.py +++ b/src/psyclone/tests/psyir/backend/opencl_test.py @@ -40,10 +40,10 @@ import pytest from psyclone.psyir.backend.visitor import VisitorError from psyclone.psyir.backend.opencl import OpenCLWriter -from psyclone.psyir.nodes import Return, KernelSchedule -from psyclone.psyir.symbols import DataSymbol, SymbolTable, \ - ArgumentInterface, UnresolvedInterface, ArrayType, REAL_TYPE, \ - INTEGER_TYPE +from psyclone.psyir.nodes import Return, KernelSchedule, Literal +from psyclone.psyir.symbols import ( + DataSymbol, SymbolTable, ArgumentInterface, UnresolvedInterface, ArrayType, + REAL_TYPE, INTEGER_TYPE) def test_oclw_initialization(): @@ -117,7 +117,9 @@ def test_oclw_gen_declaration(): assert result == "__global int * restrict dummy2" # Array with a lower bound other than 1 - array_type = ArrayType(INTEGER_TYPE, [2, ArrayType.ArrayBounds(2, 5)]) + two = Literal("2", INTEGER_TYPE) + five = Literal("5", INTEGER_TYPE) + array_type = ArrayType(INTEGER_TYPE, [2, ArrayType.ArrayBounds(two, five)]) symbol = DataSymbol("dummy3", array_type) with pytest.raises(VisitorError) as err: oclwriter.gen_declaration(symbol) diff --git a/src/psyclone/transformations.py b/src/psyclone/transformations.py index d37859eafc..ce9f06c3dc 100644 --- a/src/psyclone/transformations.py +++ b/src/psyclone/transformations.py @@ -2971,7 +2971,6 @@ def apply(self, node, options=None): "GOceanOMPParallelLoopTrans", "KernelImportsToArguments", "MoveTrans", - "OMPLoopTrans", "OMPMasterTrans", "OMPParallelLoopTrans", "OMPParallelTrans",