Skip to content

Commit c426762

Browse files
committed
Add benchmarks to CI test build and analysis
1 parent d386357 commit c426762

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

script/run_generate.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ mkdir -p build/
8686
cd build/
8787

8888
"${ALPAKA_CI_CMAKE_EXECUTABLE}" --log-level=VERBOSE -G "${ALPAKA_CI_CMAKE_GENERATOR}" ${ALPAKA_CI_CMAKE_GENERATOR_PLATFORM}\
89-
-Dalpaka_BUILD_EXAMPLES=ON -DBUILD_TESTING=ON \
89+
-Dalpaka_BUILD_EXAMPLES=ON -Dalpaka_BUILD_BENCHMARK=ON -DBUILD_TESTING=ON \
9090
"$(env2cmake BOOST_ROOT)" -DBOOST_LIBRARYDIR="${ALPAKA_CI_BOOST_LIB_DIR}/lib" -DBoost_USE_STATIC_LIBS=ON -DBoost_USE_MULTITHREADED=ON -DBoost_USE_STATIC_RUNTIME=OFF -DBoost_ARCHITECTURE="-x64" \
9191
"$(env2cmake CMAKE_BUILD_TYPE)" "$(env2cmake CMAKE_CXX_FLAGS)" "$(env2cmake CMAKE_C_COMPILER)" "$(env2cmake CMAKE_CXX_COMPILER)" "$(env2cmake CMAKE_EXE_LINKER_FLAGS)" "$(env2cmake CMAKE_CXX_EXTENSIONS)"\
9292
"$(env2cmake alpaka_ACC_CPU_B_SEQ_T_SEQ_ENABLE)" "$(env2cmake alpaka_ACC_CPU_B_SEQ_T_THREADS_ENABLE)" "$(env2cmake alpaka_ACC_CPU_B_SEQ_T_FIBERS_ENABLE)" \

test/analysis/headerCheck/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ if(alpaka_CHECK_HEADERS)
4949
PRIVATE common)
5050

5151
set_target_properties(headerCheckTest PROPERTIES FOLDER "test/analysis")
52+
# Catch2 benchmark macros must be defined, otherwise the benchmarking headers will not pass the check.
53+
target_compile_definitions(${_TARGET_NAME} PUBLIC CATCH_CONFIG_ENABLE_BENCHMARKING)
5254

5355
add_test(NAME ${_TARGET_NAME} COMMAND ${_TARGET_NAME} ${_alpaka_TEST_OPTIONS})
5456

test/benchmark/rand/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ set_target_properties(${_TARGET_NAME} PROPERTIES FOLDER "test/benchmark")
2323
target_compile_definitions(${_TARGET_NAME} PUBLIC CATCH_CONFIG_ENABLE_BENCHMARKING)
2424

2525
if(alpaka_CI)
26-
add_test(NAME ${_TARGET_NAME} COMMAND ${_TARGET_NAME} ${_alpaka_TEST_OPTIONS} --benchmark-samples 1)
26+
# For non-benchmarking CI test runs - It will only run the benchmark once to see if it works at all.
27+
add_test(NAME ${_TARGET_NAME} COMMAND ${_TARGET_NAME} ${_alpaka_TEST_OPTIONS} --benchmark-samples 1)
28+
# Real automated benchmark runs will need to collect more samples (the default 100 is fine). The CI will then
29+
# have to set another variable to indicate if it is only testing, or if it wants to do a full benchmark.
2730
else()
31+
# For full benchmark run - will collect 100 samples wor godd benchmark statistics.
2832
add_test(NAME ${_TARGET_NAME} COMMAND ${_TARGET_NAME} ${_alpaka_TEST_OPTIONS})
2933
endif()

test/benchmark/rand/src/randBenchmark.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ TEST_CASE("defaultRandomGeneratorBenchmark", "[randBenchmark]")
6262
const Idx numThreads = std::thread::hardware_concurrency(); // TODO: GPU?
6363
std::cout << "Hardware threads: " << numThreads << std::endl;
6464

65-
const unsigned numPoints = GENERATE(100'000u, 1'000'000u, 10'000'000u, 100'000'000u, 1'000'000'000u);
65+
#ifdef ALPAKA_CI // Reduced benchmark set for automated test runs.
66+
const unsigned numPoints = GENERATE(10u, 1'000'000u);
67+
#else
68+
const unsigned numPoints = GENERATE(10u, 100'000u, 1'000'000u, 10'000'000u, 100'000'000u, 1'000'000'000u);
69+
#endif
6670

6771
WorkDiv workdiv{alpaka::getValidWorkDiv<Acc>(
6872
devAcc,

0 commit comments

Comments
 (0)