Before adding cudaz to your project, make sure you have two prerequisites in place: the NVIDIA CUDA Toolkit installed on your system (which provides theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/akhildevelops/cudaz/llms.txt
Use this file to discover all available pages before exploring further.
cuda.h header, and the libcuda, libnvrtc shared libraries), and a supported Zig toolchain (0.13.0 through 0.16.0). cudaz ships separate tagged releases for each Zig version, so you must fetch the correct archive for the compiler you are using.
Fetch cudaz and save it to build.zig.zon
Run the
zig fetch --save command for your Zig version. This downloads the cudaz source archive and writes the URL and content hash into your project’s build.zig.zon file automatically.- zig 0.16.0
- zig 0.15.2
- zig 0.14.1
- zig 0.13.0
Configure build.zig
Add the cudaz module to your executable and link the required system libraries. The key steps are: retrieve the
cudaz dependency, import its cudaz module, then link libc, libcuda, and libnvrtc.build.zig
Specifying a custom CUDA path
By default, cudaz searches for the CUDA toolkit in these standard locations (in order):/usr/usr/local/cuda/opt/cuda/usr/lib/cuda
include/cuda.h under each candidate directory. If your CUDA toolkit is installed somewhere else — for example, a versioned directory like /usr/local/cuda-12.4 — you can override the search by passing the -DCUDA_PATH build option:
build.zig so every developer on the project uses the same path:
build.zig