arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2407.05202cs.SEcs.AI
收藏

利用 LLM 的力量:面向高性能计算的自动化单元测试生成

Harnessing the Power of LLMs: Automating Unit Test Generation for High-Performance Computing

University Of Houston(休斯顿大学);Kent State University(肯特州立大学)

Rabimba Karanjai, Aftab Hussain, Md Rafiqul Islam Rabin, Lei Xu, Weidong Shi, Mohammad Amin Alipour

AI总结:

针对高性能并行科学软件单元测试成本高、现有工具效果差的问题,本文利用 Davinci 与 ChatGPT 为 C++ 并行程序自动生成单元测试,验证了 LLM 的有效性及局限。

摘要:

单元测试在软件工程中对于确保质量至关重要。然而,由于并行和高性能计算软件(尤其是科学应用)用户群体较小且多样、逻辑复杂,单元测试在这类软件中并未得到广泛应用。这些因素使单元测试既困难又昂贵,因为它需要专业知识,而且现有自动化工具往往效果不佳。为解决这一问题,我们提出一种为此类软件自动生成单元测试的方法,充分考虑其复杂逻辑和并行处理等独有特征。近年来,大语言模型(LLM)在编程和测试方面展现出潜力。我们探索了 Davinci(text-davinci-002)和 ChatGPT(gpt-3.5-turbo)为 C++ 并行程序创建单元测试的能力。结果表明,LLM 能够生成基本正确且全面的单元测试,但仍存在一些局限,例如重复断言和空白测试用例。

英文摘要:

Unit testing is crucial in software engineering for ensuring quality. However, it's not widely used in parallel and high-performance computing software, particularly scientific applications, due to their smaller, diverse user base and complex logic. These factors make unit testing challenging and expensive, as it requires specialized knowledge and existing automated tools are often ineffective. To address this, we propose an automated method for generating unit tests for such software, considering their unique features like complex logic and parallel processing. Recently, large language models (LLMs) have shown promise in coding and testing. We explored the capabilities of Davinci (text-davinci-002) and ChatGPT (gpt-3.5-turbo) in creating unit tests for C++ parallel programs. Our results show that LLMs can generate mostly correct and comprehensive unit tests, although they have some limitations, such as repetitive assertions and blank test cases.

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

↑