Fix build failure on Python 3.14t without --enable-shared #201
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Windows CUDA | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - nightly | |
| - main | |
| - release/* | |
| tags: | |
| - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }} | |
| cancel-in-progress: true | |
| permissions: | |
| id-token: write | |
| contents: write | |
| defaults: | |
| run: | |
| shell: bash -l -eo pipefail {0} | |
| jobs: | |
| generate-matrix: | |
| uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main | |
| with: | |
| package-type: wheel | |
| os: windows | |
| test-infra-repository: pytorch/test-infra | |
| test-infra-ref: main | |
| with-cpu: disable | |
| with-xpu: disable | |
| with-rocm: disable | |
| with-cuda: enable | |
| build-python-only: "disable" | |
| python-versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]' | |
| build: | |
| needs: generate-matrix | |
| strategy: | |
| fail-fast: false | |
| name: Build and Upload wheel | |
| uses: pytorch/test-infra/.github/workflows/build_wheels_windows.yml@main | |
| with: | |
| repository: meta-pytorch/torchcodec | |
| ref: "" | |
| test-infra-repository: pytorch/test-infra | |
| test-infra-ref: main | |
| build-matrix: ${{ needs.generate-matrix.outputs.matrix }} | |
| pre-script: packaging/pre_build_script.sh | |
| # post-script: packaging/post_build_script.sh TODO: consider enabling post-build checks for Windows | |
| env-script: packaging/vc_env_helper.bat | |
| smoke-test-script: packaging/fake_smoke_test.py | |
| package-name: torchcodec | |
| trigger-event: ${{ github.event_name }} | |
| build-platform: "python-build-package" | |
| # The BUILD_AGAINST_ALL_FFMPEG_FROM_S3 and ENABLE_CUDA vars, needed to | |
| # build the wheel, are set in vc_env_helper.bat. Couldn't find a way to | |
| # set them from here. | |
| build-command: "python -m build --wheel -vvv --no-isolation" | |
| install-and-test: | |
| runs-on: windows.g5.4xlarge.nvidia.gpu | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # 3.10 corresponds to the minimum python version for which we build | |
| # the wheel unless the label cliflow/binaries/all is present in the | |
| # PR. | |
| # For the actual release we should add that label and change this to | |
| # include more python versions. | |
| python-version: ['3.10'] | |
| cuda-version: ['12.6', '13.0'] | |
| # TODO: FFmpeg 5 on Windows segfaults in avcodec_open2() when passing | |
| # bad parameters. | |
| # See https://github.com/pytorch/torchcodec/pull/806 | |
| ffmpeg-version-for-tests: ['4', '6', '7', '8'] | |
| needs: build | |
| steps: | |
| - name: Setup env vars | |
| run: | | |
| cuda_version_without_periods=$(echo "${{ matrix.cuda-version }}" | sed 's/\.//g') | |
| echo cuda_version_without_periods=${cuda_version_without_periods} >> $GITHUB_ENV | |
| python_version_without_periods=$(echo "${{ matrix.python-version }}" | sed 's/\.//g') | |
| echo python_version_without_periods=${python_version_without_periods} >> $GITHUB_ENV | |
| - name: Check out repo | |
| uses: actions/checkout@v6 | |
| - name: Update NVIDIA driver | |
| uses: pytorch/test-infra/.github/actions/setup-nvidia-windows@main | |
| - name: Remove src/ folder | |
| run: bash packaging/remove_src.sh | |
| - name: Setup conda env | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| auto-update-conda: true | |
| miniforge-version: latest | |
| activate-environment: test | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install CUDA and FFmpeg conda packages | |
| run: | | |
| conda install -y \ | |
| "nvidia::cuda-nvrtc=${{ matrix.cuda-version }}" \ | |
| "nvidia::cuda-cudart=${{ matrix.cuda-version }}" \ | |
| "conda-forge::ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" | |
| - name: Check env | |
| run: | | |
| env | |
| conda info | |
| conda list | |
| - name: Assert ffmpeg exists | |
| run: | | |
| ffmpeg -buildconf | |
| - name: Check FFmpeg CUDA support | |
| run: | | |
| ffmpeg -decoders | grep -i nvidia | |
| - name: Update pip | |
| run: python -m pip install --upgrade pip | |
| - name: Install PyTorch | |
| run: | | |
| bash packaging/install_pytorch.sh cu${{ env.cuda_version_without_periods }} "torch torchvision" | |
| python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")' | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: meta-pytorch_torchcodec__${{ matrix.python-version }}_cu${{ env.cuda_version_without_periods }}_x64 | |
| path: dist/ | |
| - name: Install torchcodec from the wheel | |
| run: bash packaging/install_torchcodec_wheel.sh "*cu${{ env.cuda_version_without_periods }}-cp${{ env.python_version_without_periods }}*.whl" | |
| - name: Install test dependencies | |
| run: bash packaging/install_test_dependencies.sh | |
| - name: Run Python tests | |
| run: | | |
| FAIL_WITHOUT_CUDA=1 pytest --override-ini="addopts=-v" test/smoke_test.py --tb=short | |
| - name: Run Python benchmark | |
| run: | | |
| time python benchmarks/decoders/gpu_benchmark.py --devices=cuda:0,cpu --resize_devices=none | |
| install-and-test-on-cpu-only-machine: | |
| # This job tests that CUDA wheels work fine on CPU-only machines. Note that | |
| # we still install a CUDA-enabled version of torch, and that's by design. | |
| # Essentially, what we want to make sure is that | |
| # `pip install torch torchcodec` works on CPU-only machines, and this | |
| # command should install CUDA-enabled versions of both torch and torchcodec. | |
| # It's critical that this job runs on a CPU-only machine. | |
| runs-on: windows-latest | |
| needs: build | |
| env: | |
| PYTHON_VERSION: '3.10' | |
| CUDA_VERSION: '12.6' | |
| FFMPEG_VERSION: '7' | |
| steps: | |
| - name: Setup env vars | |
| run: | | |
| cuda_version_without_periods=$(echo "${{ env.CUDA_VERSION }}" | sed 's/\.//g') | |
| echo cuda_version_without_periods=${cuda_version_without_periods} >> $GITHUB_ENV | |
| python_version_without_periods=$(echo "${{ env.PYTHON_VERSION }}" | sed 's/\.//g') | |
| echo python_version_without_periods=${python_version_without_periods} >> $GITHUB_ENV | |
| - name: Check out repo | |
| uses: actions/checkout@v6 | |
| - name: Remove src/ folder | |
| run: bash packaging/remove_src.sh | |
| - name: Setup conda env | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| auto-update-conda: true | |
| miniforge-version: latest | |
| activate-environment: test | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Update pip | |
| run: python -m pip install --upgrade pip | |
| - name: Install PyTorch | |
| run: bash packaging/install_pytorch.sh cu${{ env.cuda_version_without_periods }} "torch torchvision" | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: meta-pytorch_torchcodec__${{ env.PYTHON_VERSION }}_cu${{ env.cuda_version_without_periods }}_x64 | |
| path: dist/ | |
| - name: Install torchcodec from the wheel | |
| run: bash packaging/install_torchcodec_wheel.sh "*cu${{ env.cuda_version_without_periods }}-cp${{ env.python_version_without_periods }}*.whl" | |
| - name: Install ffmpeg | |
| run: bash -l packaging/install_ffmpeg.sh ${{ env.FFMPEG_VERSION }} | |
| - name: Install test dependencies | |
| run: bash packaging/install_test_dependencies.sh | |
| - name: Assert CUDA is not available | |
| run: | | |
| python -c "import torch; assert not torch.cuda.is_available()" | |
| - name: Run Python tests | |
| run: | | |
| pytest --override-ini="addopts=-v" test/smoke_test.py --tb=short |