From 080fae1f8a895e9fe6e5a73ea483ad30c84d64cf Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Fri, 14 Nov 2025 12:02:44 +0100 Subject: [PATCH 1/4] Do not mix conda-forge, defaults and nvidia conda channels in linux_cuda_wheel job --- .github/workflows/linux_cuda_wheel.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux_cuda_wheel.yaml b/.github/workflows/linux_cuda_wheel.yaml index 17f18fe8b..aa8a1a95b 100644 --- a/.github/workflows/linux_cuda_wheel.yaml +++ b/.github/workflows/linux_cuda_wheel.yaml @@ -70,8 +70,7 @@ jobs: # We test against 12.6 and 13.0 to avoid having too big of a CI matrix, # but for releases we should add 12.8. cuda-version: ['12.6', '13.0'] - # TODO: put back ffmpeg 5 https://github.com/pytorch/torchcodec/issues/325 - ffmpeg-version-for-tests: ['4.4.2', '6', '7', '8.0'] + ffmpeg-version-for-tests: ['4.4.2', '5', '6', '7', '8.0'] container: image: "pytorch/manylinux2_28-builder:cuda${{ matrix.cuda-version }}" @@ -89,12 +88,17 @@ jobs: name: meta-pytorch_torchcodec__${{ matrix.python-version }}_cu${{ env.cuda_version_without_periods }}_x86_64 path: pytorch/torchcodec/dist/ - name: Setup miniconda using test-infra - uses: pytorch/test-infra/.github/actions/setup-miniconda@main + uses: conda-incubator/setup-miniconda@v3 with: + # Using miniforge instead of miniconda ensures that the default + # conda channel is conda-forge instead of main/default. This ensures + # ABI consistency between dependencies: + # https://conda-forge.org/docs/user/transitioning_from_defaults/ + miniforge-version: latest python-version: ${{ matrix.python-version }} # We install conda packages at the start because otherwise conda may have conflicts with dependencies. # Note: xorg-libxau was addded to fix a problem with ffmpeg 4. We should consider removing it. - default-packages: "nvidia/label/cuda-${{ matrix.cuda-version }}.0::libnpp nvidia::cuda-nvrtc=${{ matrix.cuda-version }} nvidia::cuda-toolkit=${{ matrix.cuda-version }} nvidia::cuda-cudart=${{ matrix.cuda-version }} nvidia::cuda-driver-dev=${{ matrix.cuda-version }} conda-forge::ffmpeg=${{ matrix.ffmpeg-version-for-tests }} conda-forge::xorg-libxau" + default-packages: "libnpp cuda-nvrtc=${{ matrix.cuda-version }} cuda-toolkit=${{ matrix.cuda-version }} cuda-cudart=${{ matrix.cuda-version }} cuda-driver-dev=${{ matrix.cuda-version }} ffmpeg=${{ matrix.ffmpeg-version-for-tests }} xorg-libxau" - name: Check env run: | ${CONDA_RUN} env From 9f34b3ca96748b2ed69ab476c9e800e12e0aa791 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Fri, 14 Nov 2025 13:17:24 +0100 Subject: [PATCH 2/4] Install conda packages with conda install --- .github/workflows/linux_cuda_wheel.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux_cuda_wheel.yaml b/.github/workflows/linux_cuda_wheel.yaml index aa8a1a95b..f05f045eb 100644 --- a/.github/workflows/linux_cuda_wheel.yaml +++ b/.github/workflows/linux_cuda_wheel.yaml @@ -96,9 +96,10 @@ jobs: # https://conda-forge.org/docs/user/transitioning_from_defaults/ miniforge-version: latest python-version: ${{ matrix.python-version }} - # We install conda packages at the start because otherwise conda may have conflicts with dependencies. + - name: Install dependencies + run: | # Note: xorg-libxau was addded to fix a problem with ffmpeg 4. We should consider removing it. - default-packages: "libnpp cuda-nvrtc=${{ matrix.cuda-version }} cuda-toolkit=${{ matrix.cuda-version }} cuda-cudart=${{ matrix.cuda-version }} cuda-driver-dev=${{ matrix.cuda-version }} ffmpeg=${{ matrix.ffmpeg-version-for-tests }} xorg-libxau" + conda install libnpp cuda-nvrtc=${{ matrix.cuda-version }} cuda-toolkit=${{ matrix.cuda-version }} cuda-cudart=${{ matrix.cuda-version }} cuda-driver-dev=${{ matrix.cuda-version }} ffmpeg=${{ matrix.ffmpeg-version-for-tests }} xorg-libxau - name: Check env run: | ${CONDA_RUN} env From d25c3d5ecd111541bea176d5e1410d449829b248 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Fri, 14 Nov 2025 13:57:26 +0100 Subject: [PATCH 3/4] Add environment variables to CUDA workflow --- .github/workflows/linux_cuda_wheel.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/linux_cuda_wheel.yaml b/.github/workflows/linux_cuda_wheel.yaml index f05f045eb..cd3294614 100644 --- a/.github/workflows/linux_cuda_wheel.yaml +++ b/.github/workflows/linux_cuda_wheel.yaml @@ -100,6 +100,8 @@ jobs: run: | # Note: xorg-libxau was addded to fix a problem with ffmpeg 4. We should consider removing it. conda install libnpp cuda-nvrtc=${{ matrix.cuda-version }} cuda-toolkit=${{ matrix.cuda-version }} cuda-cudart=${{ matrix.cuda-version }} cuda-driver-dev=${{ matrix.cuda-version }} ffmpeg=${{ matrix.ffmpeg-version-for-tests }} xorg-libxau + echo "CONDA_PREFIX=${CONDA_PREFIX}" >> "${GITHUB_ENV}" + echo "CONDA_RUN=$(which conda) run -p ${CONDA_PREFIX} --no-capture-output" >> "${GITHUB_ENV}" - name: Check env run: | ${CONDA_RUN} env From 151efc4e9db8655c53344b8a819c95ff4e2473a0 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Fri, 14 Nov 2025 16:27:11 +0100 Subject: [PATCH 4/4] Simplify commands by removing CONDA_RUN variable Removed usage of CONDA_RUN variable for various commands in the workflow. --- .github/workflows/linux_cuda_wheel.yaml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/linux_cuda_wheel.yaml b/.github/workflows/linux_cuda_wheel.yaml index cd3294614..28a97a25c 100644 --- a/.github/workflows/linux_cuda_wheel.yaml +++ b/.github/workflows/linux_cuda_wheel.yaml @@ -100,28 +100,26 @@ jobs: run: | # Note: xorg-libxau was addded to fix a problem with ffmpeg 4. We should consider removing it. conda install libnpp cuda-nvrtc=${{ matrix.cuda-version }} cuda-toolkit=${{ matrix.cuda-version }} cuda-cudart=${{ matrix.cuda-version }} cuda-driver-dev=${{ matrix.cuda-version }} ffmpeg=${{ matrix.ffmpeg-version-for-tests }} xorg-libxau - echo "CONDA_PREFIX=${CONDA_PREFIX}" >> "${GITHUB_ENV}" - echo "CONDA_RUN=$(which conda) run -p ${CONDA_PREFIX} --no-capture-output" >> "${GITHUB_ENV}" - name: Check env run: | - ${CONDA_RUN} env - ${CONDA_RUN} conda info - ${CONDA_RUN} nvidia-smi - ${CONDA_RUN} conda list + env + conda info + nvidia-smi + conda list - name: Assert ffmpeg exists run: | - ${CONDA_RUN} ffmpeg -buildconf + ffmpeg -buildconf - name: Update pip run: ${CONDA_RUN} python -m pip install --upgrade pip - name: Install PyTorch run: | - ${CONDA_RUN} python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu${{ env.cuda_version_without_periods }} - ${CONDA_RUN} python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")' + conda run python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu${{ env.cuda_version_without_periods }} + conda run python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")' - name: Install torchcodec from the wheel run: | wheel_path=`find pytorch/torchcodec/dist -type f -name "*cu${{ env.cuda_version_without_periods }}-cp${{ env.python_version_without_periods }}*.whl"` echo Installing $wheel_path - ${CONDA_RUN} python -m pip install $wheel_path -vvv + python -m pip install $wheel_path -vvv - name: Check out repo uses: actions/checkout@v3 @@ -129,7 +127,7 @@ jobs: - name: Install test dependencies run: | # Ideally we would find a way to get those dependencies from pyproject.toml - ${CONDA_RUN} python -m pip install numpy pytest pillow + python -m pip install numpy pytest pillow - name: Delete the src/ folder just for fun run: | @@ -147,7 +145,7 @@ jobs: ls - name: Run Python tests run: | - ${CONDA_RUN} FAIL_WITHOUT_CUDA=1 pytest --override-ini="addopts=-v" test --tb=short + FAIL_WITHOUT_CUDA=1 pytest --override-ini="addopts=-v" test --tb=short - name: Run Python benchmark run: | - ${CONDA_RUN} time python benchmarks/decoders/gpu_benchmark.py --devices=cuda:0,cpu --resize_devices=none + time python benchmarks/decoders/gpu_benchmark.py --devices=cuda:0,cpu --resize_devices=none