Skip to content

Commit a8abea3

Browse files
committed
Add new benchmarks
1 parent c3319a0 commit a8abea3

File tree

6 files changed

+907
-10
lines changed

6 files changed

+907
-10
lines changed

.github/workflows/reusable_gpu.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ jobs:
112112
run: ctest --output-on-failure --test-dir examples -C ${{matrix.build_type}}
113113

114114
- name: Run benchmarks
115+
if: matrix.build_type == 'Release'
115116
working-directory: ${{env.BUILD_DIR}}
116117
run: ctest --output-on-failure --test-dir benchmark -C ${{matrix.build_type}} --exclude-regex umf-bench-multithreaded
117118

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ endif()
320320
# compiler is required. Moreover, if these options are not set, CMake will set
321321
# up a strict C build, without C++ support.
322322
set(OPTIONS_REQUIRING_CXX "UMF_BUILD_TESTS" "UMF_BUILD_LIBUMF_POOL_DISJOINT"
323-
"UMF_BUILD_BENCHMARKS_MT")
323+
"UMF_BUILD_BENCHMARKS_MT" "UMF_BUILD_BENCHMARKS")
324324
foreach(option_name ${OPTIONS_REQUIRING_CXX})
325325
if(${option_name})
326326
enable_language(CXX)

benchmark/CMakeLists.txt

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
1-
# Copyright (C) 2023 Intel Corporation
1+
# Copyright (C) 2023-2024 Intel Corporation
22
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
include(FetchContent)
6+
FetchContent_Declare(
7+
googlebenchmark
8+
GIT_REPOSITORY https://github.com/google/benchmark.git
9+
GIT_TAG v1.9.0)
10+
11+
set(BENCHMARK_ENABLE_GTEST_TESTS
12+
OFF
13+
CACHE BOOL "" FORCE)
14+
set(BENCHMARK_ENABLE_TESTING
15+
OFF
16+
CACHE BOOL "" FORCE)
17+
set(BENCHMARK_ENABLE_INSTALL
18+
OFF
19+
CACHE BOOL "" FORCE)
20+
FetchContent_MakeAvailable(googlebenchmark)
21+
522
# In MSVC builds, there is no way to determine the actual build type during the
623
# CMake configuration step. Therefore, this message is printed in all MSVC
724
# builds.
@@ -32,7 +49,7 @@ function(add_umf_benchmark)
3249
"${multiValueArgs}"
3350
${ARGN})
3451

35-
set(BENCH_NAME umf-bench-${ARG_NAME})
52+
set(BENCH_NAME umf-${ARG_NAME})
3653

3754
set(BENCH_LIBS ${ARG_LIBS} umf)
3855

@@ -55,13 +72,17 @@ function(add_umf_benchmark)
5572
COMMAND ${BENCH_NAME}
5673
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
5774

58-
# Benchmark passes if it prints "PASSED" in the output, because ubench of
59-
# scalable pool fails if the confidence interval exceeds maximum permitted
60-
# 2.5%.
61-
set_tests_properties(
62-
${BENCH_NAME} PROPERTIES
63-
LABELS "benchmark"
64-
PASS_REGULAR_EXPRESSION "PASSED")
75+
if("${BENCH_NAME}" STREQUAL "umf-ubench")
76+
# Benchmark passes if it prints "PASSED" in the output, because ubench
77+
# of scalable pool fails if the confidence interval exceeds maximum
78+
# permitted 2.5%.
79+
set_tests_properties(
80+
${BENCH_NAME} PROPERTIES
81+
LABELS "benchmark"
82+
PASS_REGULAR_EXPRESSION "PASSED")
83+
else()
84+
set_tests_properties(${BENCH_NAME} PROPERTIES LABELS "benchmark")
85+
endif()
6586

6687
if(WINDOWS)
6788
# append PATH to DLLs
@@ -120,6 +141,12 @@ add_umf_benchmark(
120141
LIBS ${LIBS_OPTIONAL}
121142
LIBDIRS ${LIB_DIRS})
122143

144+
add_umf_benchmark(
145+
NAME benchmark
146+
SRCS benchmark.cpp
147+
LIBS ${LIBS_OPTIONAL} benchmark::benchmark
148+
LIBDIRS ${LIB_DIRS})
149+
123150
if(UMF_BUILD_BENCHMARKS_MT)
124151
add_umf_benchmark(
125152
NAME multithreaded

0 commit comments

Comments
 (0)