Evaluating LLMs for Translating Legacy Fortran Atmospheric Physics to GPU-Accelerated JAX
Iris Linck, John Dennis, John Schreck, Karen Stengel, David John Gagne
Abstract
Legacy Fortran physics packages in atmospheric models such as CESM, WRF, and E3SM pose a barrier to GPU modernization, while manual porting requires accelerator-programming expertise. We present LAFT (LLM-Assisted Fortran Translation), an agentic framework for converting Fortran atmospheric physics parameterizations into GPU-accelerated JAX while preserving numerical agreement with the Fortran reference. LAFT coordinates source-code analysis, translation, repair, runtime validation, and performance profiling. It combines a deterministic front end for metadata extraction and bridge generation, structured translation prompts, numerical validation, and profiling-guided feedback to identify inefficient execution patterns. The bridge handles array-layout conversion separately from scientific computation. We evaluate LAFT using the Kessler warm-rain microphysics scheme and four LLMs: Claude, GPT, Gemini, and Qwen. All four validated translations reproduce the Fortran reference outputs to near floating-point precision for the evaluated case, but their GPU performance differs substantially with execution design. The Gemini-generated implementation achieves up to a 357-fold speedup over serial Fortran in cached execution at 1,000,000 atmospheric columns, excluding compilation and host-device transfers. The results demonstrate that numerical agreement alone does not ensure efficient GPU execution and motivate combining numerical validation with hardware-aware performance analysis. LAFT provides a practical workflow for modernizing legacy atmospheric physics code through LLM-assisted translation, deterministic interface generation, automated validation and repair, and reproducible profiling.
Create a lesson
Related papers
Morphology-based retrieval of local wave parameters and phase shifts in satellite-observed atmospheric disturbances
Yuriy Klymenko, Alla Fedorenko, Evgen Kryuchkov et al.
Parametric wave spectrum models for prediction of Stokes drift profiles
W. Erick Rogers, Yalin Fan, Luis Zamudio et al.
legoESM: a modular, differentiable, multiscale, AI-ready Earth system model built with AI agents
Pierre Gentine, Dhruv Balwada, Aytaç Paçal et al.
A Physics-Constrained Implicit Profile Network for Continuous Reconstruction of Tropical Cyclone Near-Surface Wind Profiles
Jian Ma, Yilin Yang, Robert Rogers et al.
A Graph Neural Network for Global Daily Fire Radiative Power Prediction at Medium-Range Lead Times
Li Zhang, Jun Wang, Isidora Jankov et al.
Three-dimensional Lagrangian ecosystems: carbon dynamics and potential for artificial fertilization
Stefano Campagnola, Stephanie Dutkiewicz, Michael J. Follows et al.