Skip to content

Commit

Permalink
Update source installation instuctions with Cython considerations
Browse files Browse the repository at this point in the history
  • Loading branch information
vzhurba01 committed Jan 10, 2025
1 parent 61ef224 commit 78e28e0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 50 deletions.
2 changes: 1 addition & 1 deletion cuda_bindings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ Latest dependencies can be found in [requirements.txt](https://github.com/NVIDIA

Multiple testing options are available:

* Cython Unit Tests
* Python Unit Tests
* Cython Unit Tests
* Samples
* Benchmark

Expand Down
72 changes: 23 additions & 49 deletions cuda_bindings/docs/source/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,91 +2,65 @@

## Runtime Requirements

CUDA Python is supported on all platforms that CUDA is supported. Specific
dependencies are as follows:
`cuda-python` supports the same platforms as CUDA. Runtime dependencies are:

* Driver: Linux (450.80.02 or later) Windows (456.38 or later)
* CUDA Toolkit 12.0 to 12.6

```{note} Only the NVRTC redistributable component is required from the CUDA Toolkit. [CUDA Toolkit Documentation](https://docs.nvidia.com/cuda/index.html) Installation Guides can be used for guidance. Note that the NVRTC component in the Toolkit can be obtained via PYPI, Conda or Local Installer.
```{note} Only the NVRTC redistributable component is required from the CUDA Toolkit. [CUDA Toolkit Documentation](https://docs.nvidia.com/cuda/index.html) Installation Guides can be used for guidance. Note that the NVRTC component in the Toolkit can be obtained via PYPI, Conda or local installers.
```

## Installing from PyPI

```{code-block} shell
pip install cuda-python
```console
$ pip install cuda-python
```

## Installing from Conda

```{code-block} shell
conda install -c nvidia cuda-python
```console
$ conda install -c nvidia cuda-python
```

Conda packages are assigned a dependency to CUDA Toolkit:
Conda packages have dependencies to CUDA Toolkit components:

* cuda-cudart (Provides CUDA headers to enable writting NVRTC kernels with CUDA types)
* cuda-cudart (Provides CUDA headers to enable writing NVRTC kernels with CUDA types)
* cuda-nvrtc (Provides NVRTC shared library)

## Installing from Source

### Build Requirements
### Requirements

* CUDA Toolkit headers
* Cython
* pyclibrary
* CUDA Toolkit headers[^1]
* [requirements.txt](https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/requirements.txt)

Remaining build and test dependencies are outlined in [requirements.txt](https://github.com/NVIDIA/cuda-python/blob/main/requirements.txt)
[^1]: User projects that `cimport` CUDA symbols in Cython must also use CUDA Toolkit (CTK) types as provided by the `cuda-python` major.minor version. This results in CTK headers becoming a transitive dependency of downstream projects through CUDA Python.

The version of CUDA Toolkit headers must match the major.minor of CUDA Python. Note that minor version compatibility will still be maintained.

During the build process, environment variable `CUDA_HOME` or `CUDA_PATH` are used to find the location of CUDA headers. In particular, if your headers are located in path `/usr/local/cuda/include`, then you should set `CUDA_HOME` as follows:
Source builds require that the provided CUDA headers are of the same major.minor version as the `cuda-python` bindings you're trying to build. Despite of this requirement, note that the minor version compatibility is still maintained. Use the `CUDA_HOME` (or `CUDA_PATH`) environment variable to specify the location of your headers. For example, if your headers are located in `/usr/local/cuda/include`, then you should set `CUDA_HOME` with:

```console
$ export CUDA_HOME=/usr/local/cuda
```
export CUDA_HOME=/usr/local/cuda

```{note} Only `cydriver`, `cyruntime` and `cynvrtc` are impacted by the header requirement.
```
### In-place
To compile the extension in-place, run:
```{code-block} shell
python setup.py build_ext --inplace
```console
$ python setup.py build_ext --inplace
```

To compile for debugging the extension modules with gdb, pass the `--debug`
argument to setup.py.
To compile for debugging the extension modules with gdb, pass the `--debug` argument to setup.py.

### Develop

You can use

```{code-block} shell
pip install -e .
```

to install the module as editible in your current Python environment (e.g. for
testing of porting other libraries to use the binding).

## Build the Docs

```{code-block} shell
conda env create -f docs_src/environment-docs.yml
conda activate cuda-python-docs
```
Then compile and install `cuda-python` following the steps above.

```{code-block} shell
cd docs_src
make html
open build/html/index.html
```console
$ pip install -e .
```

### Publish the Docs

```{code-block} shell
git checkout gh-pages
cd docs_src
make html
cp -a build/html/. ../docs/
```
to install the module as editable in your current Python environment (e.g. for testing of porting other libraries to use the binding).

0 comments on commit 78e28e0

Please sign in to comment.