arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2509.12136cs.DC
收藏

UniPar:一个用于HPC中并行与加速代码翻译的统一LLM框架

UniPar: A Unified LLM-Based Framework for Parallel and Accelerated Code Translation in HPC

Technion(以色列理工学院);Ben-Gurion University(本-古里安大学);IAEC(以色列原子能委员会);Argonne National Laboratory(阿贡国家实验室);Code Metal;Stanford University(斯坦福大学)

Tomer Bitan, Tal Kadosh, Erel Kaplan, Shira Meiri, Le Chen, Peter Morales, Niranjan Hasabnis, Gal Oren

AI总结:

本文提出UniPar框架,系统评估GPT-4o-mini等LLM在HPC中串行、CUDA与OpenMP间代码翻译能力,通过微调、超参数调优和编译器引导修复将性能提升2倍,并构建了PARATRANS数据集。

摘要:

在不同并行编程语言之间翻译程序是高性能计算(HPC)社区中的一个重要问题。针对该问题的现有工具要么适用范围太窄,要么已经过时。近期大型语言模型(LLMs)普及度的爆发性增长及其生成和翻译代码的能力,提供了一种潜在的替代方法。为此,我们首先需要系统地评估LLMs在并行语言之间进行翻译的能力。在这项工作中,我们引入了UniPar,一个用于基于LLM的并行代码翻译的系统评估框架。具体而言,本工作针对串行代码、CUDA和OpenMP之间的翻译。我们的目标是评估当前的指令微调LLMs——具体为GPT-4o-mini和LLaMA-3.3-70B-Instruct——在开箱即用的情况下或通过已知策略增强后的表现。我们评估了四种主要使用模式:解码的超参数优化、零样本和少样本提示、监督微调,以及通过基于编译器的修复进行迭代反馈。作为评估的一部分,我们构建了一个名为PARATRANS的新数据集,涵盖了串行到并行翻译和跨范式转换。我们的发现表明,尽管现成模型在默认设置下表现不佳(例如,GPT-4o-mini仅达到46%的编译率和15%的功能正确率),但我们的UniPar方法——结合了微调、超参数调优和编译器引导的修复——将性能提升了多达2倍(69%的编译率和33%的正确率)。我们相信,我们的发现将为研究人员进一步改进LLMs以解决并行语言翻译问题提供有用的见解。UniPar源代码和PARATRANS数据集可在我们的GitHub仓库https://github.com/Scientific-Computing-Lab/UniPar_AI获取。

英文摘要:

Translating programs between various parallel programming languages is an important problem in the high-performance computing (HPC) community. Existing tools for this problem are either too narrow in scope and/or outdated. Recent explosive growth in the popularity of large language models (LLMs) and their ability to generate and translate code offers a potential alternative approach. Toward that end, we first need to systematically evaluate the ability of LLMs to translate between parallel languages. In this work, we introduce UniPar, a systematic evaluation framework for LLM-based parallel code translation. Specifically, in this work, we target translations between serial code, CUDA, and OpenMP. Our goal is to assess how well current instruction-tuned LLMs -- specifically GPT-4o-mini and LLaMA-3.3-70B-Instruct -- can be used out of the box or enhanced through known strategies. We evaluated four major usage modes: hyperparameter optimization for decoding, zero- and few-shot prompting, supervised fine-tuning, and iterative feedback through compiler-based repair. As a part of the evaluation, we construct a new dataset called PARATRANS, covering both serial-to-parallel translation and cross-paradigm transformations. Our findings reveal that while off-the-shelf models struggle under the default settings (e.g., GPT-4o-mini achieves only 46% compilation and 15% functional correctness), our UniPar methodology -- combining fine-tuning, hyperparameter tuning, and compiler-guided repair -- improves performance by up to 2X (69% compilation and 33% correctness). We believe that our findings will provide useful insights for researchers to further improve LLMs for the parallel language translation problem. UniPar source code and PARATRANS dataset are available at our GitHub repository https://github.com/Scientific-Computing-Lab/UniPar_AI.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