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

fix for argument shape regarding module imports #148

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

MichaelSt98
Copy link
Collaborator

Currently, there is a problem regarding the array argument shape transformation used within the SCC transformations.

E.g. regarding

MODULE DRIVER_MOD
USE KERNEL_A_MOD, ONLY: KERNEL_A
IMPLICIT NONE
CONTAINS
  SUBROUTINE driver(nlon, nlev, a, b, c)
    INTEGER, INTENT(IN)   :: nlon, nlev  ! Dimension sizes
    INTEGER, PARAMETER    :: n = 5
    REAL, INTENT(INOUT)   :: a(nlon)
    REAL, INTENT(INOUT)   :: b(nlon,nlev)
    REAL, INTENT(INOUT)   :: c(nlon,n)

    call kernel_a(a, b, c)

  END SUBROUTINE driver

END MODULE DRIVER_MOD
MODULE KERNEL_A_MOD
IMPLICIT NONE
CONTAINS
  SUBROUTINE kernel_a(a, b, c)
    USE VAR_MODULE_MOD, only: n
    REAL, INTENT(INOUT)   :: a(:)
    REAL, INTENT(INOUT)   :: b(:,:)
    REAL, INTENT(INOUT)   :: c(:,:)

  END SUBROUTINE kernel_a

END MODULE KERNEL_A_MOD

with

MODULE VAR_MODULE_MOD
INTEGER, PARAMETER    :: n = 5
END MODULE VAR_MODULE_MOD

the transformation without fix would create a definition INTEGER, PARAMETER,INTENT(IN) :: n = 5 in the routine kernel_a which causes a compilation error.

This is fixed by checking additionally for module imports (of both the routine and module).

@github-actions
Copy link

github-actions bot commented Sep 8, 2023

Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/148/index.html

@codecov
Copy link

codecov bot commented Sep 8, 2023

Codecov Report

Merging #148 (28c8be9) into main (0db337c) will decrease coverage by 0.04%.
Report is 67 commits behind head on main.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #148      +/-   ##
==========================================
- Coverage   92.15%   92.12%   -0.04%     
==========================================
  Files          90       89       -1     
  Lines       16653    16512     -141     
==========================================
- Hits        15347    15212     -135     
+ Misses       1306     1300       -6     
Flag Coverage Δ
lint_rules 96.22% <ø> (+0.26%) ⬆️
loki 92.05% <ø> (-0.05%) ⬇️
transformations 91.71% <100.00%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
transformations/transformations/argument_shape.py 92.72% <100.00%> (+0.57%) ⬆️

... and 17 files with indirect coverage changes

📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@mlange05 mlange05 left a comment

Choose a reason for hiding this comment

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

Clean, neat and well tested. Very nice! GTG from me. :shipit:

Copy link
Collaborator

@reuterbal reuterbal left a comment

Choose a reason for hiding this comment

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

Fully agreed, GTG!

@reuterbal reuterbal merged commit ed7e624 into main Sep 13, 2023
11 checks passed
@reuterbal reuterbal deleted the nams_argument_shape_fix branch September 13, 2023 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants