Migrating a Legacy Scientific Application with an AI Coding Agent: NICAM from Fortran to Kokkos
Xuanzhengbo Ren, Takashi Shimokawabe, Hisashi Yashiro
Abstract
Migrating from Fortran to C++/Kokkos broadens access to hardware accelerators through backends such as CUDA and HIP while offering greater flexibility in software design. However, legacy Fortran applications often have large codebases, making manual porting time-consuming and costly. Recent advances in large language models (LLMs) and AI coding agents have made large-scale code migration increasingly feasible. In this study, we ported NICAM (Nonhydrostatic ICosahedral Atmospheric Model), a legacy Fortran climate model accelerated with OpenACC, to C++/Kokkos with the assistance of Claude Code. The agent translated the code directly from Fortran to C++/Kokkos under human review. Approximately 140,000 lines of Fortran were analyzed and ported into 35,000 lines of C++/Kokkos, covering the dynamical core and seven physics packages. A 100-member ensemble comparison with the original Fortran model showed that the port is statistically consistent with the original. Performance was evaluated on Miyabi-G, an NVIDIA GH200 cluster, and Sirius, an AMD MI300A cluster. Compared with the Fortran/OpenACC baseline on GH200, the port achieved application speedups of 1.71× on GH200 and 1.54× on MI300A. The CUDA build achieved a GPU kernel-time speedup of 1.38× on GH200. After normalization by peak memory bandwidth, the HIP build on MI300A achieved 0.96× the kernel performance of the Fortran/OpenACC baseline.
Create a lesson
Related papers
More with Less: Efficient Parallel Scientific Code Translation via an Agent-Skill Workflow
Shared title terminology · Jianuo Shen, Pengyi Xu, Bo Zhang
Can Agentic LLMs Write Task-Based Parallel Code? A Study of OpenMP Tasking, HPX, StarPU and TTG
Shared title terminology · Linus Bantel, Anna-Lena Roth, Tim Thüring et al.
PegasusAI Studio: Legible Cyberinfrastructure and Accountable AI Agents for Scientific Workflows
Shared title terminology · Komal Thareja, Mats Rynge, Berent Aldikacti et al.
Falcons: Pushing the Speed-Ratio Limits of Lossy Compression for Parallel Scientific Applications
Shared title terminology · Bing Lu, Jinyang Liu, Xinyang Ma et al.
Contexture: Runtime Context Eviction for High-Throughput Agent Serving
Shared title terminology · Colin Hong, Bryan Shan, Wei Siong Pang et al.
Aggron: Aggressive Compression of Agentic KV Caches during Head-of-Line Stalls in the Request Queue
Shared title terminology · Rishabh Ravi, Tony Hong, Chen Wang et al.