Skip to content

Version Compatibility ​

Zig Compiler ​

cuda.zigMinimum Zig
0.0.x0.16.0

CUDA Toolkit & Driver ​

cuda.zig dynamically probes and resolves CUDA symbols at runtime with zero link-time dependencies. The table below outlines supported toolkit and driver versions:

cuda.zigSupported CUDA VersionsMinimum DrivercuDNN
0.0.2CUDA 11.0 – 13.4 (Major 11, 12, 13; Minor 0–9 probe loop)525.60+Optional

Latest validated environment: CUDA Toolkit 13.3 Update 1 (nvidia/cuda:13.3.1-cudnn-devel), Driver 572.16 (Windows 11 x86_64, RTX 4070 SUPER Compute Capability 8.9).

Minimum validated environment: CUDA 12.8.1 with cuDNN (nvidia/cuda:12.8.1-cudnn-devel).

GPU Compute Capability Requirements ​

FeatureMinimum Compute CapRequired CUDA VersionNotes
Basic Memory, Streams, Events5.0 (Maxwell)CUDA 11.0+H2D / D2H transfers, event timing
2D Pitched Memory5.0 (Maxwell)CUDA 11.0+mallocPitch, memcpy2DAsync
Multi-GPU Peer Access5.0 (Maxwell)CUDA 11.0+canAccessPeer, enablePeerAccess
Unified/Managed Memory Prefetch6.0 (Pascal)CUDA 11.0+cudaMemPrefetchAsync, cudaMemAdvise
Occupancy Calculator6.0 (Pascal)CUDA 11.0+cuOccupancyMaxActiveBlocksPerMultiprocessor
Stream-Ordered Memory Pools7.0 (Volta)CUDA 11.2+cudaMallocAsync, cudaFreeAsync, PoolBuffer
Tensor Cores (FP16 / BF16 / TF32)7.0 (Volta)CUDA 11.0+Hardware acceleration via cuBLAS / PTX
N-Dimensional Tensors (up to 8D)AnyAnyPure Zig layout engine + CUDA / CPU fallback
NVRTC Runtime Compilation5.0 (Maxwell)CUDA 11.0+Automatic probe across versioned DLLs/SOs

Operating System Support ​

CUDA is officially supported on Windows, Linux, and Windows Subsystem for Linux (WSL 2).

OS FamilyDistribution / VersionStatusNotes
WindowsWindows 10, 11, Server (64-bit)✅ SupportedDynamic resolution of nvcuda.dll & cudart64_*.dll
LinuxUbuntu, RHEL, CentOS, Fedora, Rocky, AlmaLinux, SUSE✅ SupportedDynamic resolution of libcuda.so.1 & libcudart.so
WSL 2Ubuntu & supported distros under WSL 2✅ SupportedFull GPU acceleration via Windows host driver bridge
macOSmacOS 10.15+ (Intel & Apple Silicon)🔶 CPU Fallback OnlyApple/NVIDIA dropped native macOS CUDA driver support

NOTE

On macOS or systems without NVIDIA hardware/drivers, cuda.zig transparently routes all memory allocations, tensor computations, and matrix operations through its pure Zig CPU fallback backend without crashing or throwing startup errors.

Build Flags vs CUDA Libraries ​

Build FlagDefaultRequired CUDA VersionTarget Dynamic Library
-Denable_cublas=truefalse12.0+libcublas.so / cublas64_12.dll
-Denable_curand=truefalse12.0+libcurand.so / curand64_10.dll
-Denable_cusolver=truefalse12.0+libcusolver.so / cusolver64_11.dll
-Denable_nvrtc=truefalse11.0+libnvrtc.so / nvrtc64_*.dll

Released under the MIT License.