LLM-Assisted Translation of Legacy FORTRAN Codes to C++: A Cross-Platform Study

  • 2025-04-21 20:34:37
  • Nishath Rajiv Ranasinghe, Shawn M. Jones, Michal Kucer, Ayan Biswas, Daniel O'Malley, Alexander Buschmann Most, Selma Liliane Wanna, Ajay Sreekumar
  • 0

Abstract

Large Language Models (LLMs) are increasingly being leveraged for generatingand translating scientific computer codes by both domain-experts and non-domainexperts. Fortran has served as one of the go to programming languages in legacyhigh-performance computing (HPC) for scientific discoveries. Despite growingadoption, LLM-based code translation of legacy code-bases has not beenthoroughly assessed or quantified for its usability. Here, we studied theapplicability of LLM-based translation of Fortran to C++ as a step towardsbuilding an agentic-workflow using open-weight LLMs on two differentcomputational platforms. We statistically quantified the compilation accuracyof the translated C++ codes, measured the similarity of the LLM translated codeto the human translated C++ code, and statistically quantified the outputsimilarity of the Fortran to C++ translation.