LLM-Driven Fortran-to-C/C++ Portability for Parallel Scientific Codes
We define the fundamental practices and criteria for evaluating and using the Meta Llama 3 and OpenAI ChatGPT 3.5 and 4o large language models (LLMs) to translate parallel scientific Fortran + OpenMP and Fortran + OpenACC codes to C/C++ codes that can leverage vendor-specific libraries (CUDA, HIP) for GPU acceleration in addition to other performance-portable programming models (e.g., Kokkos, OpenMP, OpenACC). In this study, LLMs are used to translate 11 different parallel Fortran codes with some of the most popular and widely used kernels/proxies in high-performance computing (HPC): AXPY, GEMV, GEMM, Jacobi, SpMV, and the >200-line Hartree-Fock application proxy, which implements a solver for quantum many-body systems. In all, we analyze the correctness and reproducibility of more than 1,650 AI-generated parallel C/C++ codes. Additionally, we evaluate the performance of Fortran codes and AI-generated C/C++ codes on two modern HPC architectures—one AMD EPYC Rome CPU with 64 cores and one NVIDIA Ampere A100 GPU. We use multi-modal prompting and fine-tuning techniques for LLMs to produce parallel scientific C/C++ codes with high levels of correctness (more than 95% of the codes are well ported) and speedups of up to an order of magnitude versus Fortran + OpenMP and Fortran + OpenACC codes on the same system.
Authors
- Keita Teranishi (ORCID: https://orcid.org/0000-0001-6647-2690)
- William F. Godoy (ORCID: https://orcid.org/0000-0002-2590-5178)
- Jeffrey S. Vetter (ORCID: https://orcid.org/0000-0002-2449-6720)
- J. Gonzalez (ORCID: https://orcid.org/0009-0007-1597-3963)
- Pedro Valero‐Lara (ORCID: https://orcid.org/0000-0002-1479-4310)
- Alexis Huante (ORCID: https://orcid.org/0009-0008-2818-0265)
- José Antonio González (ORCID: https://orcid.org/0000-0003-2751-7555)
- Yuan Tang (ORCID: https://orcid.org/0000-0001-6772-9427)
- Hallyma Gauthier-Chaparro
Institutions
- Oak Ridge National Laboratory (US)
- Texas A&M International University (US)
- The University of Texas at El Paso (US)
- University of Puerto Rico System (PR)
- University of California, Berkeley (US)
Publication Details
- Published
- 2025-09-15
- DOI
- https://doi.org/10.1109/escience65000.2025.00083
- Primary Topic
- Distributed and Parallel Computing Systems
- Type
- article
- Field-Weighted Citation Impact
- 0.00