Skip to content

Commit d67f2f6

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 6e3a84c commit d67f2f6

File tree

3 files changed

+43
-97
lines changed

3 files changed

+43
-97
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
@@ -246,7 +246,7 @@ jobs:
246246

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

251251
macos-build:
252252
name: MacOS

.github/workflows/benchmarks.yml

Lines changed: 40 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -7,126 +7,72 @@ 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+
VCPKG_PATH: "${{github.workspace}}/build/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/build/vcpkg/packages/tbb_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
19+
pool_jemalloc: 'ON'
20+
21+
- os: windows-latest
22+
pool_jemalloc: 'OFF'
23+
1824
runs-on: ${{matrix.os}}
1925

2026
steps:
2127
- name: Checkout
2228
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2329

2430
- name: Install apt packages
31+
if: matrix.os == 'ubuntu-latest'
2532
run: |
2633
sudo apt-get update
2734
sudo apt-get install -y cmake libhwloc-dev libnuma-dev libjemalloc-dev libtbb-dev
2835
36+
- name: Initialize vcpkg
37+
if: matrix.os == 'windows-latest'
38+
uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5
39+
with:
40+
vcpkgGitCommitId: 3dd44b931481d7a8e9ba412621fa810232b66289
41+
vcpkgDirectory: ${{env.BUILD_DIR}}/vcpkg
42+
vcpkgJsonGlob: '**/vcpkg.json'
43+
44+
- name: Install vcpkg packages
45+
if: matrix.os == 'windows-latest'
46+
run: vcpkg install
47+
shell: pwsh # Specifies PowerShell as the shell for running the script.
48+
2949
- name: Configure build
3050
run: >
3151
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}}
52+
-B ${{env.BUILD_DIR}}
53+
-DCMAKE_BUILD_TYPE=Release
54+
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
55+
-DUMF_BUILD_SHARED_LIBRARY=ON
3756
-DUMF_BUILD_BENCHMARKS=ON
3857
-DUMF_BUILD_BENCHMARKS_MT=ON
3958
-DUMF_BUILD_TESTS=OFF
4059
-DUMF_FORMAT_CODE_STYLE=OFF
4160
-DUMF_DEVELOPER_MODE=OFF
4261
-DUMF_BUILD_OS_MEMORY_PROVIDER=ON
43-
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
4462
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
63+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=${{matrix.pool_jemalloc}}
4564
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=ON
4665
-DUMF_ENABLE_POOL_TRACKING=OFF
4766
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
4867
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."
68+
- name: Build UMF on Linux
69+
if: matrix.os == 'ubuntu-latest'
70+
run: cmake --build ${{env.BUILD_DIR}} -j $(nproc)
6871

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

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

benchmark/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function(add_umf_benchmark)
5151
if(TBB_LIBRARY_DIRS)
5252
set(DLL_PATH_LIST "${DLL_PATH_LIST};PATH=path_list_append:${TBB_LIBRARY_DIRS}/../bin")
5353
endif()
54-
set_property(TEST ${EXAMPLE_NAME} PROPERTY ENVIRONMENT_MODIFICATION "${DLL_PATH_LIST}")
54+
set_property(TEST ${BENCH_NAME} PROPERTY ENVIRONMENT_MODIFICATION "${DLL_PATH_LIST}")
5555
endif()
5656

5757
if (UMF_BUILD_OS_MEMORY_PROVIDER)

0 commit comments

Comments
 (0)