vosen / ZLUDA

CUDA on AMD GPUs
Apache License 2.0
8.29k stars 486 forks source link
amd-gpu amdgpu cuda rust

ZLUDA

ZLUDA lets you run unmodified CUDA applications with near-native performance on Intel AMD GPUs.

ZLUDA is currently alpha quality, but it has been confirmed to work with a variety of native CUDA applications: Geekbench, 3DF Zephyr, Blender, Reality Capture, LAMMPS, NAMD, waifu2x, OpenFOAM, Arnold (proof of concept) and more.

If you want to give it a try, download it from Release page to the right and read Usage and Known Issues sections below. If you are interested in its history and future read FAQ section further below.

geekbench.svg

Usage

Windows

Using command line:

<ZLUDA_DIRECTORY>\zluda.exe -- <APPLICATION> <APPLICATION_ARGUMENTS>

If you downloaded a ZIP file with the release and unpacked it, then <ZLUDA_DIRECTORY> is the zluda directory you have just unpacked.\ If you are building from source, then <ZLUDA_DIRECTORY> is subdirectory target\release.

Linux

Using command line:

LD_LIBRARY_PATH="<ZLUDA_DIRECTORY>:$LD_LIBRARY_PATH" <APPLICATION> <APPLICATION_ARGUMENTS>

If you downloaded a ZIP file with the release and unpacked it, then <ZLUDA_DIRECTORY> is the zluda directory you have just unpacked.\ If you are building from source, then <ZLUDA_DIRECTORY> is subdirectory target\release.

Build

Prerequisites

Make sure you have the following installed:

Alternatively, if you are building for Linux, .devcontainer directory contains various developer Dockerfiles with all the required dependencies

Checkout

Checkout ZLUDA code with:

git clone --recurse-submodules https://github.com/vosen/zluda.git

Build

Build by running:

cargo xtask --release

Unknown issues

If an application fails to start under ZLUDA or crashes please check Known Issues section below. If nothing there applies, then please read TROUBLESHOOTING.md.

Known Issues

Hardware

Software

CUDA 12+

OptiX

Windows

Applications

CGBN

CGBN crashes due to an underlying ROCm/HIP issue.

You can solve the issue by building comgr with LLVM containing this patch: ROCm/llvm-project#91. ZLUDA then must be able to find the comgr library (amd_comgr.dll on Windows and libamd_comgr.so.2 on Linux) in a library search path.

Meshroom

Meshroom works only with on Windows due to an underlying ROCm/HIP issue.

Meshroom 2023.3.0 might not work, it's recommended to use Meshroom freshly built from develop branch. See #79 and alicevision/Meshroom#595. Please open an issue here if you run into problems.

llama.cpp

If you are building llama.cpp with cmake and don't want it to crash on ZLUDA then you should use CUDA_DOCKER_ARCH=compute_61 like this:

make CUDA_DOCKER_ARCH=compute_61 

Alternatively, building with cmake should work with no changes.

Performance is currently much lower than the native HIP backend, see the discussion in #102.

Arnold

PyTorch

3DF Zephyr

Reality Capture

CompuBench

V-Ray Benchmark

Cinebench CUDA

OctaneBench

FAQ

For developers

If you are curious about ZLUDA's architecture, you can read a broad overview in ARCHITECTURE.md. If you want to debug ZLUDA check the "Debugging" section in TROUBLESHOOTING.md.

License

This software is dual-licensed under either the Apache 2.0 license or the MIT license. See LICENSE-APACHE or LICENSE-MIT for details