Skip to content

Commit 5256d9a

Browse files
authored
ci: add cpu check (#42)
1 parent 08fee50 commit 5256d9a

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

.github/workflows/ci-avx512.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,18 @@ jobs:
3434

3535
- name: Verify AVX-512 Support
3636
run: |
37+
set -euo pipefail
3738
echo "=== CPU Info ==="
3839
lscpu | grep -E "Model name|CPU\(s\)|Thread|Core|Socket"
3940
echo ""
4041
echo "=== Required AVX-512 Flags (avx512f, avx512bw, avx512vl) ==="
4142
grep -oE 'avx512(f|bw|vl)' /proc/cpuinfo | sort -u
43+
for f in avx512f avx512bw avx512vl; do
44+
if ! grep -qE "(^|[[:space:]])${f}([[:space:]]|$)" /proc/cpuinfo; then
45+
echo "Missing required CPU flag: ${f}"
46+
exit 1
47+
fi
48+
done
4249
echo ""
4350
echo "=== Go Version & GOEXPERIMENT ==="
4451
go version

avx_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//go:build goexperiment.simd && amd64
2+
3+
package simdcsv
4+
5+
import (
6+
"fmt"
7+
"os"
8+
"testing"
9+
)
10+
11+
func TestMain(m *testing.M) {
12+
fmt.Fprintf(os.Stderr, "simdcsv: useAVX512=%v\n", useAVX512)
13+
os.Exit(m.Run())
14+
}

0 commit comments

Comments
 (0)