This project implements a GPU-accelerated simulation of heat distribution on a 2D metal plate using the Jacobi iterative method.
The serial implementation is based on the OpenACC Training Materials provided by OpenACC.org
This repository extends the original tutorial by adding a CUDA version for GPU acceleration.
Heat diffusion on a 2D plate is modeled by solving the Laplace equation iteratively:
-
Boundary conditions:
- Top row fixed at 1.0 (heat source).
- Other boundaries fixed at 0.0.
-
Convergence: Iteration stops when the maximum difference between iterations falls below a tolerance, or after a maximum number of iterations.
-
serial/– serial implementation in C. -
cuda/– GPU implementation in CUDA.
| Grid Size | Serial | CUDA | Speedup |
|---|---|---|---|
| 1024 x 1024 | 6.6511 s | 0.0757 s | 88x |
| 2048 x 2048 | 26.7749 s | 0.4801 s | 55x |
| 4096 x 4096 | 154.8857 s | 2.4873 s | 62x |
| 8192 x 8192 | 437.6124 s | 7.7569 s | 56x |
- CPU: AMD Ryzen 7 5800X 8-Core Processor
- GPU: NVIDIA GeForce RTX 4070 Ti
- Ubuntu 22.04.1
-
gcc compiler for serial version.
-
NVIDIA CUDA Toolkit - nvcc compiler for CUDA version.
-
Linux environment recommended.
cd serial
make
./jacobi
cd cuda
make
./jacobi