Manifestations

Café Fortran - FGPT: Automatic Transpilation of Fortran to Python, JAX, and Automatic Differentiation

par Kazem Ardaneh (IPSL), Shivamshan Sivanesan (IPSL)

→ Europe/Paris
Description
FGPT is a general-purpose source-to-source transpiler that modernizes legacy Fortran. Its dependency-aware isolation frontend, built on the fparser parser, uses breadth-first search to traverse module dependencies — resolving declarations, subroutine definitions, interfaces, and external procedures — and extracts each target procedure into a standalone unit. An AST-based middle-end then lowers Fortran into Python/NumPy, differentiable Fortran via Tapenade, or GPU-adapted Fortran, while a JAX backend produces Equinox modules for GPU acceleration and automatic differentiation. Unlike LLM-based approaches, FGPT preserves program semantics and validates every output numerically against the original Fortran. Evaluated on some modules (~15,000 lines) of the IPSL land-surface model (~300,000 lines), it delivers correct, differentiable implementations with deviations of 10⁻⁹–10⁻¹⁶ and up to 3.66× speedup in JAX over compiled Fortran — no manual rewriting required.
Organisé par

Fabrice Roy