Performance Testing Suite for the Stan C++ libraries
BSD-3-CLAUSE License
Performance Testing Suite for the Stan C++ libraries
cmake -S . -B "build" -DCMAKE_BUILD_TYPE=Release
cd ./build
# After you are in the build file you can call `cmake ..` to re-run cmake
make matmul_soa matmul_aos
taskset -c 0
to pin the benchmark to the first cpu.taskset -c 11 ./benchmarks/matmul_aos_soa/matmul_soa --benchmark_out_format=csv --benchmark_out=./benchmarks/matmul_aos_soa/matmul_soa.csv --benchmark_repetitions=30 --benchmark_report_aggregates_only=false
taskset -c 11 ./benchmarks/matmul_aos_soa/matmul_aos --benchmark_out_format=csv --benchmark_out=./benchmarks/matmul_aos_soa/matmul_aos.csv --benchmark_repetitions=30 --benchmark_report_aggregates_only=false
Rscript ./scripts/matmul_aos_soa/plot.R
benchmarks
mkdir ./benchmarks/my_new_bench
// Example benchmark
#include <benchmark/benchmark.h>
static void BM_StringCreation(benchmark::State& state) {
for (auto _ : state)
std::string empty_string;
}
// Register the function as a benchmark
BENCHMARK(BM_StringCreation);
// Define another benchmark
static void BM_StringCopy(benchmark::State& state) {
std::string x = "hello";
for (auto _ : state)
std::string copy(x);
}
BENCHMARK(BM_StringCopy);
BENCHMARK_MAIN();
CMakeLists.txt
file in your benchmark folder to compile your testadd_executable(matmul_aos aos.cpp)
benchmarks
folder, add your subdirectory to the CMakeLists.txt
add_subdirectory(my_new_bench)
From the top level directory, either call cmake -S . -B "build" -DCMAKE_BUILD_TYPE=Release
or mkdir build; cd build; cmake .. -DCMAKE_BUILD_TYPE=Release
cd
into build and call make my_bench_name
Run your benchmark, storing any scripts to generate plots in a scripts/my_new_bench
folder
This repo comes with tbb
, Eigen
, sundials
, boost
headers, stan
, and stan math
which you can find in the top level CMakeLists.txt
.