Skip to content

Commit ea755b5

Browse files
committed
.
1 parent 602280a commit ea755b5

File tree

2 files changed

+42
-33
lines changed

2 files changed

+42
-33
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ ffmpeg -f lavfi -i \
9393
```
9494

9595
## Installing TorchCodec
96+
### Installing CPU-only TorchCodec
9697

9798
1. Install the latest stable version of PyTorch following the
9899
[official instructions](https://pytorch.org/get-started/locally/). For other
@@ -127,6 +128,46 @@ The following table indicates the compatibility between versions of
127128
| not yet supported | `2.5` | `>=3.9`, `<=3.12` |
128129
| `0.0.3` | `2.4` | `>=3.8`, `<=3.12` |
129130

131+
### Installing CUDA-enabled TorchCodec
132+
133+
First, make sure you have a GPU that has NVDEC hardware that can decode the
134+
format you want. Refer to Nvidia's GPU support matrix for more details
135+
[here](https://developer.nvidia.com/video-encode-and-decode-gpu-support-matrix-new).
136+
137+
1. Install CUDA Toolkit. Pytorch and TorchCodec supports CUDA Toolkit
138+
versions 11.8, 12.1 or 12.4. In particular TorchCodec depends on
139+
CUDA libraries libnpp and libnvrtc.
140+
141+
2. Install Pytorch that corresponds to your CUDA Toolkit version using the
142+
[official instructions](https://pytorch.org/get-started/locally/).
143+
144+
3. Install or compile FFmpeg with NVDEC support.
145+
TorchCodec with CUDA should work with FFmpeg versions in [4, 7].
146+
147+
If FFmpeg is not already installed, or you need a more recent version, an
148+
easy way to install it is to use `conda`:
149+
150+
```bash
151+
conda install ffmpeg
152+
# or
153+
conda install ffmpeg -c conda-forge
154+
```
155+
156+
If you are building FFmpeg from source you can follow Nvidia's guide to
157+
configuring and installing FFmpeg with NVDEC support
158+
[here](https://docs.nvidia.com/video-technologies/video-codec-sdk/12.0/ffmpeg-with-nvidia-gpu/index.html).
159+
160+
4. Install TorchCodec by passing in an `--index-url` parameter that corresponds to your CUDA
161+
Toolkit version, example:
162+
163+
```bash
164+
# This corresponds to CUDA Toolkit version 12.4
165+
pip install torchcodec --index-url=https://download.pytorch.org/whl/nightly/cu124
166+
```
167+
168+
Note that without passing in the `--index-url` parameter, `pip` installs TorchCodec
169+
binaries from PyPi which are CPU-only and do not have CUDA support.
170+
130171
## Benchmark Results
131172

132173
The following was generated by running [our benchmark script](./benchmarks/decoders/generate_readme_data.py) on a lightly loaded 56-core machine.

examples/basic_cuda_example.py

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -43,39 +43,7 @@
4343
Installing TorchCodec with CUDA Enabled
4444
---------------------------------------
4545
46-
In order to use CUDA Decoding will need the following installed in your environment:
47-
48-
#. An Nvidia GPU that supports decoding the video format you want to decode. See
49-
the support matrix `here <https://developer.nvidia.com/video-encode-and-decode-gpu-support-matrix-new>`_
50-
#. `CUDA-enabled pytorch <https://pytorch.org/get-started/locally/>`_
51-
#. FFmpeg binaries that support
52-
`NVDEC-enabled <https://docs.nvidia.com/video-technologies/video-codec-sdk/12.0/ffmpeg-with-nvidia-gpu/index.html>`_
53-
codecs
54-
#. libnpp and nvrtc (these are usually installed when you install the full cuda-toolkit)
55-
#. TorchCodec built with CUDA enabled. Note that the TorchCodec binaries on PyPi do not have CUDA enabled.
56-
For installing CUDA-enabled TorchCodec binaries you have two options:
57-
58-
#. Install TorchCodec's CUDA-enable prebuilts using one of Pytorch's package URLs. These are specified
59-
to ``pip`` by passing in the ``--index-url`` argument, example:
60-
61-
.. code-block:: bash
62-
63-
# If you have CUDA toolkit version 12.4 and have the nightly pytorch version installed:
64-
pip3 install --pre torchcodec --index-url https://download.pytorch.org/whl/nightly/cu124
65-
66-
#. Build TorchCodec from source using the environment variable ENABLE_CUDA=1
67-
68-
69-
FFmpeg versions 5, 6 and 7 from conda-forge are built with
70-
`NVDEC support <https://docs.nvidia.com/video-technologies/video-codec-sdk/12.0/ffmpeg-with-nvidia-gpu/index.html>`_
71-
and you can install them with conda. For example, to install FFmpeg version 7:
72-
73-
74-
.. code-block:: bash
75-
76-
conda install ffmpeg=7 -c conda-forge
77-
conda install libnpp cuda-nvrtc -c nvidia
78-
46+
Refer to the installation guide in the `README <https://github.com/pytorch/torchcodec#installing-torchcodec>`_.
7947
8048
"""
8149

0 commit comments

Comments
 (0)