Skip to content

Add skeleton fab script - #246

Merged
Sam Clarke-Green (t00sa) merged 55 commits into
MetOffice:mainfrom
hiker:240_add_skeleton_fab_script
May 5, 2026
Merged

Sam Clarke-Green (t00sa) merged 55 commits into
MetOffice:mainfrom
hiker:240_add_skeleton_fab_script

Conversation

@hiker

@hiker Joerg Henrichs (hiker) commented Jan 27, 2026 •

Copy link
Copy Markdown
Contributor

PR Summary

Sci/Tech Reviewer: Matthew Hambley (@MatthewHambley)
Code Reviewer: Sam Clarke-Green (@t00sa)

Adds a first Fab build script for Skeleton. To keep this change minimal, it's command line only (i.e. no cylc integration, which can come later).

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 Core rose-stem suite
  • If required (e.g. API changes) I have also run the LFRic Apps test suite using this branch
  • 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

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

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

@hiker
Joerg Henrichs (hiker) marked this pull request as draft January 27, 2026 06:04
@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 Jan 27, 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 Jan 27, 2026
@hiker

Copy link
Copy Markdown
Contributor Author

This PR only adds a command-line build system using Fab for the Skeleton apps. It is not at all integrated into cylc or any other test suite. Tests have been added to the infrastructure/build/fab scripts which cover the newly added infrastructure files there.

Some unit tests are based on some AI input to setup the frame work, but have been manually tweaked to ensure code coverage.

Documentation is in form of a README in the above directory, please let me know if you want me to add more elsewhere.

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.

I note that a lot of requests made in the original review on SRS have not been addressed so for convenience I have repeated them here.

Comment thread lfric_build/templaterator.py
Comment thread lfric_build/templaterator.py
Comment thread infrastructure/build/fab/rose_picker_tool.py Outdated
Comment thread infrastructure/build/fab/rose_picker_tool.py Outdated
Comment thread infrastructure/build/fab/rose_picker_tool.py Outdated
Comment thread infrastructure/build/fab/rose_picker_tool.py Outdated
Comment thread lfric_build/site_specific/default/config.py Outdated
Comment thread lfric_build/site_specific/default/config.py Outdated
Comment thread applications/skeleton/fab_skeleton.py
Comment thread applications/skeleton/fab_skeleton.py Outdated
@hiker

Copy link
Copy Markdown
Contributor Author

I note that a lot of requests made in the original review on SRS have not been addressed so for convenience I have repeated them here.

