8000 Python: Example of JIT-compiled Fortran execute from Python by mlange05 · Pull Request #112 · ecmwf-ifs/dwarf-p-cloudsc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

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

Draft
wants to merge 12 commit 8000 s 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
@mlange05 mlange05 force-pushed the naml-python-jit-experiments branch 2 times, most recently from c21105a to c450a31 Compare March 20, 2025 12:30
@mlange05 mlange05 force-pushed the naml-python-jit-experiments branch from c450a31 to d522f94 Compare March 20, 2025 12:54
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
0