Solving Nonlinear PDEs Using CUDA - Johannesson,Anna (LU-CS-EX, 2025)
Partial differential equations (PDEs) are central in many scientific research areas, including modeling physical phenomena and economic forecasting. While the general solutions of PDEs can be complex, we can determine a particular solution by introducing boundary conditions and/or initial conditions. This is called an Initial Boundary Value Problem (IBVP). Thalassa is a framework that generates solvers for IBVPs in PyTorch, target- ing both CPU and GPU execution. One goal of this thesis was to extend Thalassa to produce solvers in CUDA C++. We compared the performance of the PyTorch solvers to their CUDA C++ counterparts, using different PDEs and problem sizes, focusing on the execution time. We also profiled the CUDA C++ solvers in order to identify bottlenecks that would affect the speed of the CUDA C++ solvers. Our results show that the CUDA C++ solvers outperformed their equivalent PyTorch solvers, targeting both the CPU and the GPU. Speedups ranged from 3.5x to 77x compared to PyTorch GPU solvers, and from 52x to 160x compared to PyTorch CPU solvers. The generated CUDA C++ solvers were limited by architectural factors such as shared memory and register availability, as well as runtime factors like memory latency and warp-level stalls. Additionally, performance depended on manual tuning of thread block sizes.
Keywords: partial differential equations; finite difference methods; CUDA; GPU computing; parallel programming; code generation; performance profiling