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

Python: Example of JIT-compiled Fortran execute from Python #112

Draft
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

mlange05
Copy link
Collaborator

This PR provides a first example of how the Just-in-Time (JIT) compilation infrastructure from loki.build can be used to on-the-fly compile the CLOUDSC kernel and invoke it form Python with Numpy arrays.

This change requires two main steps:

  • Extension to the utilities in the current cloudscf2py sub-package to account for the transposed Fortran array layout.
  • A slightly hacky/hand-holding implementation of the JIT compilation and linkage against the common lib.

The latter step is by no means clean, but highlights the challenges for JIT-compiling self-contained IFS-style kernels/parametrisations.

Please note that the linkage to the common sub-library also requires a dynamic library build!

A few other small updates and clean-ups:

  • Updated Loki API usage for regenerating the pure-Python kernel via Loki transformation
  • Re-organise Fortran sources into a sub-directory and move Python validation into separate sub-package
  • Clean up file-read and validation utilities and add simple docstrings
  • Add transpose functionality for input reads and validation steps

@mlange05 mlange05 requested a review from reuterbal January 22, 2025 09:43
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.

1 participant