This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
468 lines (414 loc) · 18.3 KB
/
build.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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
name: Build
env:
CUDA_LINUX: "11.8"
CUDA_WINDOWS: "11.8.0_522.06"
VULKAN_LINUX: "1.3.231"
VULKAN_MAC: "1.3.231.1"
VULKAN_WINDOWS: "1.3.231.1"
on:
pull_request:
push:
branches: [develop]
jobs:
linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install CUDA
run: .github/tools/linux-install-cuda.sh
- name: Install Vulkan
run: .github/tools/linux-install-vulkan.sh
- run: cmake -B build -DSPACEMESHVULKAN=OFF
- run: cmake --build build
- name: Copy library
run: cp build/src/libgpu-setup.so build/test/libgpu-setup.so
- name: Unit tests - List providers
run: build/test/gpu-setup-test --list
- name: Unit tests - Golden vectors
run: build/test/gpu-setup-test --test-vector-check
- name: Unit tests - hash and bitstream
run: build/test/gpu-setup-test --unit-tests
- name: Unit tests - PoW
run: build/test/gpu-setup-test -tp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
- name: Unit tests - PoW and Leafs
run: build/test/gpu-setup-test -tlp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
- name: Unit tests - label lengths
run: build/test/gpu-setup-test -il
- name: Unit tests - labels count
run: build/test/gpu-setup-test -in
- name: Integration tests - concurrency test
run: build/test/gpu-setup-test -ip
- name: Integration tests - cancellation test
run: build/test/gpu-setup-test -ic
- name: Upload lib
uses: actions/upload-artifact@v3
with:
name: linux
path: build/src/libgpu-setup.so
- name: Upload test-app
uses: actions/upload-artifact@v3
with:
name: linux
path: build/test/gpu-setup-test
- name: Upload api.h
uses: actions/upload-artifact@v3
with:
name: linux
path: include/api.h
windows:
runs-on: windows-2022
env:
vs_path: C:\Program Files\Microsoft Visual Studio\2022\Enterprise
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Cache Windows Vulkan downloads
uses: actions/cache@v3
id: cache-win-vulkan
with:
path: .cache/vulkan
key: win-vulkan-${{ env.VULKAN_WINDOWS }}
- name: Cache Windows CUDA downloads
uses: actions/cache@v3
id: cache-win-cuda
with:
path: .cache/cuda
key: win-cuda-${{ env.CUDA_WINDOWS }}
- name: Download Vulkan SDK
if: ${{ steps.cache-win-vulkan.outputs.cache-hit != 'true' }}
env:
file-url: "https://sdk.lunarg.com/sdk/download/${{ env.VULKAN_WINDOWS }}/windows/VulkanSDK-${{ env.VULKAN_WINDOWS }}-Installer.exe"
file-name: VulkanSDK-${{ env.VULKAN_WINDOWS }}-Installer.exe
location: .cache/vulkan
sha256: "ffdf442893761a453499d612d86534a02573c3d2b2442b40311b69a4b2518bf2"
run: go run .github/tools/download.go
- name: Install vulkan SDK
run: |
Start-Process .cache/vulkan/VulkanSDK-${{ env.VULKAN_WINDOWS }}-Installer.exe -Wait -ArgumentList "--accept-licenses","--default-answer","--confirm-command install"
"VULKAN_SDK_VERSION=${{ env.VULKAN_WINDOWS }}" >> $env:GITHUB_ENV
"VULKAN_SDK=C:\VulkanSDK\${{ env.VULKAN_WINDOWS }}" >> $env:GITHUB_ENV
"PATH=C:\VulkanSDK\${{ env.VULKAN_WINDOWS }}\bin;$env:PATH" >> $env:GITHUB_ENV
- name: Setup CUDA env variables
shell: bash
run: |
CUDA_SHORT="$(cut -d '.' -f 1 <<< ${{ env.CUDA_WINDOWS }})"."$(cut -d '.' -f 2 <<< ${{ env.CUDA_WINDOWS }})"
echo "CUDA_WINDOWS_SHORT=$CUDA_SHORT" >> $GITHUB_ENV
CUDA_URL=${CUDA_WINDOWS/_*/}
echo "CUDA_WINDOWS_URL=$CUDA_URL" >> $GITHUB_ENV
- name: Download CUDA
if: ${{ steps.cache-win-cuda.outputs.cache-hit != 'true' }}
env:
file-url: "https://developer.download.nvidia.com/compute/cuda/${{ env.CUDA_WINDOWS_URL }}/local_installers/cuda_${{ env.CUDA_WINDOWS }}_windows.exe"
file-name: cuda_${{ env.CUDA_WINDOWS }}_windows.exe
location: .cache/cuda
md5: "894c61ba173d26dc667e95ee734d3c5a"
run: go run .github/tools/download.go
- name: Install CUDA
run: Start-Process .cache/cuda/cuda_${{ env.CUDA_WINDOWS }}_windows.exe -Wait -ArgumentList "-s","-n"
- name: Build
run: |
call "${{ env.vs_path }}\VC\Auxiliary\Build\vcvars64.bat"
"${{ env.vs_path }}\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake" -G "Ninja" -B build -DCMAKE_BUILD_TYPE="Release" -DCMAKE_IGNORE_PATH="C:/Strawberry/c/bin;C:/ProgramData/chocolatey/bin" -DCUDA_TOOLKIT_ROOT_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${{ env.CUDA_WINDOWS_SHORT }}" -DCMAKE_MAKE_PROGRAM="${{ env.vs_path }}\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe"
cmake --build build
shell: cmd
- name: Setup msys2
uses: msys2/setup-msys2@v2
with:
msystem: mingw64
pacboy: >-
toolchain:p
- name: Convert library to gnu format
run: |
cd build/src
gendef gpu-setup.dll
dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib libgpu-setup.a --input-def gpu-setup.def
shell: msys2 {0}
- name: Copy library
shell: bash
run: cp build/src/gpu-setup.dll build/test/gpu-setup.dll
- name: Unit tests - List providers
run: build/test/gpu-setup-test --list
- name: Unit tests - Golden vectors
run: build/test/gpu-setup-test --test-vector-check
- name: Unit tests - hash and bitstream
run: build/test/gpu-setup-test --unit-tests
- name: Unit tests - PoW
run: build/test/gpu-setup-test -tp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
- name: Unit tests - PoW and Leafs
run: build/test/gpu-setup-test -tlp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
- name: Unit tests - label lengths
run: build/test/gpu-setup-test -il
- name: Unit tests - labels count
run: build/test/gpu-setup-test -in
- name: Integration tests - concurrency test
run: build/test/gpu-setup-test -ip
- name: Integration tests - cancellation test
run: build/test/gpu-setup-test -ic
- name: Upload DLL
uses: actions/upload-artifact@v3
with:
name: windows
path: build/src/gpu-setup.dll
- name: Upload lib
uses: actions/upload-artifact@v3
with:
name: windows
path: build/src/gpu-setup.lib
- name: Upload gnu lib
uses: actions/upload-artifact@v3
with:
name: windows
path: build/src/libgpu-setup.a
- name: Upload test app
uses: actions/upload-artifact@v3
with:
name: windows
path: build/test/gpu-setup-test.exe
- name: Upload api.h
uses: actions/upload-artifact@v3
with:
name: windows
path: include/api.h
macos:
runs-on: macos-11
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Cache macOS downloads
id: cache-mac-vulkan
uses: actions/cache@v3
with:
path: .cache/vulkan
key: macos-cuda-vulkan-${{ env.VULKAN_MAC }}
- name: Download Vulkan SDK
if: ${{ steps.cache-mac-vulkan.outputs.cache-hit != 'true' }}
env:
file-url: "https://sdk.lunarg.com/sdk/download/${{ env.VULKAN_MAC }}/mac/vulkansdk-macos-${{ env.VULKAN_MAC }}.dmg"
file-name: vulkansdk-macos-${{ env.VULKAN_MAC }}.dmg
location: .cache/vulkan
sha256: "ee63c647eb5108dfb663b701fd3d5e976e9826f991cbe4aaaf43b5bb01971db5"
run: go run .github/tools/download.go
- name: Install vulkan SDK
run: |
sudo hdiutil attach .cache/vulkan/vulkansdk-macos-${{ env.VULKAN_MAC }}.dmg
cd /Volumes/vulkansdk-macos-${{ env.VULKAN_MAC }}
./InstallVulkan.app/Contents/MacOS/InstallVulkan --accept-licenses --default-answer --confirm-command install
cd /Users/runner/VulkanSDK/${{ env.VULKAN_MAC }}
python install_vulkan.py
VULKAN_ROOT_LOCATION=$PWD
VULKAN_SDK=${VULKAN_ROOT_LOCATION}/macOS
echo "VULKAN_ROOT_LOCATION=$VULKAN_ROOT_LOCATION" >> $GITHUB_ENV
echo "VULKAN_SDK_VERSION=${{ env.VULKAN_MAC }}" >> $GITHUB_ENV
echo "VULKAN_SDK=$VULKAN_SDK" >> $GITHUB_ENV
echo "VK_ICD_FILENAMES=${VULKAN_SDK}/etc/vulkan/icd.d/MoltenVK_icd.json" >> $GITHUB_ENV
echo "VK_LAYER_PATH=${VULKAN_SDK}/etc/vulkan/explicit_layers.d" >> $GITHUB_ENV
echo "PATH=${VULKAN_SDK}/bin:$PATH" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${VULKAN_SDK}/lib" >> $GITHUB_ENV
- run: cmake -DSPACEMESHCUDA=OFF -DSPACEMESHVULKAN=OFF -B build
- run: cmake --build build
- name: Copy library
run: cp build/src/libgpu-setup.dylib build/test/libgpu-setup.dylib
- name: Copy ICD file
run: cp ${{ env.VULKAN_ROOT_LOCATION }}/MoltenVK/dylib/macOS/MoltenVK_icd.json build/test/MoltenVK_icd.json
- name: Copy libMoltenVK
run: cp ${{ env.VULKAN_ROOT_LOCATION }}/MoltenVK/dylib/macOS/libMoltenVK.dylib build/test/libMoltenVK.dylib
- name: Fix library import paths
run: install_name_tool -add_rpath @loader_path build/test/libgpu-setup.dylib
- name: Unit tests - List providers
run: VK_LOADER_DEBUG=all build/test/gpu-setup-test --list
- name: Unit tests - Golden vectors
run: build/test/gpu-setup-test --test-vector-check
- name: Unit tests - hash and bitstream
run: build/test/gpu-setup-test --unit-tests
- name: Unit tests - PoW
run: build/test/gpu-setup-test -tp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
- name: Unit tests - PoW and Leafs
run: build/test/gpu-setup-test -tlp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
- name: Unit tests - label lengths
run: build/test/gpu-setup-test -il
- name: Unit tests - labels count
run: build/test/gpu-setup-test -in
- name: Integration tests - concurrency test
run: build/test/gpu-setup-test -ip
- name: Integration tests - cancellation test
run: build/test/gpu-setup-test -ic
- name: Upload library
uses: actions/upload-artifact@v3
with:
name: macos
path: build/src/libgpu-setup.dylib
- name: Upload test app
uses: actions/upload-artifact@v3
with:
name: macos
path: build/test/gpu-setup-test
- name: Upload api.h
uses: actions/upload-artifact@v3
with:
name: macos
path: include/api.h
- name: Upload MoltenVK
uses: actions/upload-artifact@v3
with:
name: macos
path: build/test/libMoltenVK.dylib
- name: Upload MoltenVK config
uses: actions/upload-artifact@v3
with:
name: macos
path: build/test/MoltenVK_icd.json
- name: Upload Vulkan
uses: actions/upload-artifact@v3
with:
name: macos
path: ${{ env.VULKAN_ROOT_LOCATION }}/macOS/lib/libvulkan.1.dylib
macos-m1:
runs-on: [self-hosted, macos, arm64]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup env
run: echo "VULKAN_ROOT_LOCATION=$VULKAN_ROOT_LOCATION" >> $GITHUB_ENV
- name: Vulkan Info
run: vulkaninfo
- run: arch -arm64 cmake -DSPACEMESHCUDA=OFF -DSPACEMESHVULKAN=OFF -B build
- run: arch -arm64 cmake --build build
- name: Copy library
run: cp build/src/libgpu-setup.dylib build/test/libgpu-setup.dylib
- name: Copy ICD file
run: cp ${{ env.VULKAN_ROOT_LOCATION }}/MoltenVK/dylib/macOS/MoltenVK_icd.json build/test/MoltenVK_icd.json
- name: Copy libMoltenVK
run: cp ${{ env.VULKAN_ROOT_LOCATION }}/MoltenVK/dylib/macOS/libMoltenVK.dylib build/test/libMoltenVK.dylib
- name: Fix library import paths
run: install_name_tool -add_rpath @loader_path build/test/libgpu-setup.dylib
- name: Unit tests - List providers
run: VK_LOADER_DEBUG=all build/test/gpu-setup-test --list
- name: Unit tests - Golden vectors
run: build/test/gpu-setup-test --test-vector-check
- name: Unit tests - hash and bitstream
run: build/test/gpu-setup-test --unit-tests
- name: Unit tests - PoW
run: build/test/gpu-setup-test -tp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
- name: Unit tests - PoW and Leafs
run: build/test/gpu-setup-test -tlp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
- name: Unit tests - label lengths
run: build/test/gpu-setup-test -il
- name: Unit tests - labels count
run: build/test/gpu-setup-test -in
- name: Integration tests - concurrency test
run: build/test/gpu-setup-test -ip
- name: Integration tests - cancellation test
run: build/test/gpu-setup-test -ic
- name: Upload library
uses: actions/upload-artifact@v3
with:
name: macos-m1
path: build/src/libgpu-setup.dylib
- name: Upload test app
uses: actions/upload-artifact@v3
with:
name: macos-m1
path: build/test/gpu-setup-test
- name: Upload api.h
uses: actions/upload-artifact@v3
with:
name: macos-m1
path: include/api.h
- name: Upload MoltenVK
uses: actions/upload-artifact@v3
with:
name: macos-m1
path: build/test/libMoltenVK.dylib
- name: Upload MoltenVK config
uses: actions/upload-artifact@v3
with:
name: macos-m1
path: build/test/MoltenVK_icd.json
- name: Upload Vulkan
uses: actions/upload-artifact@v3
with:
name: macos-m1
path: ${{ env.VULKAN_ROOT_LOCATION }}/macOS/lib/libvulkan.1.dylib
linux-arm64:
runs-on: [self-hosted, linux, arm64]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- run: cmake -DSPACEMESH_ARCH_ARM64=ON -DSPACEMESHVULKAN=OFF -B build
- run: cmake --build build
- name: Copy library
run: cp build/src/libgpu-setup.so build/test/libgpu-setup.so
- name: Unit tests - List providers
run: build/test/gpu-setup-test --list
- name: Unit tests - Golden vectors
run: build/test/gpu-setup-test --test-vector-check
# # Disabled because it's super slow on lavapipe
# - name: Unit tests - hash and bitstream
# run: build/test/gpu-setup-test --unit-tests
- name: Unit tests - PoW
run: build/test/gpu-setup-test -tp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
- name: Unit tests - PoW and Leafs
run: build/test/gpu-setup-test -tlp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
# # Disabled because it's super slow on lavapipe
# - name: Unit tests - label lengths
# run: build/test/gpu-setup-test -il
# - name: Unit tests - labels count
# run: build/test/gpu-setup-test -in
- name: Integration tests - concurrency test
run: build/test/gpu-setup-test -ip
- name: Integration tests - cancellation test
run: build/test/gpu-setup-test -ic
- name: Upload lib
uses: actions/upload-artifact@v3
with:
name: linux-arm64
path: build/src/libgpu-setup.so
- name: Upload test-app
uses: actions/upload-artifact@v3
with:
name: linux-arm64
path: build/test/gpu-setup-test
- name: Upload api.h
uses: actions/upload-artifact@v3
with:
name: linux-arm64
path: include/api.h
release:
runs-on: ubuntu-latest
needs: [linux, windows, macos, macos-m1, linux-arm64]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v3
- run: |
VER="${{ github.ref }}"
echo "VERSION=${VER#refs/tags/v}" >> $GITHUB_ENV
- name: Archive Linux Library
run: zip --junk-paths libgpu-setup-linux-${{ env.VERSION }}.zip linux/*
- name: Archive Windows Library
run: zip --junk-paths libgpu-setup-windows-${{ env.VERSION }}.zip windows/*
- name: Archive MacOS Library
run: zip --junk-paths libgpu-setup-macos-${{ env.VERSION }}.zip macos/*
- name: Archive MacOS-M1 Library
run: zip --junk-paths libgpu-setup-macos-m1-${{ env.VERSION }}.zip macos-m1/*
- name: Archive Linux ARM64 Library
run: zip --junk-paths libgpu-setup-linux-arm64-${{ env.VERSION }}.zip linux-arm64/*
- name: Release
uses: softprops/action-gh-release@v1
with:
name: Release v${{ env.VERSION }}
files: |
libgpu-setup-linux-${{ env.VERSION }}.zip
libgpu-setup-windows-${{ env.VERSION }}.zip
libgpu-setup-macos-${{ env.VERSION }}.zip
libgpu-setup-macos-m1-${{ env.VERSION }}.zip
libgpu-setup-linux-arm64-${{ env.VERSION }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}