Skip to content

Commit ee03b29

Browse files
authored
Merge pull request oneapi-src#959 from oneapi-src/v0.10.x
Merge stable v0.10.x branch into main
2 parents c0dc97c + 705ced8 commit ee03b29

File tree

8 files changed

+925
-24
lines changed

8 files changed

+925
-24
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: 40 additions & 13 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

@@ -52,13 +69,17 @@ function(add_umf_benchmark)
5269
COMMAND ${BENCH_NAME}
5370
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
5471

55-
# Benchmark passes if it prints "PASSED" in the output, because ubench of
56-
# scalable pool fails if the confidence interval exceeds maximum permitted
57-
# 2.5%.
58-
set_tests_properties(
59-
${BENCH_NAME} PROPERTIES
60-
LABELS "benchmark"
61-
PASS_REGULAR_EXPRESSION "PASSED")
72+
if("${BENCH_NAME}" STREQUAL "umf-ubench")
73+
# Benchmark passes if it prints "PASSED" in the output, because ubench
74+
# of scalable pool fails if the confidence interval exceeds maximum
75+
# permitted 2.5%.
76+
set_tests_properties(
77+
${BENCH_NAME} PROPERTIES
78+
LABELS "benchmark"
79+
PASS_REGULAR_EXPRESSION "PASSED")
80+
else()
81+
set_tests_properties(${BENCH_NAME} PROPERTIES LABELS "benchmark")
82+
endif()
6283

6384
if(WINDOWS)
6485
# append PATH to DLLs
@@ -68,19 +89,19 @@ function(add_umf_benchmark)
6889

6990
if(UMF_BUILD_LIBUMF_POOL_DISJOINT)
7091
target_compile_definitions(${BENCH_NAME}
71-
PRIVATE UMF_BUILD_LIBUMF_POOL_DISJOINT=1)
92+
PRIVATE UMF_POOL_DISJOINT_ENABLED=1)
7293
endif()
73-
if(UMF_BUILD_LIBUMF_POOL_JEMALLOC)
94+
if(UMF_POOL_JEMALLOC_ENABLED)
7495
target_compile_definitions(${BENCH_NAME}
75-
PRIVATE UMF_BUILD_LIBUMF_POOL_JEMALLOC=1)
96+
PRIVATE UMF_POOL_JEMALLOC_ENABLED=1)
7697
endif()
7798
if(UMF_POOL_SCALABLE_ENABLED)
7899
target_compile_definitions(${BENCH_NAME}
79100
PRIVATE UMF_POOL_SCALABLE_ENABLED=1)
80101
endif()
81102
if(UMF_BUILD_LEVEL_ZERO_PROVIDER)
82103
target_compile_definitions(${BENCH_NAME}
83-
PRIVATE UMF_BUILD_LEVEL_ZERO_PROVIDER=1)
104+
PRIVATE UMF_PROVIDER_LEVEL_ZERO_ENABLED=1)
84105
target_include_directories(
85106
${BENCH_NAME} PRIVATE ${UMF_CMAKE_SOURCE_DIR}/test/common
86107
${LEVEL_ZERO_INCLUDE_DIRS})
@@ -121,6 +142,12 @@ add_umf_benchmark(
121142
LIBS ${LIBS_OPTIONAL}
122143
LIBDIRS ${LIB_DIRS})
123144

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

0 commit comments

Comments
 (0)