Skip to content
This repository was archived by the owner on Apr 8, 2024. It is now read-only.

Commit eda1279

Browse files
authored
Merge pull request #73 from spacemeshos/add-mingw64-build-to-ci
Create .a file during windows build of gpu-post
2 parents a8cf154 + 88b681a commit eda1279

File tree

3 files changed

+99
-98
lines changed

3 files changed

+99
-98
lines changed

.github/workflows/build.yml

+76-59
Original file line numberDiff line numberDiff line change
@@ -26,39 +26,39 @@ jobs:
2626
- name: Install Vulkan
2727
run: .github/tools/linux-install-vulkan.sh
2828

29-
- run: cmake .
30-
- run: make
29+
- run: cmake -B build
30+
- run: cmake --build build
3131

3232
- name: Copy library
33-
run: cp src/libgpu-setup.so test/libgpu-setup.so
33+
run: cp build/src/libgpu-setup.so build/test/libgpu-setup.so
3434

3535
- name: Unit tests - Golden vectors
36-
run: test/gpu-setup-test --test-vector-check
36+
run: build/test/gpu-setup-test --test-vector-check
3737
- name: Unit tests - hash and bitstream
38-
run: test/gpu-setup-test --unit-tests
38+
run: build/test/gpu-setup-test --unit-tests
3939
- name: Unit tests - PoW
40-
run: test/gpu-setup-test -tp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
40+
run: build/test/gpu-setup-test -tp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
4141
- name: Unit tests - PoW and Leafs
42-
run: test/gpu-setup-test -tlp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
42+
run: build/test/gpu-setup-test -tlp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
4343
- name: Unit tests - label lengths
44-
run: test/gpu-setup-test -il
44+
run: build/test/gpu-setup-test -il
4545
- name: Unit tests - labels count
46-
run: test/gpu-setup-test -in
46+
run: build/test/gpu-setup-test -in
4747
- name: Integration tests - concurrency test
48-
run: test/gpu-setup-test -ip
48+
run: build/test/gpu-setup-test -ip
4949
- name: Integration tests - cancellation test
50-
run: test/gpu-setup-test -ic
50+
run: build/test/gpu-setup-test -ic
5151

5252
- name: Upload lib
5353
uses: actions/upload-artifact@v2
5454
with:
5555
name: linux
56-
path: src/libgpu-setup.so
56+
path: build/src/libgpu-setup.so
5757
- name: Upload test-app
5858
uses: actions/upload-artifact@v2
5959
with:
6060
name: linux
61-
path: test/gpu-setup-test
61+
path: build/test/gpu-setup-test
6262
- name: Upload api.h
6363
uses: actions/upload-artifact@v2
6464
with:
@@ -129,12 +129,24 @@ jobs:
129129
- name: Build
130130
run: |
131131
call "${{ env.vs_path }}\VC\Auxiliary\Build\vcvars64.bat"
132-
mkdir build
133-
cd build
134-
"${{ env.vs_path }}\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake" -G "Ninja" -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" ..
135-
cmake --build .
132+
"${{ 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"
133+
cmake --build build
136134
shell: cmd
137135

136+
- name: Setup msys2
137+
uses: msys2/setup-msys2@v2
138+
with:
139+
msystem: mingw64
140+
pacboy: >-
141+
toolchain:p
142+
143+
- name: Convert library to gnu format
144+
run: |
145+
cd build/src
146+
gendef gpu-setup.dll
147+
dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib libgpu-setup.a --input-def gpu-setup.def
148+
shell: msys2 {0}
149+
138150
- name: Copy library
139151
shell: bash
140152
run: cp build/src/gpu-setup.dll build/test/gpu-setup.dll
@@ -166,6 +178,11 @@ jobs:
166178
with:
167179
name: windows
168180
path: build/src/gpu-setup.lib
181+
- name: Upload gnu lib
182+
uses: actions/upload-artifact@v2
183+
with:
184+
name: windows
185+
path: build/src/libgpu-setup.a
169186
- name: Upload test app
170187
uses: actions/upload-artifact@v2
171188
with:
@@ -219,41 +236,41 @@ jobs:
219236
echo "PATH=${VULKAN_SDK}/bin:$PATH" >> $GITHUB_ENV
220237
echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${VULKAN_SDK}/lib" >> $GITHUB_ENV
221238
222-
- run: cmake -DSPACEMESHCUDA=OFF .
223-
- run: make
239+
- run: cmake -DSPACEMESHCUDA=OFF -B build
240+
- run: cmake --build build
224241

