Skip to content

Commit d0e8a78

Browse files
committed
Unify benchmarks' CI workflows for Linux and Windows
Unify benchmarks' CI workflows for Linux and Windows. Use ctest to run benchmarks. A benchmark passes if it prints "PASSED" in the output, because ubench of scalable pool fails if the confidence interval exceeds maximum permitted 2.5%. Fixes: #301 Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 97ff506 commit d0e8a78

File tree

2 files changed

+45
-96
lines changed

2 files changed

+45
-96
lines changed

.github/workflows/basic.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ jobs:
158158

159159
- name: Run tests
160160
working-directory: ${{env.BUILD_DIR}}
161-
run: ctest --output-on-failure
161+
run: ctest --output-on-failure --test-dir test
162162

163163
- name: Test make install
164164
# Run only when the example is built
@@ -245,7 +245,7 @@ jobs:
245245

246246
- name: Run tests
247247
working-directory: ${{env.BUILD_DIR}}
248-
run: ctest -C ${{matrix.build_type}} --output-on-failure
248+
run: ctest -C ${{matrix.build_type}} --output-on-failure --test-dir test
249249

250250
macos-build:
251251
name: MacOS

.github/workflows/benchmarks.yml

Lines changed: 43 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -7,125 +7,74 @@ permissions:
77
contents: read
88

99
jobs:
10-
benchmarks-ubuntu:
11-
name: Ubuntu
10+
benchmarks:
11+
name: Benchmarks
12+
env:
13+
BUILD_DIR : "${{github.workspace}}/build/"
14+
HWLOC_PATH: "${{github.workspace}}/build/vcpkg/packages/hwloc_x64-windows"
1215
strategy:
1316
matrix:
14-
os: ['ubuntu-22.04']
15-
build_type: [Release]
16-
compiler: [{c: gcc, cxx: g++}]
17-
shared_library: ['ON', 'OFF']
17+
include:
18+
- os: ubuntu-latest # shared library on Linux
19+
pool_scalable: 'ON'
20+
pool_jemalloc: 'ON'
21+
22+
- os: windows-latest # shared library on Windows
23+
pool_scalable: 'OFF'
24+
pool_jemalloc: 'OFF'
25+
1826
runs-on: ${{matrix.os}}
1927

2028
steps:
2129
- name: Checkout
2230
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2331

2432
- name: Install apt packages
33+
if: matrix.os == 'ubuntu-latest'
2534
run: |
2635
sudo apt-get update
2736
sudo apt-get install -y cmake libhwloc-dev libnuma-dev libjemalloc-dev libtbb-dev
2837
38+
- name: Initialize vcpkg
39+
if: matrix.os == 'windows-latest'
40+
uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5
41+
with:
42+
vcpkgGitCommitId: 3dd44b931481d7a8e9ba412621fa810232b66289
43+
vcpkgDirectory: ${{env.BUILD_DIR}}/vcpkg
44+
vcpkgJsonGlob: '**/vcpkg.json'
45+
46+
- name: Install vcpkg packages
47+
if: matrix.os == 'windows-latest'
48+
run: vcpkg install
49+
shell: pwsh # Specifies PowerShell as the shell for running the script.
50+
2951
- name: Configure build
3052
run: >
3153
cmake
32-
-B ${{github.workspace}}/build
33-
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
34-
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
35-
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
36-
-DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}}
54+
-B ${{env.BUILD_DIR}}
55+
-DCMAKE_BUILD_TYPE=Release
56+
-DCMAKE_PREFIX_PATH="${{env.HWLOC_PATH}}"
57+
-DUMF_BUILD_SHARED_LIBRARY=ON
3758
-DUMF_BUILD_BENCHMARKS=ON
3859
-DUMF_BUILD_BENCHMARKS_MT=ON
3960
-DUMF_BUILD_TESTS=OFF
4061
-DUMF_FORMAT_CODE_STYLE=OFF
4162
-DUMF_DEVELOPER_MODE=OFF
4263
-DUMF_BUILD_OS_MEMORY_PROVIDER=ON
43-
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
4464
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
45-
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=ON
65+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=${{matrix.pool_jemalloc}}
66+
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=${{matrix.pool_scalable}}
4667
-DUMF_ENABLE_POOL_TRACKING=OFF
4768
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
4869
49-
- name: Build UMF
50-
run: cmake --build ${{github.workspace}}/build -j $(nproc)
51-
52-
- name: Run benchmarks
53-
working-directory: ${{github.workspace}}/build
54-
# The benchmark of TBB pool manager fails very often with the
55-
# "confidence interval exceeds maximum permitted 2.5%" error.
56-
# Do not treat that as a failure in CI.
57-
run: |
58-
export LOG=/tmp/ubench.log
59-
if ! ./benchmark/ubench 2>/dev/null > $LOG; then \
60-
cat $LOG; \
61-
if ! grep -q -e "exceeds maximum permitted 2.5" $LOG; then \
62-
echo "[ FAILED ] The CI benchmark job FAILED."; \
63-
exit 1; \
64-
fi; \
65-
fi
66-
cat $LOG
67-
echo "[ PASSED ] The CI benchmark job PASSED."
70+
- name: Build UMF on Linux
71+
if: matrix.os == 'ubuntu-latest'
72+
run: cmake --build ${{env.BUILD_DIR}} -j $(nproc)
6873

