diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 86961cc885..abcd9dcb36 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -3,6 +3,9 @@ name: Build wheels on: workflow_dispatch: {} +# this yaml file can be cleaned up using yaml anchors, but they're not supported in github actions yet +# https://github.com/actions/runner/issues/1182 + env: # all values: # 3.5;3.7;5.0;5.2;5.3;6.0;6.1;6.2;7.0;7.2;7.5;8.0;8.6 @@ -11,43 +14,94 @@ env: # you need at least cuda 5.0 for some of the stuff compiled here. TORCH_CUDA_ARCH_LIST: "6.0 6.1 7.0 7.5 8.0 8.6" FORCE_CUDA: 1 + MAX_JOBS: 1 # will crash otherwise + DISTUTILS_USE_SDK: 1 # otherwise distutils will complain on windows about multiple versions of msvc jobs: build_wheels: strategy: + fail-fast: false # don't stop other jobs if one failed matrix: + os: + - ubuntu-22.04 + - windows-2019 python: - - "python3.7" - - "python3.8" - - "python3.9" - - "python3.10" + - "3.7" + - "3.8" + - "3.9" + - "3.10" config: # torch 1.13 is built with cuda 11.6 and 11.7 - torch_version: "1.13.0+cu117" + cuda_version: "11.7.0" pip_index: https://download.pytorch.org/whl/cu117 cuda_run_file: https://developer.download.nvidia.com/compute/cuda/11.7.1/local_installers/cuda_11.7.1_515.65.01_linux.run - torch_version: "1.13.0+cu116" + cuda_version: "11.6.2" pip_index: https://download.pytorch.org/whl/cu116 cuda_run_file: https://developer.download.nvidia.com/compute/cuda/11.6.2/local_installers/cuda_11.6.2_510.47.03_linux.run # torch 1.12 is built with cuda 11.3 and 11.6, we ignore 11.3 for now - torch_version: "1.12.1+cu116" + cuda_version: "11.6.2" pip_index: https://download.pytorch.org/whl/cu116 cuda_run_file: https://developer.download.nvidia.com/compute/cuda/11.6.2/local_installers/cuda_11.6.2_510.47.03_linux.run - name: ${{ matrix.python }}-torch${{ matrix.config.torch_version }} - runs-on: ubuntu-22.04 + name: ${{ matrix.os }}-py${{ matrix.python }}-torch${{ matrix.config.torch_version }} + runs-on: ${{ matrix.os }} + env: + # alias for the current python version + # windows does not have per version binary, it is just 'python3' + PY: python${{ contains(matrix.os, 'ubuntu') && matrix.python || '3' }} + + container: ${{ contains(matrix.os, 'ubuntu') && 'quay.io/pypa/manylinux2014_x86_64' || null }} timeout-minutes: 360 - container: - image: quay.io/pypa/manylinux2014_x86_64 + defaults: + run: + shell: bash steps: - - name: install cuda + ##### linux build setup + - if: runner.os == 'Linux' + name: (Linux) install cuda run: > yum install wget git prename -y && wget -q "${{ matrix.config.cuda_run_file }}" -O cuda.run && sh ./cuda.run --silent --toolkit + #### end linux build setup + ### windows build setup + - if: runner.os == 'Windows' + name: (Windows) install cuda + uses: okazunori2013/cuda-toolkit@v0.3.2 + with: + cuda: ${{ matrix.config.cuda_version }} + method: network + + - if: runner.os == 'Windows' + name: (Windows) install python + uses: actions/setup-python@v4 + with: + python-version: "${{ matrix.python }}" + + - if: runner.os == 'Windows' + name: (Windows) setup msvc + uses: ilammy/msvc-dev-cmd@v1 + + - if: runner.os == 'Windows' + name: configure Pagefile + # windows runners will OOM with many CUDA architectures + # we cheat here with a page file + uses: al-cheb/configure-pagefile-action@v1.2 + with: + minimum-size: 8GB + + - if: runner.os == 'Windows' + name: (Windows) Remove link.exe + # really unfortunate: https://github.com/ilammy/msvc-dev-cmd#name-conflicts-with-shell-bash + run: rm /usr/bin/link + #### end windows build setup + #### now the actual build: - name: Recursive checkout uses: actions/checkout@v3 with: @@ -56,13 +110,14 @@ jobs: - name: Install build dependencies run: > - ${{ matrix.python }} -m pip install setuptools torch==${{ matrix.config.torch_version }} -r requirements.txt --extra-index-url ${{ matrix.config.pip_index }} && + $PY -m pip install wheel setuptools torch==${{ matrix.config.torch_version }} -r requirements.txt --extra-index-url ${{ matrix.config.pip_index }} && git config --global --add safe.directory "*" - name: Build wheel - run: ${{ matrix.python }} setup.py bdist_wheel -d "dist/${{ matrix.python }}-torch${{ matrix.config.torch_version }}" + run: $PY setup.py bdist_wheel -d "dist/torch${{ matrix.config.torch_version }}" - uses: actions/upload-artifact@v3 with: + name: ${{ matrix.os }} path: dist # Note: it might be helpful to have additional steps that test if the built wheels actually work