I note that all my comments and questions to your original reviews (as originally agreed a few months ago on MetOffice/lfric-baf#83) have not been addressed so for convenience I will repeat them here.

It will take me a while to get through all your comments, but I will start adding comments now, so ideally we can discuss some of the issue and reach an agreement while I still work on other comments.

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.

This change represents an initial implementation on which we can build.

@t00sa Sam Clarke-Green (t00sa) changed the title 240 add skeleton fab script Add skeleton fab script Mar 19, 2026

@t00sa Sam Clarke-Green (t00sa) left a comment

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.

Thanks, looks good. See comments inline for minor changes.

return

if gfortran.get_version() < (4, 9):
raise RuntimeError(f"GFortran is too old to build dynamo. "

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.

Minor name change:

Suggested change
raise RuntimeError(f"GFortran is too old to build dynamo. "
raise RuntimeError(f"GFortran is too old to build LFRic. "

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.

Done.

Comment thread lfric_build/README.md Outdated
## Setting up Site- and Platform-specific Settings
Site- and platform-specific settings are contained in
```$LFRIC_CORE/infrastructure/build/site-specific/${SITE}-${PLATFORM}```
The default settings are in ```.../site-specific/default``` (and at this

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.

Suggested change
The default settings are in ```.../site-specific/default``` (and at this
The default settings are in ```../site-specific/default``` (and at this

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.

Hmm - I have to admit I don't like this: .. indicates the parent directory, so I fear that this might be understood as site_specific being lfric_core/site_specific, while it is in lfric_core/lfric_build/site_specific.

What about removing the .../ entirely ("... are in site_specific/default"). Or "are in $LFRIC_CORE/lfric_build/site-specific" instead?

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.

For now I've removed the ``.../```, hope that's a good compromise.

Comment thread lfric_build/README.md Outdated
and use the following command:

```
./fab_skeleton.py --nprocs 4 --site nci --platform gadi --suite intel-classic

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.

This should probably be a more generic example. Site flags should be documented separately if they are not required.

Suggested change
./fab_skeleton.py --nprocs 4 --site nci --platform gadi --suite intel-classic
./fab_skeleton.py --nprocs 4

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.

Hmm - I don't like removing this entirely, since it would often end up in using gfortran, while sites might expect intel compiler to be used (if no compiler is specified, fab will pick the first available one in its internal list, which is alphabetically sorted). So, I took --site and --platform out, but left the --suite in, together with a list of the default valid suite names.

Then I added a paragraph to discuss the site-specific setup (which will likely be required, since libraries will likely need additional flags). I hope that's ok.

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.

This is not required. Please delete.

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.

Done.

self.setup_gnu(build_config)
self.setup_nvidia(build_config)
self.setup_cray(build_config)

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.

All the lfric applications currently require netCDF. Would be a good point to check whether any netcdf flags are set and trigger an immediate error rather than waiting for the linker to fail?

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.

Difficult question. Yes, everything needs NetCDF. But the default setup will create a netcdf entry (based on nf-config, though some sites might overwrite this due to issues with nf-config on Crays). So, each linker will have a netcdf entry.

We could test if an entry for netcdf is empty (i.e. no flags), which happens when nf-config is not available. BUT, not specifying flags for NetCDF is de-facto valid on Cray systems (I assume that is still the case, that loading the netcdf module will automatically add the required include and linking flags).

Additionally, typically an application will not explicitly specify a linker (in which case the linking step will pick a linker based on compiler-suite, mpi flags and language of the main program, i.e. Fortran or C). So, before doing the analysis step we will likely not even know which linker to use (since only the analysis step will determine program units).

Now, this is a lot of theoretical thinking of setups, which will likely not happen (I can't see a good reason to link with any LFRic apps with a C compiler wrapper). I checked, on ncas_ex we hard-coded explicit libraries for NetCDF (since nf-config there did not work). So, I've added the test that you recommended, which will abort before starting the actual work.

@hiker

Copy link
Copy Markdown
Contributor Author

I've addressed the issues raised here (though in some cases differently, and am happy to discuss). Brought up to current main; ready for next review.

@t00sa

Copy link
Copy Markdown
Collaborator

Can you go through and add copyright headers to all the files that need them?

@t00sa Sam Clarke-Green (t00sa) left a comment

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.

I've added some suggestions based on changes to the UM versions of similar files.

Comment thread lfric_build/site_specific/default/setup_script_gnu.py Outdated
Comment thread lfric_build/site_specific/default/setup_script_gnu.py
Comment thread lfric_build/site_specific/default/config.py Outdated
Comment thread lfric_build/site_specific/default/config.py Outdated
Joerg Henrichs (hiker) and others added 6 commits May 4, 2026 11:03
Co-authored-by: Sam Clarke-Green <74185251+t00sa@users.noreply.github.com>
Co-authored-by: Sam Clarke-Green <74185251+t00sa@users.noreply.github.com>
Co-authored-by: Sam Clarke-Green <74185251+t00sa@users.noreply.github.com>
Co-authored-by: Sam Clarke-Green <74185251+t00sa@users.noreply.github.com>
@hiker

Copy link
Copy Markdown
Contributor Author

Can you go through and add copyright headers to all the files that need them?

Thanks, done. I did notice that there seems to be two different templates, one with year, one without. I used the one with year, not sure what you prefer.

@hiker

Copy link
Copy Markdown
Contributor Author

I've added some suggestions based on changes to the UM versions of similar files.

All applied, thanks a lot!!

@t00sa Sam Clarke-Green (t00sa) left a comment

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.

Looks good. Approved

@t00sa Sam Clarke-Green (t00sa) left a comment

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.

Re-approving.

@t00sa
Sam Clarke-Green (t00sa) merged commit 18ccb42 into MetOffice:main May 5, 2026
7 checks passed
@hiker
Joerg Henrichs (hiker) deleted the 240_add_skeleton_fab_script branch June 10, 2026 04:38
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.

Add Fab build script for Skeleton apps

6 participants