|
| 1 | +name: Building Wheels |
| 2 | + |
| 3 | +on: [workflow_dispatch] |
| 4 | + |
| 5 | +jobs: |
| 6 | + |
| 7 | + wheel: |
| 8 | + runs-on: ${{ matrix.os }} |
| 9 | + environment: production |
| 10 | + |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + # os: [windows-2019] |
| 15 | + # python-version: ['3.7'] |
| 16 | + # torch-version: [1.11.0] |
| 17 | + # cuda-version: ['cu113'] |
| 18 | + os: [ubuntu-20.04, windows-2019] |
| 19 | + # support version based on: https://download.pytorch.org/whl/torch/ |
| 20 | + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] |
| 21 | + torch-version: [1.11.0, 1.12.0, 1.13.0, 2.0.0] |
| 22 | + cuda-version: ['cu113', 'cu115', 'cu116', 'cu117', 'cu118'] |
| 23 | + exclude: |
| 24 | + - torch-version: 1.11.0 |
| 25 | + python-version: '3.11' |
| 26 | + - torch-version: 1.11.0 |
| 27 | + cuda-version: 'cu116' |
| 28 | + - torch-version: 1.11.0 |
| 29 | + cuda-version: 'cu117' |
| 30 | + - torch-version: 1.11.0 |
| 31 | + cuda-version: 'cu118' |
| 32 | + |
| 33 | + - torch-version: 1.12.0 |
| 34 | + python-version: '3.11' |
| 35 | + - torch-version: 1.12.0 |
| 36 | + cuda-version: 'cu115' |
| 37 | + - torch-version: 1.12.0 |
| 38 | + cuda-version: 'cu117' |
| 39 | + - torch-version: 1.12.0 |
| 40 | + cuda-version: 'cu118' |
| 41 | + |
| 42 | + - torch-version: 1.13.0 |
| 43 | + cuda-version: 'cu102' |
| 44 | + - torch-version: 1.13.0 |
| 45 | + cuda-version: 'cu113' |
| 46 | + - torch-version: 1.13.0 |
| 47 | + cuda-version: 'cu115' |
| 48 | + - torch-version: 1.13.0 |
| 49 | + cuda-version: 'cu118' |
| 50 | + |
| 51 | + - torch-version: 2.0.0 |
| 52 | + python-version: '3.7' |
| 53 | + - torch-version: 2.0.0 |
| 54 | + cuda-version: 'cu102' |
| 55 | + - torch-version: 2.0.0 |
| 56 | + cuda-version: 'cu113' |
| 57 | + - torch-version: 2.0.0 |
| 58 | + cuda-version: 'cu115' |
| 59 | + - torch-version: 2.0.0 |
| 60 | + cuda-version: 'cu116' |
| 61 | + |
| 62 | + - os: windows-2019 |
| 63 | + cuda-version: 'cu102' |
| 64 | + - os: windows-2019 |
| 65 | + torch-version: 1.13.0 |
| 66 | + python-version: '3.11' |
| 67 | + |
| 68 | + # - os: windows-2019 |
| 69 | + # torch-version: 1.13.0 |
| 70 | + # cuda-version: 'cu117' |
| 71 | + # python-version: '3.9' |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@v3 |
| 77 | + with: |
| 78 | + submodules: 'recursive' |
| 79 | + |
| 80 | + - name: Set up Python ${{ matrix.python-version }} |
| 81 | + uses: actions/setup-python@v4 |
| 82 | + with: |
| 83 | + python-version: ${{ matrix.python-version }} |
| 84 | + |
| 85 | + - name: Upgrade pip |
| 86 | + run: | |
| 87 | + pip install --upgrade setuptools |
| 88 | + pip install ninja |
| 89 | +
|
| 90 | + - name: Free up disk space |
| 91 | + if: ${{ runner.os == 'Linux' }} |
| 92 | + run: | |
| 93 | + sudo rm -rf /usr/share/dotnet |
| 94 | +
|
| 95 | + - name: Install CUDA ${{ matrix.cuda-version }} |
| 96 | + if: ${{ matrix.cuda-version != 'cpu' }} |
| 97 | + run: | |
| 98 | + bash .github/workflows/cuda/${{ runner.os }}.sh ${{ matrix.cuda-version }} |
| 99 | +
|
| 100 | + - name: Install PyTorch ${{ matrix.torch-version }}+${{ matrix.cuda-version }} |
| 101 | + run: | |
| 102 | + pip install torch==${{ matrix.torch-version }} --extra-index-url https://download.pytorch.org/whl/${{ matrix.cuda-version }} |
| 103 | + python -c "import torch; print('PyTorch:', torch.__version__)" |
| 104 | + python -c "import torch; print('CUDA:', torch.version.cuda)" |
| 105 | + python -c "import torch; print('CUDA Available:', torch.cuda.is_available())" |
| 106 | +
|
| 107 | + - name: Patch PyTorch static constexpr on Windows |
| 108 | + if: ${{ runner.os == 'Windows' }} |
| 109 | + run: | |
| 110 | + Torch_DIR=`python -c 'import os; import torch; print(os.path.dirname(torch.__file__))'` |
| 111 | + sed -i '31,38c\ |
| 112 | + TORCH_API void lazy_init_num_threads();' ${Torch_DIR}/include/ATen/Parallel.h |
| 113 | + shell: bash |
| 114 | + |
| 115 | + - name: Set version |
| 116 | + if: ${{ runner.os != 'macOS' }} |
| 117 | + run: | |
| 118 | + VERSION=`sed -n 's/^__version__ = "\(.*\)"/\1/p' gsplat/version.py` |
| 119 | + TORCH_VERSION=`echo "pt${{ matrix.torch-version }}" | sed "s/..$//" | sed "s/\.//g"` |
| 120 | + CUDA_VERSION=`echo ${{ matrix.cuda-version }}` |
| 121 | + echo "New version name: $VERSION+$TORCH_VERSION$CUDA_VERSION" |
| 122 | + sed -i "s/$VERSION/$VERSION+$TORCH_VERSION$CUDA_VERSION/" gsplat/version.py |
| 123 | + shell: |
| 124 | + bash |
| 125 | + |
| 126 | + - name: Install main package for CPU |
| 127 | + if: ${{ matrix.cuda-version == 'cpu' }} |
| 128 | + run: | |
| 129 | + BUILD_NO_CUDA=1 pip install . |
| 130 | +
|
| 131 | + - name: Build wheel |
| 132 | + run: | |
| 133 | + pip install wheel |
| 134 | + source .github/workflows/cuda/${{ runner.os }}-env.sh ${{ matrix.cuda-version }} |
| 135 | + python setup.py bdist_wheel --dist-dir=dist |
| 136 | + shell: bash # `source` does not exist in windows powershell |
| 137 | + |
| 138 | + - name: Test wheel |
| 139 | + run: | |
| 140 | + cd dist |
| 141 | + ls -lah |
| 142 | + pip install *.whl |
| 143 | + python -c "import gsplat; print('gsplat:', gsplat.__version__)" |
| 144 | + cd .. |
| 145 | + shell: bash # `ls -lah` does not exist in windows powershell |
0 commit comments