-
-
Notifications
You must be signed in to change notification settings - Fork 3
224 lines (206 loc) · 7.45 KB
/
wheels-generator.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
name: CI
on:
workflow_dispatch:
env:
TINY_CUDA_NN_VERSION: "1.7.1"
jobs:
build-tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install GitHub CLI
run: |
sudo apt-get update
sudo apt-get install -y gh
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TINY_CUDA_NN_VERSION }}
release_name: ${{ env.TINY_CUDA_NN_VERSION }}
draft: false
prerelease: false
build_windows:
needs: build-tag
name: Build on Windows
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-2019
visual_studio: "Visual Studio 16 2019"
python-version: '3.10'
torch-version: '2.3.1'
cuda-version: "12.1"
arch: 89
- os: windows-2019
visual_studio: "Visual Studio 16 2019"
python-version: '3.10'
torch-version: '2.3.1'
cuda-version: "12.1"
arch: 75
- os: windows-2019
visual_studio: "Visual Studio 16 2019"
python-version: '3.10'
torch-version: '2.3.1'
cuda-version: "12.1"
arch: 70
- os: windows-2019
visual_studio: "Visual Studio 16 2019"
python-version: '3.10'
torch-version: '2.3.1'
cuda-version: "12.1"
arch: 61
env:
build_dir: "build"
config: "Release"
TCNN_CUDA_ARCHITECTURES: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v3
with:
repository: 'NVlabs/tiny-cuda-nn'
submodules: 'recursive'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: List Visual Studio installations
run: |
& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -products * -legacy -format text
- name: Install Wheel
run:
pip3 install setuptools wheel
- name: Install Torch + Cuda ${{ matrix.cuda-version }}
run: |
$CUDA_VERSION="${{ matrix.cuda-version }}"
$CUDA_VERSION_NO_DOT=$CUDA_VERSION -replace '\.', ''
pip3 install torch==${{ matrix.torch-version }} --index-url https://download.pytorch.org/whl/cu$CUDA_VERSION_NO_DOT
pip3 install numpy
python3 --version
- name: Download and Extract CUDA Toolkit ${{ matrix.cuda-version }}
run: |
if ("${{ matrix.cuda-version }}" -eq "12.1") {
choco install cuda --version=12.2.0.53625
} else {
choco install cuda --version=11.8.0.52206
}
- name: Find CUDA Toolkit path
run: |
$env:CUDART_PATH= "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${{ matrix.cuda-version }}\bin"
$env:CUDART_HOME= "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${{ matrix.cuda-version }}\bin"
- name: Create NVCC and MSVC Wrappers
run: |
# Create a directory for wrappers
mkdir $env:RUNNER_TEMP\wrappers
$nvccWrapper = @"
@echo off
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\bin\nvcc.exe" -std=c++17 %*
"@
$clWrapper = @"
@echo off
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /std:c++17 %*
"@
Set-Content -Path "$env:RUNNER_TEMP\wrappers\nvcc.bat" -Value $nvccWrapper
Set-Content -Path "$env:RUNNER_TEMP\wrappers\cl.bat" -Value $clWrapper
- name: Adjust PATH to Include CUDA and Wrappers
run: |
$cudaPath = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\bin"
echo "PATH=$env:RUNNER_TEMP\wrappers;$cudaPath;$env:PATH" >> $env:GITHUB_ENV
shell: pwsh
- name: Set CUDA_HOME
run: echo "CUDA_HOME=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2" >> $env:GITHUB_ENV
shell: pwsh
- name: Generate latest Wheels
run: |
cd bindings/torch
python3 setup.py bdist_wheel --plat-name win_amd64 # Build the wheel
shell: pwsh # Ensure PowerShell is used on Windows
- name: Upload assets
run: |
$CUDA_VERSION="${{ matrix.cuda-version }}"
$CUDA_VERSION_NO_DOT = $CUDA_VERSION -replace '\.', ''
$TORCH_VERSION="${{ matrix.torch-version }}"
$TORCH_VERSION_NO_DOT = $TORCH_VERSION -replace '\.', ''
cd bindings/torch/dist
Get-ChildItem -Name | ForEach-Object {
$new_filename = $_ -replace '1.7', "1.7.post{{ matrix.arch }}$TORCH_VERSION_NO_DOT$CUDA_VERSION_NO_DOT"
Rename-Item -Path $_ -NewName $new_filename
echo "Uploading $new_filename"
gh release upload ${{ env.TINY_CUDA_NN_VERSION }} "$new_filename" --clobber --repo ${{ github.repository }}
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: pwsh
build_linux:
needs: build-tag
name: Build on linux systems
runs-on: ${{ matrix.os }}
container:
image: ${{ matrix.cuda }}
strategy:
matrix:
include:
- os: ubuntu-22.04
cuda: nvidia/cuda:12.1.0-devel-ubuntu22.04
cudaversion: 121
torchversion: 231
arch: 75 # for T4 on google colab
- os: ubuntu-22.04
cuda: nvidia/cuda:12.1.0-devel-ubuntu22.04
cudaversion: 121
torchversion: 231
arch: 70 # for v100 on google colab
- os: ubuntu-22.04
cuda: nvidia/cuda:12.1.0-devel-ubuntu22.04
cudaversion: 121
torchversion: 231
arch: 89 # for a100 on google colab
env:
build_dir: "build"
config: "Release"
TCNN_CUDA_ARCHITECTURES: ${{ matrix.arch }}
steps:
- name: Install Git and Python
run: |
apt-get update
apt-get install -y git python3 python3-pip
- name: Install GitHub CLI
run: |
apt-get update
apt-get install -y gh
- uses: actions/checkout@v3
with:
repository: 'NVlabs/tiny-cuda-nn'
submodules: 'recursive'
token: ${{ secrets.GITHUB_TOKEN }}
- name: List directory structure
run: |
ls -R
- name: Install Wheel
run:
pip install setuptools wheel
- name: Install Pytorch
run: |
pip3 install torch==2.3.1 --index-url https://download.pytorch.org/whl/cu121
- name: Generate Wheels
run: |
cd bindings/torch
python3 setup.py bdist_wheel --plat-name linux_x86_64
env:
INCLUDE_ARCH: ${{ matrix.arch }}
- name: Upload assets
run: |
cd bindings/torch/dist
for filename in *; do
# Rename the file by inserting .post${{ matrix.arch }} directly after "1.7"
new_filename=$(echo "$filename" | sed "s/1.7/1.7.post${{ matrix.arch }}${{ matrix.torchversion }}${{ matrix.cudaversion }}/")
mv "$filename" "$new_filename"
echo "Uploading $new_filename"
gh release upload ${{ env.TINY_CUDA_NN_VERSION }} "$new_filename" --clobber --repo ${{ github.repository }}
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}