Accelerating Ray Tracing Using Parallelization
This project is an enhanced version of the "Ray Tracing in One Weekend" series, with a focus on high-performance computing. Our goal is to achieve significant speedup in ray tracing by parallelizing the computation on both CPU and GPU nodes.
Final Scene (samples_per_pixel=500)
The performance of our ray tracing implementation has been tested on an M3 MacBook Air with 16GB of memory. The results demonstrate the impact of parallelization on rendering speed, particularly when varying the number of threads and samples per pixel.
Samples per Pixel | OMP_NUM_THREADS | Elapsed Time (s) |
---|---|---|
10 | 1 | 26.8 |
10 | 2 | 14.3 |
10 | 4 | 8.6 |
10 | 8 | 6.8 |
500 | 8 | 408.9 |
- Ray Tracing Basics: Implements the foundational concepts of ray tracing as described in the "Ray Tracing in One Weekend" book.
- High Performance Computing: Optimized for speed and efficiency, leveraging modern hardware capabilities.
- Parallelization:
- CPU Node Parallelization: Utilizes multi-threading to distribute the workload across multiple CPU cores.
- GPU Node Parallelization: Offloads computation to the GPU, taking advantage of its massive parallel processing power.
- A C++ compiler with C++11 support
- OpenMP for CPU parallelization
-
Clone the repository:
git clone https://github.com/csc746-tp-ray-tracing-omp cd csc746-tp-ray-tracing-omp
-
Build the project: On Perlmutter, run this before build:
module load e4s/23.08 # on Perlmutter spack env activate gcc spack load likwid
After that, to build:
cmake -B build/
cmake --build build/
OMP_NUM_THREADS=1 ./build/ray-tracing-omp > image.ppm
OMP_NUM_THREADS=2 ./build/ray-tracing-omp > image.ppm
OMP_NUM_THREADS=4 ./build/ray-tracing-omp > image.ppm
OMP_NUM_THREADS=8 ./build/ray-tracing-omp > image.ppm
By parallelizing the ray tracing algorithm, we aim to achieve significant speedups compared to the original single-threaded implementation. Benchmarks and performance metrics will be provided in future updates.
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by the Ray Tracing in One Weekend series by Peter Shirley.