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

[PSyData] Kernel extraction and derived-types as arguments or with any other write access #2830

Open
3 tasks
hiker opened this issue Dec 19, 2024 · 0 comments
Open
3 tasks
Labels
LFRic Issue relates to the LFRic domain NG-ARCH Issues relevant to the GPU parallelisation of LFRic and other models expected to be used in NG-ARCH PSyData

Comments

@hiker
Copy link
Collaborator

hiker commented Dec 19, 2024

While #2706 adds support for derived type, this actually only works if components of a derived types are used, e.g.:

        DO j = tdims % j_start, tdims % j_end

This would add tdims%jstart and j_end to the kernel-data-file as expected. But if a whole derived type is passed on as an argument, the extraction/driver creation fails. Example:

TYPE(array_dims), SAVE :: tdims
...
CALL pc2_checks(...tdims % i_len, tdims % j_len, tdims % k_end, ...)     ! This works

CALL wtrac_pc2_phase_chg(tdims, q, qcl, 'pc2_initiate', wtrac = wtrac)   ! Doesn't work

In this case the driver creation fails because tdims has no intrinsic type. (which happens when the driver tries to create the corresponding _post variable)

As far as I can see, the only option here is to add code that can write the all individual components of a derived type, and make sure that the two different usages (tdims%i_len and tdims) are stored only once for the same object.

Suggested approach:

  • If a structure type is detected in the access analysis, replace it with access to each individual element (recursively in case of nested derived types)
    • Not sure if this should become an option of the variable access collection, or a post-processing step
  • Update the driver extraction (if still required) to read the individual components
  • Verify the extraction. At this stage, I would expect the extraction to fail to compile (since there won't be a generic interface that can write the derived type
@hiker hiker added LFRic Issue relates to the LFRic domain PSyData NG-ARCH Issues relevant to the GPU parallelisation of LFRic and other models expected to be used in NG-ARCH labels Dec 19, 2024
hiker added a commit that referenced this issue Dec 24, 2024
hiker added a commit that referenced this issue Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LFRic Issue relates to the LFRic domain NG-ARCH Issues relevant to the GPU parallelisation of LFRic and other models expected to be used in NG-ARCH PSyData
Projects
None yet
Development

No branches or pull requests

1 participant