-
Notifications
You must be signed in to change notification settings - Fork 0
198 lines (164 loc) · 6.07 KB
/
test.yml
File metadata and controls
198 lines (164 loc) · 6.07 KB
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
name: Build and Test
on:
push:
branches: [main, metal-backend]
pull_request:
branches: [main, metal-backend]
env:
BUILD_TYPE: Release
jobs:
# Linux CPU-only build and tests
linux-cpu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache CMake FetchContent dependencies
uses: actions/cache@v4
with:
path: build/_deps
key: deps-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('CMakeLists.txt') }}
restore-keys: |
deps-${{ runner.os }}-${{ runner.arch }}-
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libopenblas-dev cmake build-essential
- name: Configure CMake
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DSPRUX_USE_CUBLAS=OFF \
-DSPRUX_USE_METAL=OFF \
-DSPRUX_USE_OPENCL=OFF \
-DSPRUX_BUILD_TESTS=ON \
-DSPRUX_BUILD_EXAMPLES=ON
- name: Build
run: cmake --build build --config ${{ env.BUILD_TYPE }} -j"$(nproc)"
- name: Run Tests
run: ctest --test-dir build --output-on-failure -j"$(nproc)"
- name: Scipy cross-validation (CPU)
run: |
python3 -m venv .venv
.venv/bin/pip install --quiet scipy numpy
.venv/bin/python tests/scipy_ring_comparison.py --build-dir build --test-binary SequenceSolveTest
# Linux with OpenCL (CPU backend via pocl)
linux-opencl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache CMake FetchContent dependencies
uses: actions/cache@v4
with:
path: build/_deps
key: deps-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('CMakeLists.txt') }}
restore-keys: |
deps-${{ runner.os }}-${{ runner.arch }}-
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libopenblas-dev cmake build-essential \
opencl-headers ocl-icd-opencl-dev pocl-opencl-icd libclblast-dev
- name: Configure CMake
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DSPRUX_USE_CUBLAS=OFF \
-DSPRUX_USE_METAL=OFF \
-DSPRUX_USE_OPENCL=ON \
-DSPRUX_BUILD_TESTS=ON \
-DSPRUX_BUILD_EXAMPLES=OFF
- name: Build
run: cmake --build build --config ${{ env.BUILD_TYPE }} -j"$(nproc)"
- name: Run Tests (OpenCL via PoCL CPU backend)
run: ctest --test-dir build --output-on-failure -j"$(nproc)"
# macOS with Metal GPU tests
macos-metal:
runs-on: macos-latest-xlarge # Bare-metal Apple Silicon with GPU access
steps:
- uses: actions/checkout@v4
- name: Cache CMake FetchContent dependencies
uses: actions/cache@v4
with:
path: build/_deps
key: deps-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('CMakeLists.txt') }}
restore-keys: |
deps-${{ runner.os }}-${{ runner.arch }}-
- name: Install dependencies
run: |
brew install openblas llvm
- name: Configure CMake
run: |
LLVM_PREFIX="$(brew --prefix llvm)"
OPENBLAS_PREFIX="$(brew --prefix openblas)"
export PATH="${LLVM_PREFIX}/bin:$PATH"
export LDFLAGS="-L${OPENBLAS_PREFIX}/lib"
export CPPFLAGS="-I${OPENBLAS_PREFIX}/include"
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DSPRUX_USE_CUBLAS=OFF \
-DSPRUX_USE_METAL=ON \
-DSPRUX_USE_OPENCL=OFF \
-DSPRUX_BUILD_TESTS=ON \
-DSPRUX_BUILD_EXAMPLES=ON \
-DBLA_VENDOR=OpenBLAS \
-DCMAKE_PREFIX_PATH="${OPENBLAS_PREFIX}"
- name: Build
run: |
LLVM_PREFIX="$(brew --prefix llvm)"
export PATH="${LLVM_PREFIX}/bin:$PATH"
cmake --build build --config ${{ env.BUILD_TYPE }} -j"$(sysctl -n hw.ncpu)"
- name: Run all tests (CPU + Metal GPU)
run: ctest --test-dir build --output-on-failure -j"$(sysctl -n hw.ncpu)"
- name: Scipy cross-validation (CPU + Metal)
run: |
python3 -m venv .venv
.venv/bin/pip install --quiet scipy numpy
.venv/bin/python tests/scipy_ring_comparison.py --build-dir build --test-binary SequenceSolveTest
.venv/bin/python tests/scipy_ring_comparison.py --build-dir build --test-binary MetalSequenceSolveTest
# CUDA GPU tests on self-hosted NVIDIA runner
cuda-gpu:
runs-on: [nvidia-runner-1]
container:
image: nvidia/cuda:12.6.3-devel-ubuntu24.04
options: --gpus all
steps:
- uses: actions/checkout@v4
- name: Cache CMake FetchContent dependencies
uses: actions/cache@v4
with:
path: build/_deps
key: deps-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('CMakeLists.txt') }}
restore-keys: |
deps-${{ runner.os }}-${{ runner.arch }}-
- name: Install dependencies
run: |
apt-get update
apt-get install -y cmake build-essential libopenblas-dev python3-pip
- name: System info
run: |
echo "=== GPU Info ==="
nvidia-smi || echo "nvidia-smi not available"
echo "=== CUDA ==="
nvcc --version
echo "=== CMake ==="
cmake --version
- name: Configure CMake
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DSPRUX_USE_CUBLAS=ON \
-DSPRUX_USE_METAL=OFF \
-DSPRUX_USE_OPENCL=OFF \
-DSPRUX_BUILD_TESTS=ON \
-DSPRUX_BUILD_EXAMPLES=ON
- name: Build
run: cmake --build build --config ${{ env.BUILD_TYPE }} -j"$(nproc)"
- name: Run all tests
run: ctest --test-dir build --output-on-failure -j"$(nproc)"
- name: Scipy cross-validation (CPU + CUDA)
run: |
apt-get install -y -qq python3-venv
python3 -m venv .venv
.venv/bin/pip install --quiet scipy numpy
.venv/bin/python tests/scipy_ring_comparison.py --build-dir build --test-binary SequenceSolveTest
.venv/bin/python tests/scipy_ring_comparison.py --build-dir build --test-binary CudaSequenceSolveTest