Skip to content

Commit 2621e1a

Browse files
docs: cleanup compilation instrs for multi-backend
1 parent 7800734 commit 2621e1a

File tree

1 file changed

+42
-29
lines changed

1 file changed

+42
-29
lines changed

docs/source/installation.mdx

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## CUDA
44

5-
bitsandbytes is only supported on CUDA GPUs for CUDA versions **11.0 - 12.5**.
5+
bitsandbytes is only supported on CUDA GPUs for CUDA versions **11.0 - 12.5**. However, there's a multi-backend effort under way which is currently in alpha release, check [the respective section below in case you're interested to help us with early feedback](#multi-backend).
66

77
The latest version of bitsandbytes builds on:
88

@@ -31,7 +31,7 @@ To install from PyPI.
3131
pip install bitsandbytes
3232
```
3333

34-
### Compile from source
34+
### Compile from source[[compile]]
3535

3636
For Linux and Windows systems, you can compile bitsandbytes from source. Installing from source allows for more build options with different CMake configurations.
3737

@@ -61,7 +61,7 @@ git clone https://github.com/TimDettmers/bitsandbytes.git && cd bitsandbytes/
6161
pip install -r requirements-dev.txt
6262
cmake -DCOMPUTE_BACKEND=cuda -S .
6363
make
64-
pip install .
64+
pip install -e . # `-e` for "editable" install, when developing BNB (otherwise leave that out)
6565
```
6666

6767
> [!TIP]
@@ -85,7 +85,7 @@ git clone https://github.com/TimDettmers/bitsandbytes.git && cd bitsandbytes/
8585
pip install -r requirements-dev.txt
8686
cmake -DCOMPUTE_BACKEND=cuda -S .
8787
cmake --build . --config Release
88-
python -m build --wheel
88+
pip install -e . # `-e` for "editable" install, when developing BNB (otherwise leave that out)
8989
```
9090

9191
Big thanks to [wkpark](https://github.com/wkpark), [Jamezo97](https://github.com/Jamezo97), [rickardp](https://github.com/rickardp), [akx](https://github.com/akx) for their amazing contributions to make bitsandbytes compatible with Windows.
@@ -129,55 +129,68 @@ For example, to use a local install path:
129129

130130
```bash
131131
export BNB_CUDA_VERSION=117
132-
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/tim/local/cuda-11.7
132+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/YOUR_USERNAME/local/cuda-11.7
133133
```
134134

135135
3. Now when you launch bitsandbytes with these environment variables, the PyTorch CUDA version is overridden by the new CUDA version (in this example, version 11.7) and a different bitsandbytes library is loaded.
136136

137+
## Multi-backend preview release compilation[[multi-backend]]
137138

138-
## Intel CPU
139+
Please follow these steps to install bitsandbytes with device-specific backend support other than CUDA:
139140

140-
> [!TIP]
141-
> Intel CPU backend only supports building from source; for now, please follow the instructions below.
141+
<hfoptions id="backend">
142+
<hfoption id="AMD ROCm">
142143

143-
Like CUDA, you can compile bitsandbytes from source for Linux and Windows systems. Installing from source allows for more build options with different CMake configurations.
144+
### AMD GPU
144145

145-
<hfoptions id="source">
146-
<hfoption id="Linux">
146+
bitsandbytes is fully supported from ROCm 6.1 onwards (currently in alpha release).
147147

148-
To compile from source, you need CMake >= **3.22.1** and Python >= **3.8** installed. Make sure you have a compiler installed to compile C++ (gcc, make, headers, etc.). For example, to install a compiler and CMake on Ubuntu:
148+
> [!TIP]
149+
> If you already installed ROCm and PyTorch, skip Docker steps below and please check that the torch version matches your ROCm install. To install torch for a specific ROCm version, please refer to step 3 of wheels install in [Installing PyTorch for ROCm](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/3rd-party/pytorch-install.html#using-wheels-package) guide.
149150
150151
```bash
151-
apt-get install -y build-essential cmake
152-
```
153-
154-
We recommend installing **GCC >= 11** and have at least **GCC >= 6**.
152+
# Create a docker container with latest pytorch. It comes with ROCm and pytorch preinstalled
153+
docker pull rocm/pytorch:latest
154+
docker run -it --device=/dev/kfd --device=/dev/dri --group-add video rocm/pytorch:latest
155155

156-
Now to install the bitsandbytes package from source, run the following commands:
156+
# Clone bitsandbytes repo, ROCm backend is currently enabled on multi-backend-refactor branch
157+
git clone --depth 1 -b multi-backend-refactor https://github.com/TimDettmers/bitsandbytes.git && cd bitsandbytes/
157158

158-
```bash
159-
git clone --branch multi-backend-refactor https://github.com/TimDettmers/bitsandbytes.git && cd bitsandbytes/
159+
# Install dependencies
160160
pip install -r requirements-dev.txt
161-
pip install intel_extension_for_pytorch
162-
cmake -DCOMPUTE_BACKEND=cpu -S .
161+
162+
# Compile & install
163+
apt-get install -y build-essential cmake # install build tools dependencies, unless present
164+
cmake -DCOMPUTE_BACKEND=hip -S . # Use -DBNB_ROCM_ARCH="gfx90a;gfx942" to target specific gpu arch
163165
make
164-
pip install .
166+
pip install -e . # `-e` for "editable" install, when developing BNB (otherwise leave that out)
165167
```
166168

167169
</hfoption>
168-
<hfoption id="Windows">
170+
<hfoption id="Intel CPU + GPU">
169171

170-
Windows systems require Visual Studio with C++ support.
172+
### Intel CPU
171173

172-
To compile from source, you need CMake >= **3.22.1** and Python >= **3.8** installed.
174+
> [!TIP]
175+
> Intel CPU backend only supports building from source; for now, please follow the instructions below.
173176
174-
```bash
175-
git clone --branch multi-backend-refactor https://github.com/TimDettmers/bitsandbytes.git && cd bitsandbytes/
177+
Similar to the CUDA case, you can compile bitsandbytes from source for Linux and Windows systems.
178+
179+
The below commands are for Linux. For installing on Windows, please adapt the below commands according to the same pattern as described [the section above on compiling from source under the Windows tab](#compile).
180+
181+
```
182+
git clone --depth 1 -b multi-backend-refactor https://github.com/TimDettmers/bitsandbytes.git && cd bitsandbytes/
183+
pip install intel_extension_for_pytorch
176184
pip install -r requirements-dev.txt
177185
cmake -DCOMPUTE_BACKEND=cpu -S .
178-
cmake --build . --config Release
179-
pip install .
186+
make
187+
pip install -e . # `-e` for "editable" install, when developing BNB (otherwise leave that out)
180188
```
181189

190+
</hfoption>
191+
<hfoption id="Apple Silicon (MPS)">
192+
193+
WIP
194+
182195
</hfoption>
183196
</hfoptions>

0 commit comments

Comments
 (0)