-
Notifications
You must be signed in to change notification settings - Fork 311
173 lines (155 loc) · 5.82 KB
/
building.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Build Wheels
on: [workflow_call, workflow_dispatch]
jobs:
build_sdist:
name: Build source distribution and no binary wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Strip unsupported tags in README
run: |
sed -i '/<!-- pypi-strip -->/,/<!-- \/pypi-strip -->/d' README.md
- name: Build sdist
run: BUILD_NO_CUDA=1 pipx run build --sdist
- name: Build wheel with no binaries
run: BUILD_NO_CUDA=1 python setup.py bdist_wheel --dist-dir=dist
- uses: actions/upload-artifact@v3
with:
name: pypi_packages
path: dist/*.tar.gz
build_wheels:
runs-on: ${{ matrix.os }}
environment: production
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019]
python-version: ['3.10']
torch-version: ['2.0.0', '2.1.0', '2.2.0', '2.3.0', '2.4.0']
cuda-version: ['cu118', 'cu121', 'cu124']
# python-version: ['3.8']
# torch-version: ['2.0.0']
# cuda-version: ['cu118']
exclude:
- python-version: 3.12
torch-version: 2.0.0
- python-version: 3.12
torch-version: 2.1.0
- torch-version: 2.0.0
cuda-version: 'cu113'
- torch-version: 2.0.0
cuda-version: 'cu116'
- torch-version: 2.0.0
cuda-version: 'cu121'
- torch-version: 2.0.0
cuda-version: 'cu124'
- torch-version: 2.1.0
cuda-version: 'cu113'
- torch-version: 2.1.0
cuda-version: 'cu116'
- torch-version: 2.1.0
cuda-version: 'cu117'
- torch-version: 2.1.0
cuda-version: 'cu124'
- torch-version: 2.2.0
cuda-version: 'cu113'
- torch-version: 2.2.0
cuda-version: 'cu116'
- torch-version: 2.2.0
cuda-version: 'cu117'
- torch-version: 2.2.0
cuda-version: 'cu124'
- torch-version: 2.3.0
cuda-version: 'cu113'
- torch-version: 2.3.0
cuda-version: 'cu116'
- torch-version: 2.3.0
cuda-version: 'cu117'
- torch-version: 2.3.0
cuda-version: 'cu124'
- torch-version: 2.4.0
cuda-version: 'cu113'
- torch-version: 2.4.0
cuda-version: 'cu116'
- torch-version: 2.4.0
cuda-version: 'cu117'
- os: windows-2019
torch-version: 2.0.0
cuda-version: 'cu121'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Free up disk space
if: ${{ runner.os == 'Linux' }}
run: |
echo "Disk space before cleanup:"
df -h
sudo rm -rf /usr/share/dotnet
echo "Disk space after cleanup:"
df -h
shell: bash
- name: Install CUDA ${{ matrix.cuda-version }}
if: ${{ matrix.cuda-version != 'cpu' }}
run: |
bash .github/workflows/cuda/${{ runner.os }}.sh ${{ matrix.cuda-version }}
shell: bash
- name: Install PyTorch ${{ matrix.torch-version }}+${{ matrix.cuda-version }}
run: |
pip install torch==${{ matrix.torch-version }} --extra-index-url https://download.pytorch.org/whl/${{ matrix.cuda-version }}
python -c "import torch; print('PyTorch:', torch.__version__)"
python -c "import torch; print('CUDA:', torch.version.cuda)"
python -c "import torch; print('CUDA Available:', torch.cuda.is_available())"
shell: bash
- name: Patch PyTorch static constexpr on Windows
if: ${{ runner.os == 'Windows' }}
run: |
Torch_DIR=`python -c 'import os; import torch; print(os.path.dirname(torch.__file__))'`
sed -i '31,38c\
TORCH_API void lazy_init_num_threads();' ${Torch_DIR}/include/ATen/Parallel.h
shell: bash
- name: Set version
if: ${{ runner.os != 'macOS' }}
run: |
VERSION=`sed -n 's/^__version__ = "\(.*\)"/\1/p' gsplat/version.py`
TORCH_VERSION=`echo "pt${{ matrix.torch-version }}" | sed "s/..$//" | sed "s/\.//g"`
CUDA_VERSION=`echo ${{ matrix.cuda-version }}`
echo "New version name: $VERSION+$TORCH_VERSION$CUDA_VERSION"
sed -i "s/$VERSION/$VERSION+$TORCH_VERSION$CUDA_VERSION/" gsplat/version.py
shell: bash
- name: Upgrade pip
run: |
pip install --upgrade setuptools
pip install ninja
shell: bash
- name: Install main package for CPU
if: ${{ matrix.cuda-version == 'cpu' }}
run: |
BUILD_NO_CUDA=1 pip install .
shell: bash
- name: Build wheel
# build against architectures >= 7.0 (required by cooperative_groups::labeled_partition in gsplat)
run: |
pip install wheel
source .github/workflows/cuda/${{ runner.os }}-env.sh ${{ matrix.cuda-version }}
MAX_JOBS=2 python setup.py bdist_wheel --dist-dir=dist
shell: bash # `source` does not exist in windows powershell
- name: Test wheel
run: |
cd dist
ls -lah
pip install *.whl
python -c "import gsplat; print('gsplat:', gsplat.__version__)"
cd ..
shell: bash # `ls -lah` does not exist in windows powershell
# v4 does not allow writing into the same folder, so stick with v3
# https://github.com/actions/upload-artifact/issues/478
- uses: actions/upload-artifact@v3
with:
name: compiled_wheels_python${{ matrix.python-version }}
path: dist/*.whl