This repository contains a small ray tracing project with three implementations of the same renderer:
- a sequential CPU version
- a FastFlow parallel CPU version
- a CUDA GPU version
The goal is to keep the rendering pipeline and scene logic comparable across implementations, so performance and scaling behavior can be evaluated more clearly.
Rendered image (from seq.ppm):
main.cpp: sequential entry pointraytracer_ff/main_ff.cpp: FastFlow entry pointraytracer_cuda/main.cu: CUDA entry pointmaterials/: material modelsreport/: performance and analysis artifactsscripts/: helper scripts for experiments
Assuming cwd the outer one (i.e., ray_tracer_final/) and the FastFlow library located at ../fastflow. To open .ppm files on Linux: eog img.ppm (ensure that WRITE_IMG macro is set to true).
g++ -O3 main.cpp -o main.out
./main.out > seq.ppmMacros:
WRITE_IMGIMAGE_WIDTHSAMPLES_PER_PIXELMAX_BOUNCING_DEPTH
The scene can be changed in main.cpp. Image sample is ./seq.ppm.
g++ -O3 -I ../../fastflow raytracer_ff/main_ff.cpp -o raytracer_ff/main_ff.out
./raytracer_ff/main_ff.out > ff.ppmMacros:
WRITE_IMGIMAGE_WIDTHSAMPLES_PER_PIXELMAX_BOUNCING_DEPTHNUM_WORKERSFF_ROW_BLOCK:grainparameter ofParallelFor
The scene can be changed in raytracer_ff/main_ff.cpp. Image sample is ./ff.ppm.
nvcc raytracer_cuda/main.cu -o raytracer_cuda/main_cu.out
./raytracer_cuda/main_cu.out > cuda.ppmMacros:
WRITE_IMGMEMORY_UNIFIED:1to use unified memory,0to use explicit memoryIMAGE_WIDTHASPECT_RATIOMAX_DEPTH_RT: same asMAX_BOUNCING_DEPTHSAMPLING_SIZE: same asSAMPLES_PER_PIXEL
The scene can be changed in raytracer_cuda/ray_tracing.cu. Image sample is ./cuda.ppm.
