Evaluating AI-generated code for C++, Fortran, Go, Java, Julia, Matlab, Python, R, and Rust
Patrick Diehl, Noujoud Nader, Steve Brandt, Hartmut Kaiser

TL;DR
This paper assesses ChatGPT 3.5 and 4's ability to generate, compile, and run scientific code in multiple languages, revealing strengths and limitations in performance, accuracy, and language support.
Contribution
It provides a comprehensive evaluation of ChatGPT's code generation capabilities across various programming languages for scientific applications.
Findings
Both models successfully generated runnable code.
Performance and accuracy varied by language.
Parallel code generation was particularly challenging.
Abstract
This study evaluates the capabilities of ChatGPT versions 3.5 and 4 in generating code across a diverse range of programming languages. Our objective is to assess the effectiveness of these AI models for generating scientific programs. To this end, we asked ChatGPT to generate three distinct codes: a simple numerical integration, a conjugate gradient solver, and a parallel 1D stencil-based heat equation solver. The focus of our analysis was on the compilation, runtime performance, and accuracy of the codes. While both versions of ChatGPT successfully created codes that compiled and ran (with some help), some languages were easier for the AI to use than others (possibly because of the size of the training sets used). Parallel codes -- even the simple example we chose to study here -- also difficult for the AI to generate correctly.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsComputational Physics and Python Applications
MethodsFocus
