compiling.mdx 1.81 KB
Newer Older
Titus's avatar
Titus committed
1
2
# Compiling from Source[[compiling]]

3
4
5
6
7
8
9
10
11
12
13
14
## Linux

To compile from source, you need the following:

* The ability to compile C++ (gcc, make, headers, etc)
* CMake (version 3.22.1 or newer)
* Python 3.10 or newer
* [The CUDA toolkit](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html) (nvcc)

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](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html).
Titus's avatar
Titus committed
15
16
17



18
To install the package from source, then run
Titus's avatar
Titus committed
19
20

```
21
22
23
24
pip install -r requirements-dev.txt
cmake -DCOMPUTE_BACKEND=cuda -S .
make
pip install .
Titus's avatar
Titus committed
25
26
```

27
If you have multiple versions of CUDA installed, or have installed it in a non-standard location, please refer to [cmake CUDA documentation](https://cliutils.gitlab.io/modern-cmake/chapters/packages/CUDA.html) for how to configure the CUDA compiler used.
Titus's avatar
Titus committed
28

29
## Windows
Titus's avatar
Titus committed
30

31
The following is required to install from source on Windows
Titus's avatar
Titus committed
32

33
34
35
36
* [Microsoft Visual Studio](https://visualstudio.microsoft.com/downloads/) with C++ support
* CMake (version 3.22.1 or newer)
* Python 3.10 or newer
* [The CUDA toolkit](https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html) (nvcc)
Titus's avatar
Titus committed
37

38
To install the CUDA toolkit, follow the [instructions for Windows](https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html).
Titus's avatar
Titus committed
39

40
41
42
43
44
45
46
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 .
```
Titus's avatar
Titus committed
47
48
49
50

## 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.