Close

Presentation

Facilitating Mixed Python-Fortran HPC Codes: 4D Drift-Kinetic Simulations with Pyccel
DescriptionPython is widely used in scientific computing for prototyping, but its performance and memory overhead limit its suitability for production in high-performance computing (HPC) environments. Pyccel addresses this by translating Python into human-readable Fortran or C, while retaining Python interoperability. Recent developments extend this approach: the pyccel-wrap tool generates Python bindings for existing Fortran/C libraries by mapping functions and classes to Python objects defined in stub files, and pyccel-make enables project-wide builds with CMake or Meson. Together, these features support bidirectional exchange between Python prototypes and low-level implementations. We demonstrate this with PyGyro, a drift-kinetic plasma simulation code. By replacing SciPy’s sparse matrix solver with SeLaLib’s optimized Fortran implementation via pyccel-wrap, we reduce spline solve time by 30% and enable translation of the surrounding loops, removing Python overhead and enabling OpenMP usage. The approach lowers barriers between teams working on Python prototypes and Fortran/C production codes, supporting tighter inter-community collaboration.