arXiv:2606.08710cs.SEcs.AI2026-06

用结构化智能体AI,3个月内将6万行科学代码从Fortran转为C++并行版

Structuring agentic AI for HPC code modernization

  • 设计带人工示例的结构化智能体流程,确保代码持续可构建
  • 成功将单线程Fortran MPI程序转为OpenMP+C++并行版本
  • 适合科研软件工程人员参考,尤其关注代码现代化挑战者

现代科学计算代码的现代化对于应对不断变化的计算资源生态至关重要。并行化与迁移至不再受支持的软件生态系统是研究软件工程中最耗时的任务之一。本文报告了我们对一个约6万行、基于再生核粒子法(RKPM)的3D显式固体力学物理引擎NMAP-RKPM的两次阶段式AI辅助现代化的成功经验。该程序原为单线程、基于Fortran的MPI应用,我们仅用数月便成功转化为基于OpenMP并行的C++ MPI工具。尽管纯大语言模型(LLM)工具表现不足,但通过采用高度结构化的‘引导式’智能体方法——包括提供人工创建的示例、保证持续可构建性及限制会话范围——取得了显著成效。本文详细展示了成功的AI辅助步骤、所克服的问题及其背后的设计思路。

原文摘要 · Abstract (English)

Modernization of legacy scientific codes is often necessary to keep up with the ever-evolving changes in the compute resource ecosystem. Parallelization and migration from poorly supported software ecosystems are two of the most time-consuming activities in the research software engineering field. This paper presents our experience in the successful, two-phase AI-assisted modernization of NMAP-RKPM, a roughly 60,000-line, 3D explicit solid mechanics physics engine based on the Reproducing Kernel Particle Method (RKPM). We converted this single-threaded, Fortran based MPI application into a OpenMP-parallel C++ based MPI tool in the span of a few months. While Large Language Model (LLM) based tools on their own proved inadequate, we developed a highly structured "hand-holding" agentic AI methodology, like providing manually created examples, ensuring continuous buildability and limiting session scope, that was instead highly effective. The paper provides both the AI-assisted steps that were successful and the problems that we had to overcome, alongside the reasoning behind the chosen path.

代码现代化智能体AI高性能计算科学计算

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。