Skip to content

371 fab transmute support - #442

Open
Joerg Henrichs (hiker) wants to merge 124 commits into
MetOffice:mainfrom
hiker:371_fab_transmute_support
Open

371 fab transmute support#442
Joerg Henrichs (hiker) wants to merge 124 commits into
MetOffice:mainfrom
hiker:371_fab_transmute_support

Conversation

@hiker

@hiker Joerg Henrichs (hiker) commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

PR Summary

This PR adds support for transmutation. While this is atm not used in lfric_core, it could be useful to have it available here (since it allows e.g. testing of PSyclone transmute steps with the much smaller skeleton apps, which gives a much quicker turnaround compared to compiling lfric_atm).

Sci/Tech Reviewer:
Code Reviewer: Matthew Hambley (@MatthewHambley)

This adds the psyclone control yaml file, which can be used to specify in detail when/how to run dsl and transmute phases on code.

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)

I have run the simple example for skeleton, but not the rose-stem suite. I have also similarly confirmed that lfric_atm works with this change (once the lfric_atm Fab script is added). Again only using the simple example build and test, not any cylc suite.

trac.log

Security Considerations

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

Performance Impact

  • [N/A] 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)

The psyclone_control_test.py file has been initially created with copilot, but was then manually cleaned up and fixed.

Documentation

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

PSyclone Approval

  • [N/A] 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

Joerg Henrichs (hiker) and others added 30 commits January 23, 2026 17:40
…be required for lfric_apps. Minor code updates.

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 don't think the big lists of work is the way we want to go in the long run, but given this change is written, and modifying it would likely take a considerable amount of effort, we can go ahead with this now and change it later.

Comment on lines +109 to +122
# A simplified example to use mirrors could be (which would
# typically be implemented in a derived, site-specific class)
# root = Path("/root/of/mirrors")
# mirrors = {"git@github.com:MetOffice/casim.git": root / "casim",
# "git@github.com:MetOffice/jules.git": root / "jules",
# }
# for dependency in dep_info.get_repo_names():
# repo_infos = dep_info.get_repo_info(dependency)
# for source_ref in repo_infos:
# if source_ref.source in mirrors:
# logger.info(f"Using mirror "
# f"'{mirrors[source_ref.source]}' for "
# f"'{source_ref.source}")
# source_ref.source = mirrors[source_ref.source]

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.

Can this example be included in the docstring, and therefore the documentation?

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.

Depends on previous solution. Imho, moving DependencyInfo to Fab would be best (avoiding code duplication between lfric and UM and potentially other codes; and the documentation would nicely go into the Fab documentation of 'usage pattern'


:param build_config: the Fab build configuration instance
'''
print("SiteConfig default GNU")

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.

Is this left over debug or intentional logging. If the latter, is there a way to use the logging framework?

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.

Oops, indeed a debug print. Removed

# initialising compilers
self._args = args

def update_repos(self, dep_info):

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.

Type hinting please.

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.

Now this is a really difficult question.
IIRC, we decided to have DependencyInfo added to LFRic apps only. So, I can't typehint it here, the class is not known.

If I would move this function into lfric_apps, we would in one way or another duplicate a lot of code:

  1. We add site_config settings to apps. Then we have two sources of 'standard lfric' compilation flags, one in core, one in apps.
  2. We add this as an application specific setting (which will be added for lfric_atm in https://github.com/hiker/lfric_apps/tree/513_more_fab_scripts). Then we still have the problem if/when there are other applications that needs a git checkout (not certain if there are tbh), that we need to duplicate the mirror handling.
  3. We add site_config settings to lfric_apps, and inherit from the site_config settings in core. That might work, though it complicates the setup a bit more.
  4. We add DependencyInfo to Fab instead (see Supporting dependencies.yaml and mirrors? fab#563 where I suggested this). Note that the UM also uses dependency info, so moving this class into Fab would also solve this code duplication.

Amy comments?

# Test case 3: No PSykal but optimisation directory
optimisation_folder_path = (tmp_path / "optimisation" / "default-default" /
"psykal")
# Test case 2: No PSykal but optimisation directory

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.

Can these various test cases be split into separate test functions? Maybe with fixtures for commonly used harnes? Maybe parameterised tests?

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.

Support PSyclone transmute in Fab scripts

5 participants