Skip to content

Commit b6ba236

Browse files
committed
Rebase on benchmark prototype branch
1 parent cc8d3d3 commit b6ba236

19 files changed

+159
-226
lines changed

bench/CMakeLists.txt

Lines changed: 0 additions & 62 deletions
This file was deleted.

bench/blaze/CMakeLists.txt

Lines changed: 0 additions & 27 deletions
This file was deleted.

bench/ipp/CMakeLists.txt

Lines changed: 0 additions & 31 deletions
This file was deleted.

bench/ipp/test_transpose.cpp

Lines changed: 0 additions & 58 deletions
This file was deleted.

bench/opencv/CMakeLists.txt

Lines changed: 0 additions & 46 deletions
This file was deleted.

benchmark/google/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,15 @@ endforeach()
6161

6262
unset(_benchmarks)
6363
unset(_benchmark)
64+
65+
if(BOOST_GIL_BUILD_BENCHMARKS_OPENCV)
66+
add_subdirectory(opencv)
67+
endif()
68+
69+
if(BOOST_GIL_BUILD_BENCHMARKS_BLAZE)
70+
add_subdirectory(blaze)
71+
endif()
72+
73+
if(BOOST_GIL_BUILD_BENCHMARKS_IPP)
74+
add_subdirectory(ipp)
75+
endif()
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright (C) 2020 Samuel Debionne, ESRF.
2+
3+
# Use, modification and distribution is subject to the Boost Software
4+
# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5+
# http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#-----------------------------------------------------------------------------
8+
# Find package Blaze
9+
#-----------------------------------------------------------------------------
10+
find_package(blaze REQUIRED)
11+
12+
#-----------------------------------------------------------------------------
13+
# Build benchmarks
14+
#-----------------------------------------------------------------------------
15+
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12.0)
16+
file(GLOB_RECURSE _benchmarks ${CMAKE_CURRENT_LIST_DIR}/*.cpp CONFIGURE_DEPEND)
17+
else()
18+
file(GLOB_RECURSE _benchmarks ${CMAKE_CURRENT_LIST_DIR}/*.cpp)
19+
endif()
20+
21+
foreach(_benchmark ${_benchmarks})
22+
get_filename_component(_name ${_benchmark} NAME_WE)
23+
set(_target benchmark_google_blaze_${_name})
24+
add_executable(${_target} ${_name}.cpp)
25+
target_compile_definitions(${_target} PRIVATE BOOST_GIL_USE_CONCEPT_CHECK=1)
26+
target_link_libraries(${_target}
27+
PRIVATE
28+
gil_compile_options
29+
gil_include_directories
30+
gil_dependencies
31+
gil_googlebenchmark
32+
blaze::blaze)
33+
endforeach()
34+
35+
unset(_benchmarks)
36+
unset(_benchmark)

bench/blaze/bench_transpose.cpp renamed to benchmark/google/blaze/view_transpose.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ static void blaze_transpose(benchmark::State& state)
3030
size_t dim = state.range(0);
3131

3232
gray8_image_t in(dim, dim);
33+
generate_pixels(view(in), [i = 0]() mutable -> std::uint8_t { return ++i; });
3334
gray8_image_t out(dim, dim);
3435

3536
auto mat_in = as_matrix(view(in));
@@ -39,6 +40,9 @@ static void blaze_transpose(benchmark::State& state)
3940
// The code to benchmark
4041
mat_out = blaze::trans(mat_in);
4142
}
43+
44+
if (!equal_pixels(transposed_view(const_view(in)), const_view(in))))
45+
state.SkipWithError("blaze_transpose wrong result");
4246
}
4347
BENCHMARK(blaze_transpose)->RangeMultiplier(2)->Range(256, 8 << 10);
4448

@@ -49,13 +53,18 @@ static void blaze_transpose_inplace(benchmark::State& state)
4953
size_t dim = state.range(0);
5054

5155
gray8_image_t in(dim, dim);
56+
generate_pixels(view(in), [i = 0]() mutable -> std::uint8_t { return ++i; });
57+
gray8_image_t in_ref(in);
5258

5359
auto mat_in_out = as_matrix(view(in));
5460

5561
for (auto _ : state) {
5662
// The code to benchmark
5763
blaze::transpose(mat_in_out);
5864
}
65+
66+
if (!equal_pixels(transposed_view(const_view(in_ref)), const_view(in))))
67+
state.SkipWithError("blaze_transpose_inplace wrong result");
5968
}
6069
BENCHMARK(blaze_transpose_inplace)->RangeMultiplier(2)->Range(256, 8 << 10);
6170

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (C) 2020 Samuel Debionne, ESRF.
2+
3+
# Use, modification and distribution is subject to the Boost Software
4+
# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5+
# http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#-----------------------------------------------------------------------------
8+
# Find package IPP
9+
#-----------------------------------------------------------------------------
10+
#find_package(IPP REQUIRED)
11+
find_path(IPP_INCLUDE_DIR ipp.h PATHS ${IPP_ROOT}/include)
12+
message("IPP_INCLUDE_DIR: ${IPP_INCLUDE_DIR}")
13+
find_library(IPP_LIB_CORE ippcore PATHS ${IPP_ROOT}/lib)
14+
find_library(IPP_LIB_I ippi PATHS ${IPP_ROOT}/lib)
15+
message("IPP_LIB_CORE: ${IPP_LIB_CORE}")
16+
message("IPP_LIB_I: ${IPP_LIB_I}")
17+
add_library(ipp::ipp INTERFACE IMPORTED)
18+
target_include_directories(ipp::ipp INTERFACE ${IPP_INCLUDE_DIR})
19+
target_link_libraries(ipp::ipp INTERFACE ${IPP_LIB_CORE} ${IPP_LIB_I})
20+
21+
foreach(_benchmark ${_benchmarks})
22+
get_filename_component(_name ${_benchmark} NAME_WE)
23+
set(_target benchmark_google_ipp_${_name})
24+
add_executable(${_target} ${_name}.cpp)
25+
target_compile_definitions(${_target} PRIVATE BOOST_GIL_USE_CONCEPT_CHECK=1)
26+
target_link_libraries(${_target}
27+
PRIVATE
28+
gil_compile_options
29+
gil_include_directories
30+
gil_dependencies
31+
gil_googlebenchmark
32+
ipp::ipp)
33+
endforeach()

0 commit comments

Comments
 (0)