Using ChatGPT for Converting Sequential Python Programs into Parallel Code
Document Type
Conference Proceeding
Publication Date
2025
Abstract
This paper investigates ChatGPT capability to automatically convert sequential Python programs into parallel code, addressing the challenge of parallelizing code for multi-core processors. We develop a methodology where sequential code is fed to ChatGPT with prompts to introduce parallel constructs (e.g., multithreading, multiprocessing), and we evaluate the correctness and performance of the AI-generated parallel code. A comparative analysis against traditional parallelization methods—including manual expert refactoring and existing automated tools—highlights the effectiveness and limitations of ChatGPT in parallel code transformation. The results show that ChatGPT can identify independent computations and inject parallelism to achieve notable speedups comparable to human-written parallel code in simple cases, significantly reducing development effort. However, ChatGPT, if not guided by appropriate patterns, fails with more complex scenarios: it may overlook Python-specific constraints, leading to suboptimal or incorrect parallel code that requires manual correction. © 2025 Elsevier B.V., All rights reserved.
Recommended Citation
Czejdo, Denny B.; Daszczuk, Wiktor Bohdan; and Grabski, Waldemar, "Using ChatGPT for Converting Sequential Python Programs into Parallel Code" (2025). College of Health, Science, and Technology. 1175.
https://digitalcommons.uncfsu.edu/college_health_science_technology/1175