Commit f5268f9
authored
Add C++ benchmarks (part 1/n) (#659)
Partially addresses #606
This PR kick-starts the process of adding benchmarks to KvikIO. The following tasks are done:
- Add CMake scripts for the benchmark.
- Add a simple benchmark for the threadpool.
To build and run the benchmark programs in the dev container:
```
# Build the benchmarks
build-kvikio-cpp -DBUILD_TESTS=ON -DBUILD_BENCHMARKS=ON -j 16
# Run specific benchmark
~/kvikio/cpp/build/latest/benchmarks/<benchmark-name>
```
Sample output:
```
2025-03-14T04:38:46+00:00
Running ./THREADPOOL_BENCHMARK
Run on (16 X 5050 MHz CPU s)
CPU Caches:
L1 Data 32 KiB (x8)
L1 Instruction 32 KiB (x8)
L2 Unified 1024 KiB (x8)
L3 Unified 98304 KiB (x1)
Load Average: 0.34, 1.07, 1.22
***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead.
---------------------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
---------------------------------------------------------------------------------------------------------------------------
BM_threadpool_compute:strong_scaling/1/min_time:2.000/real_time 162 ms 0.728 ms 17 threads=1
BM_threadpool_compute:strong_scaling/2/min_time:2.000/real_time 81.6 ms 0.885 ms 34 threads=2
BM_threadpool_compute:strong_scaling/4/min_time:2.000/real_time 41.1 ms 0.972 ms 68 threads=4
BM_threadpool_compute:strong_scaling/8/min_time:2.000/real_time 21.3 ms 1.40 ms 127 threads=8
BM_threadpool_compute:strong_scaling/16/min_time:2.000/real_time 18.7 ms 1.84 ms 150 threads=16
BM_threadpool_compute:strong_scaling/32/min_time:2.000/real_time 19.2 ms 2.76 ms 145 threads=32
BM_threadpool_compute:strong_scaling/64/min_time:2.000/real_time 20.8 ms 5.46 ms 139 threads=64
BM_threadpool_compute:weak_scaling/1/min_time:2.000/real_time 16.2 ms 0.135 ms 172 threads=1
BM_threadpool_compute:weak_scaling/2/min_time:2.000/real_time 16.3 ms 0.260 ms 171 threads=2
BM_threadpool_compute:weak_scaling/4/min_time:2.000/real_time 16.6 ms 0.527 ms 168 threads=4
BM_threadpool_compute:weak_scaling/8/min_time:2.000/real_time 17.2 ms 1.05 ms 164 threads=8
BM_threadpool_compute:weak_scaling/16/min_time:2.000/real_time 29.7 ms 2.66 ms 94 threads=16
BM_threadpool_compute:weak_scaling/32/min_time:2.000/real_time 60.9 ms 8.04 ms 46 threads=32
BM_threadpool_compute:weak_scaling/64/min_time:2.000/real_time 133 ms 36.0 ms 21 threads=64
```
Authors:
- Tianyu Liu (https://github.com/kingcrimsontianyu)
Approvers:
- Mads R. B. Kristensen (https://github.com/madsbk)
- Kyle Edwards (https://github.com/KyleFromNVIDIA)
- Muhammad Haseeb (https://github.com/mhaseeb123)
URL: #6591 parent 3adbe7e commit f5268f9
File tree
5 files changed
+172
-6
lines changed- cpp
- benchmarks
- threadpool
- examples
- python/libkvikio
5 files changed
+172
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
203 | 204 | | |
204 | 205 | | |
205 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
206 | 218 | | |
207 | 219 | | |
208 | 220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
24 | 23 | | |
25 | | - | |
| 24 | + | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
46 | | - | |
47 | | - | |
| 45 | + | |
48 | 46 | | |
49 | | - | |
| 47 | + | |
50 | 48 | | |
51 | 49 | | |
52 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
0 commit comments