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

Problem parsing array of derived types #2772

Open
jwallwork23 opened this issue Nov 12, 2024 · 3 comments
Open

Problem parsing array of derived types #2772

jwallwork23 opened this issue Nov 12, 2024 · 3 comments
Labels
NG-ARCH Issues relevant to the GPU parallelisation of LFRic and other models expected to be used in NG-ARCH

Comments

@jwallwork23
Copy link
Collaborator

I've been going through UKCA and editing it so that PSyclone can parse it. For example, removing labelled loops. The one remaining thing that I'm unable to address is a case where there's an array of derived types. Parsing it gives:

TypeError: A StructureReference must refer to a symbol that is (or could be) a structure, however symbol 'chch_defs_master' has type 'Array<chch_t1: DataTypeSymbol, shape=[Reference[name:'n_chch_master']]>'
@jwallwork23 jwallwork23 added the NG-ARCH Issues relevant to the GPU parallelisation of LFRic and other models expected to be used in NG-ARCH label Nov 12, 2024
@arporter
Copy link
Member

arporter commented Nov 12, 2024

Thanks @jwallwork23. Do we really not support labelled loops (or is it that they use the label for loop control, e.g. EXIT)? Also, just to check, is this with HEAD of master? If so, please could you provide some example Fortran, thanks :-)

@jwallwork23
Copy link
Collaborator Author

Regarding labelled loops, if I parse

program test
  implicit none
  integer :: i
  integer :: a(2)

  my_loop: do i = 1, 2
    a(i) = i
    if (i > 1) then
      exit my_loop
    end if
  end do my_loop

end program test

with no optimisation script (and HEAD of master) I get

program test
  integer :: i
  integer, dimension(2) :: a

  ! PSyclone CodeBlock (unsupported code) reason:
  !  - Unsupported label reference within DO
  my_loop:DO i = 1, 2
    a(i) = i
    IF (i > 1) THEN
      EXIT my_loop
    END IF
  END DO my_loop

end program test

Without the exit my_loop it doesn't use a CodeBlock so I guess that's the part it doesn't like.

For the derived type part, I'll figure out a minimal failing example and get back to you.

@arporter
Copy link
Member

Without the exit my_loop it doesn't use a CodeBlock so I guess that's the part it doesn't like.

Ah yes, that's expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NG-ARCH Issues relevant to the GPU parallelisation of LFRic and other models expected to be used in NG-ARCH
Projects
None yet
Development

No branches or pull requests

2 participants