针对高性能并行科学软件单元测试成本高、现有工具效果差的问题,本文利用 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.
Harnessing Large Language Models for Software Vulnerability Detection: A Comprehensive Benchmarking Study
School of Information Technologies Tallinn University of Technology(塔林理工大学信息技术学院);School of Informatics, Computing, and Cyber Systems Northern Arizona University(北亚利桑那大学信息学、计算与网络系统学院)
MigGPT: Harnessing Large Language Models for Automated Migration of Out-of-Tree Linux Kernel Patches Across Versions
State Key Lab of Processors, Institute of Computing Technology, CAS(处理器国家重点实验室,计算技术研究所,中国科学院);University of Chinese Academy of Sciences(中国科学院大学);Zhongguancun Laboratory(中关村实验室);Tsinghua University(清华大学)
Harnessing non-adversarial robustness in large language models
Applied AI Institute, Moscow, Russia(莫斯科应用人工智能研究所);King's College London, London, UK(伦敦国王学院);International Joint Laboratory of AI for Industry, QUST, Qingdao, China(工业人工智能联合实验室)
Automating Legal Interpretation with LLMs: Retrieval, Generation, and Evaluation
Wangxuan Institute of Computer Technology, Peking University(北京大学王轩计算机技术研究所);Institute for Artificial Intelligence, Peking University(北京大学人工智能研究所);Peking University Law School(北京大学法学院)
Pre-review to Peer review: Pitfalls of Automating Reviews using Large Language Models
AllSci Corp(AllSci公司);Sunwater Capital(Sunwater资本);Kellogg School of Management, Northwestern University(西北大学凯洛格管理学院);Dept. of Computer Science, Northern Illinois University(北伊利诺伊大学计算机科学系);Institute of Foundation Models, MBZUAI(基础模型研究所,MBZUAI)
Meta-Prompting for Automating Zero-shot Visual Recognition with LLMs
ICG, TU Graz(格拉茨工业大学ICG研究所);CDL-EML(CDL-EML中心);MIT-IBM Watson AI Lab(麻省理工学院-IBM沃森人工智能实验室);JKU(约翰内斯开普勒大学);IBM Research(IBM研究院);Weizmann Institute of Science(魏茨曼科学研究所);University of Bonn(波恩大学)
Harnessing LLMs for Automated Video Content Analysis: An Exploratory Workflow of Short Videos on Depression
The University of Texas at Austin(德克萨斯大学奥斯汀分校);Institute of High Performance Computing (IHPC), A*STAR(高性能计算研究所(A*STAR));Pennsylvania State University(宾夕法尼亚州立大学);Clark University(克拉克大学);Columbia University(哥伦比亚大学)
Transcending Language Boundaries: Harnessing LLMs for Low-Resource Language Translation
School of Computing, The University of Georgia(佐治亚大学计算学院);Second Language Acquisition and Teaching, University of Arizona(亚利桑那大学第二语言习得与教学系);University of Alberta(阿尔伯塔大学);Department of History, The University of Georgia(佐治亚大学历史系);National GENIUS Center(国家GENIUS中心);AI4STEM Education Center, University of Georgia(佐治亚大学AI4STEM教育中心);Department of Mathematics, Science, and Social Studies Education, University of Georgia(佐治亚大学数学、科学与社会研究教育系)