Skip to content

Update PSyclone scripts for UKCA chemistry 3D chunking - #593

Open
mn416 wants to merge 4 commits into
MetOffice:mainfrom
mn416:mn416-3d-chunking
Open

Update PSyclone scripts for UKCA chemistry 3D chunking#593
mn416 wants to merge 4 commits into
MetOffice:mainfrom
mn416:mn416-3d-chunking

Conversation

@mn416

@mn416 mn416 commented Jul 6, 2026

Copy link
Copy Markdown

PR Summary

Sci/Tech Reviewer: Joe Wallwork (@joewallwork)
Code Reviewer: Pierre Siddall (@Pierre-siddall)

UKCA full-domain mode chemistry chunking will now be implemented in the UKCA code base, not as an lfric_apps PSyclone transformer. This PR updates the PSyclone transformer so that it now only adds OpenMP directives to the already-chunked code, rather than introduce chunking from scratch.

Code Quality Checklist

  • I have performed a self-review of my own code
  • My code follows the project's style guidelines
  • Comments have been included that aid understanding and enhance the readability of the code
  • My changes generate no new warnings
  • All automated checks in the CI pipeline have completed successfully

Testing

  • I have tested this change locally, using the LFRic Apps rose-stem suite
  • If any tests fail (rose-stem or CI) the reason is understood and acceptable (e.g. kgo changes)
  • I have added tests to cover new functionality as appropriate (e.g. system tests, unit tests, etc.)
  • Any new tests have been assigned an appropriate amount of compute resource and have been allocated to an appropriate testing group (i.e. the developer tests are for jobs which use a small amount of compute resource and complete in a matter of minutes)

trac.log

testing branch: https://github.com/RobWatersMet/lfric_apps/tree/tesing-mn416-3d-chunking

macro applied and dependencies.sh updated

trac.log output:

Test Suite Results - lfric_apps - testing_mn416_3d_chunking_lfric/run1

Suite Information

Item Value
Suite Name testing_mn416_3d_chunking_lfric/run1
Suite User robert.waters
Workflow Start 2026-08-21T09:56:40
Groups Run all
Dependency Reference Main Like
casim MetOffice/casim@2026.07.1 True
jules MetOffice/jules@2026.07.1 True
lfric_apps RobWatersMet/lfric_apps@tesing-mn416-3d-chunking False
lfric_core MetOffice/lfric_core@2026.07.1 True
moci MetOffice/moci@2026.07.1 True
SimSys_Scripts MetOffice/SimSys_Scripts@2026.07.1 True
socrates MetOffice/socrates@2026.07.1 True
socrates-spectral MetOffice/socrates-spectral@2026.07.1 True
ukca mn416/ukca@mn416-3d-chunking True

Task Information

✅ succeeded tasks - 1602

Security Considerations

  • I have reviewed my changes for potential security issues
  • Sensitive data is properly handled (if applicable)
  • Authentication and authorisation are properly implemented (if applicable)

Performance Impact

  • Performance of the code has been considered and, if applicable, suitable performance measurements have been conducted

AI Assistance and Attribution

  • Some of the content of this change has been produced with the assistance of Generative AI tool name (e.g., Met Office Github Copilot Enterprise, Github Copilot Personal, ChatGPT GPT-4, etc) and I have followed the Simulation Systems AI policy (including attribution labels)

Documentation

  • Where appropriate I have updated documentation related to this change and confirmed that it builds correctly

PSyclone Approval

  • If you have edited any PSyclone-related code (e.g. PSyKAl-lite, Kernel interface, optimisation scripts, LFRic data structure code) then please contact the TCD Team

I emailed the TCD team, but the email bounced.

Note to PSyclone team: This PR removes one PSyclone script that is no longer needed and simplifies another, so should reduce concerns around forward/backwards compatibility. Note that the modification includes a check of the PSyclone version number to decide how to insert explicitly private variables: for PSyclone < 3.3.0, these are added to the loop, and PSyclone >= 3.3.0 they are added to the directive.

