用智能体自动化改造大型旧代码,零误差迁移量子化学核心模块。
An Agentic Workflow for Legacy HPC Modernization: Converting the Two-Electron-Integral Core of GAMESS
- 设计三角色智能体协作流程,自动完成代码重构
- 12个文件5.6万行代码转换后0处化学差异,测试全通过
- 适合大规模科学计算代码现代化的团队参考
现代化工遗留的Fortran代码面临规模挑战:单个转换虽简单,但代码库庞大,多数工作难以推进。本文提出一种代理工作流,在生产规模上实现代码现代化,并评估其可扩展性。三个专精提示的角色在版本控制规范下协同工作,该规范由代理自身编写与修订,人类仅保留少量决策权。系统通过领域内继承的精确验证工具保障安全,安全边界即验证工具失效之处。本研究以拥有48年历史的量子化学软件GAMESS为例,将其中两个电子积分计算核心从固定格式Fortran 77转换为自由格式Fortran 2008。涉及12个源文件、56,448行代码和225个子程序。智能体以Claude Code角色在隔离工作树中运行,跨越四代Claude模型。由于GAMESS用户社区以标准测试套件输出的能量值为基准,我们采用逐位一致作为合并标准——十二位小数偏差即判定失败。所有12个文件通过包含49个标准测试及2个额外计算的51项验证,612次测试中无任何化学相关差异,且全部通过连续集成所用的Jenkins测试。
原文摘要 · Abstract (English)
Modernizing legacy Fortran is a problem of volume: the transformations are individually routine, but the codebases can be enormous, and across much of computational science the work simply goes undone. We propose an agentic workflow that takes this work on at production scale, and we set out to measure how far such delegation can reach. In this work, three prompt-specialized agent roles operate under a version-controlled specification that the agents themselves authored and revised, while humans hold a small number of gates. The arrangement is kept safe by an exact verification oracle inherited from the domain, and the boundary of safe delegation lies exactly where that oracle stops seeing. We apply the proposed workflow in a case study, converting the two-electron-integral routines of GAMESS (General Atomic and Molecular Electronic Structure System), a mature quantum-chemistry package with a 48-year development history, from fixed-form Fortran 77 to free-form Fortran 2008. The scope of this work was twelve source files, 56,448 lines, and 225 subroutines for computing electron repulsion integrals. The agents ran as three Claude Code roles in isolated worktrees, and the work spanned four Claude model generations. Because the GAMESS group ships a standard test suite whose printed energies its user community treats as canonical, we could adopt bit-for-bit reproduction of those energies as the merge criterion, where a deviation in the twelfth decimal place counts as a failure rather than drift. All twelve source files pass a 51-test validation battery comprising the 49 standard GAMESS tests and two additional calculations, and across 612 test runs the number of chemistry-relevant differences is zero, and every file also passes the Jenkins tests that are used for continuous integration.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。