diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index def496b2..47f96bfd 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -1,6 +1,6 @@ # Algebra plugins library, part of the ACTS project (R&D line) # -# (c) 2023 CERN for the benefit of the ACTS project +# (c) 2023-2026 CERN for the benefit of the ACTS project # # Mozilla Public License Version 2.0 @@ -8,179 +8,149 @@ include(algebra-plugins-compiler-options-cpp) # Set up an INTERFACE library for the common header(s). -add_library(algebra_bench_common INTERFACE) +add_library( + algebra_bench_common + INTERFACE + "algebra/include/algebra/common/benchmark_base.hpp" + "algebra/include/algebra/common/benchmark_getter.hpp" + "algebra/include/algebra/common/benchmark_matrix.hpp" + "algebra/include/algebra/common/benchmark_transform3.hpp" + "algebra/include/algebra/common/benchmark_types.hpp" + "algebra/include/algebra/common/benchmark_vector.hpp" + "algebra/include/algebra/common/register_benchmark.hpp" +) + target_include_directories( algebra_bench_common - INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/common/include" + INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/algebra/include/" ) + if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC") target_compile_definitions( algebra_bench_common INTERFACE -D_USE_MATH_DEFINES ) endif() + add_library(algebra::bench_common ALIAS algebra_bench_common) -# Set up all of the (available) "host" benchmarks. -add_library(algebra_bench_array INTERFACE) -target_include_directories( - algebra_bench_array - INTERFACE "$" -) -target_link_libraries( - algebra_bench_array - INTERFACE algebra::array algebra::common -) -algebra_add_benchmark( array_getter - "array/array_getter.cpp" - LINK_LIBRARIES benchmark::benchmark algebra::bench_common - algebra_bench_array algebra::array -) -algebra_add_benchmark( array_vector - "array/array_vector.cpp" - LINK_LIBRARIES benchmark::benchmark algebra::bench_common - algebra_bench_array algebra::array -) -algebra_add_benchmark( array_transform3 - "array/array_transform3.cpp" - LINK_LIBRARIES benchmark::benchmark algebra::bench_common - algebra_bench_array algebra::array -) -algebra_add_benchmark( array_matrix - "array/array_matrix.cpp" - LINK_LIBRARIES benchmark::benchmark algebra::bench_common - algebra_bench_array algebra::array -) +# Macro setting up the CPU benchmarks for a specific algebra plugin. +macro(algebra_add_benchmarks plugin) + string(TOUPPER ${plugin} PLUGIN) + + add_library( + algebra_bench_${plugin} + INTERFACE + "algebra/include/algebra/${plugin}/data_generator.hpp" + ) -if(ALGEBRA_PLUGINS_INCLUDE_EIGEN) - add_library(algebra_bench_eigen INTERFACE) target_include_directories( - algebra_bench_eigen - INTERFACE "$" + algebra_bench_${plugin} + INTERFACE + "$" ) + target_link_libraries( - algebra_bench_eigen - INTERFACE algebra::eigen algebra::common + algebra_bench_${plugin} + INTERFACE algebra::${plugin} algebra::common ) - algebra_add_benchmark(eigen_getter - "eigen/eigen_getter.cpp" - LINK_LIBRARIES benchmark::benchmark algebra::bench_common - algebra_bench_eigen algebra::eigen + + algebra_add_benchmark( ${plugin}_getter + "algebra/src/benchmark_getter.cpp" + LINK_LIBRARIES benchmark::benchmark algebra::bench_common + algebra_bench_${plugin} algebra::${plugin} ) - algebra_add_benchmark(eigen_vector - "eigen/eigen_vector.cpp" - LINK_LIBRARIES benchmark::benchmark algebra::bench_common - algebra_bench_eigen algebra::eigen + target_compile_definitions( + algebra_benchmark_${plugin}_getter + PUBLIC ALGEBRA_BENCHMARK_${PLUGIN} ) - algebra_add_benchmark(eigen_transform3 - "eigen/eigen_transform3.cpp" - LINK_LIBRARIES benchmark::benchmark algebra::bench_common - algebra_bench_eigen algebra::eigen + + algebra_add_benchmark( ${plugin}_vector + "algebra/src/benchmark_vector.cpp" + LINK_LIBRARIES benchmark::benchmark algebra::bench_common + algebra_bench_${plugin} algebra::${plugin} ) - algebra_add_benchmark(eigen_matrix - "eigen/eigen_matrix.cpp" - LINK_LIBRARIES benchmark::benchmark algebra::bench_common - algebra_bench_eigen algebra::eigen + target_compile_definitions( + algebra_benchmark_${plugin}_vector + PUBLIC ALGEBRA_BENCHMARK_${PLUGIN} ) -endif() -if(ALGEBRA_PLUGINS_INCLUDE_VC) - add_library(algebra_bench_vc_aos INTERFACE) - target_include_directories( - algebra_bench_vc_aos - INTERFACE - "$" + algebra_add_benchmark( ${plugin}_transform3 + "algebra/src/benchmark_transform3.cpp" + LINK_LIBRARIES benchmark::benchmark algebra::bench_common + algebra_bench_${plugin} algebra::${plugin} ) - target_link_libraries( - algebra_bench_vc_aos - INTERFACE algebra::vc_aos algebra::common - ) - algebra_add_benchmark(vc_aos_getter - "vc_aos/vc_aos_getter.cpp" - LINK_LIBRARIES benchmark::benchmark algebra::bench_common - algebra_bench_vc_aos algebra::vc_aos + target_compile_definitions( + algebra_benchmark_${plugin}_transform3 + PUBLIC ALGEBRA_BENCHMARK_${PLUGIN} ) - algebra_add_benchmark(vc_aos_vector - "vc_aos/vc_aos_vector.cpp" - LINK_LIBRARIES benchmark::benchmark algebra::bench_common - algebra_bench_vc_aos algebra::vc_aos + + algebra_add_benchmark( ${plugin}_matrix + "algebra/src/benchmark_matrix.cpp" + LINK_LIBRARIES benchmark::benchmark algebra::bench_common + algebra_bench_${plugin} algebra::${plugin} ) - algebra_add_benchmark(vc_aos_transform3 - "vc_aos/vc_aos_transform3.cpp" - LINK_LIBRARIES benchmark::benchmark algebra::bench_common - algebra_bench_vc_aos algebra::vc_aos + target_compile_definitions( + algebra_benchmark_${plugin}_matrix + PUBLIC ALGEBRA_BENCHMARK_${PLUGIN} ) - algebra_add_benchmark(vc_aos_matrix - "vc_aos/vc_aos_matrix.cpp" - LINK_LIBRARIES benchmark::benchmark algebra::bench_common - algebra_bench_vc_aos algebra::vc_aos +endmacro() + +# Set up all of the (available) "host" benchmarks. +if(ALGEBRA_PLUGINS_INCLUDE_ARRAY) + algebra_add_benchmarks(array) +endif() + +if(ALGEBRA_PLUGINS_INCLUDE_EIGEN) + algebra_add_benchmarks(eigen) +endif() + +if(ALGEBRA_PLUGINS_INCLUDE_FASTOR) + algebra_add_benchmarks(fastor) +endif() + +if(ALGEBRA_PLUGINS_INCLUDE_SMATRIX) + algebra_add_benchmarks(smatrix) +endif() + +if(ALGEBRA_PLUGINS_INCLUDE_VC) + algebra_add_benchmarks(vc_aos) + + add_library( + algebra_bench_vc_soa + INTERFACE + "algebra/include/algebra/vc_soa/data_generator.hpp" ) - add_library(algebra_bench_vc_soa INTERFACE) target_include_directories( algebra_bench_vc_soa INTERFACE - "$" + "$" ) + target_link_libraries( algebra_bench_vc_soa INTERFACE algebra::vc_soa algebra::common ) + algebra_add_benchmark(vc_soa_getter - "vc_soa/vc_soa_getter.cpp" + "algebra/src/vc_soa/vc_soa_getter.cpp" LINK_LIBRARIES benchmark::benchmark algebra::bench_common algebra_bench_vc_soa algebra::vc_soa ) algebra_add_benchmark(vc_soa_vector - "vc_soa/vc_soa_vector.cpp" + "algebra/src/vc_soa/vc_soa_vector.cpp" LINK_LIBRARIES benchmark::benchmark algebra::bench_common algebra_bench_vc_soa algebra::vc_soa ) algebra_add_benchmark(vc_soa_transform3 - "vc_soa/vc_soa_transform3.cpp" + "algebra/src/vc_soa/vc_soa_transform3.cpp" LINK_LIBRARIES benchmark::benchmark algebra::bench_common algebra_bench_vc_soa algebra::vc_soa ) algebra_add_benchmark(vc_soa_matrix - "vc_soa/vc_soa_matrix.cpp" + "algebra/src/vc_soa/vc_soa_matrix.cpp" LINK_LIBRARIES benchmark::benchmark algebra::bench_common algebra_bench_vc_soa algebra::vc_soa ) endif() - -if(ALGEBRA_PLUGINS_INCLUDE_FASTOR) - add_library(algebra_bench_fastor INTERFACE) - message( - STATUS - "Include directory: ${CMAKE_CURRENT_SOURCE_DIR}/fastor/include" - ) - target_include_directories( - algebra_bench_fastor - INTERFACE - "$" - ) - target_link_libraries( - algebra_bench_fastor - INTERFACE algebra::fastor algebra::common - ) - algebra_add_benchmark(fastor_getter - "fastor/fastor_getter.cpp" - LINK_LIBRARIES benchmark::benchmark algebra::bench_common - algebra_bench_fastor algebra::fastor - ) - algebra_add_benchmark(fastor_vector - "fastor/fastor_vector.cpp" - LINK_LIBRARIES benchmark::benchmark algebra::bench_common - algebra_bench_fastor algebra::fastor - ) - algebra_add_benchmark(fastor_transform3 - "fastor/fastor_transform3.cpp" - LINK_LIBRARIES benchmark::benchmark algebra::bench_common - algebra_bench_fastor algebra::fastor - ) - algebra_add_benchmark(fastor_matrix - "fastor/fastor_matrix.cpp" - LINK_LIBRARIES benchmark::benchmark algebra::bench_common - algebra_bench_fastor algebra::fastor - ) -endif() diff --git a/benchmarks/array/include/benchmark/array/data_generator.hpp b/benchmarks/algebra/include/algebra/array/data_generator.hpp similarity index 100% rename from benchmarks/array/include/benchmark/array/data_generator.hpp rename to benchmarks/algebra/include/algebra/array/data_generator.hpp diff --git a/benchmarks/common/include/benchmark/common/benchmark_base.hpp b/benchmarks/algebra/include/algebra/common/benchmark_base.hpp similarity index 97% rename from benchmarks/common/include/benchmark/common/benchmark_base.hpp rename to benchmarks/algebra/include/algebra/common/benchmark_base.hpp index af3e6c87..668624f6 100644 --- a/benchmarks/common/include/benchmark/common/benchmark_base.hpp +++ b/benchmarks/algebra/include/algebra/common/benchmark_base.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/benchmarks/common/include/benchmark/common/benchmark_getter.hpp b/benchmarks/algebra/include/algebra/common/benchmark_getter.hpp similarity index 59% rename from benchmarks/common/include/benchmark/common/benchmark_getter.hpp rename to benchmarks/algebra/include/algebra/common/benchmark_getter.hpp index c6c9c9ae..afa8f79a 100644 --- a/benchmarks/common/include/benchmark/common/benchmark_getter.hpp +++ b/benchmarks/algebra/include/algebra/common/benchmark_getter.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,8 +8,8 @@ #pragma once // Project include(s) -#include "benchmark_vector.hpp" -#include "register_benchmark.hpp" +#include "algebra/common/benchmark_vector.hpp" +#include "algebra/common/register_benchmark.hpp" namespace algebra::bench_op { /* TODO: Implement */ } // namespace algebra::bench_op diff --git a/benchmarks/algebra/include/algebra/common/benchmark_matrix.hpp b/benchmarks/algebra/include/algebra/common/benchmark_matrix.hpp new file mode 100644 index 00000000..9489727e --- /dev/null +++ b/benchmarks/algebra/include/algebra/common/benchmark_matrix.hpp @@ -0,0 +1,340 @@ +/** Algebra plugins library, part of the ACTS project + * + * (c) 2024-2026 CERN for the benefit of the ACTS project + * + * Mozilla Public License Version 2.0 + */ + +#pragma once + +// Project include(s) +#include "algebra/common/benchmark_base.hpp" +#include "algebra/common/register_benchmark.hpp" +#include "algebra/concepts.hpp" + +// System include(s) +#include +#include + +namespace algebra { + +template +void fill_random_matrix(std::vector&); + +template +void fill_random_vec(std::vector&); + +/// Benchmark for matrix operations +template +struct matrix_bm : public benchmark_base { + + /// Prefix for the benchmark name + static constexpr std::string_view name{"matrix"}; + + std::vector a; + std::vector b; + + /// No default construction: Cannot prepare data + matrix_bm() = delete; + + /// Construct from an externally provided configuration @param cfg + explicit matrix_bm(benchmark_base::configuration cfg) : benchmark_base{cfg} { + + const std::size_t n_data{this->m_cfg.n_samples()}; + + a.reserve(n_data); + b.reserve(n_data); + + fill_random_matrix(a); + fill_random_matrix(b); + } + + matrix_bm(const matrix_bm& bm) = default; + matrix_bm& operator=(matrix_bm& other) = default; + + /// Clear state + ~matrix_bm() override { + a.clear(); + b.clear(); + } +}; + +/// Benchmark operations on a single matrix (transpose, inverse etc) +template + requires std::invocable +struct matrix_unaryOP_bm : public matrix_bm { + using base_type = matrix_bm; + + matrix_unaryOP_bm() = delete; + explicit matrix_unaryOP_bm(benchmark_base::configuration cfg) + : base_type{cfg} {} + matrix_unaryOP_bm(const matrix_unaryOP_bm& bm) = default; + matrix_unaryOP_bm& operator=(matrix_unaryOP_bm& other) = default; + + constexpr std::string name() const override { + return std::string{base_type::name} + "_" + std::string{unaryOP::name}; + } + + inline void operator()(::benchmark::State& state) const override { + + using result_t = std::invoke_result_t; + + const std::size_t n_samples{this->m_cfg.n_samples()}; + + // Run the benchmark + for (auto _ : state) { + for (std::size_t i{0}; i < n_samples; ++i) { + result_t result = unaryOP{}(this->a[i]); + ::benchmark::DoNotOptimize(result); + } + } + } +}; + +/// Benchmark elementwise addition/subtraction/multiplication of matrices +template + requires std::invocable +struct matrix_binaryOP_bm : public matrix_bm { + using base_type = matrix_bm; + + matrix_binaryOP_bm() = delete; + explicit matrix_binaryOP_bm(benchmark_base::configuration cfg) + : base_type{cfg} {} + matrix_binaryOP_bm(const matrix_binaryOP_bm& bm) = default; + matrix_binaryOP_bm& operator=(matrix_binaryOP_bm& other) = default; + + constexpr std::string name() const override { + return std::string{base_type::name} + "_" + std::string{binaryOP::name}; + } + + inline void operator()(::benchmark::State& state) const override { + + using result_t = std::invoke_result_t; + + const std::size_t n_samples{this->m_cfg.n_samples()}; + + // Run the benchmark + for (auto _ : state) { + for (std::size_t i{0}; i < n_samples; ++i) { + result_t result = binaryOP{}(this->a[i], this->b[i]); + ::benchmark::DoNotOptimize(result); + } + } + } +}; + +/// Benchmark matrix vector multiplication +template +struct matrix_vector_bm : public matrix_bm { + using base_type = matrix_bm; + + std::vector v; + + matrix_vector_bm() = delete; + explicit matrix_vector_bm(benchmark_base::configuration cfg) + : base_type{cfg} { + + v.reserve(this->m_cfg.n_samples()); + + fill_random_vec(v); + } + matrix_vector_bm(const matrix_vector_bm& bm) = default; + matrix_vector_bm& operator=(matrix_vector_bm& other) = default; + + /// Clear state + ~matrix_vector_bm() override { v.clear(); } + + constexpr std::string name() const override { + return std::string{base_type::name} + "_vector"; + } + + inline void operator()(::benchmark::State& state) const override { + + const std::size_t n_samples{this->m_cfg.n_samples()}; + + // Run the benchmark + for (auto _ : state) { + for (std::size_t i{0}; i < n_samples; ++i) { + vector_t result = this->a[i] * this->v[i]; + ::benchmark::DoNotOptimize(result); + } + } + } +}; + +// Functions to be benchmarked +namespace bench_op::matrix { + +struct add { + static constexpr std::string_view name{"add"}; + template + constexpr matrix_t operator()(const matrix_t& a, const matrix_t& b) const { + return a + b; + } +}; +struct sub { + static constexpr std::string_view name{"sub"}; + template + constexpr matrix_t operator()(const matrix_t& a, const matrix_t& b) const { + return a - b; + } +}; +struct mul { + static constexpr std::string_view name{"mul"}; + template + constexpr matrix_t operator()(const matrix_t& a, const matrix_t& b) const { + return a * b; + } +}; +struct transpose { + static constexpr std::string_view name{"transpose"}; + template + constexpr auto operator()(const matrix_t& a) const { + return algebra::matrix::transpose(a); + } +}; +struct determinant { + static constexpr std::string_view name{"determinant"}; + template + constexpr auto operator()(const matrix_t& a) const { + return algebra::matrix::determinant(a); + } +}; +struct invert { + static constexpr std::string_view name{"invert"}; + template + constexpr auto operator()(const matrix_t& a) const { + return algebra::matrix::inverse(a); + } +}; + +} // namespace bench_op::matrix + +// Macro for defining all matrix benchmark types +#define ALGEBRA_PLUGINS_DEFINE_MATRIX_BENCH(PLUGIN) \ + using mat44_transp_f_t = matrix_unaryOP_bm, \ + bench_op::matrix::transpose>; \ + using mat44_transp_d_t = \ + matrix_unaryOP_bm, \ + bench_op::matrix::transpose>; \ + using mat66_transp_f_t = matrix_unaryOP_bm, \ + bench_op::matrix::transpose>; \ + using mat66_transp_d_t = \ + matrix_unaryOP_bm, \ + bench_op::matrix::transpose>; \ + using mat88_transp_f_t = matrix_unaryOP_bm, \ + bench_op::matrix::transpose>; \ + using mat88_transp_d_t = \ + matrix_unaryOP_bm, \ + bench_op::matrix::transpose>; \ + \ + using mat44_inv_f_t = matrix_unaryOP_bm, \ + bench_op::matrix::invert>; \ + using mat44_inv_d_t = matrix_unaryOP_bm, \ + bench_op::matrix::invert>; \ + using mat66_inv_f_t = matrix_unaryOP_bm, \ + bench_op::matrix::invert>; \ + using mat66_inv_d_t = matrix_unaryOP_bm, \ + bench_op::matrix::invert>; \ + using mat88_inv_f_t = matrix_unaryOP_bm, \ + bench_op::matrix::invert>; \ + using mat88_inv_d_t = matrix_unaryOP_bm, \ + bench_op::matrix::invert>; \ + \ + using mat44_det_f_t = matrix_unaryOP_bm, \ + bench_op::matrix::determinant>; \ + using mat44_det_d_t = matrix_unaryOP_bm, \ + bench_op::matrix::determinant>; \ + using mat66_det_f_t = matrix_unaryOP_bm, \ + bench_op::matrix::determinant>; \ + using mat66_det_d_t = matrix_unaryOP_bm, \ + bench_op::matrix::determinant>; \ + using mat88_det_f_t = matrix_unaryOP_bm, \ + bench_op::matrix::determinant>; \ + using mat88_det_d_t = matrix_unaryOP_bm, \ + bench_op::matrix::determinant>; \ + \ + using mat44_add_f_t = matrix_binaryOP_bm, \ + bench_op::matrix::add>; \ + using mat44_add_d_t = matrix_binaryOP_bm, \ + bench_op::matrix::add>; \ + using mat66_add_f_t = matrix_binaryOP_bm, \ + bench_op::matrix::add>; \ + using mat66_add_d_t = matrix_binaryOP_bm, \ + bench_op::matrix::add>; \ + using mat88_add_f_t = matrix_binaryOP_bm, \ + bench_op::matrix::add>; \ + using mat88_add_d_t = matrix_binaryOP_bm, \ + bench_op::matrix::add>; \ + \ + using mat44_mul_f_t = matrix_binaryOP_bm, \ + bench_op::matrix::mul>; \ + using mat44_mul_d_t = matrix_binaryOP_bm, \ + bench_op::matrix::mul>; \ + using mat66_mul_f_t = matrix_binaryOP_bm, \ + bench_op::matrix::mul>; \ + using mat66_mul_d_t = matrix_binaryOP_bm, \ + bench_op::matrix::mul>; \ + using mat88_mul_f_t = matrix_binaryOP_bm, \ + bench_op::matrix::mul>; \ + using mat88_mul_d_t = matrix_binaryOP_bm, \ + bench_op::matrix::mul>; \ + \ + using mat44_vec_f_t = matrix_vector_bm, \ + PLUGIN::vector_type>; \ + using mat44_vec_d_t = matrix_vector_bm, \ + PLUGIN::vector_type>; \ + using mat66_vec_f_t = matrix_vector_bm, \ + PLUGIN::vector_type>; \ + using mat66_vec_d_t = matrix_vector_bm, \ + PLUGIN::vector_type>; \ + using mat88_vec_f_t = matrix_vector_bm, \ + PLUGIN::vector_type>; \ + using mat88_vec_d_t = matrix_vector_bm, \ + PLUGIN::vector_type>; + +// Macro for registering all matrix benchmarks +#define ALGEBRA_PLUGINS_REGISTER_MATRIX_BENCH(CFGS, CFGD) \ + algebra::register_benchmark(CFGS, "_4x4_single"); \ + algebra::register_benchmark(CFGD, "_4x4_double"); \ + algebra::register_benchmark(CFGS, "_6x6_single"); \ + algebra::register_benchmark(CFGD, "_6x6_double"); \ + algebra::register_benchmark(CFGS, "_8x8_single"); \ + algebra::register_benchmark(CFGD, "_8x8_double"); \ + \ + algebra::register_benchmark(CFGS, "_4x4_single"); \ + algebra::register_benchmark(CFGD, "_4x4_double"); \ + algebra::register_benchmark(CFGS, "_6x6_single"); \ + algebra::register_benchmark(CFGD, "_6x6_double"); \ + algebra::register_benchmark(CFGS, "_8x8_single"); \ + algebra::register_benchmark(CFGD, "_8x8_double"); \ + \ + algebra::register_benchmark(CFGS, "_4x4_single"); \ + algebra::register_benchmark(CFGD, "_4x4_double"); \ + algebra::register_benchmark(CFGS, "_6x6_single"); \ + algebra::register_benchmark(CFGD, "_6x6_double"); \ + algebra::register_benchmark(CFGS, "_8x8_single"); \ + algebra::register_benchmark(CFGD, "_8x8_double"); \ + \ + algebra::register_benchmark(CFGS, "_4x4_single"); \ + algebra::register_benchmark(CFGD, "_4x4_double"); \ + algebra::register_benchmark(CFGS, "_6x6_single"); \ + algebra::register_benchmark(CFGD, "_6x6_double"); \ + algebra::register_benchmark(CFGS, "_8x8_single"); \ + algebra::register_benchmark(CFGD, "_8x8_double"); \ + \ + algebra::register_benchmark(CFGS, "_4x4_single"); \ + algebra::register_benchmark(CFGD, "_4x4_double"); \ + algebra::register_benchmark(CFGS, "_6x6_single"); \ + algebra::register_benchmark(CFGD, "_6x6_double"); \ + algebra::register_benchmark(CFGS, "_8x8_single"); \ + algebra::register_benchmark(CFGD, "_8x8_double"); \ + \ + algebra::register_benchmark(CFGS, "_4x4_single"); \ + algebra::register_benchmark(CFGD, "_4x4_double"); \ + algebra::register_benchmark(CFGS, "_6x6_single"); \ + algebra::register_benchmark(CFGD, "_6x6_double"); \ + algebra::register_benchmark(CFGS, "_8x8_single"); \ + algebra::register_benchmark(CFGD, "_8x8_double"); + +} // namespace algebra diff --git a/benchmarks/common/include/benchmark/common/benchmark_transform3.hpp b/benchmarks/algebra/include/algebra/common/benchmark_transform3.hpp similarity index 77% rename from benchmarks/common/include/benchmark/common/benchmark_transform3.hpp rename to benchmarks/algebra/include/algebra/common/benchmark_transform3.hpp index a6c16fa6..17b62c7b 100644 --- a/benchmarks/common/include/benchmark/common/benchmark_transform3.hpp +++ b/benchmarks/algebra/include/algebra/common/benchmark_transform3.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023-2024 CERN for the benefit of the ACTS project + * (c) 2023-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,7 +8,8 @@ #pragma once // Project include(s) -#include "benchmark_vector.hpp" +#include "algebra/common/benchmark_vector.hpp" +#include "algebra/common/register_benchmark.hpp" // System include(s) #include @@ -79,4 +80,14 @@ struct transform3_bm : public vector_bm { } }; +// Macro for defining all transform benchmark types +#define ALGEBRA_PLUGINS_DEFINE_TRANSFORM_BENCH(PLUGIN) \ + using trf_f_t = transform3_bm>; \ + using trf_d_t = transform3_bm>; + +// Macro for registering all transform benchmarks +#define ALGEBRA_PLUGINS_REGISTER_TRANSFORM_BENCH(CFGS, CFGD) \ + algebra::register_benchmark(CFGS, "_single"); \ + algebra::register_benchmark(CFGD, "_double"); + } // namespace algebra diff --git a/benchmarks/algebra/include/algebra/common/benchmark_types.hpp b/benchmarks/algebra/include/algebra/common/benchmark_types.hpp new file mode 100644 index 00000000..e95ed197 --- /dev/null +++ b/benchmarks/algebra/include/algebra/common/benchmark_types.hpp @@ -0,0 +1,62 @@ +/** Algebra plugins library, part of the ACTS project + * + * (c) 2026 CERN for the benefit of the ACTS project + * + * Mozilla Public License Version 2.0 + */ + +#pragma once + +// Algebra plugin selection +#if ALGEBRA_BENCHMARK_ARRAY +#include "algebra/array.hpp" +#include "algebra/array/data_generator.hpp" +#endif +#if ALGEBRA_BENCHMARK_EIGEN +#include "algebra/eigen.hpp" +#include "algebra/eigen/data_generator.hpp" +#endif +#if ALGEBRA_BENCHMARK_FASTOR +#include "algebra/fastor.hpp" +#include "algebra/fastor/data_generator.hpp" +#endif +#if ALGEBRA_BENCHMARK_SMATRIX +#include "algebra/smatrix.hpp" +#include "algebra/smatrix/data_generator.hpp" +#endif +#if ALGEBRA_BENCHMARK_VC_AOS +#include "algebra/vc_aos.hpp" +#include "algebra/vc_aos/data_generator.hpp" +#endif + +// Project include(s). +#include "algebra/common/benchmark_vector.hpp" + +// Benchmark include +#include + +// System include(s) +#include +#include + +namespace algebra::benchmark { + +#define ALGEBRA_DEFINE_BENCHMARK_NAME(ALGEBRA) \ + static std::string plugin_name(#ALGEBRA); + +// Select algebra-plugin to compile the test with +#if ALGEBRA_BENCHMARK_ARRAY +ALGEBRA_DEFINE_BENCHMARK_NAME(array) +#elif ALGEBRA_BENCHMARK_EIGEN +ALGEBRA_DEFINE_BENCHMARK_NAME(eigen) +#elif ALGEBRA_BENCHMARK_FASTOR +ALGEBRA_DEFINE_BENCHMARK_NAME(fastor) +#elif ALGEBRA_BENCHMARK_SMATRIX +ALGEBRA_DEFINE_BENCHMARK_NAME(smatrix) +#elif ALGEBRA_BENCHMARK_VC_AOS +ALGEBRA_DEFINE_BENCHMARK_NAME(vc_aos) +#elif ALGEBRA_BENCHMARK_VC_SOA +ALGEBRA_DEFINE_BENCHMARK_NAME(vc_soa) +#endif + +} // namespace algebra::benchmark diff --git a/benchmarks/common/include/benchmark/common/benchmark_vector.hpp b/benchmarks/algebra/include/algebra/common/benchmark_vector.hpp similarity index 51% rename from benchmarks/common/include/benchmark/common/benchmark_vector.hpp rename to benchmarks/algebra/include/algebra/common/benchmark_vector.hpp index 386de937..0164e9de 100644 --- a/benchmarks/common/include/benchmark/common/benchmark_vector.hpp +++ b/benchmarks/algebra/include/algebra/common/benchmark_vector.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023-2024 CERN for the benefit of the ACTS project + * (c) 2023-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,8 +8,9 @@ #pragma once // Project include(s) -#include "benchmark_base.hpp" -#include "register_benchmark.hpp" +#include "algebra/common/benchmark_base.hpp" +#include "algebra/common/register_benchmark.hpp" +#include "algebra/concepts.hpp" // System include(s) #include @@ -126,7 +127,7 @@ struct vector_binaryOP_bm : public vector_bm> { }; // Functions to be benchmarked -namespace bench_op { +namespace bench_op::vector { struct add { static constexpr std::string_view name{"add"}; @@ -175,30 +176,76 @@ ALGEBRA_PLUGINS_BENCH_VECTOR(perp, algebra::traits::scalar_t) ALGEBRA_PLUGINS_BENCH_VECTOR(norm, algebra::traits::scalar_t) ALGEBRA_PLUGINS_BENCH_VECTOR(normalize, vector_t) -} // namespace bench_op +} // namespace bench_op::vector + +// Macro for defining all vector benchmark types +#define ALGEBRA_PLUGINS_DEFINE_VECTOR_BENCH(PLUGIN) \ + using phi_f_t = \ + vector_unaryOP_bm; \ + using theta_f_t = \ + vector_unaryOP_bm; \ + using perp_f_t = \ + vector_unaryOP_bm; \ + using norm_f_t = \ + vector_unaryOP_bm; \ + using eta_f_t = \ + vector_unaryOP_bm; \ + \ + using add_f_t = \ + vector_binaryOP_bm; \ + using sub_f_t = \ + vector_binaryOP_bm; \ + using dot_f_t = \ + vector_binaryOP_bm; \ + using cross_f_t = \ + vector_binaryOP_bm; \ + using normlz_f_t = \ + vector_unaryOP_bm; \ + \ + using phi_d_t = \ + vector_unaryOP_bm; \ + using theta_d_t = \ + vector_unaryOP_bm; \ + using perp_d_t = \ + vector_unaryOP_bm; \ + using norm_d_t = \ + vector_unaryOP_bm; \ + using eta_d_t = \ + vector_unaryOP_bm; \ + \ + using add_d_t = \ + vector_binaryOP_bm; \ + using sub_d_t = \ + vector_binaryOP_bm; \ + using dot_d_t = \ + vector_binaryOP_bm; \ + using cross_d_t = \ + vector_binaryOP_bm; \ + using normlz_d_t = \ + vector_unaryOP_bm; // Macro for registering all vector benchmarks -#define ALGEBRA_PLUGINS_REGISTER_VECTOR_BENCH(CFG) \ - algebra::register_benchmark(CFG, "_single"); \ - algebra::register_benchmark(CFG, "_double"); \ - algebra::register_benchmark(CFG, "_single"); \ - algebra::register_benchmark(CFG, "_double"); \ - algebra::register_benchmark(CFG, "_single"); \ - algebra::register_benchmark(CFG, "_double"); \ - algebra::register_benchmark(CFG, "_single"); \ - algebra::register_benchmark(CFG, "_double"); \ - algebra::register_benchmark(CFG, "_single"); \ - algebra::register_benchmark(CFG, "_double"); \ - \ - algebra::register_benchmark(CFG, "_single"); \ - algebra::register_benchmark(CFG, "_double"); \ - algebra::register_benchmark(CFG, "_single"); \ - algebra::register_benchmark(CFG, "_double"); \ - algebra::register_benchmark(CFG, "_single"); \ - algebra::register_benchmark(CFG, "_double"); \ - algebra::register_benchmark(CFG, "_single"); \ - algebra::register_benchmark(CFG, "_double"); \ - algebra::register_benchmark(CFG, "_single"); \ - algebra::register_benchmark(CFG, "_double"); +#define ALGEBRA_PLUGINS_REGISTER_VECTOR_BENCH(CFGS, CFGD) \ + algebra::register_benchmark(CFGS, "_single"); \ + algebra::register_benchmark(CFGD, "_double"); \ + algebra::register_benchmark(CFGS, "_single"); \ + algebra::register_benchmark(CFGD, "_double"); \ + algebra::register_benchmark(CFGS, "_single"); \ + algebra::register_benchmark(CFGD, "_double"); \ + algebra::register_benchmark(CFGS, "_single"); \ + algebra::register_benchmark(CFGD, "_double"); \ + algebra::register_benchmark(CFGS, "_single"); \ + algebra::register_benchmark(CFGD, "_double"); \ + \ + algebra::register_benchmark(CFGS, "_single"); \ + algebra::register_benchmark(CFGD, "_double"); \ + algebra::register_benchmark(CFGS, "_single"); \ + algebra::register_benchmark(CFGD, "_double"); \ + algebra::register_benchmark(CFGS, "_single"); \ + algebra::register_benchmark(CFGD, "_double"); \ + algebra::register_benchmark(CFGS, "_single"); \ + algebra::register_benchmark(CFGD, "_double"); \ + algebra::register_benchmark(CFGS, "_single"); \ + algebra::register_benchmark(CFGD, "_double"); } // namespace algebra diff --git a/benchmarks/common/include/benchmark/common/register_benchmark.hpp b/benchmarks/algebra/include/algebra/common/register_benchmark.hpp similarity index 86% rename from benchmarks/common/include/benchmark/common/register_benchmark.hpp rename to benchmarks/algebra/include/algebra/common/register_benchmark.hpp index 4dd9c267..5e769e97 100644 --- a/benchmarks/common/include/benchmark/common/register_benchmark.hpp +++ b/benchmarks/algebra/include/algebra/common/register_benchmark.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2024 CERN for the benefit of the ACTS project + * (c) 2024-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,7 +8,7 @@ #pragma once // Project include(s) -#include "benchmark_base.hpp" +#include "algebra/common/benchmark_base.hpp" // Benchmark include #include diff --git a/benchmarks/eigen/include/benchmark/eigen/data_generator.hpp b/benchmarks/algebra/include/algebra/eigen/data_generator.hpp similarity index 96% rename from benchmarks/eigen/include/benchmark/eigen/data_generator.hpp rename to benchmarks/algebra/include/algebra/eigen/data_generator.hpp index 28f97ca1..0d44caa7 100644 --- a/benchmarks/eigen/include/benchmark/eigen/data_generator.hpp +++ b/benchmarks/algebra/include/algebra/eigen/data_generator.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/benchmarks/fastor/include/benchmark/fastor/data_generator.hpp b/benchmarks/algebra/include/algebra/fastor/data_generator.hpp similarity index 96% rename from benchmarks/fastor/include/benchmark/fastor/data_generator.hpp rename to benchmarks/algebra/include/algebra/fastor/data_generator.hpp index 09efea35..78e77ea4 100644 --- a/benchmarks/fastor/include/benchmark/fastor/data_generator.hpp +++ b/benchmarks/algebra/include/algebra/fastor/data_generator.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2025 CERN for the benefit of the ACTS project + * (c) 2025-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/benchmarks/vc_aos/include/benchmark/vc_aos/data_generator.hpp b/benchmarks/algebra/include/algebra/vc_aos/data_generator.hpp similarity index 97% rename from benchmarks/vc_aos/include/benchmark/vc_aos/data_generator.hpp rename to benchmarks/algebra/include/algebra/vc_aos/data_generator.hpp index def78aba..4baffca3 100644 --- a/benchmarks/vc_aos/include/benchmark/vc_aos/data_generator.hpp +++ b/benchmarks/algebra/include/algebra/vc_aos/data_generator.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2024 CERN for the benefit of the ACTS project + * (c) 2024-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/benchmarks/vc_soa/include/benchmark/vc_soa/data_generator.hpp b/benchmarks/algebra/include/algebra/vc_soa/data_generator.hpp similarity index 97% rename from benchmarks/vc_soa/include/benchmark/vc_soa/data_generator.hpp rename to benchmarks/algebra/include/algebra/vc_soa/data_generator.hpp index 48c6ea31..7c4950d1 100644 --- a/benchmarks/vc_soa/include/benchmark/vc_soa/data_generator.hpp +++ b/benchmarks/algebra/include/algebra/vc_soa/data_generator.hpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ diff --git a/benchmarks/array/array_getter.cpp b/benchmarks/algebra/src/benchmark_getter.cpp similarity index 70% rename from benchmarks/array/array_getter.cpp rename to benchmarks/algebra/src/benchmark_getter.cpp index 23875f8c..be1cac14 100644 --- a/benchmarks/array/array_getter.cpp +++ b/benchmarks/algebra/src/benchmark_getter.cpp @@ -1,14 +1,15 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023-2024 CERN for the benefit of the ACTS project + * (c) 2023-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ // Project include(s) -#include "algebra/array.hpp" -#include "benchmark/array/data_generator.hpp" -#include "benchmark/common/benchmark_getter.hpp" +// clang-format off +#include "algebra/common/benchmark_types.hpp" +#include "algebra/common/benchmark_getter.hpp" +// clang-format on // Benchmark include #include @@ -28,7 +29,8 @@ int main(int argc, char** argv) { cfg.n_samples(100000); std::cout << "-----------------------------------------------\n" - << "Algebra-Plugins 'getter' benchmark (std::array)\n" + << "Algebra-Plugins 'getter' benchmark (" + << algebra::benchmark::plugin_name << ")\n" << "-----------------------------------------------\n\n" << cfg; diff --git a/benchmarks/algebra/src/benchmark_matrix.cpp b/benchmarks/algebra/src/benchmark_matrix.cpp new file mode 100644 index 00000000..d89ca50c --- /dev/null +++ b/benchmarks/algebra/src/benchmark_matrix.cpp @@ -0,0 +1,57 @@ +/** Algebra plugins library, part of the ACTS project + * + * (c) 2024-2026 CERN for the benefit of the ACTS project + * + * Mozilla Public License Version 2.0 + */ + +// Project include(s) +// clang-format off +#include "algebra/common/benchmark_types.hpp" +#include "algebra/common/benchmark_matrix.hpp" +// clang-format on + +// Benchmark include +#include + +// System include(s) +#include + +using namespace algebra; + +/// Run vector benchmarks +int main(int argc, char** argv) { + + // + // Prepare benchmarks + // + algebra::benchmark_base::configuration cfg{}; + cfg.n_samples(100000); + + std::cout << "-----------------------------------------------\n" + << "Algebra-Plugins 'matrix' benchmark (" + << algebra::benchmark::plugin_name << ")\n" + << "-----------------------------------------------\n\n" + << cfg; + +// +// Define and register all benchmarks +// +#if ALGEBRA_BENCHMARK_ARRAY + ALGEBRA_PLUGINS_DEFINE_MATRIX_BENCH(array) +#elif ALGEBRA_BENCHMARK_EIGEN + ALGEBRA_PLUGINS_DEFINE_MATRIX_BENCH(eigen) +#elif ALGEBRA_BENCHMARK_FASTOR + ALGEBRA_PLUGINS_DEFINE_MATRIX_BENCH(fastor) +#elif ALGEBRA_BENCHMARK_SMATRIX + ALGEBRA_PLUGINS_DEFINE_MATRIX_BENCH(smatrix) +#elif ALGEBRA_BENCHMARK_VC_AOS + ALGEBRA_PLUGINS_DEFINE_MATRIX_BENCH(vc_aos) +#endif + + ALGEBRA_PLUGINS_REGISTER_MATRIX_BENCH(cfg, cfg) + + ::benchmark::Initialize(&argc, argv); + ::benchmark::RunSpecifiedBenchmarks(); + ::benchmark::Shutdown(); +} diff --git a/benchmarks/algebra/src/benchmark_transform3.cpp b/benchmarks/algebra/src/benchmark_transform3.cpp new file mode 100644 index 00000000..61f6751b --- /dev/null +++ b/benchmarks/algebra/src/benchmark_transform3.cpp @@ -0,0 +1,57 @@ +/** Algebra plugins library, part of the ACTS project + * + * (c) 2023-2026 CERN for the benefit of the ACTS project + * + * Mozilla Public License Version 2.0 + */ + +// Project include(s) +// clang-format off +#include "algebra/common/benchmark_types.hpp" +#include "algebra/common/benchmark_transform3.hpp" +// clang-format on + +// Benchmark include +#include + +// System include(s) +#include + +using namespace algebra; + +/// Run vector benchmarks +int main(int argc, char** argv) { + + // + // Prepare benchmarks + // + algebra::benchmark_base::configuration cfg{}; + cfg.n_samples(100000); + + std::cout << "---------------------------------------------------\n" + << "Algebra-Plugins 'transform3' benchmark (" + << algebra::benchmark::plugin_name << ")\n" + << "---------------------------------------------------\n\n" + << cfg; + +// +// Define and register all benchmarks +// +#if ALGEBRA_BENCHMARK_ARRAY + ALGEBRA_PLUGINS_DEFINE_TRANSFORM_BENCH(array) +#elif ALGEBRA_BENCHMARK_EIGEN + ALGEBRA_PLUGINS_DEFINE_TRANSFORM_BENCH(eigen) +#elif ALGEBRA_BENCHMARK_FASTOR + ALGEBRA_PLUGINS_DEFINE_TRANSFORM_BENCH(fastor) +#elif ALGEBRA_BENCHMARK_SMATRIX + ALGEBRA_PLUGINS_DEFINE_TRANSFORM_BENCH(smatrix) +#elif ALGEBRA_BENCHMARK_VC_AOS + ALGEBRA_PLUGINS_DEFINE_TRANSFORM_BENCH(vc_aos) +#endif + + ALGEBRA_PLUGINS_REGISTER_TRANSFORM_BENCH(cfg, cfg) + + ::benchmark::Initialize(&argc, argv); + ::benchmark::RunSpecifiedBenchmarks(); + ::benchmark::Shutdown(); +} diff --git a/benchmarks/algebra/src/benchmark_vector.cpp b/benchmarks/algebra/src/benchmark_vector.cpp new file mode 100644 index 00000000..ceb46179 --- /dev/null +++ b/benchmarks/algebra/src/benchmark_vector.cpp @@ -0,0 +1,57 @@ +/** Algebra plugins library, part of the ACTS project + * + * (c) 2023-2026 CERN for the benefit of the ACTS project + * + * Mozilla Public License Version 2.0 + */ + +// Project include(s) +// clang-format off +#include "algebra/common/benchmark_types.hpp" +#include "algebra/common/benchmark_vector.hpp" +// clang-format on + +// Benchmark include +#include + +// System include(s) +#include + +using namespace algebra; + +/// Run vector benchmarks +int main(int argc, char** argv) { + + // + // Prepare benchmarks + // + algebra::benchmark_base::configuration cfg{}; + cfg.n_samples(100000); + + std::cout << "-----------------------------------------------\n" + << "Algebra-Plugins 'vector' benchmark (" + << algebra::benchmark::plugin_name << ")\n" + << "-----------------------------------------------\n\n" + << cfg; + +// +// Define and register all benchmarks +// +#if ALGEBRA_BENCHMARK_ARRAY + ALGEBRA_PLUGINS_DEFINE_VECTOR_BENCH(array) +#elif ALGEBRA_BENCHMARK_EIGEN + ALGEBRA_PLUGINS_DEFINE_VECTOR_BENCH(eigen) +#elif ALGEBRA_BENCHMARK_FASTOR + ALGEBRA_PLUGINS_DEFINE_VECTOR_BENCH(fastor) +#elif ALGEBRA_BENCHMARK_SMATRIX + ALGEBRA_PLUGINS_DEFINE_VECTOR_BENCH(smatrix) +#elif ALGEBRA_BENCHMARK_VC_AOS + ALGEBRA_PLUGINS_DEFINE_VECTOR_BENCH(vc_aos) +#endif + + ALGEBRA_PLUGINS_REGISTER_VECTOR_BENCH(cfg, cfg) + + ::benchmark::Initialize(&argc, argv); + ::benchmark::RunSpecifiedBenchmarks(); + ::benchmark::Shutdown(); +} diff --git a/benchmarks/vc_soa/vc_soa_getter.cpp b/benchmarks/algebra/src/vc_soa/vc_soa_getter.cpp similarity index 83% rename from benchmarks/vc_soa/vc_soa_getter.cpp rename to benchmarks/algebra/src/vc_soa/vc_soa_getter.cpp index 0b5a1105..03f60426 100644 --- a/benchmarks/vc_soa/vc_soa_getter.cpp +++ b/benchmarks/algebra/src/vc_soa/vc_soa_getter.cpp @@ -1,15 +1,17 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023-2024 CERN for the benefit of the ACTS project + * (c) 2023-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ // Project include(s) +// clang-format off #include "algebra/vc_soa.hpp" -#include "benchmark/common/benchmark_getter.hpp" -#include "benchmark/common/register_benchmark.hpp" -#include "benchmark/vc_soa/data_generator.hpp" +#include "algebra/common/benchmark_getter.hpp" +// clang-format on +#include "algebra/common/register_benchmark.hpp" +#include "algebra/vc_soa/data_generator.hpp" // Benchmark include #include diff --git a/benchmarks/algebra/src/vc_soa/vc_soa_matrix.cpp b/benchmarks/algebra/src/vc_soa/vc_soa_matrix.cpp new file mode 100644 index 00000000..95aec485 --- /dev/null +++ b/benchmarks/algebra/src/vc_soa/vc_soa_matrix.cpp @@ -0,0 +1,134 @@ +/** Algebra plugins library, part of the ACTS project + * + * (c) 2024-2026 CERN for the benefit of the ACTS project + * + * Mozilla Public License Version 2.0 + */ + +// Project include(s) +// clang-format off +#include "algebra/vc_soa.hpp" +#include "algebra/common/benchmark_matrix.hpp" +// clang-format on +#include "algebra/common/register_benchmark.hpp" +#include "algebra/vc_soa/data_generator.hpp" + +// Benchmark include +#include + +// System include(s) +#include + +using namespace algebra; + +/// Run vector benchmarks +int main(int argc, char** argv) { + + constexpr std::size_t n_samples{100000}; + + // + // Prepare benchmarks + // + algebra::benchmark_base::configuration cfg_s{}; + // Reduce the number of samples, since a single SoA struct contains multiple + // vectors + cfg_s.n_samples(n_samples / Vc::float_v::Size); + + // For double precision we need more samples (less vectors per SoA) + algebra::benchmark_base::configuration cfg_d{cfg_s}; + cfg_d.n_samples(n_samples / Vc::double_v::Size); + + using mat44_transp_f_t = matrix_unaryOP_bm, + bench_op::matrix::transpose>; + using mat44_transp_d_t = matrix_unaryOP_bm, + bench_op::matrix::transpose>; + using mat66_transp_f_t = matrix_unaryOP_bm, + bench_op::matrix::transpose>; + using mat66_transp_d_t = matrix_unaryOP_bm, + bench_op::matrix::transpose>; + using mat88_transp_f_t = matrix_unaryOP_bm, + bench_op::matrix::transpose>; + using mat88_transp_d_t = matrix_unaryOP_bm, + bench_op::matrix::transpose>; + + using mat44_add_f_t = matrix_binaryOP_bm, + bench_op::matrix::add>; + using mat44_add_d_t = matrix_binaryOP_bm, + bench_op::matrix::add>; + using mat66_add_f_t = matrix_binaryOP_bm, + bench_op::matrix::add>; + using mat66_add_d_t = matrix_binaryOP_bm, + bench_op::matrix::add>; + using mat88_add_f_t = matrix_binaryOP_bm, + bench_op::matrix::add>; + using mat88_add_d_t = matrix_binaryOP_bm, + bench_op::matrix::add>; + + using mat44_mul_f_t = matrix_binaryOP_bm, + bench_op::matrix::mul>; + using mat44_mul_d_t = matrix_binaryOP_bm, + bench_op::matrix::mul>; + using mat66_mul_f_t = matrix_binaryOP_bm, + bench_op::matrix::mul>; + using mat66_mul_d_t = matrix_binaryOP_bm, + bench_op::matrix::mul>; + using mat88_mul_f_t = matrix_binaryOP_bm, + bench_op::matrix::mul>; + using mat88_mul_d_t = matrix_binaryOP_bm, + bench_op::matrix::mul>; + + using mat44_vec_f_t = matrix_vector_bm, + vc_soa::vector_type>; + using mat44_vec_d_t = matrix_vector_bm, + vc_soa::vector_type>; + using mat66_vec_f_t = matrix_vector_bm, + vc_soa::vector_type>; + using mat66_vec_d_t = matrix_vector_bm, + vc_soa::vector_type>; + using mat88_vec_f_t = matrix_vector_bm, + vc_soa::vector_type>; + using mat88_vec_d_t = matrix_vector_bm, + vc_soa::vector_type>; + + std::cout << "-------------------------------------------\n" + << "Algebra-Plugins 'matrix' benchmark (Vc SoA)\n" + << "-------------------------------------------\n\n" + << "(single)\n" + << cfg_s << "(double)\n" + << cfg_d; + + // + // Register all benchmarks + // + algebra::register_benchmark(cfg_s, "_4x4_single"); + algebra::register_benchmark(cfg_d, "_4x4_double"); + algebra::register_benchmark(cfg_s, "_6x6_single"); + algebra::register_benchmark(cfg_d, "_6x6_double"); + algebra::register_benchmark(cfg_s, "_8x8_single"); + algebra::register_benchmark(cfg_d, "_8x8_double"); + + algebra::register_benchmark(cfg_s, "_4x4_single"); + algebra::register_benchmark(cfg_d, "_4x4_double"); + algebra::register_benchmark(cfg_s, "_6x6_single"); + algebra::register_benchmark(cfg_d, "_6x6_double"); + algebra::register_benchmark(cfg_s, "_8x8_single"); + algebra::register_benchmark(cfg_d, "_8x8_double"); + + algebra::register_benchmark(cfg_s, "_4x4_single"); + algebra::register_benchmark(cfg_d, "_4x4_double"); + algebra::register_benchmark(cfg_s, "_6x6_single"); + algebra::register_benchmark(cfg_d, "_6x6_double"); + algebra::register_benchmark(cfg_s, "_8x8_single"); + algebra::register_benchmark(cfg_d, "_8x8_double"); + + algebra::register_benchmark(cfg_s, "_4x4_single"); + algebra::register_benchmark(cfg_d, "_4x4_double"); + algebra::register_benchmark(cfg_s, "_6x6_single"); + algebra::register_benchmark(cfg_d, "_6x6_double"); + algebra::register_benchmark(cfg_s, "_8x8_single"); + algebra::register_benchmark(cfg_d, "_8x8_double"); + + ::benchmark::Initialize(&argc, argv); + ::benchmark::RunSpecifiedBenchmarks(); + ::benchmark::Shutdown(); +} diff --git a/benchmarks/vc_soa/vc_soa_transform3.cpp b/benchmarks/algebra/src/vc_soa/vc_soa_transform3.cpp similarity index 81% rename from benchmarks/vc_soa/vc_soa_transform3.cpp rename to benchmarks/algebra/src/vc_soa/vc_soa_transform3.cpp index 480a7c7e..83517a9a 100644 --- a/benchmarks/vc_soa/vc_soa_transform3.cpp +++ b/benchmarks/algebra/src/vc_soa/vc_soa_transform3.cpp @@ -1,15 +1,17 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023-2024 CERN for the benefit of the ACTS project + * (c) 2023-2026 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ // Project include(s) +// clang-format off #include "algebra/vc_soa.hpp" -#include "benchmark/common/benchmark_transform3.hpp" -#include "benchmark/common/register_benchmark.hpp" -#include "benchmark/vc_soa/data_generator.hpp" +#include "algebra/common/benchmark_transform3.hpp" +// clang-format on +#include "algebra/common/register_benchmark.hpp" +#include "algebra/vc_soa/data_generator.hpp" // Benchmark include #include @@ -39,7 +41,7 @@ int main(int argc, char** argv) { using trf_f_t = transform3_bm>; using trf_d_t = transform3_bm>; - std::cout << "-------------------------------------------\n" + std::cout << "-----------------------------------------------\n" << "Algebra-Plugins 'transform3' benchmark (Vc SoA)\n" << "-----------------------------------------------\n\n" << "(single)\n" diff --git a/benchmarks/algebra/src/vc_soa/vc_soa_vector.cpp b/benchmarks/algebra/src/vc_soa/vc_soa_vector.cpp new file mode 100644 index 00000000..e2b4cc85 --- /dev/null +++ b/benchmarks/algebra/src/vc_soa/vc_soa_vector.cpp @@ -0,0 +1,57 @@ +/** Algebra plugins library, part of the ACTS project + * + * (c) 2023-2026 CERN for the benefit of the ACTS project + * + * Mozilla Public License Version 2.0 + */ + +// Project include(s) +// clang-format off +#include "algebra/vc_soa.hpp" +#include "algebra/common/benchmark_vector.hpp" +// clang-format on +#include "algebra/common/register_benchmark.hpp" +#include "algebra/vc_soa/data_generator.hpp" + +// Benchmark include +#include + +// System include(s) +#include + +using namespace algebra; + +/// Run vector benchmarks +int main(int argc, char** argv) { + + constexpr std::size_t n_samples{100000}; + + // + // Prepare benchmarks + // + algebra::benchmark_base::configuration cfg_s{}; + // Reduce the number of samples, since a single SoA struct contains multiple + // vectors + cfg_s.n_samples(n_samples / Vc::float_v::Size); + + // For double precision we need more samples (less vectors per SoA) + algebra::benchmark_base::configuration cfg_d{cfg_s}; + cfg_d.n_samples(n_samples / Vc::double_v::Size); + + std::cout << "-------------------------------------------\n" + << "Algebra-Plugins 'vector' benchmark (Vc SoA)\n" + << "-------------------------------------------\n\n" + << "(single)\n" + << cfg_s << "(double)\n" + << cfg_d; + + // + // Define and register all benchmarks + // + ALGEBRA_PLUGINS_DEFINE_VECTOR_BENCH(vc_soa) + ALGEBRA_PLUGINS_REGISTER_VECTOR_BENCH(cfg_s, cfg_d) + + ::benchmark::Initialize(&argc, argv); + ::benchmark::RunSpecifiedBenchmarks(); + ::benchmark::Shutdown(); +} diff --git a/benchmarks/array/array_matrix.cpp b/benchmarks/array/array_matrix.cpp deleted file mode 100644 index 21d9908c..00000000 --- a/benchmarks/array/array_matrix.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2024 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -// Project include(s) -#include "algebra/array.hpp" -#include "benchmark/array/data_generator.hpp" -#include "benchmark/common/benchmark_matrix.hpp" - -// Benchmark include -#include - -// System include(s) -#include - -using namespace algebra; - -/// Run vector benchmarks -int main(int argc, char** argv) { - - // - // Prepare benchmarks - // - algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(100000); - - using mat44_transp_f_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat44_transp_d_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat66_transp_f_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat66_transp_d_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat88_transp_f_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat88_transp_d_t = - matrix_unaryOP_bm, bench_op::transpose>; - - using mat44_inv_f_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat44_inv_d_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat66_inv_f_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat66_inv_d_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat88_inv_f_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat88_inv_d_t = - matrix_unaryOP_bm, bench_op::invert>; - - using mat44_det_f_t = - matrix_unaryOP_bm, bench_op::determinant>; - using mat44_det_d_t = matrix_unaryOP_bm, - bench_op::determinant>; - using mat66_det_f_t = - matrix_unaryOP_bm, bench_op::determinant>; - using mat66_det_d_t = matrix_unaryOP_bm, - bench_op::determinant>; - using mat88_det_f_t = - matrix_unaryOP_bm, bench_op::determinant>; - using mat88_det_d_t = matrix_unaryOP_bm, - bench_op::determinant>; - - using mat44_add_f_t = - matrix_binaryOP_bm, bench_op::add>; - using mat44_add_d_t = - matrix_binaryOP_bm, bench_op::add>; - using mat66_add_f_t = - matrix_binaryOP_bm, bench_op::add>; - using mat66_add_d_t = - matrix_binaryOP_bm, bench_op::add>; - using mat88_add_f_t = - matrix_binaryOP_bm, bench_op::add>; - using mat88_add_d_t = - matrix_binaryOP_bm, bench_op::add>; - - using mat44_mul_f_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat44_mul_d_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat66_mul_f_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat66_mul_d_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat88_mul_f_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat88_mul_d_t = - matrix_binaryOP_bm, bench_op::mul>; - - using mat44_vec_f_t = matrix_vector_bm, - array::vector_type>; - using mat44_vec_d_t = matrix_vector_bm, - array::vector_type>; - using mat66_vec_f_t = matrix_vector_bm, - array::vector_type>; - using mat66_vec_d_t = matrix_vector_bm, - array::vector_type>; - using mat88_vec_f_t = matrix_vector_bm, - array::vector_type>; - using mat88_vec_d_t = matrix_vector_bm, - array::vector_type>; - - std::cout << "-----------------------------------------------\n" - << "Algebra-Plugins 'matrix' benchmark (std::array)\n" - << "-----------------------------------------------\n\n" - << cfg; - - // - // Register all benchmarks - // - ALGEBRA_PLUGINS_REGISTER_MATRIX_BENCH(cfg) - - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - ::benchmark::Shutdown(); -} diff --git a/benchmarks/array/array_transform3.cpp b/benchmarks/array/array_transform3.cpp deleted file mode 100644 index 4c9d0390..00000000 --- a/benchmarks/array/array_transform3.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2023-2024 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -// Project include(s) -#include "algebra/array.hpp" -#include "benchmark/array/data_generator.hpp" -#include "benchmark/common/benchmark_transform3.hpp" -#include "benchmark/common/register_benchmark.hpp" - -// Benchmark include -#include - -// System include(s) -#include - -using namespace algebra; - -/// Run vector benchmarks -int main(int argc, char** argv) { - - // - // Prepare benchmarks - // - algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(100000); - - using trf_f_t = transform3_bm>; - using trf_d_t = transform3_bm>; - - std::cout << "---------------------------------------------------\n" - << "Algebra-Plugins 'transform3' benchmark (std::array)\n" - << "---------------------------------------------------\n\n" - << cfg; - - // - // Register all benchmarks - // - algebra::register_benchmark(cfg, "_single"); - algebra::register_benchmark(cfg, "_double"); - - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - ::benchmark::Shutdown(); -} diff --git a/benchmarks/array/array_vector.cpp b/benchmarks/array/array_vector.cpp deleted file mode 100644 index 47be948a..00000000 --- a/benchmarks/array/array_vector.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2023-2024 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -// Project include(s) -#include "algebra/array.hpp" -#include "benchmark/array/data_generator.hpp" -#include "benchmark/common/benchmark_vector.hpp" - -// Benchmark include -#include - -// System include(s) -#include - -using namespace algebra; - -/// Run vector benchmarks -int main(int argc, char** argv) { - - // - // Prepare benchmarks - // - algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(100000); - - using phi_f_t = vector_unaryOP_bm; - using theta_f_t = vector_unaryOP_bm; - using perp_f_t = vector_unaryOP_bm; - using norm_f_t = vector_unaryOP_bm; - using eta_f_t = vector_unaryOP_bm; - - using add_f_t = vector_binaryOP_bm; - using sub_f_t = vector_binaryOP_bm; - using dot_f_t = vector_binaryOP_bm; - using cross_f_t = vector_binaryOP_bm; - using normlz_f_t = - vector_unaryOP_bm; - - using phi_d_t = vector_unaryOP_bm; - using theta_d_t = vector_unaryOP_bm; - using perp_d_t = vector_unaryOP_bm; - using norm_d_t = vector_unaryOP_bm; - using eta_d_t = vector_unaryOP_bm; - - using add_d_t = vector_binaryOP_bm; - using sub_d_t = vector_binaryOP_bm; - using dot_d_t = vector_binaryOP_bm; - using cross_d_t = vector_binaryOP_bm; - using normlz_d_t = - vector_unaryOP_bm; - - std::cout << "-----------------------------------------------\n" - << "Algebra-Plugins 'vector' benchmark (std::array)\n" - << "-----------------------------------------------\n\n" - << cfg; - - // - // Register all benchmarks - // - ALGEBRA_PLUGINS_REGISTER_VECTOR_BENCH(cfg) - - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - ::benchmark::Shutdown(); -} diff --git a/benchmarks/common/include/benchmark/common/benchmark_matrix.hpp b/benchmarks/common/include/benchmark/common/benchmark_matrix.hpp deleted file mode 100644 index 5bc6ba1c..00000000 --- a/benchmarks/common/include/benchmark/common/benchmark_matrix.hpp +++ /dev/null @@ -1,256 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2024 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -#pragma once - -// Project include(s) -#include "benchmark_base.hpp" -#include "register_benchmark.hpp" - -// System include(s) -#include -#include - -namespace algebra { - -template -void fill_random_matrix(std::vector&); - -template -void fill_random_vec(std::vector&); - -/// Benchmark for matrix operations -template -struct matrix_bm : public benchmark_base { - - /// Prefix for the benchmark name - static constexpr std::string_view name{"matrix"}; - - std::vector a; - std::vector b; - - /// No default construction: Cannot prepare data - matrix_bm() = delete; - - /// Construct from an externally provided configuration @param cfg - explicit matrix_bm(benchmark_base::configuration cfg) : benchmark_base{cfg} { - - const std::size_t n_data{this->m_cfg.n_samples()}; - - a.reserve(n_data); - b.reserve(n_data); - - fill_random_matrix(a); - fill_random_matrix(b); - } - - matrix_bm(const matrix_bm& bm) = default; - matrix_bm& operator=(matrix_bm& other) = default; - - /// Clear state - ~matrix_bm() override { - a.clear(); - b.clear(); - } -}; - -/// Benchmark operations on a single matrix (transpose, inverse etc) -template - requires std::invocable -struct matrix_unaryOP_bm : public matrix_bm { - using base_type = matrix_bm; - - matrix_unaryOP_bm() = delete; - explicit matrix_unaryOP_bm(benchmark_base::configuration cfg) - : base_type{cfg} {} - matrix_unaryOP_bm(const matrix_unaryOP_bm& bm) = default; - matrix_unaryOP_bm& operator=(matrix_unaryOP_bm& other) = default; - - constexpr std::string name() const override { - return std::string{base_type::name} + "_" + std::string{unaryOP::name}; - } - - inline void operator()(::benchmark::State& state) const override { - - using result_t = std::invoke_result_t; - - const std::size_t n_samples{this->m_cfg.n_samples()}; - - // Run the benchmark - for (auto _ : state) { - for (std::size_t i{0}; i < n_samples; ++i) { - result_t result = unaryOP{}(this->a[i]); - ::benchmark::DoNotOptimize(result); - } - } - } -}; - -/// Benchmark elementwise addition/subtraction/multiplication of matrices -template - requires std::invocable -struct matrix_binaryOP_bm : public matrix_bm { - using base_type = matrix_bm; - - matrix_binaryOP_bm() = delete; - explicit matrix_binaryOP_bm(benchmark_base::configuration cfg) - : base_type{cfg} {} - matrix_binaryOP_bm(const matrix_binaryOP_bm& bm) = default; - matrix_binaryOP_bm& operator=(matrix_binaryOP_bm& other) = default; - - constexpr std::string name() const override { - return std::string{base_type::name} + "_" + std::string{binaryOP::name}; - } - - inline void operator()(::benchmark::State& state) const override { - - using result_t = std::invoke_result_t; - - const std::size_t n_samples{this->m_cfg.n_samples()}; - - // Run the benchmark - for (auto _ : state) { - for (std::size_t i{0}; i < n_samples; ++i) { - result_t result = binaryOP{}(this->a[i], this->b[i]); - ::benchmark::DoNotOptimize(result); - } - } - } -}; - -/// Benchmark matrix vector multiplication -template -struct matrix_vector_bm : public matrix_bm { - using base_type = matrix_bm; - - std::vector v; - - matrix_vector_bm() = delete; - explicit matrix_vector_bm(benchmark_base::configuration cfg) - : base_type{cfg} { - - v.reserve(this->m_cfg.n_samples()); - - fill_random_vec(v); - } - matrix_vector_bm(const matrix_vector_bm& bm) = default; - matrix_vector_bm& operator=(matrix_vector_bm& other) = default; - - /// Clear state - ~matrix_vector_bm() override { v.clear(); } - - constexpr std::string name() const override { - return std::string{base_type::name} + "_vector"; - } - - inline void operator()(::benchmark::State& state) const override { - - const std::size_t n_samples{this->m_cfg.n_samples()}; - - // Run the benchmark - for (auto _ : state) { - for (std::size_t i{0}; i < n_samples; ++i) { - vector_t result = this->a[i] * this->v[i]; - ::benchmark::DoNotOptimize(result); - } - } - } -}; - -// Functions to be benchmarked -namespace bench_op { - -struct add { - static constexpr std::string_view name{"add"}; - template - constexpr matrix_t operator()(const matrix_t& a, const matrix_t& b) const { - return a + b; - } -}; -struct sub { - static constexpr std::string_view name{"sub"}; - template - constexpr matrix_t operator()(const matrix_t& a, const matrix_t& b) const { - return a - b; - } -}; -struct mul { - static constexpr std::string_view name{"mul"}; - template - constexpr matrix_t operator()(const matrix_t& a, const matrix_t& b) const { - return a * b; - } -}; -struct transpose { - static constexpr std::string_view name{"transpose"}; - template - constexpr auto operator()(const matrix_t& a) const { - return algebra::matrix::transpose(a); - } -}; -struct determinant { - static constexpr std::string_view name{"determinant"}; - template - constexpr auto operator()(const matrix_t& a) const { - return algebra::matrix::determinant(a); - } -}; -struct invert { - static constexpr std::string_view name{"invert"}; - template - constexpr auto operator()(const matrix_t& a) const { - return algebra::matrix::inverse(a); - } -}; - -} // namespace bench_op - -// Macro for registering all vector benchmarks -#define ALGEBRA_PLUGINS_REGISTER_MATRIX_BENCH(CFG) \ - algebra::register_benchmark(CFG, "_4x4_single"); \ - algebra::register_benchmark(CFG, "_4x4_double"); \ - algebra::register_benchmark(CFG, "_6x6_single"); \ - algebra::register_benchmark(CFG, "_6x6_double"); \ - algebra::register_benchmark(CFG, "_8x8_single"); \ - algebra::register_benchmark(CFG, "_8x8_double"); \ - \ - algebra::register_benchmark(CFG, "_4x4_single"); \ - algebra::register_benchmark(CFG, "_4x4_double"); \ - algebra::register_benchmark(CFG, "_6x6_single"); \ - algebra::register_benchmark(CFG, "_6x6_double"); \ - algebra::register_benchmark(CFG, "_8x8_single"); \ - algebra::register_benchmark(CFG, "_8x8_double"); \ - \ - algebra::register_benchmark(CFG, "_4x4_single"); \ - algebra::register_benchmark(CFG, "_4x4_double"); \ - algebra::register_benchmark(CFG, "_6x6_single"); \ - algebra::register_benchmark(CFG, "_6x6_double"); \ - algebra::register_benchmark(CFG, "_8x8_single"); \ - algebra::register_benchmark(CFG, "_8x8_double"); \ - \ - algebra::register_benchmark(CFG, "_4x4_single"); \ - algebra::register_benchmark(CFG, "_4x4_double"); \ - algebra::register_benchmark(CFG, "_6x6_single"); \ - algebra::register_benchmark(CFG, "_6x6_double"); \ - algebra::register_benchmark(CFG, "_8x8_single"); \ - algebra::register_benchmark(CFG, "_8x8_double"); \ - \ - algebra::register_benchmark(CFG, "_4x4_single"); \ - algebra::register_benchmark(CFG, "_4x4_double"); \ - algebra::register_benchmark(CFG, "_6x6_single"); \ - algebra::register_benchmark(CFG, "_6x6_double"); \ - algebra::register_benchmark(CFG, "_8x8_single"); \ - algebra::register_benchmark(CFG, "_8x8_double"); \ - \ - algebra::register_benchmark(CFG, "_4x4_single"); \ - algebra::register_benchmark(CFG, "_4x4_double"); \ - algebra::register_benchmark(CFG, "_6x6_single"); \ - algebra::register_benchmark(CFG, "_6x6_double"); \ - algebra::register_benchmark(CFG, "_8x8_single"); \ - algebra::register_benchmark(CFG, "_8x8_double"); - -} // namespace algebra diff --git a/benchmarks/eigen/eigen_getter.cpp b/benchmarks/eigen/eigen_getter.cpp deleted file mode 100644 index 806b8cbb..00000000 --- a/benchmarks/eigen/eigen_getter.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2023-2024 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -// Project include(s) -#include "algebra/eigen.hpp" -#include "benchmark/common/benchmark_getter.hpp" -#include "benchmark/eigen/data_generator.hpp" - -// Benchmark include -#include - -// System include(s) -#include - -using namespace algebra; - -/// Run vector benchmarks -int main(int argc, char** argv) { - - // - // Prepare benchmarks - // - algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(100000); - - std::cout << "------------------------------------------\n" - << "Algebra-Plugins 'getter' benchmark (Eigen)\n" - << "------------------------------------------\n\n" - << cfg; - - // - // Register all benchmarks - // - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - ::benchmark::Shutdown(); -} diff --git a/benchmarks/eigen/eigen_matrix.cpp b/benchmarks/eigen/eigen_matrix.cpp deleted file mode 100644 index 7b97edc8..00000000 --- a/benchmarks/eigen/eigen_matrix.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2024 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -// Project include(s) -#include "algebra/eigen.hpp" -#include "benchmark/common/benchmark_matrix.hpp" -#include "benchmark/eigen/data_generator.hpp" - -// Benchmark include -#include - -// System include(s) -#include - -using namespace algebra; - -/// Run vector benchmarks -int main(int argc, char** argv) { - - // - // Prepare benchmarks - // - algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(100000); - - using mat44_transp_f_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat44_transp_d_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat66_transp_f_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat66_transp_d_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat88_transp_f_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat88_transp_d_t = - matrix_unaryOP_bm, bench_op::transpose>; - - using mat44_inv_f_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat44_inv_d_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat66_inv_f_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat66_inv_d_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat88_inv_f_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat88_inv_d_t = - matrix_unaryOP_bm, bench_op::invert>; - - using mat44_det_f_t = - matrix_unaryOP_bm, bench_op::determinant>; - using mat44_det_d_t = matrix_unaryOP_bm, - bench_op::determinant>; - using mat66_det_f_t = - matrix_unaryOP_bm, bench_op::determinant>; - using mat66_det_d_t = matrix_unaryOP_bm, - bench_op::determinant>; - using mat88_det_f_t = - matrix_unaryOP_bm, bench_op::determinant>; - using mat88_det_d_t = matrix_unaryOP_bm, - bench_op::determinant>; - - using mat44_add_f_t = - matrix_binaryOP_bm, bench_op::add>; - using mat44_add_d_t = - matrix_binaryOP_bm, bench_op::add>; - using mat66_add_f_t = - matrix_binaryOP_bm, bench_op::add>; - using mat66_add_d_t = - matrix_binaryOP_bm, bench_op::add>; - using mat88_add_f_t = - matrix_binaryOP_bm, bench_op::add>; - using mat88_add_d_t = - matrix_binaryOP_bm, bench_op::add>; - - using mat44_mul_f_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat44_mul_d_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat66_mul_f_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat66_mul_d_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat88_mul_f_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat88_mul_d_t = - matrix_binaryOP_bm, bench_op::mul>; - - using mat44_vec_f_t = matrix_vector_bm, - eigen::vector_type>; - using mat44_vec_d_t = matrix_vector_bm, - eigen::vector_type>; - using mat66_vec_f_t = matrix_vector_bm, - eigen::vector_type>; - using mat66_vec_d_t = matrix_vector_bm, - eigen::vector_type>; - using mat88_vec_f_t = matrix_vector_bm, - eigen::vector_type>; - using mat88_vec_d_t = matrix_vector_bm, - eigen::vector_type>; - - std::cout << "------------------------------------------\n" - << "Algebra-Plugins 'matrix' benchmark (Eigen)\n" - << "------------------------------------------\n\n" - << cfg; - - // - // Register all benchmarks - // - ALGEBRA_PLUGINS_REGISTER_MATRIX_BENCH(cfg) - - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - ::benchmark::Shutdown(); -} diff --git a/benchmarks/eigen/eigen_transform3.cpp b/benchmarks/eigen/eigen_transform3.cpp deleted file mode 100644 index 2be6eb8f..00000000 --- a/benchmarks/eigen/eigen_transform3.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2023-2024 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -// Project include(s) -#include "algebra/eigen.hpp" -#include "benchmark/common/benchmark_transform3.hpp" -#include "benchmark/common/register_benchmark.hpp" -#include "benchmark/eigen/data_generator.hpp" - -// Benchmark include -#include - -// System include(s) -#include - -using namespace algebra; - -/// Run vector benchmarks -int main(int argc, char** argv) { - - // - // Prepare benchmarks - // - algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(100000); - - using trf_f_t = transform3_bm>; - using trf_d_t = transform3_bm>; - - std::cout << "----------------------------------------------\n" - << "Algebra-Plugins 'transform3' benchmark (Eigen)\n" - << "----------------------------------------------\n\n" - << cfg; - - // - // Register all benchmarks - // - algebra::register_benchmark(cfg, "_single"); - algebra::register_benchmark(cfg, "_double"); - - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - ::benchmark::Shutdown(); -} diff --git a/benchmarks/eigen/eigen_vector.cpp b/benchmarks/eigen/eigen_vector.cpp deleted file mode 100644 index 5eb2844f..00000000 --- a/benchmarks/eigen/eigen_vector.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2023-2024 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -// Project include(s) -#include "algebra/eigen.hpp" -#include "benchmark/common/benchmark_vector.hpp" -#include "benchmark/eigen/data_generator.hpp" - -// Benchmark include -#include - -// System include(s) -#include - -using namespace algebra; - -/// Run vector benchmarks -int main(int argc, char** argv) { - - // - // Prepare benchmarks - // - algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(100000); - - using phi_f_t = vector_unaryOP_bm; - using theta_f_t = vector_unaryOP_bm; - using perp_f_t = vector_unaryOP_bm; - using norm_f_t = vector_unaryOP_bm; - using eta_f_t = vector_unaryOP_bm; - - using add_f_t = vector_binaryOP_bm; - using sub_f_t = vector_binaryOP_bm; - using dot_f_t = vector_binaryOP_bm; - using cross_f_t = vector_binaryOP_bm; - using normlz_f_t = - vector_unaryOP_bm; - - using phi_d_t = vector_unaryOP_bm; - using theta_d_t = vector_unaryOP_bm; - using perp_d_t = vector_unaryOP_bm; - using norm_d_t = vector_unaryOP_bm; - using eta_d_t = vector_unaryOP_bm; - - using add_d_t = vector_binaryOP_bm; - using sub_d_t = vector_binaryOP_bm; - using dot_d_t = vector_binaryOP_bm; - using cross_d_t = vector_binaryOP_bm; - using normlz_d_t = - vector_unaryOP_bm; - - std::cout << "------------------------------------------\n" - << "Algebra-Plugins 'vector' benchmark (Eigen)\n" - << "------------------------------------------\n\n" - << cfg; - - // - // Register all benchmarks - // - ALGEBRA_PLUGINS_REGISTER_VECTOR_BENCH(cfg) - - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - ::benchmark::Shutdown(); -} diff --git a/benchmarks/fastor/fastor_getter.cpp b/benchmarks/fastor/fastor_getter.cpp deleted file mode 100644 index f2266688..00000000 --- a/benchmarks/fastor/fastor_getter.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2025 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -// Project include(s) -#include "algebra/fastor.hpp" -#include "benchmark/common/benchmark_getter.hpp" -#include "benchmark/fastor/data_generator.hpp" - -// Benchmark include -#include - -// System include(s) -#include - -using namespace algebra; - -/// Run vector benchmarks -int main(int argc, char** argv) { - - // - // Prepare benchmarks - // - algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(100000); - - std::cout << "------------------------------------------\n" - << "Algebra-Plugins 'getter' benchmark (Fastor)\n" - << "------------------------------------------\n\n" - << cfg; - - // - // Register all benchmarks - // - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - ::benchmark::Shutdown(); -} diff --git a/benchmarks/fastor/fastor_matrix.cpp b/benchmarks/fastor/fastor_matrix.cpp deleted file mode 100644 index 878b769e..00000000 --- a/benchmarks/fastor/fastor_matrix.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2024 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -// Project include(s) -#include "algebra/fastor.hpp" -#include "benchmark/common/benchmark_matrix.hpp" -#include "benchmark/fastor/data_generator.hpp" - -// Benchmark include -#include - -// System include(s) -#include - -using namespace algebra; - -/// Run vector benchmarks -int main(int argc, char** argv) { - - // - // Prepare benchmarks - // - algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(100000); - - using mat44_transp_f_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat44_transp_d_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat66_transp_f_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat66_transp_d_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat88_transp_f_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat88_transp_d_t = - matrix_unaryOP_bm, bench_op::transpose>; - - using mat44_inv_f_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat44_inv_d_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat66_inv_f_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat66_inv_d_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat88_inv_f_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat88_inv_d_t = - matrix_unaryOP_bm, bench_op::invert>; - - using mat44_det_f_t = matrix_unaryOP_bm, - bench_op::determinant>; - using mat44_det_d_t = matrix_unaryOP_bm, - bench_op::determinant>; - using mat66_det_f_t = matrix_unaryOP_bm, - bench_op::determinant>; - using mat66_det_d_t = matrix_unaryOP_bm, - bench_op::determinant>; - using mat88_det_f_t = matrix_unaryOP_bm, - bench_op::determinant>; - using mat88_det_d_t = matrix_unaryOP_bm, - bench_op::determinant>; - - using mat44_add_f_t = - matrix_binaryOP_bm, bench_op::add>; - using mat44_add_d_t = - matrix_binaryOP_bm, bench_op::add>; - using mat66_add_f_t = - matrix_binaryOP_bm, bench_op::add>; - using mat66_add_d_t = - matrix_binaryOP_bm, bench_op::add>; - using mat88_add_f_t = - matrix_binaryOP_bm, bench_op::add>; - using mat88_add_d_t = - matrix_binaryOP_bm, bench_op::add>; - - using mat44_mul_f_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat44_mul_d_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat66_mul_f_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat66_mul_d_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat88_mul_f_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat88_mul_d_t = - matrix_binaryOP_bm, bench_op::mul>; - - using mat44_vec_f_t = matrix_vector_bm, - fastor::vector_type>; - using mat44_vec_d_t = matrix_vector_bm, - fastor::vector_type>; - using mat66_vec_f_t = matrix_vector_bm, - fastor::vector_type>; - using mat66_vec_d_t = matrix_vector_bm, - fastor::vector_type>; - using mat88_vec_f_t = matrix_vector_bm, - fastor::vector_type>; - using mat88_vec_d_t = matrix_vector_bm, - fastor::vector_type>; - - std::cout << "------------------------------------------\n" - << "Algebra-Plugins 'matrix' benchmark (Fastor)\n" - << "-------------------------------------------\n\n" - << cfg; - - // - // Register all benchmarks - // - ALGEBRA_PLUGINS_REGISTER_MATRIX_BENCH(cfg) - - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - ::benchmark::Shutdown(); -} diff --git a/benchmarks/fastor/fastor_transform3.cpp b/benchmarks/fastor/fastor_transform3.cpp deleted file mode 100644 index a77fb99e..00000000 --- a/benchmarks/fastor/fastor_transform3.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2025 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -// Project include(s) -#include "algebra/fastor.hpp" -#include "benchmark/common/benchmark_transform3.hpp" -#include "benchmark/common/register_benchmark.hpp" -#include "benchmark/fastor/data_generator.hpp" - -// Benchmark include -#include - -using namespace algebra; - -/// Run vector benchmarks -int main(int argc, char** argv) { - - // - // Prepare benchmarks - // - algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(100000); - - using trf_f_t = transform3_bm>; - using trf_d_t = transform3_bm>; - - std::cout << "-----------------------------------------------\n" - << "Algebra-Plugins 'transform3' benchmark (Fastor)\n" - << "-----------------------------------------------\n\n" - << cfg; - - // - // Register all benchmarks - // - algebra::register_benchmark(cfg, "_single"); - algebra::register_benchmark(cfg, "_double"); - - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - ::benchmark::Shutdown(); -} diff --git a/benchmarks/fastor/fastor_vector.cpp b/benchmarks/fastor/fastor_vector.cpp deleted file mode 100644 index e7b8f406..00000000 --- a/benchmarks/fastor/fastor_vector.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2025 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -// Project include(s) -#include "algebra/fastor.hpp" -#include "benchmark/common/benchmark_vector.hpp" -#include "benchmark/fastor/data_generator.hpp" - -// Benchmark include -#include - -// System include(s) -#include - -using namespace algebra; - -/// Run vector benchmarks -int main(int argc, char** argv) { - - // - // Prepare benchmarks - // - algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(100000); - - using phi_f_t = vector_unaryOP_bm; - using theta_f_t = vector_unaryOP_bm; - using perp_f_t = vector_unaryOP_bm; - using norm_f_t = vector_unaryOP_bm; - using eta_f_t = vector_unaryOP_bm; - - using add_f_t = vector_binaryOP_bm; - using sub_f_t = vector_binaryOP_bm; - using dot_f_t = vector_binaryOP_bm; - using cross_f_t = vector_binaryOP_bm; - using normlz_f_t = - vector_unaryOP_bm; - - using phi_d_t = vector_unaryOP_bm; - using theta_d_t = vector_unaryOP_bm; - using perp_d_t = vector_unaryOP_bm; - using norm_d_t = vector_unaryOP_bm; - using eta_d_t = vector_unaryOP_bm; - - using add_d_t = vector_binaryOP_bm; - using sub_d_t = vector_binaryOP_bm; - using dot_d_t = vector_binaryOP_bm; - using cross_d_t = - vector_binaryOP_bm; - using normlz_d_t = - vector_unaryOP_bm; - - std::cout << "-------------------------------------------\n" - << "Algebra-Plugins 'vector' benchmark (Fastor)\n" - << "-------------------------------------------\n\n" - << cfg; - - // - // Register all benchmarks - // - ALGEBRA_PLUGINS_REGISTER_VECTOR_BENCH(cfg) - - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - ::benchmark::Shutdown(); -} diff --git a/benchmarks/vc_aos/vc_aos_getter.cpp b/benchmarks/vc_aos/vc_aos_getter.cpp deleted file mode 100644 index 74aa3eef..00000000 --- a/benchmarks/vc_aos/vc_aos_getter.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2024-2024 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -// Project include(s) -#include "algebra/vc_aos.hpp" -#include "benchmark/common/benchmark_getter.hpp" -#include "benchmark/vc_aos/data_generator.hpp" - -// Benchmark include -#include - -// System include(s) -#include - -using namespace algebra; - -/// Run vector benchmarks -int main(int argc, char** argv) { - - // - // Prepare benchmarks - // - algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(100000); - - std::cout << "-------------------------------------------\n" - << "Algebra-Plugins 'getter' benchmark (Vc AoS)\n" - << "-------------------------------------------\n\n" - << cfg; - - // - // Register all benchmarks - // - - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - ::benchmark::Shutdown(); -} diff --git a/benchmarks/vc_aos/vc_aos_matrix.cpp b/benchmarks/vc_aos/vc_aos_matrix.cpp deleted file mode 100644 index 4a20d0cd..00000000 --- a/benchmarks/vc_aos/vc_aos_matrix.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2024 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -// Project include(s) -#include "algebra/vc_aos.hpp" -#include "benchmark/common/benchmark_matrix.hpp" -#include "benchmark/vc_aos/data_generator.hpp" - -// Benchmark include -#include - -// System include(s) -#include - -using namespace algebra; - -/// Run vector benchmarks -int main(int argc, char** argv) { - - // - // Prepare benchmarks - // - algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(100000); - - using mat44_transp_f_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat44_transp_d_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat66_transp_f_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat66_transp_d_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat88_transp_f_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat88_transp_d_t = - matrix_unaryOP_bm, bench_op::transpose>; - - using mat44_inv_f_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat44_inv_d_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat66_inv_f_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat66_inv_d_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat88_inv_f_t = - matrix_unaryOP_bm, bench_op::invert>; - using mat88_inv_d_t = - matrix_unaryOP_bm, bench_op::invert>; - - using mat44_det_f_t = matrix_unaryOP_bm, - bench_op::determinant>; - using mat44_det_d_t = matrix_unaryOP_bm, - bench_op::determinant>; - using mat66_det_f_t = matrix_unaryOP_bm, - bench_op::determinant>; - using mat66_det_d_t = matrix_unaryOP_bm, - bench_op::determinant>; - using mat88_det_f_t = matrix_unaryOP_bm, - bench_op::determinant>; - using mat88_det_d_t = matrix_unaryOP_bm, - bench_op::determinant>; - - using mat44_add_f_t = - matrix_binaryOP_bm, bench_op::add>; - using mat44_add_d_t = - matrix_binaryOP_bm, bench_op::add>; - using mat66_add_f_t = - matrix_binaryOP_bm, bench_op::add>; - using mat66_add_d_t = - matrix_binaryOP_bm, bench_op::add>; - using mat88_add_f_t = - matrix_binaryOP_bm, bench_op::add>; - using mat88_add_d_t = - matrix_binaryOP_bm, bench_op::add>; - - using mat44_mul_f_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat44_mul_d_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat66_mul_f_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat66_mul_d_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat88_mul_f_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat88_mul_d_t = - matrix_binaryOP_bm, bench_op::mul>; - - using mat44_vec_f_t = matrix_vector_bm, - vc_aos::vector_type>; - using mat44_vec_d_t = matrix_vector_bm, - vc_aos::vector_type>; - using mat66_vec_f_t = matrix_vector_bm, - vc_aos::vector_type>; - using mat66_vec_d_t = matrix_vector_bm, - vc_aos::vector_type>; - using mat88_vec_f_t = matrix_vector_bm, - vc_aos::vector_type>; - using mat88_vec_d_t = matrix_vector_bm, - vc_aos::vector_type>; - - std::cout << "-------------------------------------------\n" - << "Algebra-Plugins 'matrix' benchmark (Vc AoS)\n" - << "-------------------------------------------\n\n" - << cfg; - - // - // Register all benchmarks - // - ALGEBRA_PLUGINS_REGISTER_MATRIX_BENCH(cfg) - - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - ::benchmark::Shutdown(); -} diff --git a/benchmarks/vc_aos/vc_aos_transform3.cpp b/benchmarks/vc_aos/vc_aos_transform3.cpp deleted file mode 100644 index 9118eaea..00000000 --- a/benchmarks/vc_aos/vc_aos_transform3.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2024-2024 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -// Project include(s) -#include "algebra/vc_aos.hpp" -#include "benchmark/common/benchmark_transform3.hpp" -#include "benchmark/common/register_benchmark.hpp" -#include "benchmark/vc_aos/data_generator.hpp" - -// Benchmark include -#include - -// System include(s) -#include - -using namespace algebra; - -/// Run vector benchmarks -int main(int argc, char** argv) { - - // - // Prepare benchmarks - // - algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(100000); - - using trf_f_t = transform3_bm>; - using trf_d_t = transform3_bm>; - - std::cout << "-----------------------------------------------\n" - << "Algebra-Plugins 'transform3' benchmark (Vc AoS)\n" - << "-----------------------------------------------\n\n" - << cfg; - - // - // Register all benchmarks - // - algebra::register_benchmark(cfg, "_single"); - algebra::register_benchmark(cfg, "_double"); - - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - ::benchmark::Shutdown(); -} diff --git a/benchmarks/vc_aos/vc_aos_vector.cpp b/benchmarks/vc_aos/vc_aos_vector.cpp deleted file mode 100644 index 836d3bec..00000000 --- a/benchmarks/vc_aos/vc_aos_vector.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2024-2024 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -// Project include(s) -#include "algebra/vc_aos.hpp" -#include "benchmark/common/benchmark_vector.hpp" -#include "benchmark/vc_aos/data_generator.hpp" - -// Benchmark include -#include - -// System include(s) -#include - -using namespace algebra; - -/// Run vector benchmarks -int main(int argc, char** argv) { - - // - // Prepare benchmarks - // - algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(100000); - - using phi_f_t = vector_unaryOP_bm; - using theta_f_t = vector_unaryOP_bm; - using perp_f_t = vector_unaryOP_bm; - using norm_f_t = vector_unaryOP_bm; - using eta_f_t = vector_unaryOP_bm; - - using add_f_t = vector_binaryOP_bm; - using sub_f_t = vector_binaryOP_bm; - using dot_f_t = vector_binaryOP_bm; - using cross_f_t = vector_binaryOP_bm; - using normlz_f_t = - vector_unaryOP_bm; - - using phi_d_t = vector_unaryOP_bm; - using theta_d_t = vector_unaryOP_bm; - using perp_d_t = vector_unaryOP_bm; - using norm_d_t = vector_unaryOP_bm; - using eta_d_t = vector_unaryOP_bm; - - using add_d_t = vector_binaryOP_bm; - using sub_d_t = vector_binaryOP_bm; - using dot_d_t = vector_binaryOP_bm; - using cross_d_t = - vector_binaryOP_bm; - using normlz_d_t = - vector_unaryOP_bm; - - std::cout << "-------------------------------------------\n" - << "Algebra-Plugins 'vector' benchmark (Vc AoS)\n" - << "-------------------------------------------\n\n" - << cfg; - - // - // Register all benchmarks - // - ALGEBRA_PLUGINS_REGISTER_VECTOR_BENCH(cfg) - - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - ::benchmark::Shutdown(); -} diff --git a/benchmarks/vc_soa/vc_soa_matrix.cpp b/benchmarks/vc_soa/vc_soa_matrix.cpp deleted file mode 100644 index 362d1cb9..00000000 --- a/benchmarks/vc_soa/vc_soa_matrix.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2024 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -// Project include(s) -#include "algebra/vc_soa.hpp" -#include "benchmark/common/benchmark_matrix.hpp" -#include "benchmark/common/register_benchmark.hpp" -#include "benchmark/vc_soa/data_generator.hpp" - -// Benchmark include -#include - -// System include(s) -#include - -using namespace algebra; - -/// Run vector benchmarks -int main(int argc, char** argv) { - - constexpr std::size_t n_samples{100000}; - - // - // Prepare benchmarks - // - algebra::benchmark_base::configuration cfg_s{}; - // Reduce the number of samples, since a single SoA struct contains multiple - // vectors - cfg_s.n_samples(n_samples / Vc::float_v::Size); - - // For double precision we need more samples (less vectors per SoA) - algebra::benchmark_base::configuration cfg_d{cfg_s}; - cfg_d.n_samples(n_samples / Vc::double_v::Size); - - using mat44_transp_f_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat44_transp_d_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat66_transp_f_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat66_transp_d_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat88_transp_f_t = - matrix_unaryOP_bm, bench_op::transpose>; - using mat88_transp_d_t = - matrix_unaryOP_bm, bench_op::transpose>; - - using mat44_add_f_t = - matrix_binaryOP_bm, bench_op::add>; - using mat44_add_d_t = - matrix_binaryOP_bm, bench_op::add>; - using mat66_add_f_t = - matrix_binaryOP_bm, bench_op::add>; - using mat66_add_d_t = - matrix_binaryOP_bm, bench_op::add>; - using mat88_add_f_t = - matrix_binaryOP_bm, bench_op::add>; - using mat88_add_d_t = - matrix_binaryOP_bm, bench_op::add>; - - using mat44_mul_f_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat44_mul_d_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat66_mul_f_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat66_mul_d_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat88_mul_f_t = - matrix_binaryOP_bm, bench_op::mul>; - using mat88_mul_d_t = - matrix_binaryOP_bm, bench_op::mul>; - - using mat44_vec_f_t = matrix_vector_bm, - vc_soa::vector_type>; - using mat44_vec_d_t = matrix_vector_bm, - vc_soa::vector_type>; - using mat66_vec_f_t = matrix_vector_bm, - vc_soa::vector_type>; - using mat66_vec_d_t = matrix_vector_bm, - vc_soa::vector_type>; - using mat88_vec_f_t = matrix_vector_bm, - vc_soa::vector_type>; - using mat88_vec_d_t = matrix_vector_bm, - vc_soa::vector_type>; - - std::cout << "-------------------------------------------\n" - << "Algebra-Plugins 'matrix' benchmark (Vc SoA)\n" - << "-------------------------------------------\n\n" - << "(single)\n" - << cfg_s << "(double)\n" - << cfg_d; - - // - // Register all benchmarks - // - algebra::register_benchmark(cfg_s, "_4x4_transpose_single"); - algebra::register_benchmark(cfg_d, "_4x4_transpose_double"); - algebra::register_benchmark(cfg_s, "_6x6_transpose_single"); - algebra::register_benchmark(cfg_d, "_6x6_transpose_double"); - algebra::register_benchmark(cfg_s, "_8x8_transpose_single"); - algebra::register_benchmark(cfg_d, "_8x8_transpose_double"); - - algebra::register_benchmark(cfg_s, "_4x4_add_single"); - algebra::register_benchmark(cfg_d, "_4x4_add_double"); - algebra::register_benchmark(cfg_s, "_6x6_add_single"); - algebra::register_benchmark(cfg_d, "_6x6_add_double"); - algebra::register_benchmark(cfg_s, "_8x8_add_single"); - algebra::register_benchmark(cfg_d, "_8x8_add_double"); - - algebra::register_benchmark(cfg_s, "_4x4_mul_single"); - algebra::register_benchmark(cfg_d, "_4x4_mul_double"); - algebra::register_benchmark(cfg_s, "_6x6_mul_single"); - algebra::register_benchmark(cfg_d, "_6x6_mul_double"); - algebra::register_benchmark(cfg_s, "_8x8_mul_single"); - algebra::register_benchmark(cfg_d, "_8x8_mul_double"); - - algebra::register_benchmark(cfg_s, "_4x4_vec_single"); - algebra::register_benchmark(cfg_d, "_4x4_vec_double"); - algebra::register_benchmark(cfg_s, "_6x6_vec_single"); - algebra::register_benchmark(cfg_d, "_6x6_vec_double"); - algebra::register_benchmark(cfg_s, "_8x8_vec_single"); - algebra::register_benchmark(cfg_d, "_8x8_vec_double"); - - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - ::benchmark::Shutdown(); -} diff --git a/benchmarks/vc_soa/vc_soa_vector.cpp b/benchmarks/vc_soa/vc_soa_vector.cpp deleted file mode 100644 index c436b118..00000000 --- a/benchmarks/vc_soa/vc_soa_vector.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2023-2024 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -// Project include(s) -#include "algebra/vc_soa.hpp" -#include "benchmark/common/benchmark_vector.hpp" -#include "benchmark/common/register_benchmark.hpp" -#include "benchmark/vc_soa/data_generator.hpp" - -// Benchmark include -#include - -// System include(s) -#include - -using namespace algebra; - -/// Run vector benchmarks -int main(int argc, char** argv) { - - constexpr std::size_t n_samples{100000}; - - // - // Prepare benchmarks - // - algebra::benchmark_base::configuration cfg_s{}; - // Reduce the number of samples, since a single SoA struct contains multiple - // vectors - cfg_s.n_samples(n_samples / Vc::float_v::Size); - - // For double precision we need more samples (less vectors per SoA) - algebra::benchmark_base::configuration cfg_d{cfg_s}; - cfg_d.n_samples(n_samples / Vc::double_v::Size); - - using phi_f_t = vector_unaryOP_bm; - using theta_f_t = vector_unaryOP_bm; - using perp_f_t = vector_unaryOP_bm; - using norm_f_t = vector_unaryOP_bm; - using eta_f_t = vector_unaryOP_bm; - - using add_f_t = vector_binaryOP_bm; - using sub_f_t = vector_binaryOP_bm; - using dot_f_t = vector_binaryOP_bm; - using cross_f_t = vector_binaryOP_bm; - using normlz_f_t = - vector_unaryOP_bm; - - using phi_d_t = vector_unaryOP_bm; - using theta_d_t = vector_unaryOP_bm; - using perp_d_t = vector_unaryOP_bm; - using norm_d_t = vector_unaryOP_bm; - using eta_d_t = vector_unaryOP_bm; - - using add_d_t = vector_binaryOP_bm; - using sub_d_t = vector_binaryOP_bm; - using dot_d_t = vector_binaryOP_bm; - using cross_d_t = - vector_binaryOP_bm; - using normlz_d_t = - vector_unaryOP_bm; - - std::cout << "-------------------------------------------\n" - << "Algebra-Plugins 'vector' benchmark (Vc SoA)\n" - << "-------------------------------------------\n\n" - << "(single)\n" - << cfg_s << "(double)\n" - << cfg_d; - - // - // Register all benchmarks - // - algebra::register_benchmark(cfg_s, "_single"); - algebra::register_benchmark(cfg_d, "_double"); - algebra::register_benchmark(cfg_s, "_single"); - algebra::register_benchmark(cfg_d, "_double"); - algebra::register_benchmark(cfg_s, "_single"); - algebra::register_benchmark(cfg_d, "_double"); - algebra::register_benchmark(cfg_s, "_single"); - algebra::register_benchmark(cfg_d, "_double"); - algebra::register_benchmark(cfg_s, "_single"); - algebra::register_benchmark(cfg_d, "_double"); - - algebra::register_benchmark(cfg_s, "_single"); - algebra::register_benchmark(cfg_d, "_double"); - algebra::register_benchmark(cfg_s, "_single"); - algebra::register_benchmark(cfg_d, "_double"); - algebra::register_benchmark(cfg_s, "_single"); - algebra::register_benchmark(cfg_d, "_double"); - algebra::register_benchmark(cfg_s, "_single"); - algebra::register_benchmark(cfg_d, "_double"); - algebra::register_benchmark(cfg_s, "_single"); - algebra::register_benchmark(cfg_d, "_double"); - - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - ::benchmark::Shutdown(); -}