|
56 | 56 | architecture: aarch64 |
57 | 57 | build-platform: "python-build-package" |
58 | 58 | build-command: "BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 ENABLE_CUDA=1 python -m build --wheel -vvv --no-isolation" |
| 59 | + |
| 60 | + install-and-test: |
| 61 | + runs-on: linux.arm64.2xlarge |
| 62 | + strategy: |
| 63 | + fail-fast: false |
| 64 | + matrix: |
| 65 | + # 3.10 corresponds to the minimum python version for which we build |
| 66 | + # the wheel unless the label cliflow/binaries/all is present in the |
| 67 | + # PR. |
| 68 | + # For the actual release we should add that label and change this to |
| 69 | + # include more python versions. |
| 70 | + python-version: ['3.10'] |
| 71 | + # We test against 12.6 and 13.0 to avoid having too big of a CI matrix, |
| 72 | + # but for releases we should add 12.8. |
| 73 | + cuda-version: ['12.6', '13.0'] |
| 74 | + # TODO: put back ffmpeg 5 https://github.com/pytorch/torchcodec/issues/325 |
| 75 | + ffmpeg-version-for-tests: ['4.4.2', '6', '7', '8.0'] |
| 76 | + |
| 77 | + container: |
| 78 | + image: "pytorch/manylinux2_28-builder:cuda${{ matrix.cuda-version }}" |
| 79 | + options: "--gpus all -e NVIDIA_DRIVER_CAPABILITIES=video,compute,utility" |
| 80 | + needs: build |
| 81 | + steps: |
| 82 | + - name: Setup env vars |
| 83 | + run: | |
| 84 | + cuda_version_without_periods=$(echo "${{ matrix.cuda-version }}" | sed 's/\.//g') |
| 85 | + echo cuda_version_without_periods=${cuda_version_without_periods} >> $GITHUB_ENV |
| 86 | + python_version_without_periods=$(echo "${{ matrix.python-version }}" | sed 's/\.//g') |
| 87 | + echo python_version_without_periods=${python_version_without_periods} >> $GITHUB_ENV |
| 88 | + - uses: actions/download-artifact@v4 |
| 89 | + with: |
| 90 | + name: meta-pytorch_torchcodec__${{ matrix.python-version }}_cu${{ env.cuda_version_without_periods }}_aarch64 |
| 91 | + path: pytorch/torchcodec/dist/ |
| 92 | + - name: Setup miniconda using test-infra |
| 93 | + uses: pytorch/test-infra/.github/actions/setup-miniconda@main |
| 94 | + with: |
| 95 | + python-version: ${{ matrix.python-version }} |
| 96 | + # We install conda packages at the start because otherwise conda may have conflicts with dependencies. |
| 97 | + # Note: xorg-libxau was addded to fix a problem with ffmpeg 4. We should consider removing it. |
| 98 | + 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" |
| 99 | + - name: Check env, set LD_LIBRARY_PATH |
| 100 | + run: | |
| 101 | + ${CONDA_RUN} env |
| 102 | + ${CONDA_RUN} conda info |
| 103 | + ${CONDA_RUN} nvidia-smi |
| 104 | + ${CONDA_RUN} conda list |
| 105 | + echo LD_LIBRARY_PATH=$CONDA_PREFIX/lib:/usr/local/cuda/lib64/:${LD_LIBRARY_PATH} >> $GITHUB_ENV |
| 106 | + - name: Assert ffmpeg exists |
| 107 | + run: | |
| 108 | + ${CONDA_RUN} ffmpeg -buildconf |
| 109 | + - name: Update pip |
| 110 | + run: ${CONDA_RUN} python -m pip install --upgrade pip |
| 111 | + - name: Install PyTorch |
| 112 | + run: | |
| 113 | + ${CONDA_RUN} python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu${{ env.cuda_version_without_periods }} |
| 114 | + ${CONDA_RUN} python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")' |
| 115 | + - name: Install torchcodec from the wheel |
| 116 | + run: | |
| 117 | + wheel_path=`find pytorch/torchcodec/dist -type f -name "*cu${{ env.cuda_version_without_periods }}-cp${{ env.python_version_without_periods }}*.whl"` |
| 118 | + echo Installing $wheel_path |
| 119 | + ${CONDA_RUN} python -m pip install $wheel_path -vvv |
| 120 | +
|
| 121 | + - name: Check out repo |
| 122 | + uses: actions/checkout@v3 |
| 123 | + |
| 124 | + - name: Install test dependencies |
| 125 | + run: | |
| 126 | + # Ideally we would find a way to get those dependencies from pyproject.toml |
| 127 | + ${CONDA_RUN} python -m pip install numpy pytest pillow |
| 128 | +
|
| 129 | + - name: Delete the src/ folder just for fun |
| 130 | + run: | |
| 131 | + # The only reason we checked-out the repo is to get access to the |
| 132 | + # tests. We don't care about the rest. Out of precaution, we delete |
| 133 | + # the src/ folder to be extra sure that we're running the code from |
| 134 | + # the installed wheel rather than from the source. |
| 135 | + # This is just to be extra cautious and very overkill because a) |
| 136 | + # there's no way the `torchcodec` package from src/ can be found from |
| 137 | + # the PythonPath: the main point of `src/` is precisely to protect |
| 138 | + # against that and b) if we ever were to execute code from |
| 139 | + # `src/torchcodec`, it would fail loudly because the built .so files |
| 140 | + # aren't present there. |
| 141 | + rm -r src/ |
| 142 | + ls |
| 143 | + - name: Run Python tests |
| 144 | + run: | |
| 145 | + ${CONDA_RUN} FAIL_WITHOUT_CUDA=1 pytest --override-ini="addopts=-v" test --tb=short |
| 146 | + - name: Run Python benchmark |
| 147 | + run: | |
| 148 | + ${CONDA_RUN} time python benchmarks/decoders/gpu_benchmark.py --devices=cuda:0,cpu --resize_devices=none |
0 commit comments