CUDA Ray Tracer
Available targets for make
:
RayTracer
- multithreaded CPU implementationRayTracerCuda
- CUDA implementation (requires CUDA libraries installed)
Debug
mkdir Debug
cd Debug
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
Release
mkdir Release
cd Release
cmake -DCMAKE_BUILD_TYPE=Release ..
make
CMake flags
CMAKE_BUILD_TYPE=[Debug|Release]
- target build typeCUDA_HOST_COMPILER=path/to/gcc
- path to CUDA-compatible compiler, by default points toCMAKE_C_COMPILER
CUDA_TOOLKIT_ROOT_DIR=path/to/cuda
- path to CUDA installation directory
Enter the build directory:
# CPU
./RayTracer > image.ppm
# CUDA, requires raytracing.ptx to run
./RayTracerCuda > image.ppm
Each program can read config from file, for example:
cd Release
./RayTracer ../resources/RayTracerConfig.example > image.ppm
See format of the config file in resources/RayTracerConfig.example
.
If no file is specified, default config is used (same as in the example config).
All source files should comply with .clang-format
configuration.
Run clang-format
on each file before commit or add git hook to run it automatically:
cp -i resources/pre-commit .git/hooks/
and follow displayed instructions.