Skip to content

Commit 97e205a

Browse files
authored
Use Google Benchmark for performance tables (#800)
## What changed - Added Google Benchmark as a vendored submodule and CMake dependency for `ppc_perf_tests`. - Updated `ppc_perf_tests` to register and run Google Benchmark cases from existing performance tests. - Switched performance measurement to manual elapsed time in seconds with technology-specific timers for MPI, OpenMP, oneTBB, and chrono-based implementations. - Kept the performance entrypoint in `scripts/run_tests.py --running-type=performance` and made it write separate benchmark JSON files under `build/perf_stat_dir/benchmarks`. - Kept `all`, `mpi`, and process `seq` performance groups on the MPI runner; thread `seq`, `omp`, `stl`, and `tbb` run without MPI. - Updated the performance CI job to call `scripts/run_tests.py --running-type=performance` directly. - Removed the legacy performance scripts: `scripts/create_perf_table.py`, `scripts/generate_perf_results.sh`, and `scripts/generate_perf_results.bat`. - Removed the legacy `modules/performance` API and tests. - Moved the remaining performance test attributes into `modules/util/include/perf_test_util.hpp`. - Updated scoreboard performance loading to read Google Benchmark JSON files directly and calculate metrics from raw seconds. - Added scoreboard tests for benchmark name parsing, time-unit conversion, statistic selection, and raw-second performance metric calculation.
1 parent c358e80 commit 97e205a

30 files changed

Lines changed: 923 additions & 1372 deletions

File tree

.clang-format

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ UseTab: Never
66
AllowShortFunctionsOnASingleLine: Empty
77
IndentPPDirectives: AfterHash
88
SortIncludes: true
9+
IncludeCategories:
10+
- Regex: '^<gtest/.*'
11+
Priority: 1
12+
- Regex: '^<.*'
13+
Priority: 2
14+
- Regex: '.*'
15+
Priority: 3
916
FixNamespaceComments: true
1017
InsertBraces: true
1118
QualifierAlignment: Left

.github/workflows/perf.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
tar -xzvf ubuntu-gcc-install-ubuntu-24.04.tar.gz -C install
3131
- name: Run perf tests
3232
run: |
33-
bash -e scripts/generate_perf_results.sh
33+
scripts/run_tests.py --running-type=performance
3434
env:
3535
PPC_NUM_PROC: 2
3636
PPC_NUM_THREADS: 2
@@ -68,7 +68,7 @@ jobs:
6868
tar -xzvf macos-clang-install.tar.gz -C install
6969
- name: Run perf tests
7070
run: |
71-
bash -e scripts/generate_perf_results.sh
71+
scripts/run_tests.py --running-type=performance
7272
env:
7373
PPC_NUM_PROC: 1
7474
PPC_NUM_THREADS: 2

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@
1313
[submodule "3rdparty/libenvpp"]
1414
path = 3rdparty/libenvpp
1515
url = https://github.com/ph3at/libenvpp
16+
[submodule "3rdparty/benchmark"]
17+
path = 3rdparty/benchmark
18+
url = https://github.com/google/benchmark

3rdparty/benchmark

Submodule benchmark added at a846068

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ endforeach()
4444

4545
message( STATUS "PPC step: Setup external projects" )
4646
include(cmake/gtest.cmake)
47+
include(cmake/benchmark.cmake)
4748

4849
############################## Modules ##############################
4950

Doxyfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ PROJECT_BRIEF = "Parallel Programming Course"
66
INPUT = modules/task/include \
77
modules/util/include \
88
modules/util/src \
9-
modules/performance/include \
109
modules/runners/include \
1110
modules/runners/src
1211
FILE_PATTERNS = *.h *.c *.hpp *.cpp

cmake/benchmark.cmake

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
include_guard()
2+
3+
include(ExternalProject)
4+
5+
ExternalProject_Add(
6+
ppc_benchmark
7+
SOURCE_DIR "${CMAKE_SOURCE_DIR}/3rdparty/benchmark"
8+
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/ppc_benchmark"
9+
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/ppc_benchmark/build"
10+
INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/ppc_benchmark/install"
11+
EXCLUDE_FROM_ALL TRUE
12+
CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
13+
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
14+
-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}
15+
-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}
16+
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
17+
-DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED}
18+
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
19+
${PPC_EXTERNAL_PROJECT_CMAKE_ARGS}
20+
-DCMAKE_C_FLAGS=-w
21+
-DCMAKE_CXX_FLAGS=-w
22+
-DBENCHMARK_ENABLE_TESTING=OFF
23+
-DBENCHMARK_ENABLE_GTEST_TESTS=OFF
24+
-DBENCHMARK_ENABLE_WERROR=OFF
25+
-DBENCHMARK_ENABLE_INSTALL=ON
26+
-DBENCHMARK_ENABLE_LIBPFM=OFF
27+
BUILD_COMMAND
28+
"${CMAKE_COMMAND}" --build "${CMAKE_CURRENT_BINARY_DIR}/ppc_benchmark/build"
29+
--config $<CONFIG> --parallel
30+
INSTALL_COMMAND
31+
"${CMAKE_COMMAND}" --install
32+
"${CMAKE_CURRENT_BINARY_DIR}/ppc_benchmark/build" --config $<CONFIG>
33+
--prefix "${CMAKE_CURRENT_BINARY_DIR}/ppc_benchmark/install"
34+
${PPC_EXTERNAL_PROJECT_LOG_ARGS})
35+
36+
function(ppc_include_benchmark target_name)
37+
target_include_directories(
38+
${target_name} PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/benchmark/include)
39+
target_compile_definitions(${target_name} PUBLIC BENCHMARK_STATIC_DEFINE)
40+
endfunction()
41+
42+
function(ppc_link_benchmark target_name)
43+
ppc_include_benchmark(${target_name})
44+
add_dependencies(${target_name} ppc_benchmark)
45+
target_link_directories(${target_name} PUBLIC
46+
"${CMAKE_BINARY_DIR}/ppc_benchmark/install/lib")
47+
target_link_libraries(${target_name} PUBLIC benchmark Threads::Threads)
48+
if(WIN32)
49+
target_link_libraries(${target_name} PUBLIC shlwapi)
50+
endif()
51+
endfunction()

docs/user_guide/api.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,3 @@ Utility Module
2121

2222
.. doxygennamespace:: ppc::util
2323
:project: ParallelProgrammingCourse
24-
25-
Performance Module
26-
------------------
27-
28-
.. doxygennamespace:: ppc::performance
29-
:project: ParallelProgrammingCourse

modules/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ set_target_properties(${exec_func_lib} PROPERTIES LINKER_LANGUAGE CXX)
2626
target_include_directories(
2727
${exec_func_lib} PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty
2828
${CMAKE_SOURCE_DIR}/modules ${CMAKE_SOURCE_DIR}/tasks)
29+
ppc_include_benchmark(${exec_func_lib})
2930

3031
foreach(
3132
link

modules/performance/include/performance.hpp

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

0 commit comments

Comments
 (0)