Create a separate build directory and configure with CMake from the project root.
cmake -S . -B build
cmake --build buildBy default, the project tries to detect CUDA automatically. If you want to be explicit, use one of the options below.
To reproduce the CUDA build on this setup, make sure these tools are installed:
sudo apt install cmake g++-12 nvidia-cuda-toolkitIf your CUDA installation lives somewhere else, adjust the compiler and toolkit paths in the commands below.
cmake -S . -B build -DUSE_CUDA=OFF
cmake --build buildUse this when CUDA is installed and nvcc is available. This toolchain also
needs a supported host compiler; on this setup that means GCC/G++ 12.
cmake -S . -B build \
-DUSE_CUDA=ON \
-DCMAKE_CUDA_HOST_COMPILER=/usr/bin/g++-12
cmake --build buildIf nvcc is not on your PATH, or CUDA lives in a non-default location, use:
cmake -S . -B build \
-DUSE_CUDA=ON \
-DCMAKE_CUDA_COMPILER=/usr/lib/nvidia-cuda-toolkit/bin/nvcc \
-DCUDAToolkit_ROOT=/usr/lib/nvidia-cuda-toolkit \
-DCMAKE_CUDA_HOST_COMPILER=/usr/bin/g++-12
cmake --build buildIf you do not have GCC/G++ 12 installed yet, install it first and use that compiler for the CUDA configure step.
cd build
ctest --output-on-failurectest runs the full test suite that was generated for the current build. If
you configured CUDA support, this includes the CUDA-backed tests as well.