Skip to content

Commit 1256ff4

Browse files
committed
Clarify CUDA/CuPy install requirements in docs (#8106)
Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com>
1 parent 3a458fe commit 1256ff4

1 file changed

Lines changed: 27 additions & 2 deletions

File tree

docs/source/installation.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- [Installation Guide](#installation-guide)
66
- [Table of Contents](#table-of-contents)
7+
- [GPU-enabled installation (CUDA and CuPy)](#gpu-enabled-installation-cuda-and-cupy)
78
- [From PyPI](#from-pypi)
89
- [Milestone release](#milestone-release)
910
- [Weekly preview release](#weekly-preview-release)
@@ -30,12 +31,33 @@ Ignite](https://pytorch.org/ignite/), please follow the instructions:
3031

3132
- [Installing the recommended dependencies](#installing-the-recommended-dependencies)
3233

33-
The installation commands below usually end up installing CPU variant of PyTorch. To install GPU-enabled PyTorch:
34+
---
35+
36+
## GPU-enabled installation (CUDA and CuPy)
37+
38+
The installation commands below usually end up installing the CPU variant of PyTorch. To install GPU-enabled PyTorch:
3439

3540
1. Install the latest NVIDIA driver.
3641
1. Check [PyTorch Official Guide](https://pytorch.org/get-started/locally/) for the recommended CUDA versions. For Pip package, the user needs to download the CUDA manually, install it on the system, and ensure CUDA_PATH is set properly.
3742
1. Continue to follow the guide and install PyTorch.
38-
1. Install MONAI using one the ways described below.
43+
1. Install MONAI using one of the ways described below.
44+
45+
Installing GPU-enabled PyTorch is enough to run models and transforms on the GPU. Some transforms,
46+
however, additionally use [CuPy](https://cupy.dev/) for GPU-accelerated array operations (for example
47+
when a transform converts a CUDA tensor via `convert_to_cupy`). If CuPy is not installed, these code
48+
paths raise `OptionalImportError: import cupy (No module named 'cupy')`.
49+
50+
CuPy is provided through the `cucim` extra, so installing MONAI with that extra pulls in a compatible
51+
CuPy build:
52+
53+
```bash
54+
pip install 'monai[cucim]'
55+
```
56+
57+
If you prefer to install CuPy directly, note that the PyPI package name is CUDA-version specific
58+
(e.g. `cupy-cuda12x` for CUDA 12.x, `cupy-cuda11x` for CUDA 11.x) rather than plain `cupy`. See the
59+
[CuPy installation guide](https://docs.cupy.dev/en/stable/install.html) for the correct package for
60+
your CUDA toolkit.
3961

4062
---
4163

@@ -298,3 +320,6 @@ O(N log N) alternatives to windowed self-attention). Install with
298320
`pip install 'monai[hyena]'`.
299321

300322
- `pip install 'monai[all]'` installs all the optional dependencies.
323+
- The `cucim` extra also provides [CuPy](https://cupy.dev/), which is required by GPU-accelerated
324+
transforms. See [GPU-enabled installation (CUDA and CuPy)](#gpu-enabled-installation-cuda-and-cupy)
325+
for details.

0 commit comments

Comments
 (0)