1- name : Build and test Linux CUDA wheels
1+ name : Build and test Linux CUDA wheels and docs
22
33on :
44 pull_request :
@@ -84,10 +84,13 @@ jobs:
8484 echo cuda_version_without_periods=${cuda_version_without_periods} >> $GITHUB_ENV
8585 python_version_without_periods=$(echo "${{ matrix.python-version }}" | sed 's/\.//g')
8686 echo python_version_without_periods=${python_version_without_periods} >> $GITHUB_ENV
87- - uses : actions/download-artifact@v4
88- with :
89- name : meta-pytorch_torchcodec__${{ matrix.python-version }}_cu${{ env.cuda_version_without_periods }}_x86_64
90- path : pytorch/torchcodec/dist/
87+
88+ - name : Check out repo
89+ uses : actions/checkout@v3
90+
91+ - name : Remove src/ folder
92+ run : bash packaging/remove_src.sh
93+
9194 - name : Setup miniconda using test-infra
9295 uses : pytorch/test-infra/.github/actions/setup-miniconda@main
9396 with :
@@ -109,49 +112,90 @@ jobs:
109112 run : ${CONDA_RUN} python -m pip install --upgrade pip
110113 - name : Install PyTorch
111114 run : |
112- # If we're in a release branch or in a PR against a release branch,
113- # we install the PyTorch RCs from the test channel. Otherwise, e.g. in
114- # `main` or in PRs against `main`, we install the nightly builds.
115- # Note that the `test` RCs are
116- if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
117- CHANNEL=test
118- else
119- CHANNEL=nightly
120- fi
121-
122- ${CONDA_RUN} python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/${CHANNEL}/cu${{ env.cuda_version_without_periods }}
115+ ${CONDA_RUN} bash packaging/install_pytorch.sh cu${{ env.cuda_version_without_periods }} "torch torchvision"
123116 ${CONDA_RUN} python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")'
117+
118+ - uses : actions/download-artifact@v4
119+ with :
120+ name : meta-pytorch_torchcodec__${{ matrix.python-version }}_cu${{ env.cuda_version_without_periods }}_x86_64
121+ path : dist/
122+
124123 - name : Install torchcodec from the wheel
124+ run : ${CONDA_RUN} bash packaging/install_torchcodec_wheel.sh "*cu${{ env.cuda_version_without_periods }}-cp${{ env.python_version_without_periods }}*.whl"
125+
126+ - name : Install test dependencies
127+ run : ${CONDA_RUN} bash packaging/install_test_dependencies.sh
128+ - name : Run Python tests
129+ run : |
130+ ${CONDA_RUN} FAIL_WITHOUT_CUDA=1 pytest --override-ini="addopts=-v" test --tb=short
131+ - name : Run Python benchmark
125132 run : |
126- wheel_path=`find pytorch/torchcodec/dist -type f -name "*cu${{ env.cuda_version_without_periods }}-cp${{ env.python_version_without_periods }}*.whl"`
127- echo Installing $wheel_path
128- ${CONDA_RUN} python -m pip install $wheel_path -vvv
133+ ${CONDA_RUN} time python benchmarks/decoders/gpu_benchmark.py --devices=cuda:0,cpu --resize_devices=none
134+
135+ build-docs :
136+ runs-on : linux.4xlarge.nvidia.gpu
137+ env :
138+ PYTHON_VERSION : ' 3.10'
139+ CUDA_VERSION : ' 12.6'
140+ FFMPEG_VERSION : ' 7'
141+ container :
142+ image : " pytorch/manylinux2_28-builder:cuda12.6" # must be same as env!!
143+ options : " --gpus all -e NVIDIA_DRIVER_CAPABILITIES=video,compute,utility"
144+ needs : build
145+ steps :
146+ - name : Setup env vars
147+ run : |
148+ cuda_version_without_periods=$(echo "${{ env.CUDA_VERSION }}" | sed 's/\.//g')
149+ echo cuda_version_without_periods=${cuda_version_without_periods} >> $GITHUB_ENV
150+ python_version_without_periods=$(echo "${{ env.PYTHON_VERSION }}" | sed 's/\.//g')
151+ echo python_version_without_periods=${python_version_without_periods} >> $GITHUB_ENV
129152
130153 - name : Check out repo
131154 uses : actions/checkout@v3
132155
133- - name : Install test dependencies
134- run : |
135- # Ideally we would find a way to get those dependencies from pyproject.toml
136- ${CONDA_RUN} python -m pip install numpy pytest pillow
156+ - name : Remove src/ folder
157+ run : bash packaging/remove_src.sh
137158
138- - name : Delete the src/ folder just for fun
159+ - name : Setup miniconda using test-infra
160+ uses : pytorch/test-infra/.github/actions/setup-miniconda@main
161+ with :
162+ python-version : ${{ env.PYTHON_VERSION }}
163+ # We install conda packages at the start because otherwise conda may have conflicts with dependencies.
164+ default-packages : " nvidia/label/cuda-${{ env.CUDA_VERSION }}.0::libnpp nvidia::cuda-nvrtc=${{ env.CUDA_VERSION }} nvidia::cuda-toolkit=${{ env.CUDA_VERSION }} nvidia::cuda-cudart=${{ env.CUDA_VERSION }} nvidia::cuda-driver-dev=${{ env.CUDA_VERSION }} conda-forge::ffmpeg=${{ env.FFMPEG_VERSION }}"
165+ - name : Check env, set LD_LIBRARY_PATH
139166 run : |
140- # The only reason we checked-out the repo is to get access to the
141- # tests. We don't care about the rest. Out of precaution, we delete
142- # the src/ folder to be extra sure that we're running the code from
143- # the installed wheel rather than from the source.
144- # This is just to be extra cautious and very overkill because a)
145- # there's no way the `torchcodec` package from src/ can be found from
146- # the PythonPath: the main point of `src/` is precisely to protect
147- # against that and b) if we ever were to execute code from
148- # `src/torchcodec`, it would fail loudly because the built .so files
149- # aren't present there.
150- rm -r src/
151- ls
152- - name : Run Python tests
167+ ${CONDA_RUN} env
168+ ${CONDA_RUN} conda info
169+ ${CONDA_RUN} nvidia-smi
170+ ${CONDA_RUN} conda list
171+ echo LD_LIBRARY_PATH=$CONDA_PREFIX/lib:/usr/local/cuda/lib64/:${LD_LIBRARY_PATH} >> $GITHUB_ENV
172+ - name : Assert ffmpeg exists
153173 run : |
154- ${CONDA_RUN} FAIL_WITHOUT_CUDA=1 pytest --override-ini="addopts=-v" test --tb=short
155- - name : Run Python benchmark
174+ ${CONDA_RUN} ffmpeg -buildconf
175+ - name : Update pip
176+ run : ${CONDA_RUN} python -m pip install --upgrade pip
177+ - name : Install PyTorch
156178 run : |
157- ${CONDA_RUN} time python benchmarks/decoders/gpu_benchmark.py --devices=cuda:0,cpu --resize_devices=none
179+ ${CONDA_RUN} bash packaging/install_pytorch.sh cu${{ env.cuda_version_without_periods }} "torch torchvision"
180+ ${CONDA_RUN} python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")'
181+
182+ - uses : actions/download-artifact@v4
183+ with :
184+ name : meta-pytorch_torchcodec__${{ env.PYTHON_VERSION }}_cu${{ env.cuda_version_without_periods }}_x86_64
185+ path : dist/
186+
187+ - name : Install torchcodec from the wheel
188+ run : ${CONDA_RUN} bash packaging/install_torchcodec_wheel.sh "*cu${{ env.cuda_version_without_periods }}-cp${{ env.python_version_without_periods }}*.whl"
189+
190+ - name : Install doc dependencies
191+ run : |
192+ cd docs
193+ ${CONDA_RUN} python -m pip install -r requirements.txt
194+ - name : Build docs
195+ run : |
196+ cd docs
197+ ${CONDA_RUN} make html
198+ - uses : actions/upload-artifact@v4
199+ with :
200+ name : Built-Docs
201+ path : docs/build/html/
0 commit comments