# ZLUDA — Run CUDA Applications on AMD and Intel GPUs > A drop-in CUDA compatibility layer that lets unmodified CUDA applications run on non-NVIDIA GPUs via translation to native GPU APIs. ## Install Save as a script file and run: # ZLUDA — Run CUDA on AMD and Intel GPUs ## Quick Use ```bash # Build from source (requires Rust nightly and ROCm/oneAPI SDK) git clone https://github.com/vosen/ZLUDA.git cd ZLUDA && cargo xtask --release # Run a CUDA app through ZLUDA LD_LIBRARY_PATH=./target/release ./your_cuda_app ``` ## Introduction ZLUDA is a compatibility layer that translates CUDA API calls to native GPU APIs (ROCm HIP for AMD, oneAPI Level Zero for Intel). It allows existing CUDA binaries to run on non-NVIDIA hardware without source code changes or recompilation. ## What ZLUDA Does - Translates CUDA runtime and driver API calls to AMD ROCm HIP at runtime - Supports Intel GPUs via oneAPI Level Zero backend - Handles PTX (NVIDIA's intermediate representation) to native GPU ISA compilation - Works with pre-compiled CUDA binaries without requiring source access - Provides partial cuBLAS, cuSPARSE, cuFFT, and cuDNN API translation ## Architecture Overview ZLUDA intercepts CUDA library calls by acting as a drop-in replacement for CUDA shared libraries (libcuda, libcudart). When a CUDA application loads, ZLUDA's libraries are loaded instead. PTX kernels are compiled on-the-fly to the target GPU's native instruction set using the respective vendor SDK. The translation layer maps CUDA memory management, stream synchronization, and kernel launch semantics to equivalent constructs on the target platform. ## Self-Hosting & Configuration - Build from source with Rust nightly toolchain - AMD support requires ROCm 5.x+ installed on the host - Intel support requires oneAPI Level Zero runtime - Set LD_LIBRARY_PATH to point ZLUDA libraries before the real CUDA libraries - No configuration files; behavior is controlled via environment variables ## Key Features - Binary-level CUDA compatibility without recompilation - On-the-fly PTX to native ISA compilation - Support for CUDA runtime API, driver API, and select math libraries - Works with popular frameworks when their CUDA usage aligns with supported APIs - Active development with growing API surface coverage ## Comparison with Similar Tools - **ROCm HIP** — requires source-level porting from CUDA to HIP; ZLUDA works at binary level - **SCALE (Spectral Compute)** — compiles CUDA source to AMD targets; needs source access - **chipStar** — translates CUDA/HIP to OpenCL or Level Zero but requires source compilation - **Intel SYCL** — cross-vendor GPU programming but requires rewriting in SYCL - **Native CUDA (NVIDIA)** — no translation overhead but locks you to NVIDIA hardware ## FAQ **Q:** Does ZLUDA support all CUDA applications? A: No. Coverage depends on which CUDA APIs the application uses. Core runtime and driver APIs are well-supported; specialized libraries have partial coverage. **Q:** What is the performance overhead? A: Varies by workload. Simple compute kernels often run near-native speed. Complex applications using many CUDA libraries may see larger gaps. **Q:** Is ZLUDA officially supported by AMD or Intel? A: No. ZLUDA is an independent open-source project. AMD previously sponsored development but it is now community-driven. **Q:** Can I use ZLUDA for machine learning inference? A: Some inference workloads work, but full training pipelines often depend on cuDNN features that have limited coverage. ## Sources - https://github.com/vosen/ZLUDA --- Source: https://tokrepo.com/en/workflows/asset-25196ced Author: Script Depot