-
Notifications
You must be signed in to change notification settings - Fork 50
141 lines (128 loc) · 6.49 KB
/
Copy pathbench-linux.yml
File metadata and controls
141 lines (128 loc) · 6.49 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: Bench Linux
on:
# SECURITY INVARIANT: use `pull_request`, NEVER `pull_request_target`.
# `pull_request` runs fork code with a read-only token and no secrets;
# `pull_request_target` would expose a read-write token + secrets to
# untrusted PR code. Benchmarks on PRs are gated by the `benchmarks`
# environment approval below (see the job's `environment:`); pushes to the
# default branches run automatically to keep the CodSpeed baseline fresh.
# `workflow_dispatch` runs are also un-gated (ad-hoc manual runs).
push:
branches: [ main, develop, master ]
pull_request:
branches: [ main, develop, master ]
workflow_dispatch:
permissions:
contents: read
concurrency:
# Per-ref group: a new push to a PR supersedes that PR's older, not-yet-approved
# benchmark run (GitHub can't distinguish "waiting for approval" from "running",
# so cancel-in-progress cancels the stale waiting run too — desired, since the
# superseded commit's run is stale anyway). Per-ref (not global) so one PR never
# cancels another PR's or the default branch's run. The approval gate is now the
# throttle, so global serialization is no longer needed. For default-branch
# pushes, a rapid second push likewise supersedes the first; CodSpeed still
# records the latest commit as the baseline.
group: bench-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CODSPEED_VERSION: v2.3.0
jobs:
build:
# OPT-IN GATE: on pull_request, reference the protected `benchmarks`
# environment so a required reviewer must approve before any PR code runs.
# On push/workflow_dispatch the name is empty -> no environment -> no gate,
# so default-branch baseline runs stay automatic.
environment: ${{ github.event_name == 'pull_request' && 'benchmarks' || '' }}
runs-on: ${{ matrix.os }}
env:
BUILD_CONFIG: "${{ matrix.os }}_${{ matrix.compiler }}_${{ matrix.window }}_${{ matrix.precision_opt == '' && 'double' || matrix.precision_opt == '--enable-float' && 'float' || matrix.precision_opt == '--enable-long-double' && 'long-double' || 'unknown' }}"
name: "${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.window }}-${{ matrix.precision_opt == '' && 'double' || matrix.precision_opt == '--enable-float' && 'float' || matrix.precision_opt == '--enable-long-double' && 'long-double' || 'unknown' }}"
strategy:
matrix:
os: ["codspeed-macro"]
compiler: ["gcc"]
window: ["kaiserbessel"]
precision_opt: ["", "--enable-float", "--enable-long-double"]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
with:
persist-credentials: false
# - name: Disable initramfs update
# run: sudo sed -i 's/yes/no/g' /etc/initramfs-tools/update-initramfs.conf
# - name: Disable man-db update
# run: sudo rm -f /var/lib/man-db/auto-update
- name: Install dependencies
run: |
sudo apt-get install -y software-properties-common
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install -y libc6-dbg build-essential cmake libfftw3-dev libomp-dev libatomic1
- name: Cache CodSpeed integration library
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
id: cache-codspeed
with:
path: codspeed-cpp
key: codspeed-cpp-${{ runner.arch }}-${{ matrix.os }}-${{ env.CODSPEED_VERSION }}
- name: Checkout CodSpeed integration library
if: steps.cache-codspeed.outputs.cache-hit != 'true'
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
with:
persist-credentials: false
repository: CodSpeedHQ/codspeed-cpp
ref: "${{ env.CODSPEED_VERSION }}"
path: codspeed-cpp
submodules: recursive
- name: CMake — Configure
shell: bash
env:
WINDOW: ${{ matrix.window }}
PRECISION_OPT: ${{ matrix.precision_opt }}
COMPILER: ${{ matrix.compiler }}
run: |
case "${PRECISION_OPT}" in
"") CMAKE_PREC="" ;;
"--enable-float") CMAKE_PREC="-DNFFT_ENABLE_FLOAT=ON" ;;
"--enable-long-double") CMAKE_PREC="-DNFFT_ENABLE_LONG_DOUBLE=ON" ;;
*) echo "Unknown PRECISION_OPT '${PRECISION_OPT}'" >&2; exit 1 ;;
esac
EXTRA=()
AGNOSTIC_FLAGS="window:1,openmp:1"
[ "${PRECISION_OPT}" = "" ] && AGNOSTIC_FLAGS="$AGNOSTIC_FLAGS,precision:1" || AGNOSTIC_FLAGS="$AGNOSTIC_FLAGS,precision:0"
EXTRA+=( -DNFFT_BENCHMARK_MODE=walltime
-DBENCHMARKS_PREFIX="${BUILD_CONFIG}/"
-DNFFT_AGNOSTIC_BENCHMARKS="$AGNOSTIC_FLAGS"
-DFETCHCONTENT_SOURCE_DIR_CODSPEED="$(pwd)/codspeed-cpp" )
# -falign-functions/-falign-loops: force deterministic code layout so an
# unrelated function's hot loop can't shift to a worse alignment when a
# nearby function changes size (avoids phantom instruction-count regressions).
cmake -S . -B build-cmake \
-DCMAKE_C_FLAGS="-O3 -g -fomit-frame-pointer -fstrict-aliasing -ffast-math -falign-functions=64 -falign-loops=32" \
-DNFFT_WINDOW="${WINDOW}" ${CMAKE_PREC} -DNFFT_ENABLE_OPENMP=ON \
-DNFFT_ENABLE_EXHAUSTIVE_UNIT_TESTS=OFF \
-DNFFT_ENABLE_EXAMPLES=OFF -DNFFT_ENABLE_APPLICATIONS=OFF \
"${EXTRA[@]}"
- name: CMake — Build
run: cmake --build build-cmake -j
- name: CMake — Benchmarks
uses: CodSpeedHQ/action@a4a36bb07c0638b0b4ca52bf1f3dad1b4289e52f # v4
with:
# "walltime" measures real elapsed time instead of the deterministic
# instruction-count "simulation" build. Must match -DCODSPEED_MODE=walltime
# in the configure step above. NOTE: walltime on shared GitHub-hosted
# runners is sensitive to neighbour noise; CodSpeed recommends their
# hosted macro runners for stable walltime data.
mode: walltime
run: |
./build-cmake/benchmarks/bench_nfft_direct
if [ -x ./build-cmake/benchmarks/bench_nfft_direct_omp ]; then
./build-cmake/benchmarks/bench_nfft_direct_omp
fi
./build-cmake/benchmarks/bench_nfct_direct
if [ -x ./build-cmake/benchmarks/bench_nfct_direct_omp ]; then
./build-cmake/benchmarks/bench_nfct_direct_omp
fi
./build-cmake/benchmarks/bench_nfst_direct
if [ -x ./build-cmake/benchmarks/bench_nfst_direct_omp ]; then
./build-cmake/benchmarks/bench_nfst_direct_omp
fi