Sci/Tech Review

  • I understand this area of code and the changes being added
  • The proposed changes correspond to the pull request description
  • Documentation is sufficient (do documentation papers need updating)
  • Sufficient testing has been completed

(Please alert the code reviewer via a tag when you have approved the SR)

Code Review

  • All dependencies have been resolved
  • Related Issues have been properly linked and addressed
  • CLA compliance has been confirmed
  • Code quality standards have been met
  • Tests are adequate and have passed
  • Documentation is complete and accurate
  • Security considerations have been addressed
  • Performance impact is acceptable

@github-actions github-actions Bot added the cla-required The CLA has not yet been signed by the author of this PR - added by GA label Jul 6, 2026
@github-actions github-actions Bot added cla-signed The CLA has been signed as part of this PR - added by GA and removed cla-required The CLA has not yet been signed by the author of this PR - added by GA labels Jul 6, 2026
@RobWatersMet

Rob Waters (RobWatersMet) commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

I've added ukca_chem_full_chunk_size to the chemistry rose-meta.conf - so it will get generated into chemistry_config_mod.f90 at build time.

ukca_chem_full_chunk_size is then added directly to the ukca_setup call in ukca_init.

The changes shouldn't be needed in ukca_option_mod

@mn416
mn416 force-pushed the mn416-3d-chunking branch from 4922e75 to a42d796 Compare July 24, 2026 09:31
@RobWatersMet

Copy link
Copy Markdown
Contributor

testing branch: https://github.com/RobWatersMet/lfric_apps/tree/tesing-mn416-3d-chunking

macro applied and dependencies.sh updated

trac.log output:

Test Suite Results - lfric_apps - testing_mn416_3d_chunking_lfric/run1

Suite Information

Item Value
Suite Name testing_mn416_3d_chunking_lfric/run1
Suite User robert.waters
Workflow Start 2026-08-21T09:56:40
Groups Run all
Dependency Reference Main Like
casim MetOffice/casim@2026.07.1 True
jules MetOffice/jules@2026.07.1 True
lfric_apps RobWatersMet/lfric_apps@tesing-mn416-3d-chunking False
lfric_core MetOffice/lfric_core@2026.07.1 True
moci MetOffice/moci@2026.07.1 True
SimSys_Scripts MetOffice/SimSys_Scripts@2026.07.1 True
socrates MetOffice/socrates@2026.07.1 True
socrates-spectral MetOffice/socrates-spectral@2026.07.1 True
ukca mn416/ukca@mn416-3d-chunking True

Task Information

✅ succeeded tasks - 1602

@RobWatersMet

Copy link
Copy Markdown
Contributor

mn416 should be ready for scitech review

mn416 and others added 2 commits August 24, 2026 15:00
UKCA full-domain mode chemistry chunking is now implemented in the UKCA
code base, not as an lfric_apps PSyclone transformer. The PSyclone
transformer now only adds OpenMP directives to the already-chunked code.

@iboutle iboutle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A couple of minor metadata issues

Comment thread interfaces/physics_schemes_interface/rose-meta/um-chemistry/HEAD/rose-meta.conf Outdated
f"to loop: {err.message_text}")

raise TransformationError(err_msg) from err
if routine.name == "ukca_chemistry_ctl_full":

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Only minor comment (and I acknowledge this is more a coding style suggestion):

if routine.name != "ukca...":
    continue

This would allow you to decrease the nesting level.
Us PSyclone devs also recently discussed the handling of transformation errors might need some re-thinking (to allow you to remove the somewhat ugly large outside try block), but we don't have any agreed improved way.
Otherwise I am happy with this.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks Joerg Henrichs (@hiker). Done in commit 704d5b5.

Also remove duplicate copies of this file in favour of symlinks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The CLA has been signed as part of this PR - added by GA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants