From 95bb9012adf51ac8174807980fadd3c9d9d495d5 Mon Sep 17 00:00:00 2001 From: Aidan Chalk <3043914+LonelyCat124@users.noreply.github.com> Date: Thu, 4 Jan 2024 14:54:32 +0000 Subject: [PATCH 1/5] Improvements to fix 2418 --- src/psyclone/psyir/nodes/dynamic_omp_task_directive.py | 3 +++ src/psyclone/psyir/transformations/omp_task_trans.py | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/psyclone/psyir/nodes/dynamic_omp_task_directive.py b/src/psyclone/psyir/nodes/dynamic_omp_task_directive.py index b75d655521..e671076388 100644 --- a/src/psyclone/psyir/nodes/dynamic_omp_task_directive.py +++ b/src/psyclone/psyir/nodes/dynamic_omp_task_directive.py @@ -126,6 +126,7 @@ class DynamicOMPTaskDirective(OMPTaskDirective): IntrinsicCall.Intrinsic.ERF, IntrinsicCall.Intrinsic.EXP, IntrinsicCall.Intrinsic.FLOOR, + IntrinsicCall.Intrinsic.INT, IntrinsicCall.Intrinsic.LBOUND, IntrinsicCall.Intrinsic.LEN, IntrinsicCall.Intrinsic.LOG, @@ -133,9 +134,11 @@ class DynamicOMPTaskDirective(OMPTaskDirective): IntrinsicCall.Intrinsic.MAX, IntrinsicCall.Intrinsic.MIN, IntrinsicCall.Intrinsic.MODULO, + IntrinsicCall.Intrinsic.REAL, IntrinsicCall.Intrinsic.SIGN, IntrinsicCall.Intrinsic.SIN, IntrinsicCall.Intrinsic.SINH, + IntrinsicCall.Intrinsic.SIZE, IntrinsicCall.Intrinsic.SQRT, IntrinsicCall.Intrinsic.TAN, IntrinsicCall.Intrinsic.TANH, diff --git a/src/psyclone/psyir/transformations/omp_task_trans.py b/src/psyclone/psyir/transformations/omp_task_trans.py index 4b797cb5ff..f35c8cede7 100644 --- a/src/psyclone/psyir/transformations/omp_task_trans.py +++ b/src/psyclone/psyir/transformations/omp_task_trans.py @@ -40,7 +40,7 @@ import FoldConditionalReturnExpressionsTrans from psyclone.psyir.transformations.parallel_loop_trans import\ ParallelLoopTrans -from psyclone.psyir.nodes import CodeBlock, Call +from psyclone.psyir.nodes import CodeBlock, Call, IntrinsicCall from psyclone.psyir.nodes import DynamicOMPTaskDirective from psyclone.psyir.transformations.inline_trans import InlineTrans from psyclone.psyir.transformations.transformation_error import \ @@ -107,6 +107,9 @@ def validate(self, node, options=None): calls = node_copy.walk(Call) for call in calls: + # Skip over intrinsic calls as we can't inline them + if isinstance(call, IntrinsicCall): + continue intrans.validate(call) def _directive(self, children, collapse=None): @@ -159,6 +162,9 @@ def _inline_kernels(self, node): calls = node.walk(Call) for call in calls: + # Skip over intrinsic calls as we can't inline them + if isinstance(call, IntrinsicCall): + continue intrans.apply(call) def apply(self, node, options=None): From 06cc8ad87c76484a5a7d5b7415aafef70b656470 Mon Sep 17 00:00:00 2001 From: Aidan Chalk <3043914+LonelyCat124@users.noreply.github.com> Date: Thu, 4 Jan 2024 15:13:57 +0000 Subject: [PATCH 2/5] Another intrinsic call inside the kernel as well --- .../transformations/omp_task_transformations_test.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/psyclone/tests/psyir/transformations/omp_task_transformations_test.py b/src/psyclone/tests/psyir/transformations/omp_task_transformations_test.py index 3fc0fab6e3..508c2fa03c 100644 --- a/src/psyclone/tests/psyir/transformations/omp_task_transformations_test.py +++ b/src/psyclone/tests/psyir/transformations/omp_task_transformations_test.py @@ -96,15 +96,17 @@ def test_omptask_validate(fortran_reader): def test_omptask_apply(fortran_reader, fortran_writer): - ''' Test the apply method of the OMPTaskTrans. ''' + ''' Test the apply method of the OMPTaskTrans. We contain + an IntrinsicCall inside the region to be transformed to ensure that + the application doesn't attempt to inline it. ''' code = ''' subroutine sub() integer :: ji, jj, n integer, dimension(10, 10) :: t integer, dimension(10, 10) :: s do jj = 1, 10 - do ji = 1, 10 - t(ji, jj) = s(ji, jj) + do ji = 1, SIZE(ji,2) + t(ji, jj) = INT(s(ji, jj)) end do end do end subroutine sub @@ -130,8 +132,8 @@ def test_omptask_apply(fortran_reader, fortran_writer): do jj = 1, 10, 1 !$omp task private(ji), firstprivate(jj), shared(t,s), \ depend(in: s(:,jj)), depend(out: t(:,jj)) - do ji = 1, 10, 1 - t(ji,jj) = s(ji,jj) + do ji = 1, SIZE(ji, 2), 1 + t(ji,jj) = INT(s(ji,jj)) enddo !$omp end task enddo From 8389c10d0bc80a1080b94375448c877957caa33c Mon Sep 17 00:00:00 2001 From: "oakley.brunt" Date: Fri, 5 Jan 2024 15:25:09 +0000 Subject: [PATCH 3/5] Fixed link to PyPi installation page --- doc/user_guide/getting_going.rst | 4 ++-- doc/user_guide/system_specific_setup.rst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/user_guide/getting_going.rst b/doc/user_guide/getting_going.rst index a0df1f06d1..326a9a8bc7 100644 --- a/doc/user_guide/getting_going.rst +++ b/doc/user_guide/getting_going.rst @@ -219,7 +219,7 @@ support Python 2.7 was version 2.1.0.) PSyclone immediately relies on four external Python packages; ``configparser``, ``fparser``, ``sympy``, and ``pyparsing``. The easiest way to satisfy the Python dependencies is to use the -`PyPI installation `_ +`PyPI installation `_ and ``pip``. If everything is working correctly then using ``pip`` to install PSyclone:: @@ -260,7 +260,7 @@ parser originally developed as a part of the `f2py project ``fparser`` is available from the Python Package Index and thus may be installed using ``pip`` -(https://packaging.python.org/installing/#requirements-for-installing-packages): +(https://packaging.python.org/tutorials/installing-packages/#requirements-for-installing-packages): :: > pip install fparser diff --git a/doc/user_guide/system_specific_setup.rst b/doc/user_guide/system_specific_setup.rst index 73f772c098..a0dbb61c73 100644 --- a/doc/user_guide/system_specific_setup.rst +++ b/doc/user_guide/system_specific_setup.rst @@ -20,7 +20,7 @@ You will need a terminal window open in which to enter the commands. Installing dependencies ^^^^^^^^^^^^^^^^^^^^^^^ Most required dependencies are installed from the -Python Package Index (https://packaging.python.org/installing/) +Python Package Index (https://packaging.python.org/tutorials/installing-packages/) using the program pip ("PIP Installs Packages"). Besides ``pip`` it is also recommended to install the graphviz package to be able to visualise dependency graphs. This is optional and the associated From a0cd02d14f9895d3fc8f9573f98235b8fa9cfe53 Mon Sep 17 00:00:00 2001 From: Sergi Siso Date: Fri, 5 Jan 2024 15:27:06 +0000 Subject: [PATCH 4/5] #2418 Update changelog and copyright dates --- changelog | 2 ++ src/psyclone/psyir/nodes/dynamic_omp_task_directive.py | 2 +- src/psyclone/psyir/transformations/omp_task_trans.py | 6 ++++-- .../psyir/transformations/omp_task_transformations_test.py | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/changelog b/changelog index 86c993cdf2..8f0c923bd8 100644 --- a/changelog +++ b/changelog @@ -113,6 +113,8 @@ 42) PR #2240 for #2132. Update Integration test software stack. + 43) PR #2454 for #2418. Fix OMPTaskTrans attempts to inline IntrinsicCalls. + release 2.4.0 29th of September 2023 1) PR #1758 for #1741. Splits the PSyData read functionality into a diff --git a/src/psyclone/psyir/nodes/dynamic_omp_task_directive.py b/src/psyclone/psyir/nodes/dynamic_omp_task_directive.py index e671076388..c1b44826ea 100644 --- a/src/psyclone/psyir/nodes/dynamic_omp_task_directive.py +++ b/src/psyclone/psyir/nodes/dynamic_omp_task_directive.py @@ -1,7 +1,7 @@ # ----------------------------------------------------------------------------- # BSD 3-Clause License # -# Copyright (c) 2022-2023, Science and Technology Facilities Council. +# Copyright (c) 2022-2024, Science and Technology Facilities Council. # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/src/psyclone/psyir/transformations/omp_task_trans.py b/src/psyclone/psyir/transformations/omp_task_trans.py index f35c8cede7..f11e6fa975 100644 --- a/src/psyclone/psyir/transformations/omp_task_trans.py +++ b/src/psyclone/psyir/transformations/omp_task_trans.py @@ -1,7 +1,7 @@ # ----------------------------------------------------------------------------- # BSD 3-Clause License # -# Copyright (c) 2021, Science and Technology Facilities Council. +# Copyright (c) 2021-2024, Science and Technology Facilities Council. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -31,8 +31,10 @@ # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # ----------------------------------------------------------------------------- -# Author A. B. G. Chalk STFC Daresbury Lab +# Author A. B. G. Chalk, STFC Daresbury Lab + ''' This module provides the OMPTaskTrans transformation.''' + from psyclone.errors import GenerationError from psyclone.domain.common.transformations import KernelModuleInlineTrans from psyclone.psyGen import Kern diff --git a/src/psyclone/tests/psyir/transformations/omp_task_transformations_test.py b/src/psyclone/tests/psyir/transformations/omp_task_transformations_test.py index 508c2fa03c..5af3215e31 100644 --- a/src/psyclone/tests/psyir/transformations/omp_task_transformations_test.py +++ b/src/psyclone/tests/psyir/transformations/omp_task_transformations_test.py @@ -1,7 +1,7 @@ # ----------------------------------------------------------------------------- # BSD 3-Clause License # -# Copyright (c) 2021-2022, Science and Technology Facilities Council. +# Copyright (c) 2021-2024, Science and Technology Facilities Council. # All rights reserved. # # Redistribution and use in source and binary forms, with or without From 4d53f94817f74c54791958d95a4fb4385bd5e9a9 Mon Sep 17 00:00:00 2001 From: Sergi Siso Date: Fri, 5 Jan 2024 15:57:28 +0000 Subject: [PATCH 5/5] #2459 Update changelog --- changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog b/changelog index 8f0c923bd8..dbb07de3c4 100644 --- a/changelog +++ b/changelog @@ -115,6 +115,8 @@ 43) PR #2454 for #2418. Fix OMPTaskTrans attempts to inline IntrinsicCalls. + 44) PR #2459 for #2458. Fix broken documentation links. + release 2.4.0 29th of September 2023 1) PR #1758 for #1741. Splits the PSyData read functionality into a