-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (80 loc) · 2.8 KB
/
test-gpu-cloudrun.yml
File metadata and controls
92 lines (80 loc) · 2.8 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
name: GPU Tests (Metal)
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
BUILD_TYPE: Release
jobs:
metal-gpu:
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: System info
run: |
echo "=== System Info ==="
uname -a
sysctl -n machdep.cpu.brand_string || true
system_profiler SPHardwareDataType | grep -E "Chip|Memory|Cores" || true
echo ""
echo "=== Metal Device ==="
system_profiler SPDisplaysDataType | grep -E "Chipset|Metal|VRAM" || true
- 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: Run benchmarks
run: |
echo "=== CPU Baseline (BLAS) ==="
./build/sprux/benchmarking/bench -S "BLAS" -n 3 2>&1 || true
echo ""
echo "=== Metal GPU ==="
./build/sprux/benchmarking/bench -S "Metal" -n 3 2>&1 || true
- name: Summary
if: always()
run: |
{
echo "## Metal GPU Test Results"
echo ""
echo "- **Commit:** \`${{ github.sha }}\`"
echo "- **Runner:** macos-latest-xlarge (Apple Silicon)"
echo "- **Chip:** $(system_profiler SPHardwareDataType | grep 'Chip' | cut -d':' -f2 | xargs || echo unknown)"
echo ""
if [ "${{ job.status }}" = "success" ]; then
echo ":white_check_mark: All tests passed (CPU + Metal GPU)"
else
echo ":x: Tests failed"
fi
} >> "$GITHUB_STEP_SUMMARY"