225242
- name: Copy library
226-
run: cp src/libgpu-setup.dylib test/libgpu-setup.dylib
243+
run: cp build/src/libgpu-setup.dylib build/test/libgpu-setup.dylib
227244
- name: Fix library import paths
228-
run: install_name_tool -add_rpath @loader_path test/libgpu-setup.dylib
245+
run: install_name_tool -add_rpath @loader_path build/test/libgpu-setup.dylib
229246

230247
- name: Unit tests - Golden vectors
231-
run: test/gpu-setup-test --test-vector-check
248+
run: build/test/gpu-setup-test --test-vector-check
232249
- name: Unit tests - hash and bitstream
233-
run: test/gpu-setup-test --unit-tests
250+
run: build/test/gpu-setup-test --unit-tests
234251
- name: Unit tests - PoW
235-
run: test/gpu-setup-test -tp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
252+
run: build/test/gpu-setup-test -tp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
236253
- name: Unit tests - PoW and Leafs
237-
run: test/gpu-setup-test -tlp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
254+
run: build/test/gpu-setup-test -tlp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
238255
- name: Unit tests - label lengths
239-
run: test/gpu-setup-test -il
256+
run: build/test/gpu-setup-test -il
240257
- name: Unit tests - labels count
241-
run: test/gpu-setup-test -in
258+
run: build/test/gpu-setup-test -in
242259
- name: Integration tests - concurrency test
243-
run: test/gpu-setup-test -ip
260+
run: build/test/gpu-setup-test -ip
244261
- name: Integration tests - cancellation test
245-
run: test/gpu-setup-test -ic
262+
run: build/test/gpu-setup-test -ic
246263

247264
- name: Upload library
248265
uses: actions/upload-artifact@v2
249266
with:
250267
name: macos
251-
path: src/libgpu-setup.dylib
268+
path: build/src/libgpu-setup.dylib
252269
- name: Upload test app
253270
uses: actions/upload-artifact@v2
254271
with:
255272
name: macos
256-
path: test/gpu-setup-test
273+
path: build/test/gpu-setup-test
257274
- name: Upload api.h
258275
uses: actions/upload-artifact@v2
259276
with:
@@ -279,41 +296,41 @@ jobs:
279296
- name: Vulkan Info
280297
run: vulkaninfo
281298

282-
- run: arch -arm64 cmake -DSPACEMESHCUDA=OFF .
283-
- run: arch -arm64 make
299+
- run: arch -arm64 cmake -DSPACEMESHCUDA=OFF -B build
300+
- run: arch -arm64 cmake --build build
284301

285302
- name: Copy library
286-
run: cp src/libgpu-setup.dylib test/libgpu-setup.dylib
303+
run: cp build/src/libgpu-setup.dylib build/test/libgpu-setup.dylib
287304

288305
- name: Fix library import paths
289-
run: arch -arm64 install_name_tool -add_rpath @loader_path test/libgpu-setup.dylib
306+
run: arch -arm64 install_name_tool -add_rpath @loader_path build/test/libgpu-setup.dylib
290307
- name: Unit tests - Golden vectors
291-
run: arch -arm64 test/gpu-setup-test --test-vector-check
308+
run: arch -arm64 build/test/gpu-setup-test --test-vector-check
292309
- name: Unit tests - hash and bitstream
293-
run: arch -arm64 test/gpu-setup-test --unit-tests
310+
run: arch -arm64 build/test/gpu-setup-test --unit-tests
294311
- name: Unit tests - PoW
295-
run: arch -arm64 test/gpu-setup-test -tp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
312+
run: arch -arm64 build/test/gpu-setup-test -tp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
296313
- name: Unit tests - PoW and Leafs
297-
run: arch -arm64 test/gpu-setup-test -tlp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
314+
run: arch -arm64 build/test/gpu-setup-test -tlp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
298315
- name: Unit tests - label lengths
299-
run: arch -arm64 test/gpu-setup-test -il
316+
run: arch -arm64 build/test/gpu-setup-test -il
300317
- name: Unit tests - labels count
301-
run: arch -arm64 test/gpu-setup-test -in
318+
run: arch -arm64 build/test/gpu-setup-test -in
302319
- name: Integration tests - concurrency test
303-
run: arch -arm64 test/gpu-setup-test -ip
320+
run: arch -arm64 build/test/gpu-setup-test -ip
304321
- name: Integration tests - cancellation test
305-
run: arch -arm64 test/gpu-setup-test -ic
322+
run: arch -arm64 build/test/gpu-setup-test -ic
306323

307324
- name: Upload library
308325
uses: actions/upload-artifact@v2
309326
with:
310327
name: macos-m1
311-
path: src/libgpu-setup.dylib
328+
path: build/src/libgpu-setup.dylib
312329
- name: Upload test app
313330
uses: actions/upload-artifact@v2
314331
with:
315332
name: macos-m1
316-
path: test/gpu-setup-test
333+
path: build/test/gpu-setup-test
317334
- name: Upload api.h
318335
uses: actions/upload-artifact@v2
319336
with:
@@ -335,7 +352,7 @@ jobs:
335352
name: macos-m1
336353
path: ${{ env.VULKAN_ROOT_LOCATION }}/macOS/lib/libvulkan.1.dylib
337354

338-
## Temporarily disabled until VM becomes available again
355+
# Temporarily disabled until linux arm64 VM becomes available again
339356
#
340357
# linux-arm64:
341358
# runs-on: [self-hosted, linux]
@@ -345,39 +362,39 @@ jobs:
345362
# with:
346363
# submodules: true
347364

348-
# - run: cmake -DSPACEMESH_ARCH_ARM64=ON .
349-
# - run: make
365+
# - run: cmake -DSPACEMESH_ARCH_ARM64=ON -B build
366+
# - run: cmake --build build
350367

351368
# - name: Copy library
352-
# run: cp src/libgpu-setup.so test/libgpu-setup.so
369+
# run: cp build/src/libgpu-setup.so build/test/libgpu-setup.so
353370

354371
# - name: Unit tests - Golden vectors
355-
# run: test/gpu-setup-test --test-vector-check
372+
# run: build/test/gpu-setup-test --test-vector-check
356373
# - name: Unit tests - hash and bitstream
357-
# run: test/gpu-setup-test --unit-tests
374+
# run: build/test/gpu-setup-test --unit-tests
358375
# - name: Unit tests - PoW
359-
# run: test/gpu-setup-test -tp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
376+
# run: build/test/gpu-setup-test -tp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
360377
# - name: Unit tests - PoW and Leafs
361-
# run: test/gpu-setup-test -tlp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
378+
# run: build/test/gpu-setup-test -tlp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
362379
# - name: Unit tests - label lengths
363-
# run: test/gpu-setup-test -il
380+
# run: build/test/gpu-setup-test -il
364381
# - name: Unit tests - labels count
365-
# run: test/gpu-setup-test -in
382+
# run: build/test/gpu-setup-test -in
366383
# - name: Integration tests - concurrency test
367-
# run: test/gpu-setup-test -ip
384+
# run: build/test/gpu-setup-test -ip
368385
# - name: Integration tests - cancellation test
369-
# run: test/gpu-setup-test -ic
386+
# run: build/test/gpu-setup-test -ic
370387

371388
# - name: Upload lib
372389
# uses: actions/upload-artifact@v2
373390
# with:
374391
# name: linux-arm64
375-
# path: src/libgpu-setup.so
392+
# path: build/src/libgpu-setup.so
376393
# - name: Upload test-app
377394
# uses: actions/upload-artifact@v2
378395
# with:
379396
# name: linux-arm64
380-
# path: test/gpu-setup-test
397+
# path: build/test/gpu-setup-test
381398
# - name: Upload api.h
382399
# uses: actions/upload-artifact@v2
383400
# with:

.gitignore

-10
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,3 @@ _UpgradeReport_Files/
5656
Backup*/
5757
UpgradeLog*.XML
5858
UpgradeLog*.htm
59-
60-
# CMake files
61-
CMakeCache.txt
62-
CMakeFiles
63-
Makefile
64-
cmake_install.cmake
65-
66-
# Built binaries
67-
test/gpu-setup-test
68-
src/vulkan/gen/shaders-gen

README.md

+23-29
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ One or more of the following processors:
4040
### Windows
4141

4242
- Windows 10 Pro.
43-
- Microsoft Visual Studio 2017 (any edition). Visual Studio 2019 is NOT supported.
43+
- Microsoft Visual Studio 2022
4444
- You may also need to install specific versions of the Windows SDK when prompted when attempting to build the library for the first time.
4545

4646
### Ubuntu
@@ -107,44 +107,36 @@ To build the library with full support for both CUDA and Vulkan on Windows or on
107107

108108
### Ubuntu or macOS
109109

110-
Create a build directory:
111-
112-
```bash
113-
cd gpu-post
114-
mkdir build
115-
cd build
116-
```
117-
118110
Configure your build using the default configuration:
119111

120112
```bash
121-
cmake ..
113+
cmake -B build
122114
```
123115

124116
To disable CUDA use:
125117

126118
```bash
127-
cmake .. -DSPACEMESHCUDA=OFF
119+
cmake -B build -DSPACEMESHCUDA=OFF
128120
```
129121

130122
To disable VULKAN use:
131123

132124
```bash
133-
cmake .. -DSPACEMESHVULKAN=OFF
125+
cmake -B build -DSPACEMESHVULKAN=OFF
134126
```
135127

136128
Build the project:
137129

138130
```bash
139-
make
131+
cmake --build build
140132
```
141133

142134
Run the tests:
143135

144136
```bash
145-
./test/gpu-setup-test -t
146-
./test/gpu-setup-test -u
147-
./test/gpu-setup-test -b
137+
./build/test/gpu-setup-test -t
138+
./build/test/gpu-setup-test -u
139+
./build/test/gpu-setup-test -b
148140
```
149141

150142
## Running the Test App
@@ -165,20 +157,22 @@ Run from the console to print usage:
165157
```bash
166158
$ gpu-setup-test
167159
Usage:
168-
--list or -l print available providers
169-
--benchmark or -b run benchmark
170-
--core or -c test the core library use case
171-
--test or -t run basic test
172-
--test-vector-check run a CPU test and compare with test-vector
173-
--test-pow or -tp test pow computation
174-
--unit-tests or -u run unit tests
175-
--integration-tests or -i run integration tests
176-
--label-size or -s <1-256> set label size [1-256]
177-
--labels-count or -n <1-32M> set labels count [up to 32M]
178-
--reference-provider or -r <id> the result of this provider will be used as a reference [default - CPU]
179-
--print or -p print detailed data comparison report for incorrect results
180-
--pow-diff or -d <0-256> count of leading zero bits in target D value [default - 16]
160+
--list or -l print available providers
161+
--benchmark or -b run benchmark
162+
--core or -c test the core library use case
163+
--test or -t run basic test
164+
--test-vector-check run a CPU test and compare with test-vector
165+
--test-pow or -tp test pow computation
166+
--test-leafs-pow or -tlp test pow computation while computing leafs
167+
--unit-tests or -u run unit tests
168+
--integration-tests or -i run integration tests
169+
--label-size or -s <1-256> set label size [1-256]
170+
--labels-count or -n <1-32M> set labels count [up to 32M]
171+
--reference-provider or -r <id> the result of this provider will be used as a reference [default - CPU]
172+
--print or -p print detailed data comparison report for incorrect results
173+
--pow-diff or -d <0-256> count of leading zero bits in target D value [default - 16]
181174
--srand-seed or -ss <unsigned int> set srand seed value for POW test: 0 - use zero id/seed [default], -1 - use random value
175+
--solution-idx or -si <unsigned int> set solution index for POW test: index will be compared to be the found solution for Pow [default - unset]
182176
```
183177
184178
## Mixing CUDA and Vulkan

0 commit comments

Comments
 (0)