This project was developed as part of the "GPU Computing" course for the Master's degree in Computer Science at the University of Milan (Università degli Studi di Milano). It aims to compare the performance of a naive CPU-based ray tracing algorithm with a highly parallelized version implemented on a GPU using CUDA.
- CPU Implementation: A straightforward, sequential version of the ray tracing algorithm.
- GPU Implementation: A highly parallelized version that leverages thousands of GPU threads to accelerate computations.
- Project Report: For a detailed explanation of the implementation, results, and analysis, please refer to the project report.
To run this project, you will need the following:
- NVIDIA GPU: A compatible NVIDIA GPU is necessary to run the GPU version of the ray tracing algorithm.
- NVIDIA CUDA Toolkit: Ensure you have the NVIDIA CUDA Toolkit installed, which includes the
nvcc
compiler required to compile CUDA code. You can download it from the official NVIDIA website. - Make: A build automation tool like
make
is required to use the providedMakefile
for building and running the project.
-
Clone this repository to your local machine:
git clone https://github.com/Andreal2000/Project-Ray-Tracing.git
-
Navigate to the project directory:
cd Project-Ray-Tracing
-
Build and execute the project using make
The project provides a Makefile
to simplify the build and execution process. Below are the available commands and their descriptions:
-
Build CPU version:
Compiles the CPU-based implementation of the ray tracing algorithm.make cpu
-
Build GPU version:
Compiles the CUDA-based implementation of the ray tracing algorithm.make gpu
-
Run CPU version:
Compiles and runs the CPU-based version.make cpu-run
-
Run GPU version:
Compiles and runs the CUDA-based version.make gpu-run
-
Sanitize GPU version:
Compiles and runs the GPU version with CUDA compute sanitizer to detect memory leaks and race conditions.make gpu-sanitize
-
Clean build artifacts:
Removes the compiled binaries and other generated files.make clean