Skip to content

Change subfolders for optimisations from site to architecture - #767

Merged
James Bruten (james-bruten-mo) merged 14 commits into
MetOffice:mainfrom
MetBenjaminWent:swap_site_to_architecture
Oct 23, 2026
Merged

James Bruten (james-bruten-mo) merged 14 commits into
MetOffice:mainfrom
MetBenjaminWent:swap_site_to_architecture

Conversation

@MetBenjaminWent

@MetBenjaminWent Benjamin Went (MetBenjaminWent) commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

PR Summary

We have a-lot of duplication of the scripts due to the site name. Originally the intention of the site folder was to contain within it the ideal optimisations, given it's specific hardware architecture requirements.
However, to run the scripts, we are forced to duplicate the scripts for other sites, even though they require no specific site changes.
If we move from sites to hardware architecture, and allow the site to point at specific architecture as required, we maintain the origonal principle, but reduce the duplication and overhead updating all of the scripts together.

To begin with we will have:

  • minimum
  • cpu

With space to expand to allow for example:

  • cpu_ex
  • cpu
  • gpu_nvidia
  • gpu_arm
    (Please use underscore rather than a dash in the names, this causes issues with FAB)

Where these are then set by the sites specific marco, to dictate the type of architecture these will use.

This means CPU sites which all use EXs no longer need to have duplication given the site name, however with scope to allow custom versions of the scripts if the sites require it.

Discussion to get other perspectives: https://github.com/MetOffice/lfric_apps/discussions
Also discussed in a sync with STFC and EPCC, they have no issues with this PR.

Sci/Tech Reviewer: Matthew Walker (@mattatmet)
Code Reviewer: Oakley Brunt (@oakleybrunt)

Umbrella: #424
Issue: #766

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

Builds have failed due to usual AZ timeouts - I spent all day re-sending them, and these still failed due to leaving work.

Test Suite Results - lfric_apps - swap_site_to_architecture/run6

Suite Information

Item Value
Suite Name swap_site_to_architecture/run6
Suite User benjamin.went
Workflow Start 2026-09-10T12:03:22
Groups Run developer
Dependency Reference Main Like
casim MetOffice/casim@2026.07.1 True
jules MetOffice/jules@2026.07.1 True
lfric_apps MetBenjaminWent/lfric_apps@swap_site_to_architecture False
lfric_core MetOffice/lfric_core@3e965e8 True
moci MetOffice/moci@2026.07.1 True
SimSys_Scripts MetOffice/SimSys_Scripts@77a5166 True
socrates MetOffice/socrates@2026.07.1 True
socrates-spectral MetOffice/socrates-spectral@2026.07.1 True
ukca MetOffice/ukca@9fc2b6d True

Task Information

❌ failed tasks - 5
Task State
build_jedi_lfric_tests_azspice_gnu_fast-debug-64bit-rsolver64 failed
build_jedi_lfric_tests_azspice_gnu_full-debug-64bit failed
build_jules_azspice_gnu_fast-debug-64bit failed
run_gungho_model_rk-dcmip301-C24_azspice_gnu_fast-debug-64bit failed
run_gungho_model_schar_cart-BiP200x8-500x500_azspice_gnu_fast-debug-64bit failed
✅ succeeded tasks - 1191

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 HPC Optimisation Team

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

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.

Looks all good to me and makes sense to change. The only changes I would suggest are to update the documentation. There are a few references to sites in the psyclone part of the docs that could do with being adapted to this new structure.

@MetBenjaminWent

Copy link
Copy Markdown
Contributor Author

Looks all good to me and makes sense to change. The only changes I would suggest are to update the documentation. There are a few references to sites in the psyclone part of the docs that could do with being adapted to this new structure.

Sure, I've updated the apps docs to reflect the changes in the PR.

@mattatmet

Copy link
Copy Markdown
Contributor

Sure, I've updated the apps docs to reflect the changes in the PR.

Looks great, thanks!

@oakleybrunt

Copy link
Copy Markdown
Contributor

Benjamin Went (@MetBenjaminWent) can you explain to me the duplication across site macros? Are these intended to be edited such that the default may not be cpu?

task_values["build_memory"]
) }}

{# Set the psyclone transformation #}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As the options for each site are all the same, I think it'd be better to keep that logic here rather than having it in the site macros files

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The idea was that each site might still have their own scripts requirements. It looks like duplication, but it's not.
Currently there isn't a usecase for another site having another option, but it'll come as soon as we start having GPU specific sites and Psyclone scripts.

If we raise it up to the runtime build, sites can't set it induvdually anymore, which is not the aim of this PR (to remove duplication, but leave the door open for the origonal intent of the site folders).

I'm planning like to leave it in the macros for now, unless we can think of a better way of sites setting this flag.
Macros felt like the right place.
I could as a comprimise set the default in the generate runtime to minimum (whuch is the fallback default), and then the macros override?

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.

What if this is set at the bottom of the task definitions for each site and app?

for example, in rose-stem/site/nci/lfric_atm/tasks_lfric_atm.cylc:

{% if "psyclone_transformation" not in task_dict %}
   {% do task_dict.update({"psyclone_transformation": "MY_SITE_DEFAULT"}) %}
{% endif %}

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.

Otherwise the default is cpu

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not opposed to it being set by each site in their respective cylc files.

But that's also what the marcos are doing?

The default should be minimum, and overidden to cpu

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Also due to the default task definitons, there is always default in task_values["psyclone_transformation"]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

That's fair, if there's a requirement for sites to be able to override then I'm happy with the macros approach.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks James

@MetBenjaminWent

Benjamin Went (MetBenjaminWent) commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Benjamin Went (Benjamin Went (@MetBenjaminWent)) can you explain to me the duplication across site macros? Are these intended to be edited such that the default may not be cpu?

Yes, the intent is that each site can still pick a different script method.

When GPUs come along, those sites will put gpu, or something to that effect to access a folder of gpu specific scripts.

It's so that we have preserved the origonal intent of site specific scripts, but removed the duplication.

But sites still need a method of picking different scripts, and thats where the macros come in.

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.

Since James is happy with the implementation then I'm happy. All approved, this is a good change.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Happy with these changes now

@james-bruten-mo
James Bruten (james-bruten-mo) merged commit 4c470df into MetOffice:main Oct 23, 2026
5 checks passed
@matthewrmshin

Copy link
Copy Markdown

This change appers to break our routine building of applications/jedi_lfric_tests with python3 ./build/local_build.py jedi_lfric_tests -p meto-ex1a .... I'm getting:

make: Entering directory '/var/tmp/lfric_apps/applications/jedi_lfric_tests'
Makefile:49: *** PSyclone transformation dir "meto-ex1a" does not have a global.py script.  Stop.
make: Leaving directory '/var/tmp/lfric_apps/applications/jedi_lfric_tests'

Any advice how to fix?

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.

6 participants