Large language models (LLMs) are increasingly used for generating parallel scientific codes, with a primary focus on generating functionally correct code. Recent work has focused on generating performant code, with an emphasis on its execution time. However, energy efficiency is now recognized as a critical objective, given the significant power demands of large-scale compute systems. This paper addresses the research question of whether LLMs can generate energy-efficient parallel scientific codes when guided by empirical execution feedback. To answer this question, we propose LASSI-EE, an automated LLM-based refactoring framework that generates energy-efficient parallel codes through a multi-stage, iterative approach integrating runtime power profiling, energy-aware prompting, self-correcting feedback loops, and an LLM-as-a-Judge agent for screening generated code. We evaluate LASSI-EE using twenty-two representative scientific benchmarks and applications on NVIDIA A100 and AMD MI100 GPUs. The results indicate an average energy reduction of 36% for MI100 and 34% for A100, across trials that produced passing energy-reducing refactorings.
翻译:大语言模型(LLM)越来越多地被用于生成并行科学代码,其主要关注点在于生成功能正确的代码。近期研究聚焦于生成高性能代码,尤其强调其执行时间。然而,考虑到大规模计算系统的巨大功耗需求,能效现已被公认为关键技术目标。本文探究的核心研究问题为:在经验性执行反馈引导下,大语言模型能否生成高能效的并行科学代码?为解答该问题,我们提出LASSI-EE框架——一种基于大语言模型的自动化重构框架,通过多阶段迭代方法生成高能效并行代码,该方法集成运行时功耗分析、能耗感知提示、自纠错反馈循环,并引入“大语言模型作为裁判”(LLM-as-a-Judge)智能体对生成代码进行筛选。我们在NVIDIA A100和AMD MI100 GPU上使用二十二个代表性科学基准测试与应用程序评估LASSI-EE。结果表明,在产出通过能耗降低重构的试验中,MI100与A100平台的平均能耗分别降低36%与34%。