69-
- name: Run MT benchmarks
70-
working-directory: ${{github.workspace}}/build
71-
run: ./benchmark/multithread_bench
74+
- name: Build UMF on Windows
75+
if: matrix.os == 'windows-latest'
76+
run: cmake --build ${{env.BUILD_DIR}} --config Release -j $Env:NUMBER_OF_PROCESSORS
7277

73-
benchmarks-windows:
74-
name: Windows
75-
env:
76-
BUILD_DIR : "${{github.workspace}}/build/"
77-
HWLOC_PATH: "${{github.workspace}}/build/vcpkg/packages/hwloc_x64-windows"
78-
strategy:
79-
fail-fast: false
80-
matrix:
81-
build_type: [Release]
82-
compiler: [{c: cl, cxx: cl}]
83-
shared_library: ['ON', 'OFF']
84-
runs-on: 'windows-2022'
85-
86-
steps:
87-
- name: Checkout
88-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
89-
90-
- name: Initialize vcpkg
91-
uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5
92-
with:
93-
vcpkgGitCommitId: 3dd44b931481d7a8e9ba412621fa810232b66289
94-
vcpkgDirectory: ${{github.workspace}}/build/vcpkg
95-
vcpkgJsonGlob: '**/vcpkg.json'
96-
97-
- name: Install dependencies
98-
run: vcpkg install
99-
shell: pwsh # Specifies PowerShell as the shell for running the script.
100-
101-
- name: Configure build
102-
run: >
103-
cmake
104-
-B ${{env.BUILD_DIR}}
105-
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
106-
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
107-
-DCMAKE_PREFIX_PATH=${{env.HWLOC_PATH}}
108-
-DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}}
109-
-DUMF_BUILD_BENCHMARKS=ON
110-
-DUMF_BUILD_BENCHMARKS_MT=OFF
111-
-DUMF_BUILD_TESTS=OFF
112-
-DUMF_FORMAT_CODE_STYLE=OFF
113-
-DUMF_DEVELOPER_MODE=OFF
114-
-DUMF_BUILD_OS_MEMORY_PROVIDER=ON
115-
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
116-
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=OFF
117-
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=OFF
118-
-DUMF_ENABLE_POOL_TRACKING=OFF
119-
120-
- name: Build UMF
121-
run: cmake --build ${{env.BUILD_DIR}} --config ${{matrix.build_type}} -j $Env:NUMBER_OF_PROCESSORS
122-
123-
- name: Run benchmarks
124-
working-directory: ${{env.BUILD_DIR}}
125-
shell: pwsh # Specifies PowerShell as the shell for running the script.
126-
run: |
127-
# add path to umf.dll
128-
$env:PATH += ";${{env.BUILD_DIR}}\bin\${{matrix.build_type}}"
129-
# add path to hwloc-15.dll
130-
$env:PATH += ";${{env.HWLOC_PATH}}\bin"
131-
.\benchmark\${{matrix.build_type}}\ubench.exe
78+
- name: Run benchmarks
79+
working-directory: ${{env.BUILD_DIR}}
80+
run: ctest -V --test-dir benchmark -C Release

0 commit comments

Comments
 (0)