From Legacy Fortran to Portable Kokkos:An Autonomous Agentic AI Workflow

📅 2025-09-15
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
Facing the growing heterogeneity in high-performance computing (HPC), legacy Fortran scientific codes suffer a portability crisis due to their lack of native GPU support. This work introduces the first fully automated Fortran-to-Kokkos multi-agent AI workflow, leveraging large language models (LLMs)—specifically GPT-5 and o4-mini-high—to jointly perform code translation, semantic verification, compilation testing, and performance optimization. The framework end-to-end generates functionally correct, cross-platform (CPU/GPU) performance-portable Kokkos C++ code, drastically reducing manual refactoring effort. Experimental evaluation across multiple benchmark kernels demonstrates that automatically translated versions outperform original Fortran implementations on diverse hardware platforms, with per-kernel translation costs under several U.S. dollars. In contrast, open-source LLMs—including Llama4-Maverick—consistently fail. This study provides the first empirical validation of LLMs’ autonomous reasoning and system-level engineering capability in HPC code modernization.

Technology Category

Application Category

📝 Abstract
Scientific applications continue to rely on legacy Fortran codebases originally developed for homogeneous, CPU-based systems. As High-Performance Computing (HPC) shifts toward heterogeneous GPU-accelerated architectures, many accelerators lack native Fortran bindings, creating an urgent need to modernize legacy codes for portability. Frameworks like Kokkos provide performance portability and a single-source C++ abstraction, but manual Fortran-to-Kokkos porting demands significant expertise and time. Large language models (LLMs) have shown promise in source-to-source code generation, yet their use in fully autonomous workflows for translating and optimizing parallel code remains largely unexplored, especially for performance portability across diverse hardware. This paper presents an agentic AI workflow where specialized LLM "agents" collaborate to translate, validate, compile, run, test, debug, and optimize Fortran kernels into portable Kokkos C++ programs. Results show the pipeline modernizes a range of benchmark kernels, producing performance-portable Kokkos codes across hardware partitions. Paid OpenAI models such as GPT-5 and o4-mini-high executed the workflow for only a few U.S. dollars, generating optimized codes that surpassed Fortran baselines, whereas open-source models like Llama4-Maverick often failed to yield functional codes. This work demonstrates the feasibility of agentic AI for Fortran-to-Kokkos transformation and offers a pathway for autonomously modernizing legacy scientific applications to run portably and efficiently on diverse supercomputers. It further highlights the potential of LLM-driven agentic systems to perform structured, domain-specific reasoning tasks in scientific and systems-oriented applications.
Problem

Research questions and friction points this paper is trying to address.

Modernizing legacy Fortran code for GPU-accelerated HPC systems
Automating Fortran-to-Kokkos translation using AI agentic workflows
Achieving performance portability across heterogeneous hardware architectures
Innovation

Methods, ideas, or system contributions that make the work stand out.

AI agents automate Fortran to Kokkos translation
LLM collaboration validates and optimizes code
Produces performance-portable C++ for heterogeneous hardware
🔎 Similar Papers
No similar papers found.