In this study, we present a novel dataset for training machine learning models translating between OpenMP Fortran and C++ code. To ensure reliability and applicability, the dataset is created from a range of representative open-source OpenMP benchmarks. It is also refined using a meticulous code similarity test. The effectiveness of our dataset is assessed using both quantitative (CodeBLEU) and qualitative (human evaluation) methods. We showcase how this dataset significantly elevates the translation competencies of large language models (LLMs). Specifically, models without prior coding knowledge experienced a boost of $\mathbf{\times~5.1}$ in their CodeBLEU scores, while models with some coding familiarity saw an impressive $\mathbf{\times~9.9}$-fold increase. The best fine-tuned model using our dataset outperforms GPT-4. It is also reaching human-level accuracy. This work underscores the immense potential of our dataset in propelling advancements in the domain of code translation for high-performance computing. The dataset is accessible at \href{https://github.com/bin123apple/Fortran-CPP-HPC-code-translation-dataset}{OpenMP-Fortran-CPP-Translation}.
翻译:本研究提出一种用于训练机器学习模型的新型数据集,旨在实现OpenMP Fortran与C++代码间的互译。为确保可靠性与适用性,该数据集构建自一系列具有代表性的开源OpenMP基准测试程序,并通过严谨的代码相似性测试进行优化。我们采用定量(CodeBLEU)与定性(人工评估)相结合的方法验证数据集的效能,并展示了该数据集如何显著提升大语言模型(LLMs)的代码翻译能力。具体而言,无编程基础模型的CodeBLEU评分跃升了$\mathbf{\times~5.1}$倍,而具备一定编程经验模型的评分更是实现了$\mathbf{\times~9.9}$倍的显著提升。基于本数据集微调的最优模型不仅超越了GPT-4的性能,更达到了人类级别的翻译精度。该研究充分彰显了本数据集在推动高性能计算领域代码翻译技术发展方面的巨大潜力。数据集可通过\href{https://github.com/bin123apple/Fortran-CPP-HPC-code-translation-dataset}{OpenMP-Fortran-CPP-Translation}获取。