Skip to content

Commit 6c79b70

Browse files
authored
Merge pull request #81 from ldorau/Add_the_UMF_BUILD_BENCHMARKS_option
Add the UMF_BUILD_BENCHMARKS option
2 parents f9bebc6 + a9329f5 commit 6c79b70

File tree

3 files changed

+52
-2
lines changed

3 files changed

+52
-2
lines changed

.github/workflows/benchmarks.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Benchmarks
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
ubuntu-build:
7+
name: Build - Ubuntu
8+
9+
strategy:
10+
matrix:
11+
os: ['ubuntu-22.04']
12+
build_type: [Release]
13+
compiler: [{c: gcc, cxx: g++}]
14+
runs-on: ${{matrix.os}}
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Install apt packages
21+
run: |
22+
sudo apt-get update
23+
sudo apt-get install -y cmake libnuma-dev
24+
25+
- name: Configure build
26+
run: >
27+
cmake
28+
-B ${{github.workspace}}/build
29+
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
30+
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
31+
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
32+
-DUMF_BUILD_BENCHMARKS=ON
33+
-DUMF_BUILD_TESTS=OFF
34+
-DUMF_FORMAT_CODE_STYLE=OFF
35+
-DUMF_DEVELOPER_MODE=OFF
36+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=OFF
37+
-DUMF_ENABLE_POOL_TRACKING=OFF
38+
39+
- name: Build UMF
40+
run: cmake --build ${{github.workspace}}/build -j $(nproc)
41+
42+
- name: Run benchmarks
43+
working-directory: ${{github.workspace}}/build
44+
run: ./benchmark/ubench 2>/dev/null

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ include(helpers)
1818
option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" OFF)
1919
option(UMF_BUILD_LIBUMF_POOL_JEMALLOC "Build the libumf_pool_jemalloc static library" OFF)
2020
option(UMF_BUILD_TESTS "Build UMF tests" ON)
21+
option(UMF_BUILD_BENCHMARKS "Build UMF benchmarks" OFF)
2122
option(UMF_ENABLE_POOL_TRACKING "Build UMF with pool tracking" ON)
2223
option(UMF_DEVELOPER_MODE "Enable developer checks, treats warnings as errors" OFF)
2324
option(UMF_FORMAT_CODE_STYLE "Format UMF code with clang-format" OFF)
@@ -75,8 +76,12 @@ add_subdirectory(src)
7576
if(UMF_BUILD_TESTS)
7677
add_subdirectory(test)
7778
endif()
78-
if(LINUX)
79-
add_subdirectory(benchmark)
79+
if(UMF_BUILD_BENCHMARKS)
80+
if(LINUX)
81+
add_subdirectory(benchmark)
82+
else()
83+
message(FATAL_ERROR "benchmarks are supported on Linux only")
84+
endif()
8085
endif()
8186

8287
# Check if clang-format (in correct version) is available for code formatting.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ List of options provided by CMake:
8989
| UMF_BUILD_SHARED_LIBRARY | Build UMF as shared library | ON/OFF | OFF |
9090
| UMF_BUILD_LIBUMF_POOL_JEMALLOC | Build the libumf_pool_jemalloc static library | ON/OFF | OFF |
9191
| UMF_BUILD_TESTS | Build UMF tests | ON/OFF | ON |
92+
| UMF_BUILD_BENCHMARKS | Build UMF benchmarks | ON/OFF | OFF |
9293
| UMF_ENABLE_POOL_TRACKING | Build UMF with pool tracking | ON/OFF | ON |
9394
| UMF_DEVELOPER_MODE | Treat warnings as errors and enables additional checks | ON/OFF | OFF |
9495
| UMF_FORMAT_CODE_STYLE | Add clang-format-check and clang-format-apply targets to make | ON/OFF | OFF |

0 commit comments

Comments
 (0)