-
Notifications
You must be signed in to change notification settings - Fork 1
141 lines (118 loc) · 3.77 KB
/
benchmark.yml
File metadata and controls
141 lines (118 loc) · 3.77 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
name: Benchmark
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
BUILD_TYPE: Release
jobs:
benchmark:
name: Run Benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ninja-build gcc-12 g++-12 libomp-dev python3
- name: Configure CMake
env:
CC: gcc-12
CXX: g++-12
run: |
cmake -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_CXX_FLAGS="-O3 -march=native"
- name: Build
run: cmake --build build --config ${{ env.BUILD_TYPE }}
- name: Run Memory Benchmarks
run: |
if [ -f build/examples/02-memory-cache/aos_soa_bench ]; then
build/examples/02-memory-cache/aos_soa_bench \
--benchmark_format=json \
--benchmark_out=memory_bench.json || true
fi
- name: Run SIMD Benchmarks
run: |
if [ -f build/examples/04-simd-vectorization/simd_bench ]; then
build/examples/04-simd-vectorization/simd_bench \
--benchmark_format=json \
--benchmark_out=simd_bench.json || true
fi
- name: Upload Benchmark Results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: |
*_bench.json
if-no-files-found: ignore
- name: Download Baseline (if exists)
uses: dawidd6/action-download-artifact@v3
with:
workflow: benchmark.yml
branch: master
name: benchmark-results
path: baseline/
continue-on-error: true
- name: Compare Benchmarks
if: github.event_name == 'pull_request'
run: |
if [ -f baseline/memory_bench.json ] && [ -f memory_bench.json ]; then
python3 tools/performance/benchmark_compare.py \
baseline/memory_bench.json \
memory_bench.json \
--report memory_comparison.md \
--threshold 0.15 || true
if [ -f memory_comparison.md ]; then
echo "## Memory Benchmark Comparison" >> $GITHUB_STEP_SUMMARY
cat memory_comparison.md >> $GITHUB_STEP_SUMMARY
fi
fi
benchmark-matrix:
name: Benchmark on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Install dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y ninja-build gcc-12 g++-12 libomp-dev
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install ninja libomp
- name: Configure and Build
env:
CC: ${{ runner.os == 'Linux' && 'gcc-12' || 'clang' }}
CXX: ${{ runner.os == 'Linux' && 'g++-12' || 'clang++' }}
run: |
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build
- name: Run All Benchmarks
run: |
mkdir -p results
for bench in build/examples/*/bench/*_bench build/examples/*/*_bench; do
if [ -x "$bench" ]; then
name=$(basename "$bench" _bench)
echo "Running $name..."
"$bench" --benchmark_format=json --benchmark_out="results/${name}.json" || true
fi
done
- name: Upload Results
uses: actions/upload-artifact@v4
with:
name: benchmark-${{ matrix.os }}
path: results/
if-no-files-found: ignore