Compiling from Source

Linux

To compile from source, you need the following:

On Ubuntu, install the first two with apt-get install -y build-essential cmake.

To install the CUDA toolkit, follow the instructions from your distro.

To install the package from source, then run

pip install -r requirements-dev.txt
cmake -DCOMPUTE_BACKEND=cuda -S .
make
pip install .

If you have multiple versions of CUDA installed, or have installed it in a non-standard location, please refer to cmake CUDA documentation for how to configure the CUDA compiler used.

Windows

The following is required to install from source on Windows

To install the CUDA toolkit, follow the instructions for Windows.

To install the package from source, then run

pip install -r requirements-dev.txt
cmake -DCOMPUTE_BACKEND=cuda -S .
cmake --build . --config Release
pip install .

Compilation for Kepler Architecture

From version 0.39.1, bitsandbytes no longer includes Kepler binaries in pip installations, requiring manual compilation. Follow the general steps and use cuda11x_nomatmul_kepler for Kepler-targeted compilation.