Skip to content

Commit badc835

Browse files
Reduce benchmark problem sizes for simulation mode
Reduce problem sizes to ensure reasonable CI runtimes under CodSpeed simulation (valgrind) mode: - fib: 30 -> 20 - skynet: depth 8 (100M tasks) -> depth 6 (1M tasks) - nqueens: N=14 -> N=10 - matmul: 512x512 -> 256x256
1 parent d28b2e0 commit badc835

4 files changed

Lines changed: 18 additions & 6 deletions

File tree

cpp/codspeed/bench_fib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ static void BM_Fib(benchmark::State& state) {
4545
benchmark::DoNotOptimize(result);
4646
}
4747
}
48-
BENCHMARK(BM_Fib)->Arg(30);
48+
BENCHMARK(BM_Fib)->Arg(20);
4949
BENCHMARK_MAIN();

cpp/codspeed/bench_matmul.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// using the taskflow runtime.
33

44
// Adapted from cpp/taskflow/matmul.cpp
5+
// Uses 256x256 instead of larger sizes for reasonable CI runtimes
6+
// under simulation mode.
57

68
#include "matmul.hpp"
79
#include <taskflow/algorithm/for_each.hpp>
@@ -84,5 +86,5 @@ static void BM_Matmul(benchmark::State& state) {
8486
benchmark::ClobberMemory();
8587
}
8688
}
87-
BENCHMARK(BM_Matmul)->Arg(512);
89+
BENCHMARK(BM_Matmul)->Arg(256);
8890
BENCHMARK_MAIN();

cpp/codspeed/bench_nqueens.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// using the taskflow runtime.
33

44
// Adapted from cpp/taskflow/nqueens.cpp
5+
// Uses N=10 instead of N=14 for reasonable CI runtimes
6+
// under simulation mode.
57

68
#include <taskflow/taskflow.hpp>
79

@@ -15,7 +17,7 @@
1517
static size_t thread_count = std::thread::hardware_concurrency();
1618
std::optional<tf::Executor> executor;
1719

18-
inline constexpr int nqueens_work = 14;
20+
inline constexpr int nqueens_work = 10;
1921

2022
inline constexpr std::array<int, 28> answers = {
2123
0, 1, 0, 0, 2, 10, 4,

cpp/codspeed/bench_skynet.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// using the taskflow runtime.
33

44
// Adapted from cpp/taskflow/skynet.cpp
5+
// Uses depth 6 (1M tasks) instead of depth 8 (100M tasks)
6+
// for reasonable CI runtimes under simulation mode.
57

68
#include <taskflow/taskflow.hpp>
79

@@ -50,7 +52,13 @@ template <size_t DepthMax>
5052
void skynet(tf::Executor& exec) {
5153
size_t count;
5254
exec.async([&]() { count = skynet_one<DepthMax>(0, 0); }).get();
53-
if (count != 4999999950000000) {
55+
size_t expected = 0;
56+
size_t max_val = 1;
57+
for (size_t i = 0; i < DepthMax; ++i) {
58+
max_val *= 10;
59+
}
60+
expected = (max_val - 1) * max_val / 2;
61+
if (count != expected) {
5462
std::fprintf(
5563
stderr, "ERROR: wrong result - %" PRIu64 "\n", count
5664
);
@@ -63,10 +71,10 @@ static void BM_Skynet(benchmark::State& state) {
6371
}
6472

6573
// warmup
66-
skynet<8>(*executor);
74+
skynet<6>(*executor);
6775

6876
for (auto _ : state) {
69-
skynet<8>(*executor);
77+
skynet<6>(*executor);
7078
}
7179
}
7280
BENCHMARK(BM_Skynet);

0 commit comments

Comments
 (0)