From 747351da51fcef856755685507680a04196897a9 Mon Sep 17 00:00:00 2001 From: Joana Niermann Date: Fri, 12 Apr 2024 17:55:57 +0200 Subject: [PATCH] Rename to vc_aos --- benchmarks/CMakeLists.txt | 8 +- benchmarks/array/array_getter.cpp | 78 ++++------ benchmarks/array/array_transform3.cpp | 26 ++-- benchmarks/array/array_vector.cpp | 80 ++++------- .../benchmark/common/benchmark_base.hpp | 22 +-- .../benchmark/common/benchmark_transform3.hpp | 38 ++--- .../benchmark/common/benchmark_vector.hpp | 53 ++----- .../benchmark/common/register_benchmark.hpp | 28 ++++ benchmarks/eigen/eigen_getter.cpp | 78 ++++------ benchmarks/eigen/eigen_transform3.cpp | 26 ++-- benchmarks/eigen/eigen_vector.cpp | 80 ++++------- .../benchmark/vc_aos/data_generator.hpp | 2 +- benchmarks/vc_aos/vc_aos_getter.cpp | 80 ++++------- benchmarks/vc_aos/vc_aos_transform3.cpp | 26 ++-- benchmarks/vc_aos/vc_aos_vector.cpp | 82 ++++------- benchmarks/vc_soa/vc_soa_getter.cpp | 81 ++++------- benchmarks/vc_soa/vc_soa_transform3.cpp | 29 ++-- benchmarks/vc_soa/vc_soa_vector.cpp | 86 ++++------- frontend/CMakeLists.txt | 2 +- frontend/{vc_vc => vc_aos}/CMakeLists.txt | 12 +- frontend/vc_aos/include/algebra/vc_aos.hpp | 123 ++++++++++++++++ frontend/vc_cmath/CMakeLists.txt | 2 +- .../vc_cmath/include/algebra/vc_cmath.hpp | 40 +++--- frontend/vc_vc/include/algebra/vc_vc.hpp | 134 ------------------ math/CMakeLists.txt | 2 +- math/vc/CMakeLists.txt | 17 --- math/vc_aos/CMakeLists.txt | 17 +++ .../algebra/math/impl/vc_aos_getter.hpp} | 6 +- .../algebra/math/impl/vc_aos_transform3.hpp} | 61 +++++--- .../algebra/math/impl/vc_aos_vector.hpp} | 4 +- .../include/algebra/math/vc_aos.hpp} | 6 +- .../algebra/math/impl/vc_soa_transform3.hpp | 12 ++ storage/CMakeLists.txt | 2 +- storage/{vc => vc_aos}/CMakeLists.txt | 5 +- .../include/algebra/storage/vc_aos.hpp} | 4 +- tests/CMakeLists.txt | 10 +- tests/common/test_host_basics.hpp | 20 +-- tests/{vc/vc_vc.cpp => vc_aos/vc_aos.cpp} | 30 ++-- tests/{vc => vc_aos}/vc_cmath.cpp | 18 +-- 39 files changed, 599 insertions(+), 831 deletions(-) create mode 100644 benchmarks/common/include/benchmark/common/register_benchmark.hpp rename frontend/{vc_vc => vc_aos}/CMakeLists.txt (53%) create mode 100644 frontend/vc_aos/include/algebra/vc_aos.hpp delete mode 100644 frontend/vc_vc/include/algebra/vc_vc.hpp delete mode 100644 math/vc/CMakeLists.txt create mode 100644 math/vc_aos/CMakeLists.txt rename math/{vc/include/algebra/math/impl/vc_getter.hpp => vc_aos/include/algebra/math/impl/vc_aos_getter.hpp} (95%) rename math/{vc/include/algebra/math/impl/vc_transform3.hpp => vc_aos/include/algebra/math/impl/vc_aos_transform3.hpp} (89%) rename math/{vc/include/algebra/math/impl/vc_vector.hpp => vc_aos/include/algebra/math/impl/vc_aos_vector.hpp} (97%) rename math/{vc/include/algebra/math/vc.hpp => vc_aos/include/algebra/math/vc_aos.hpp} (57%) rename storage/{vc => vc_aos}/CMakeLists.txt (75%) rename storage/{vc/include/algebra/storage/vc.hpp => vc_aos/include/algebra/storage/vc_aos.hpp} (96%) rename tests/{vc/vc_vc.cpp => vc_aos/vc_aos.cpp} (60%) rename tests/{vc => vc_aos}/vc_cmath.cpp (72%) diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index f742a5c9..d3002c92 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -65,22 +65,22 @@ if( ALGEBRA_PLUGINS_INCLUDE_VC ) target_include_directories( algebra_bench_vc_aos INTERFACE "$" ) target_link_libraries(algebra_bench_vc_aos INTERFACE - algebra::vc_vc + algebra::vc_aos algebra::common_storage) add_library( algebra::bench_vc_aos ALIAS algebra_bench_vc_aos ) 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_vc ) + algebra::bench_vc_aos algebra::vc_aos ) 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_vc ) + algebra::bench_vc_aos algebra::vc_aos ) 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_vc ) + algebra::bench_vc_aos algebra::vc_aos ) if( NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang" ) add_library( algebra_bench_vc_soa INTERFACE ) diff --git a/benchmarks/array/array_getter.cpp b/benchmarks/array/array_getter.cpp index e53cb24a..b4d7890f 100644 --- a/benchmarks/array/array_getter.cpp +++ b/benchmarks/array/array_getter.cpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2024 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -9,6 +9,7 @@ #include "algebra/array_cmath.hpp" #include "benchmark/array/data_generator.hpp" #include "benchmark/common/benchmark_getter.hpp" +#include "benchmark/common/register_benchmark.hpp" // Benchmark include #include @@ -21,71 +22,42 @@ using namespace algebra; /// Run vector benchmarks int main(int argc, char** argv) { - constexpr std::size_t n_samples{160000}; - constexpr std::size_t n_warmup{static_cast(0.1 * n_samples)}; - // // Prepare benchmarks // algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(n_samples).n_warmup(n_warmup); - cfg.do_sleep(false); + cfg.n_samples(100000); - vector_unaryOP_bm v_phi_s{cfg}; - vector_unaryOP_bm v_theta_s{cfg}; - vector_unaryOP_bm v_perp_s{cfg}; - vector_unaryOP_bm v_norm_s{cfg}; - vector_unaryOP_bm v_eta_s{cfg}; + 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; - vector_unaryOP_bm v_phi_d{cfg}; - vector_unaryOP_bm v_theta_d{cfg}; - vector_unaryOP_bm v_perp_d{cfg}; - vector_unaryOP_bm v_norm_d{cfg}; - vector_unaryOP_bm v_eta_d{cfg}; + 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; - std::cout << "Algebra-Plugins 'getter' benchmark (std::array)\n" + std::cout << "-----------------------------------------------\n" + << "Algebra-Plugins 'getter' benchmark (std::array)\n" << "-----------------------------------------------\n\n" << cfg; // // Register all benchmarks // - ::benchmark::RegisterBenchmark((v_phi_s.name() + "_single").c_str(), v_phi_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_phi_d.name() + "_double").c_str(), v_phi_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_theta_s.name() + "_single").c_str(), - v_theta_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_theta_d.name() + "_double").c_str(), - v_theta_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_perp_s.name() + "_single").c_str(), - v_perp_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_perp_d.name() + "_double").c_str(), - v_perp_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_norm_s.name() + "_single").c_str(), - v_norm_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_norm_d.name() + "_double").c_str(), - v_norm_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_eta_s.name() + "_single").c_str(), v_eta_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_eta_d.name() + "_double").c_str(), v_eta_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); + 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"); ::benchmark::Initialize(&argc, argv); ::benchmark::RunSpecifiedBenchmarks(); diff --git a/benchmarks/array/array_transform3.cpp b/benchmarks/array/array_transform3.cpp index 752b3893..eaee61cf 100644 --- a/benchmarks/array/array_transform3.cpp +++ b/benchmarks/array/array_transform3.cpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2024 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -9,6 +9,7 @@ #include "algebra/array_cmath.hpp" #include "benchmark/array/data_generator.hpp" #include "benchmark/common/benchmark_transform3.hpp" +#include "benchmark/common/register_benchmark.hpp" // Benchmark include #include @@ -18,34 +19,27 @@ using namespace algebra; /// Run vector benchmarks int main(int argc, char** argv) { - constexpr std::size_t n_samples{160000}; - constexpr std::size_t n_warmup{static_cast(0.1 * n_samples)}; - // // Prepare benchmarks // algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(n_samples).n_warmup(n_warmup); - cfg.do_sleep(false); + cfg.n_samples(100000); - transform3_bm> v_trf_s{cfg}; - transform3_bm> v_trf_d{cfg}; + using trf_f_t = transform3_bm>; + using trf_d_t = transform3_bm>; - std::cout << "Algebra-Plugins 'transform3' benchmark (std::array)\n" + std::cout << "-----------------------------------------------\n" + << "Algebra-Plugins 'transform3' benchmark (std::array)\n" << "---------------------------------------------------\n\n" << cfg; // // Register all benchmarks // - ::benchmark::RegisterBenchmark((v_trf_s.name() + "_single").c_str(), v_trf_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_trf_d.name() + "_double").c_str(), v_trf_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); + algebra::register_benchmark(cfg, "_single"); + algebra::register_benchmark(cfg, "_double"); ::benchmark::Initialize(&argc, argv); ::benchmark::RunSpecifiedBenchmarks(); ::benchmark::Shutdown(); -} \ No newline at end of file +} diff --git a/benchmarks/array/array_vector.cpp b/benchmarks/array/array_vector.cpp index 20b7ae05..e680b481 100644 --- a/benchmarks/array/array_vector.cpp +++ b/benchmarks/array/array_vector.cpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2024 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -9,6 +9,7 @@ #include "algebra/array_cmath.hpp" #include "benchmark/array/data_generator.hpp" #include "benchmark/common/benchmark_vector.hpp" +#include "benchmark/common/register_benchmark.hpp" // Benchmark include #include @@ -21,71 +22,44 @@ using namespace algebra; /// Run vector benchmarks int main(int argc, char** argv) { - constexpr std::size_t n_samples{160000}; - constexpr std::size_t n_warmup{static_cast(0.1 * n_samples)}; - // // Prepare benchmarks // algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(n_samples).n_warmup(n_warmup); - cfg.do_sleep(false); + cfg.n_samples(100000); - vector_binaryOP_bm v_add_s{cfg}; - vector_binaryOP_bm v_sub_s{cfg}; - vector_binaryOP_bm v_dot_s{cfg}; - vector_binaryOP_bm v_cross_s{cfg}; - vector_unaryOP_bm v_normalize_s{ - cfg}; + 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; - vector_binaryOP_bm v_add_d{cfg}; - vector_binaryOP_bm v_sub_d{cfg}; - vector_binaryOP_bm v_dot_d{cfg}; - vector_binaryOP_bm v_cross_d{cfg}; - vector_unaryOP_bm v_normalize_d{ - cfg}; + 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 << "Algebra-Plugins 'vector' benchmark (std::array)\n" + std::cout << "-----------------------------------------------\n" + << "Algebra-Plugins 'vector' benchmark (std::array)\n" << "-----------------------------------------------\n\n" << cfg; // // Register all benchmarks // - ::benchmark::RegisterBenchmark((v_add_s.name() + "_single").c_str(), v_add_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_add_d.name() + "_double").c_str(), v_add_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_sub_s.name() + "_single").c_str(), v_sub_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_sub_d.name() + "_double").c_str(), v_sub_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_dot_s.name() + "_single").c_str(), v_dot_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_dot_d.name() + "_double").c_str(), v_dot_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_cross_s.name() + "_single").c_str(), - v_cross_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_cross_d.name() + "_double").c_str(), - v_cross_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_normalize_s.name() + "_single").c_str(), - v_normalize_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_normalize_d.name() + "_double").c_str(), - v_normalize_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); + 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"); ::benchmark::Initialize(&argc, argv); ::benchmark::RunSpecifiedBenchmarks(); diff --git a/benchmarks/common/include/benchmark/common/benchmark_base.hpp b/benchmarks/common/include/benchmark/common/benchmark_base.hpp index b3ca9fdd..10f38dc2 100644 --- a/benchmarks/common/include/benchmark/common/benchmark_base.hpp +++ b/benchmarks/common/include/benchmark/common/benchmark_base.hpp @@ -22,13 +22,9 @@ struct benchmark_base { struct configuration { /// Size of data sample to be used in benchmark std::size_t m_samples{100u}; - /// Run a number of operations before the benchmark - bool m_warmup = true; // Sleep after building data sample bool m_sleep = false; - // Size of data in warm-up round - std::size_t m_n_warmup{static_cast(0.1f * m_samples)}; - // Size of data in warm-up round + // Number of seconds to sleep std::size_t m_n_sleep{1u}; /// Setters @@ -37,15 +33,6 @@ struct benchmark_base { m_samples = n; return *this; } - configuration& do_warmup(bool b) { - m_warmup = b; - return *this; - } - configuration& n_warmup(std::size_t n) { - m_n_warmup = n; - m_warmup = true; - return *this; - } configuration& do_sleep(bool b) { m_sleep = b; return *this; @@ -60,8 +47,6 @@ struct benchmark_base { /// Getters /// @{ std::size_t n_samples() const { return m_samples; } - constexpr bool do_warmup() const { return m_warmup; } - constexpr std::size_t n_warmup() const { return m_n_warmup; } constexpr bool do_sleep() const { return m_sleep; } constexpr std::size_t n_sleep() const { return m_n_sleep; } /// @} @@ -95,9 +80,6 @@ struct benchmark_base { std::ostream& operator<<(std::ostream& os, const benchmark_base::configuration& cfg) { os << " -> running:\t " << cfg.n_samples() << " samples" << std::endl; - if (cfg.do_warmup()) { - os << " -> warmup: \t " << cfg.n_warmup() << " samples" << std::endl; - } if (cfg.do_sleep()) { os << " -> cool down:\t " << cfg.n_sleep() << "s" << std::endl; } @@ -105,4 +87,4 @@ std::ostream& operator<<(std::ostream& os, return os; } -} // namespace algebra \ No newline at end of file +} // namespace algebra diff --git a/benchmarks/common/include/benchmark/common/benchmark_transform3.hpp b/benchmarks/common/include/benchmark/common/benchmark_transform3.hpp index fb7298e5..e5d092e9 100644 --- a/benchmarks/common/include/benchmark/common/benchmark_transform3.hpp +++ b/benchmarks/common/include/benchmark/common/benchmark_transform3.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-2024 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -41,9 +41,7 @@ struct transform3_bm : public vector_bm { /// Construct from an externally provided configuration @param cfg transform3_bm(benchmark_base::configuration cfg) : base_type{cfg} { - const std::size_t n_data{this->m_cfg.n_samples() + this->m_cfg.n_warmup()}; - - trfs.reserve(n_data); + trfs.reserve(this->m_cfg.n_samples()); fill_random_trf(trfs); } @@ -54,30 +52,24 @@ struct transform3_bm : public vector_bm { /// Benchmark case void operator()(::benchmark::State &state) override { - const std::size_t n_samples{this->m_cfg.n_samples()}; - const std::size_t n_warmup{this->m_cfg.n_warmup()}; + using vector_t = typename transform3_t::vector3; + using point_t = typename transform3_t::point3; - // Spin down before benchmark (Thread zero is counting the clock) - if (state.thread_index() == 0 && this->m_cfg.do_sleep()) { - std::this_thread::sleep_for(std::chrono::seconds(this->m_cfg.n_sleep())); - } + const std::size_t n_samples{this->m_cfg.n_samples()}; // Run the benchmark for (auto _ : state) { - // Warm-up - state.PauseTiming(); - if (this->m_cfg.do_warmup()) { - for (std::size_t i{0u}; i < n_warmup; ++i) { - ::benchmark::DoNotOptimize( - this->trfs[i].vector_to_global(this->a[i])); - benchmark::ClobberMemory(); - } - } - state.ResumeTiming(); + for (std::size_t i{0}; i < n_samples; ++i) { + + point_t result1 = this->trfs[i].point_to_global(this->a[i]); + point_t result2 = this->trfs[i].point_to_local(this->a[i]); + vector_t result3 = this->trfs[i].vector_to_global(this->a[i]); + vector_t result4 = this->trfs[i].vector_to_local(this->a[i]); - for (std::size_t i{n_warmup}; i < n_samples + n_warmup; ++i) { - ::benchmark::DoNotOptimize(this->trfs[i].vector_to_global(this->a[i])); - benchmark::ClobberMemory(); + ::benchmark::DoNotOptimize(result1); + ::benchmark::DoNotOptimize(result2); + ::benchmark::DoNotOptimize(result3); + ::benchmark::DoNotOptimize(result4); } } } diff --git a/benchmarks/common/include/benchmark/common/benchmark_vector.hpp b/benchmarks/common/include/benchmark/common/benchmark_vector.hpp index 55ec6aee..7a5b52c1 100644 --- a/benchmarks/common/include/benchmark/common/benchmark_vector.hpp +++ b/benchmarks/common/include/benchmark/common/benchmark_vector.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-2024 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -37,7 +37,7 @@ struct vector_bm : public benchmark_base { /// Construct from an externally provided configuration @param cfg vector_bm(benchmark_base::configuration cfg) : benchmark_base{cfg} { - const std::size_t n_data{this->m_cfg.n_samples() + this->m_cfg.n_warmup()}; + const std::size_t n_data{this->m_cfg.n_samples()}; a.reserve(n_data); b.reserve(n_data); @@ -67,29 +67,15 @@ struct vector_unaryOP_bm : public vector_bm> { void operator()(::benchmark::State &state) override { - const std::size_t n_samples{this->m_cfg.n_samples()}; - const std::size_t n_warmup{this->m_cfg.n_warmup()}; + using result_t = std::invoke_result_t>; - // Spin down before benchmark (Thread zero is counting the clock) - if (state.thread_index() == 0 && this->m_cfg.do_sleep()) { - std::this_thread::sleep_for(std::chrono::seconds(this->m_cfg.n_sleep())); - } + const std::size_t n_samples{this->m_cfg.n_samples()}; // Run the benchmark for (auto _ : state) { - // Warm-up - state.PauseTiming(); - if (this->m_cfg.do_warmup()) { - for (std::size_t i{0u}; i < n_warmup; ++i) { - ::benchmark::DoNotOptimize(unaryOP{}(this->a[i])); - benchmark::ClobberMemory(); - } - } - state.ResumeTiming(); - - for (std::size_t i{n_warmup}; i < n_samples + n_warmup; ++i) { - ::benchmark::DoNotOptimize(unaryOP{}(this->a[i])); - benchmark::ClobberMemory(); + for (std::size_t i{0}; i < n_samples; ++i) { + result_t result = unaryOP{}(this->a[i]); + ::benchmark::DoNotOptimize(const_cast(result)); } } } @@ -109,29 +95,16 @@ struct vector_binaryOP_bm : public vector_bm> { void operator()(::benchmark::State &state) override { - const std::size_t n_samples{this->m_cfg.n_samples()}; - const std::size_t n_warmup{this->m_cfg.n_warmup()}; + using result_t = + std::invoke_result_t, vector_t>; - // Spin down before benchmark (Thread zero is counting the clock) - if ((state.thread_index() == 0) && this->m_cfg.do_sleep()) { - std::this_thread::sleep_for(std::chrono::seconds(this->m_cfg.n_sleep())); - } + const std::size_t n_samples{this->m_cfg.n_samples()}; // Run the benchmark for (auto _ : state) { - // Warm-up - state.PauseTiming(); - if (this->m_cfg.do_warmup()) { - for (std::size_t i{0u}; i < n_warmup; ++i) { - ::benchmark::DoNotOptimize(binaryOP{}(this->a[i], this->b[i])); - benchmark::ClobberMemory(); - } - } - state.ResumeTiming(); - - for (std::size_t i{n_warmup}; i < n_samples + n_warmup; ++i) { - ::benchmark::DoNotOptimize(binaryOP{}(this->a[i], this->b[i])); - benchmark::ClobberMemory(); + for (std::size_t i{0}; i < n_samples; ++i) { + result_t result = binaryOP{}(this->a[i], this->b[i]); + ::benchmark::DoNotOptimize(const_cast(result)); } } } diff --git a/benchmarks/common/include/benchmark/common/register_benchmark.hpp b/benchmarks/common/include/benchmark/common/register_benchmark.hpp new file mode 100644 index 00000000..6eec7a7b --- /dev/null +++ b/benchmarks/common/include/benchmark/common/register_benchmark.hpp @@ -0,0 +1,28 @@ +/** 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 + +// Benchmark include +#include + +// System include(s) +#include + +namespace algebra { + +template +void register_benchmark(const config_t& cfg, const std::string& suffix) { + benchmark_t bench{cfg}; + + ::benchmark::RegisterBenchmark((bench.name() + suffix).c_str(), bench) + ->UseRealTime() + ->MeasureProcessCPUTime() + ->ThreadPerCpu(); +} + +} // namespace algebra diff --git a/benchmarks/eigen/eigen_getter.cpp b/benchmarks/eigen/eigen_getter.cpp index 14ce10eb..2761a5b0 100644 --- a/benchmarks/eigen/eigen_getter.cpp +++ b/benchmarks/eigen/eigen_getter.cpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2024 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,6 +8,7 @@ // Project include(s) #include "algebra/eigen_eigen.hpp" #include "benchmark/common/benchmark_getter.hpp" +#include "benchmark/common/register_benchmark.hpp" #include "benchmark/eigen/data_generator.hpp" // Benchmark include @@ -21,71 +22,42 @@ using namespace algebra; /// Run vector benchmarks int main(int argc, char** argv) { - constexpr std::size_t n_samples{160000}; - constexpr std::size_t n_warmup{static_cast(0.1 * n_samples)}; - // // Prepare benchmarks // algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(n_samples).n_warmup(n_warmup); - cfg.do_sleep(false); + cfg.n_samples(100000); - vector_unaryOP_bm v_phi_s{cfg}; - vector_unaryOP_bm v_theta_s{cfg}; - vector_unaryOP_bm v_perp_s{cfg}; - vector_unaryOP_bm v_norm_s{cfg}; - vector_unaryOP_bm v_eta_s{cfg}; + 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; - vector_unaryOP_bm v_phi_d{cfg}; - vector_unaryOP_bm v_theta_d{cfg}; - vector_unaryOP_bm v_perp_d{cfg}; - vector_unaryOP_bm v_norm_d{cfg}; - vector_unaryOP_bm v_eta_d{cfg}; + 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; - std::cout << "Algebra-Plugins 'getter' benchmark (Eigen)\n" + std::cout << "------------------------------------------\n" + << "Algebra-Plugins 'getter' benchmark (Eigen)\n" << "------------------------------------------\n\n" << cfg; // // Register all benchmarks // - ::benchmark::RegisterBenchmark((v_phi_s.name() + "_single").c_str(), v_phi_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_phi_d.name() + "_double").c_str(), v_phi_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_theta_s.name() + "_single").c_str(), - v_theta_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_theta_d.name() + "_double").c_str(), - v_theta_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_perp_s.name() + "_single").c_str(), - v_perp_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_perp_d.name() + "_double").c_str(), - v_perp_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_norm_s.name() + "_single").c_str(), - v_norm_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_norm_d.name() + "_double").c_str(), - v_norm_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_eta_s.name() + "_single").c_str(), v_eta_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_eta_d.name() + "_double").c_str(), v_eta_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); + 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"); ::benchmark::Initialize(&argc, argv); ::benchmark::RunSpecifiedBenchmarks(); diff --git a/benchmarks/eigen/eigen_transform3.cpp b/benchmarks/eigen/eigen_transform3.cpp index 747a526b..414237ec 100644 --- a/benchmarks/eigen/eigen_transform3.cpp +++ b/benchmarks/eigen/eigen_transform3.cpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2024 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,6 +8,7 @@ // Project include(s) #include "algebra/eigen_eigen.hpp" #include "benchmark/common/benchmark_transform3.hpp" +#include "benchmark/common/register_benchmark.hpp" #include "benchmark/eigen/data_generator.hpp" // Benchmark include @@ -18,34 +19,27 @@ using namespace algebra; /// Run vector benchmarks int main(int argc, char** argv) { - constexpr std::size_t n_samples{160000}; - constexpr std::size_t n_warmup{static_cast(0.1 * n_samples)}; - // // Prepare benchmarks // algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(n_samples).n_warmup(n_warmup); - cfg.do_sleep(false); + cfg.n_samples(100000); - transform3_bm> v_trf_s{cfg}; - transform3_bm> v_trf_d{cfg}; + using trf_f_t = transform3_bm>; + using trf_d_t = transform3_bm>; - std::cout << "Algebra-Plugins 'transform3' benchmark (Eigen3)\n" + std::cout << "------------------------------------------\n" + << "Algebra-Plugins 'transform3' benchmark (Eigen3)\n" << "-----------------------------------------------\n\n" << cfg; // // Register all benchmarks // - ::benchmark::RegisterBenchmark((v_trf_s.name() + "_single").c_str(), v_trf_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_trf_d.name() + "_double").c_str(), v_trf_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); + algebra::register_benchmark(cfg, "_single"); + algebra::register_benchmark(cfg, "_double"); ::benchmark::Initialize(&argc, argv); ::benchmark::RunSpecifiedBenchmarks(); ::benchmark::Shutdown(); -} \ No newline at end of file +} diff --git a/benchmarks/eigen/eigen_vector.cpp b/benchmarks/eigen/eigen_vector.cpp index ba3c03a0..e36fe0e7 100644 --- a/benchmarks/eigen/eigen_vector.cpp +++ b/benchmarks/eigen/eigen_vector.cpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2024 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,6 +8,7 @@ // Project include(s) #include "algebra/eigen_eigen.hpp" #include "benchmark/common/benchmark_vector.hpp" +#include "benchmark/common/register_benchmark.hpp" #include "benchmark/eigen/data_generator.hpp" // Benchmark include @@ -21,71 +22,44 @@ using namespace algebra; /// Run vector benchmarks int main(int argc, char** argv) { - constexpr std::size_t n_samples{160000}; - constexpr std::size_t n_warmup{static_cast(0.1 * n_samples)}; - // // Prepare benchmarks // algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(n_samples).n_warmup(n_warmup); - cfg.do_sleep(false); + cfg.n_samples(100000); - vector_binaryOP_bm v_add_s{cfg}; - vector_binaryOP_bm v_sub_s{cfg}; - vector_binaryOP_bm v_dot_s{cfg}; - vector_binaryOP_bm v_cross_s{cfg}; - vector_unaryOP_bm v_normalize_s{ - cfg}; + 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; - vector_binaryOP_bm v_add_d{cfg}; - vector_binaryOP_bm v_sub_d{cfg}; - vector_binaryOP_bm v_dot_d{cfg}; - vector_binaryOP_bm v_cross_d{cfg}; - vector_unaryOP_bm v_normalize_d{ - cfg}; + 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 << "Algebra-Plugins 'vector' benchmark (Eigen)\n" + std::cout << "------------------------------------------\n" + << "Algebra-Plugins 'vector' benchmark (Eigen)\n" << "------------------------------------------\n\n" << cfg; // // Register all benchmarks // - ::benchmark::RegisterBenchmark((v_add_s.name() + "_single").c_str(), v_add_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_add_d.name() + "_double").c_str(), v_add_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_sub_s.name() + "_single").c_str(), v_sub_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_sub_d.name() + "_double").c_str(), v_sub_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_dot_s.name() + "_single").c_str(), v_dot_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_dot_d.name() + "_double").c_str(), v_dot_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_cross_s.name() + "_single").c_str(), - v_cross_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_cross_d.name() + "_double").c_str(), - v_cross_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_normalize_s.name() + "_single").c_str(), - v_normalize_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_normalize_d.name() + "_double").c_str(), - v_normalize_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); + 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"); ::benchmark::Initialize(&argc, argv); ::benchmark::RunSpecifiedBenchmarks(); diff --git a/benchmarks/vc_aos/include/benchmark/vc_aos/data_generator.hpp b/benchmarks/vc_aos/include/benchmark/vc_aos/data_generator.hpp index 6ec3e753..21874cff 100644 --- a/benchmarks/vc_aos/include/benchmark/vc_aos/data_generator.hpp +++ b/benchmarks/vc_aos/include/benchmark/vc_aos/data_generator.hpp @@ -8,7 +8,7 @@ #pragma once // Project include(s) -#include "algebra/vc_vc.hpp" +#include "algebra/vc_aos.hpp" // System include(s) #include diff --git a/benchmarks/vc_aos/vc_aos_getter.cpp b/benchmarks/vc_aos/vc_aos_getter.cpp index 35a4624f..f27bca7d 100644 --- a/benchmarks/vc_aos/vc_aos_getter.cpp +++ b/benchmarks/vc_aos/vc_aos_getter.cpp @@ -1,13 +1,14 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2024 CERN for the benefit 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_vc.hpp" +#include "algebra/vc_aos.hpp" #include "benchmark/common/benchmark_getter.hpp" +#include "benchmark/common/register_benchmark.hpp" #include "benchmark/vc_aos/data_generator.hpp" // Benchmark include @@ -21,71 +22,42 @@ using namespace algebra; /// Run vector benchmarks int main(int argc, char** argv) { - constexpr std::size_t n_samples{160000}; - constexpr std::size_t n_warmup{static_cast(0.1 * n_samples)}; - // // Prepare benchmarks // algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(n_samples).n_warmup(n_warmup); - cfg.do_sleep(false); + cfg.n_samples(100000); - vector_unaryOP_bm v_phi_s{cfg}; - vector_unaryOP_bm v_theta_s{cfg}; - vector_unaryOP_bm v_perp_s{cfg}; - vector_unaryOP_bm v_norm_s{cfg}; - vector_unaryOP_bm v_eta_s{cfg}; + 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; - vector_unaryOP_bm v_phi_d{cfg}; - vector_unaryOP_bm v_theta_d{cfg}; - vector_unaryOP_bm v_perp_d{cfg}; - vector_unaryOP_bm v_norm_d{cfg}; - vector_unaryOP_bm v_eta_d{cfg}; + 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; - std::cout << "Algebra-Plugins 'getter' benchmark (Vc AoS)\n" + std::cout << "-------------------------------------------\n" + << "Algebra-Plugins 'getter' benchmark (Vc AoS)\n" << "-------------------------------------------\n\n" << cfg; // // Register all benchmarks // - ::benchmark::RegisterBenchmark((v_phi_s.name() + "_single").c_str(), v_phi_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_phi_d.name() + "_double").c_str(), v_phi_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_theta_s.name() + "_single").c_str(), - v_theta_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_theta_d.name() + "_double").c_str(), - v_theta_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_perp_s.name() + "_single").c_str(), - v_perp_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_perp_d.name() + "_double").c_str(), - v_perp_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_norm_s.name() + "_single").c_str(), - v_norm_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_norm_d.name() + "_double").c_str(), - v_norm_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_eta_s.name() + "_single").c_str(), v_eta_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_eta_d.name() + "_double").c_str(), v_eta_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); + 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"); ::benchmark::Initialize(&argc, argv); ::benchmark::RunSpecifiedBenchmarks(); diff --git a/benchmarks/vc_aos/vc_aos_transform3.cpp b/benchmarks/vc_aos/vc_aos_transform3.cpp index d7a2bcee..021a2a6e 100644 --- a/benchmarks/vc_aos/vc_aos_transform3.cpp +++ b/benchmarks/vc_aos/vc_aos_transform3.cpp @@ -1,13 +1,14 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2024 CERN for the benefit 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_vc.hpp" +#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 @@ -18,32 +19,25 @@ using namespace algebra; /// Run vector benchmarks int main(int argc, char** argv) { - constexpr std::size_t n_samples{160000}; - // // Prepare benchmarks // algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(n_samples).n_warmup( - static_cast(0.1 * cfg.n_samples())); - cfg.do_sleep(false); + cfg.n_samples(100000); - transform3_bm> v_trf_s{cfg}; - transform3_bm> v_trf_d{cfg}; + using trf_f_t = transform3_bm>; + using trf_d_t = transform3_bm>; - std::cout << "Algebra-Plugins 'transform3' benchmark (Vc AoS)\n" + std::cout << "-------------------------------------------\n" + << "Algebra-Plugins 'transform3' benchmark (Vc AoS)\n" << "-------------------------------------------\n\n" << cfg; // // Register all benchmarks // - ::benchmark::RegisterBenchmark((v_trf_s.name() + "_single").c_str(), v_trf_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_trf_d.name() + "_double").c_str(), v_trf_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); + algebra::register_benchmark(cfg, "_single"); + algebra::register_benchmark(cfg, "_double"); ::benchmark::Initialize(&argc, argv); ::benchmark::RunSpecifiedBenchmarks(); diff --git a/benchmarks/vc_aos/vc_aos_vector.cpp b/benchmarks/vc_aos/vc_aos_vector.cpp index 92b78b99..39f0e028 100644 --- a/benchmarks/vc_aos/vc_aos_vector.cpp +++ b/benchmarks/vc_aos/vc_aos_vector.cpp @@ -1,13 +1,14 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2024 CERN for the benefit 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_vc.hpp" +#include "algebra/vc_aos.hpp" #include "benchmark/common/benchmark_vector.hpp" +#include "benchmark/common/register_benchmark.hpp" #include "benchmark/vc_aos/data_generator.hpp" // Benchmark include @@ -18,70 +19,45 @@ using namespace algebra; /// Run vector benchmarks int main(int argc, char** argv) { - constexpr std::size_t n_samples{160000}; - // // Prepare benchmarks // algebra::benchmark_base::configuration cfg{}; - cfg.n_samples(n_samples).n_warmup( - static_cast(0.1 * cfg.n_samples())); - cfg.do_sleep(false); + cfg.n_samples(100000); - vector_binaryOP_bm v_add_s{cfg}; - vector_binaryOP_bm v_sub_s{cfg}; - vector_binaryOP_bm v_dot_s{cfg}; - vector_binaryOP_bm v_cross_s{cfg}; - vector_unaryOP_bm v_normalize_s{cfg}; + 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; - vector_binaryOP_bm v_add_d{cfg}; - vector_binaryOP_bm v_sub_d{cfg}; - vector_binaryOP_bm v_dot_d{cfg}; - vector_binaryOP_bm v_cross_d{cfg}; - vector_unaryOP_bm v_normalize_d{ - cfg}; + 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 << "Algebra-Plugins 'vector' benchmark (Vc SoA)\n" + std::cout << "-------------------------------------------\n" + << "Algebra-Plugins 'vector' benchmark (Vc SoA)\n" << "-------------------------------------------\n\n" << cfg; // // Register all benchmarks // - ::benchmark::RegisterBenchmark((v_add_s.name() + "_single").c_str(), v_add_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_add_d.name() + "_double").c_str(), v_add_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_sub_s.name() + "_single").c_str(), v_sub_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_sub_d.name() + "_double").c_str(), v_sub_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_dot_s.name() + "_single").c_str(), v_dot_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_dot_d.name() + "_double").c_str(), v_dot_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_cross_s.name() + "_single").c_str(), - v_cross_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_cross_d.name() + "_double").c_str(), - v_cross_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_normalize_s.name() + "_single").c_str(), - v_normalize_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_normalize_d.name() + "_double").c_str(), - v_normalize_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); + 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"); ::benchmark::Initialize(&argc, argv); ::benchmark::RunSpecifiedBenchmarks(); diff --git a/benchmarks/vc_soa/vc_soa_getter.cpp b/benchmarks/vc_soa/vc_soa_getter.cpp index 72c6e72f..28a2ead1 100644 --- a/benchmarks/vc_soa/vc_soa_getter.cpp +++ b/benchmarks/vc_soa/vc_soa_getter.cpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2024 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,6 +8,7 @@ // Project include(s) #include "algebra/vc_soa.hpp" #include "benchmark/common/benchmark_getter.hpp" +#include "benchmark/common/register_benchmark.hpp" #include "benchmark/vc_soa/data_generator.hpp" // Benchmark include @@ -21,7 +22,7 @@ using namespace algebra; /// Run vector benchmarks int main(int argc, char** argv) { - constexpr std::size_t n_samples{160000}; + constexpr std::size_t n_samples{100000}; // // Prepare benchmarks @@ -29,28 +30,26 @@ int main(int argc, char** argv) { 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) - .n_warmup(static_cast(0.1 * cfg_s.n_samples())); - cfg_s.do_sleep(false); + 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) - .n_warmup(static_cast(0.1 * cfg_d.n_samples())); + cfg_d.n_samples(n_samples / Vc::double_v::Size); - vector_unaryOP_bm v_phi_s{cfg_s}; - vector_unaryOP_bm v_theta_s{cfg_s}; - vector_unaryOP_bm v_perp_s{cfg_s}; - vector_unaryOP_bm v_norm_s{cfg_s}; - vector_unaryOP_bm v_eta_s{cfg_s}; + 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; - vector_unaryOP_bm v_phi_d{cfg_d}; - vector_unaryOP_bm v_theta_d{cfg_d}; - vector_unaryOP_bm v_perp_d{cfg_d}; - vector_unaryOP_bm v_norm_d{cfg_d}; - vector_unaryOP_bm v_eta_d{cfg_d}; + 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; - std::cout << "Algebra-Plugins 'getter' benchmark (Vc SoA)\n" + std::cout << "-------------------------------------------\n" + << "Algebra-Plugins 'getter' benchmark (Vc SoA)\n" << "-------------------------------------------\n\n" << "(single)\n" << cfg_s << "(double)\n" @@ -59,42 +58,16 @@ int main(int argc, char** argv) { // // Register all benchmarks // - ::benchmark::RegisterBenchmark((v_phi_s.name() + "_single").c_str(), v_phi_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_phi_d.name() + "_double").c_str(), v_phi_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_theta_s.name() + "_single").c_str(), - v_theta_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_theta_d.name() + "_double").c_str(), - v_theta_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_perp_s.name() + "_single").c_str(), - v_perp_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_perp_d.name() + "_double").c_str(), - v_perp_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_norm_s.name() + "_single").c_str(), - v_norm_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_norm_d.name() + "_double").c_str(), - v_norm_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_eta_s.name() + "_single").c_str(), v_eta_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_eta_d.name() + "_double").c_str(), v_eta_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); + 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(); diff --git a/benchmarks/vc_soa/vc_soa_transform3.cpp b/benchmarks/vc_soa/vc_soa_transform3.cpp index 79191685..1abe605d 100644 --- a/benchmarks/vc_soa/vc_soa_transform3.cpp +++ b/benchmarks/vc_soa/vc_soa_transform3.cpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2024 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,6 +8,7 @@ // Project include(s) #include "algebra/vc_soa.hpp" #include "benchmark/common/benchmark_transform3.hpp" +#include "benchmark/common/register_benchmark.hpp" #include "benchmark/vc_soa/data_generator.hpp" // Benchmark include @@ -18,7 +19,7 @@ using namespace algebra; /// Run vector benchmarks int main(int argc, char** argv) { - constexpr std::size_t n_samples{160000}; + constexpr std::size_t n_samples{100000}; // // Prepare benchmarks @@ -26,19 +27,17 @@ int main(int argc, char** argv) { 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) - .n_warmup(static_cast(0.1 * cfg_s.n_samples())); - cfg_s.do_sleep(false); + 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) - .n_warmup(static_cast(0.1 * cfg_d.n_samples())); + cfg_d.n_samples(n_samples / Vc::double_v::Size); - transform3_bm> v_trf_s{cfg_s}; - transform3_bm> v_trf_d{cfg_d}; + using trf_f_t = transform3_bm>; + using trf_d_t = transform3_bm>; - std::cout << "Algebra-Plugins 'transform3' benchmark (Vc SoA)\n" + std::cout << "-------------------------------------------\n" + << "Algebra-Plugins 'transform3' benchmark (Vc SoA)\n" << "-----------------------------------------------\n\n" << "(single)\n" << cfg_s << "(double)\n" @@ -47,14 +46,10 @@ int main(int argc, char** argv) { // // Register all benchmarks // - ::benchmark::RegisterBenchmark((v_trf_s.name() + "_single").c_str(), v_trf_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_trf_d.name() + "_double").c_str(), v_trf_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); + algebra::register_benchmark(cfg_s, "_single"); + algebra::register_benchmark(cfg_d, "_double"); ::benchmark::Initialize(&argc, argv); ::benchmark::RunSpecifiedBenchmarks(); ::benchmark::Shutdown(); -} \ No newline at end of file +} diff --git a/benchmarks/vc_soa/vc_soa_vector.cpp b/benchmarks/vc_soa/vc_soa_vector.cpp index ac5694a7..abdd6413 100644 --- a/benchmarks/vc_soa/vc_soa_vector.cpp +++ b/benchmarks/vc_soa/vc_soa_vector.cpp @@ -1,6 +1,6 @@ /** Algebra plugins library, part of the ACTS project * - * (c) 2023 CERN for the benefit of the ACTS project + * (c) 2023-2024 CERN for the benefit of the ACTS project * * Mozilla Public License Version 2.0 */ @@ -8,6 +8,7 @@ // 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 @@ -18,7 +19,7 @@ using namespace algebra; /// Run vector benchmarks int main(int argc, char** argv) { - constexpr std::size_t n_samples{160000}; + constexpr std::size_t n_samples{100000}; // // Prepare benchmarks @@ -26,30 +27,29 @@ int main(int argc, char** argv) { 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) - .n_warmup(static_cast(0.1 * cfg_s.n_samples())); - cfg_s.do_sleep(false); + 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) - .n_warmup(static_cast(0.1 * cfg_d.n_samples())); + cfg_d.n_samples(n_samples / Vc::double_v::Size); - vector_binaryOP_bm v_add_s{cfg_s}; - vector_binaryOP_bm v_sub_s{cfg_s}; - vector_binaryOP_bm v_dot_s{cfg_s}; - vector_binaryOP_bm v_cross_s{cfg_s}; - vector_unaryOP_bm v_normalize_s{ - cfg_s}; + 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; - vector_binaryOP_bm v_add_d{cfg_d}; - vector_binaryOP_bm v_sub_d{cfg_d}; - vector_binaryOP_bm v_dot_d{cfg_d}; - vector_binaryOP_bm v_cross_d{cfg_d}; - vector_unaryOP_bm v_normalize_d{ - cfg_d}; + 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 << "Algebra-Plugins 'vector' benchmark (Vc SoA)\n" + std::cout << "-------------------------------------------\n" + << "Algebra-Plugins 'vector' benchmark (Vc SoA)\n" << "-------------------------------------------\n\n" << "(single)\n" << cfg_s << "(double)\n" @@ -58,42 +58,18 @@ int main(int argc, char** argv) { // // Register all benchmarks // - ::benchmark::RegisterBenchmark((v_add_s.name() + "_single").c_str(), v_add_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_add_d.name() + "_double").c_str(), v_add_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_sub_s.name() + "_single").c_str(), v_sub_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_sub_d.name() + "_double").c_str(), v_sub_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_dot_s.name() + "_single").c_str(), v_dot_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_dot_d.name() + "_double").c_str(), v_dot_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_cross_s.name() + "_single").c_str(), - v_cross_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_cross_d.name() + "_double").c_str(), - v_cross_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_normalize_s.name() + "_single").c_str(), - v_normalize_s) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); - ::benchmark::RegisterBenchmark((v_normalize_d.name() + "_double").c_str(), - v_normalize_d) - ->MeasureProcessCPUTime() - ->ThreadPerCpu(); + 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(); -} \ No newline at end of file +} diff --git a/frontend/CMakeLists.txt b/frontend/CMakeLists.txt index e107071d..268ffb92 100644 --- a/frontend/CMakeLists.txt +++ b/frontend/CMakeLists.txt @@ -18,8 +18,8 @@ if( ALGEBRA_PLUGINS_INCLUDE_SMATRIX ) endif() if( ALGEBRA_PLUGINS_INCLUDE_VC ) + add_subdirectory( vc_aos ) add_subdirectory( vc_cmath ) - add_subdirectory( vc_vc ) if( NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang" ) add_subdirectory( vc_soa ) endif() diff --git a/frontend/vc_vc/CMakeLists.txt b/frontend/vc_aos/CMakeLists.txt similarity index 53% rename from frontend/vc_vc/CMakeLists.txt rename to frontend/vc_aos/CMakeLists.txt index c2f269da..83a2b053 100644 --- a/frontend/vc_vc/CMakeLists.txt +++ b/frontend/vc_aos/CMakeLists.txt @@ -5,10 +5,10 @@ # Mozilla Public License Version 2.0 # Set up the library. -algebra_add_library( algebra_vc_vc vc_vc - "include/algebra/vc_vc.hpp" ) -target_link_libraries( algebra_vc_vc +algebra_add_library( algebra_vc_aos vc_aos + "include/algebra/vc_aos.hpp" ) +target_link_libraries( algebra_vc_aos INTERFACE algebra::common algebra::vc_storage algebra::cmath_math - algebra::vc_math ) -algebra_test_public_headers( algebra_vc_vc - "algebra/vc_vc.hpp" ) + algebra::vc_aos_math ) +algebra_test_public_headers( algebra_vc_aos + "algebra/vc_aos.hpp" ) diff --git a/frontend/vc_aos/include/algebra/vc_aos.hpp b/frontend/vc_aos/include/algebra/vc_aos.hpp new file mode 100644 index 00000000..4245f9d1 --- /dev/null +++ b/frontend/vc_aos/include/algebra/vc_aos.hpp @@ -0,0 +1,123 @@ +/** Algebra plugins library, part of the ACTS project + * + * (c) 2020-2024 CERN for the benefit of the ACTS project + * + * Mozilla Public License Version 2.0 + */ + +#pragma once + +// Project include(s). +#include "algebra/math/cmath.hpp" +#include "algebra/math/vc_aos.hpp" +#include "algebra/storage/vc_aos.hpp" + +// System include(s). +#include +#include + +namespace algebra { +namespace vc_aos { + +/// @name Vc based transforms on @c algebra::vc_aos::storage_type +/// @{ + +template +using transform3 = math::transform3, point2>; + +/// @} + +} // namespace vc_aos + +namespace getter { + +/// @name Getter functions on @c algebra::vc_aos types +/// @{ + +using vc_aos::math::eta; +using vc_aos::math::norm; +using vc_aos::math::perp; +using vc_aos::math::phi; +using vc_aos::math::theta; + +/// @} + +/// Function extracting a slice from the matrix used by +/// @c algebra::vc_aos::transform3 +template = true> +ALGEBRA_HOST_DEVICE inline vc_aos::vector3 vector( + const vc_aos::transform3::matrix44& m, + std::size_t +#ifndef NDEBUG + row +#endif // not NDEBUG + , + std::size_t col) { + + assert(row == 0); + assert(col < 4); + switch (col) { + case 0: + return m.x; + case 1: + return m.y; + case 2: + return m.z; + case 3: + return m.t; + default: + return m.x; + } +} + +/// Function extracting a slice from the matrix used by +/// @c algebra::vc_aos::transform3 +template = true> +ALGEBRA_HOST_DEVICE inline vc_aos::vector3 vector( + const vc_aos::transform3::matrix44& m, + std::size_t +#ifndef NDEBUG + row +#endif // not NDEBUG + , + std::size_t col) { + + assert(row == 0); + assert(col < 4); + switch (col) { + case 0: + return m.x; + case 1: + return m.y; + case 2: + return m.z; + case 3: + return m.t; + default: + return m.x; + } +} + +/// @name Getter functions on @c algebra::vc_aos::matrix_type +/// @{ + +using cmath::element; + +/// @} + +} // namespace getter + +namespace vector { + +/// @name Vector functions on @c algebra::vc_aos types +/// @{ + +using vc_aos::math::cross; +using vc_aos::math::dot; +using vc_aos::math::normalize; + +/// @} + +} // namespace vector + +} // namespace algebra diff --git a/frontend/vc_cmath/CMakeLists.txt b/frontend/vc_cmath/CMakeLists.txt index caff5f73..9c0245af 100644 --- a/frontend/vc_cmath/CMakeLists.txt +++ b/frontend/vc_cmath/CMakeLists.txt @@ -9,6 +9,6 @@ algebra_add_library( algebra_vc_cmath vc_cmath "include/algebra/vc_cmath.hpp" ) target_link_libraries( algebra_vc_cmath INTERFACE algebra::common algebra::vc_storage algebra::cmath_math - algebra::vc_math ) + algebra::vc_aos_math ) algebra_test_public_headers( algebra_vc_cmath "algebra/vc_cmath.hpp" ) diff --git a/frontend/vc_cmath/include/algebra/vc_cmath.hpp b/frontend/vc_cmath/include/algebra/vc_cmath.hpp index 778ef946..4daac5a2 100644 --- a/frontend/vc_cmath/include/algebra/vc_cmath.hpp +++ b/frontend/vc_cmath/include/algebra/vc_cmath.hpp @@ -9,10 +9,10 @@ // Project include(s). #include "algebra/math/cmath.hpp" -#include "algebra/math/vc.hpp" -#include "algebra/storage/vc.hpp" +#include "algebra/math/vc_aos.hpp" +#include "algebra/storage/vc_aos.hpp" -/// @name Operators on @c algebra::vc types +/// @name Operators on @c algebra::vc_aos types /// @{ using algebra::cmath::operator*; @@ -24,7 +24,7 @@ using algebra::cmath::operator+; namespace algebra { namespace getter { -/// @name Getter functions on @c algebra::vc types +/// @name Getter functions on @c algebra::vc_aos types /// @{ using cmath::eta; @@ -33,27 +33,27 @@ using cmath::perp; using cmath::phi; using cmath::theta; -using vc::math::eta; -using vc::math::norm; -using vc::math::perp; -using vc::math::phi; -using vc::math::theta; +using vc_aos::math::eta; +using vc_aos::math::norm; +using vc_aos::math::perp; +using vc_aos::math::phi; +using vc_aos::math::theta; /// @| /// Function extracting a slice from the matrix used by -/// @c algebra::vc::transform3 +/// @c algebra::vc_aos::transform3 template ALGEBRA_HOST_DEVICE inline Vc::array vector( - const vc::matrix_type& m, std::size_t row, + const vc_aos::matrix_type& m, std::size_t row, std::size_t col) { return cmath::vector_getter>()(m, row, col); } -/// @name Getter functions on @c algebra::vc::matrix_type +/// @name Getter functions on @c algebra::vc_aos::matrix_type /// @{ using cmath::element; @@ -64,16 +64,16 @@ using cmath::element; namespace vector { -/// @name Vector functions on @c algebra::vc::storage_type +/// @name Vector functions on @c algebra::vc_aos::storage_type /// @{ using cmath::cross; using cmath::dot; using cmath::normalize; -using vc::math::cross; -using vc::math::dot; -using vc::math::normalize; +using vc_aos::math::cross; +using vc_aos::math::dot; +using vc_aos::math::normalize; /// @} @@ -81,13 +81,13 @@ using vc::math::normalize; namespace matrix { -using size_type = vc::size_type; +using size_type = vc_aos::size_type; template using array_type = Vc::array; template -using matrix_type = vc::matrix_type; +using matrix_type = vc_aos::matrix_type; template using element_getter = cmath::element_getter; @@ -168,7 +168,7 @@ using preset0 = } // namespace matrix -namespace vc { +namespace vc_aos { /// @name cmath based transforms on @c algebra::matrix::actor /// @{ @@ -182,6 +182,6 @@ using transform3 = cmath::transform3>; /// @} -} // namespace vc +} // namespace vc_aos } // namespace algebra diff --git a/frontend/vc_vc/include/algebra/vc_vc.hpp b/frontend/vc_vc/include/algebra/vc_vc.hpp deleted file mode 100644 index aab5ae3a..00000000 --- a/frontend/vc_vc/include/algebra/vc_vc.hpp +++ /dev/null @@ -1,134 +0,0 @@ -/** Algebra plugins library, part of the ACTS project - * - * (c) 2020-2024 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -#pragma once - -// Project include(s). -#include "algebra/math/cmath.hpp" -#include "algebra/math/vc.hpp" -#include "algebra/storage/vc.hpp" - -// System include(s). -#include -#include - -namespace algebra { -namespace vc { - -/// @name Vc based transforms on @c algebra::vc::storage_type -/// @{ - -template -using transform3 = math::transform3, point2>; - -/// @} - -} // namespace vc - -namespace getter { - -/// @name Getter functions on @c algebra::vc types -/// @{ - -using vc::math::eta; -using vc::math::norm; -using vc::math::perp; -using vc::math::phi; -using vc::math::theta; - -/// @} - -/// Function extracting a slice from the matrix used by -/// @c algebra::vc::transform3 -template = true> -ALGEBRA_HOST_DEVICE inline vc::vector3 vector( - const vc::transform3::matrix44& m, - std::size_t -#ifndef NDEBUG - row -#endif // not NDEBUG - , - std::size_t col) { - - assert(row == 0); - assert(col < 4); - switch (col) { - case 0: - return {m.x[0], m.x[1], m.x[2]}; - case 1: - return {m.y[0], m.y[1], m.y[2]}; - case 2: - return {m.z[0], m.z[1], m.z[2]}; - case 3: - return {m.t[0], m.t[1], m.t[2]}; - default: - return {m.x[0], m.x[1], m.x[2]}; - } -} - -/// Function extracting a slice from the matrix used by -/// @c algebra::vc::transform3 -template = true> -ALGEBRA_HOST_DEVICE inline vc::vector3 vector( - const vc::transform3::matrix44& m, - std::size_t -#ifndef NDEBUG - row -#endif // not NDEBUG - , - std::size_t col) { - - assert(row == 0); - assert(col < 4); - switch (col) { - case 0: - return {m.x[0], m.x[1], m.x[2]}; - case 1: - return {m.y[0], m.y[1], m.y[2]}; - case 2: - return {m.z[0], m.z[1], m.z[2]}; - case 3: - return {m.t[0], m.t[1], m.t[2]}; - default: - return {m.x[0], m.x[1], m.x[2]}; - } -} - -/// @name Getter functions on @c algebra::vc::matrix_type -/// @{ - -using cmath::element; - -/// @} - -} // namespace getter - -namespace vector { - -/// @name Vector functions on @c algebra::vc types -/// @{ - -using vc::math::cross; -using vc::math::dot; -using vc::math::normalize; - -/// @} - -} // namespace vector - -namespace matrix { - -using size_type = vc::size_type; - -template -using array_type = vc::storage_type; - -template -using matrix_type = vc::matrix_type; - -} // namespace matrix -} // namespace algebra diff --git a/math/CMakeLists.txt b/math/CMakeLists.txt index 54ea4795..42c480ab 100644 --- a/math/CMakeLists.txt +++ b/math/CMakeLists.txt @@ -17,7 +17,7 @@ if( ALGEBRA_PLUGINS_INCLUDE_SMATRIX ) add_subdirectory( smatrix ) endif() if( ALGEBRA_PLUGINS_INCLUDE_VC ) - add_subdirectory( vc ) + add_subdirectory( vc_aos ) if( NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang" ) add_subdirectory( vc_soa ) endif() diff --git a/math/vc/CMakeLists.txt b/math/vc/CMakeLists.txt deleted file mode 100644 index 20ab90e8..00000000 --- a/math/vc/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Algebra plugins library, part of the ACTS project (R&D line) -# -# (c) 2021-2023 CERN for the benefit of the ACTS project -# -# Mozilla Public License Version 2.0 - -# Set up the library. -algebra_add_library( algebra_vc_math vc_math - "include/algebra/math/vc.hpp" - "include/algebra/math/impl/vc_getter.hpp" - "include/algebra/math/impl/vc_transform3.hpp" - "include/algebra/math/impl/vc_vector.hpp" ) -target_link_libraries( algebra_vc_math - INTERFACE Vc::Vc algebra::common algebra::common_math algebra::vc_storage - algebra::cmath_math ) -algebra_test_public_headers( algebra_vc_math - "algebra/math/vc.hpp" ) diff --git a/math/vc_aos/CMakeLists.txt b/math/vc_aos/CMakeLists.txt new file mode 100644 index 00000000..64a723c7 --- /dev/null +++ b/math/vc_aos/CMakeLists.txt @@ -0,0 +1,17 @@ +# Algebra plugins library, part of the ACTS project (R&D line) +# +# (c) 2021-2023 CERN for the benefit of the ACTS project +# +# Mozilla Public License Version 2.0 + +# Set up the library. +algebra_add_library( algebra_vc_aos_math vc_aos_math + "include/algebra/math/vc_aos.hpp" + "include/algebra/math/impl/vc_aos_getter.hpp" + "include/algebra/math/impl/vc_aos_transform3.hpp" + "include/algebra/math/impl/vc_aos_vector.hpp" ) +target_link_libraries( algebra_vc_aos_math + INTERFACE Vc::Vc algebra::common algebra::common_math algebra::vc_storage + algebra::cmath_math ) +algebra_test_public_headers( algebra_vc_aos_math + "algebra/math/vc_aos.hpp" ) diff --git a/math/vc/include/algebra/math/impl/vc_getter.hpp b/math/vc_aos/include/algebra/math/impl/vc_aos_getter.hpp similarity index 95% rename from math/vc/include/algebra/math/impl/vc_getter.hpp rename to math/vc_aos/include/algebra/math/impl/vc_aos_getter.hpp index ac28f527..e335e0e8 100644 --- a/math/vc/include/algebra/math/impl/vc_getter.hpp +++ b/math/vc_aos/include/algebra/math/impl/vc_aos_getter.hpp @@ -9,7 +9,7 @@ // Project include(s). #include "algebra/math/common.hpp" -#include "algebra/math/impl/vc_vector.hpp" +#include "algebra/math/impl/vc_aos_vector.hpp" #include "algebra/qualifiers.hpp" #include "algebra/storage/vector.hpp" @@ -22,7 +22,7 @@ #pragma warning(pop) #endif // MSVC -namespace algebra::vc::math { +namespace algebra::vc_aos::math { /// This method retrieves phi from a vector, vector base with rows >= 2 /// @@ -85,4 +85,4 @@ ALGEBRA_HOST_DEVICE inline auto eta(const vector_type &v) noexcept { return algebra::math::atanh(v[2] / norm(v)); } -} // namespace algebra::vc::math +} // namespace algebra::vc_aos::math diff --git a/math/vc/include/algebra/math/impl/vc_transform3.hpp b/math/vc_aos/include/algebra/math/impl/vc_aos_transform3.hpp similarity index 89% rename from math/vc/include/algebra/math/impl/vc_transform3.hpp rename to math/vc_aos/include/algebra/math/impl/vc_aos_transform3.hpp index 1ef3b000..d40f8ff8 100644 --- a/math/vc/include/algebra/math/impl/vc_transform3.hpp +++ b/math/vc_aos/include/algebra/math/impl/vc_aos_transform3.hpp @@ -9,7 +9,7 @@ // Project include(s). #include "algebra/math/cmath.hpp" -#include "algebra/math/impl/vc_vector.hpp" +#include "algebra/math/impl/vc_aos_vector.hpp" #include "algebra/qualifiers.hpp" // Vc include(s). @@ -24,11 +24,11 @@ // System include(s). #include -namespace algebra::vc::math { +namespace algebra::vc_aos::math { namespace internal { -/// 4x4 matrix type used by @c algebra::vc::math::transform3 +/// 4x4 matrix type used by @c algebra::vc_aos::math::transform3 template struct matrix44 { @@ -135,10 +135,14 @@ struct transform3 { ALGEBRA_HOST_DEVICE transform3(const vector3 &t, const vector3 &x, const vector3 &y, const vector3 &z, bool get_inverse = true) { - _data.x = {x[0], x[1], x[2], 0.f}; - _data.y = {y[0], y[1], y[2], 0.f}; - _data.z = {z[0], z[1], z[2], 0.f}; - _data.t = {t[0], t[1], t[2], 1.f}; + _data.x = x; + _data.y = y; + _data.z = z; + _data.t = t; + _data.x[3] = 0.f; + _data.y[3] = 0.f; + _data.z[3] = 0.f; + _data.t[3] = 1.f; if (get_inverse) { _data_inv = invert(_data); @@ -166,7 +170,8 @@ struct transform3 { _data.x = {1.f, 0.f, 0.f, 0.f}; _data.y = {0.f, 1.f, 0.f, 0.f}; _data.z = {0.f, 0.f, 1.f, 0.f}; - _data.t = {t[0], t[1], t[2], 1.f}; + _data.t = t; + _data.t[3] = 1.f; _data_inv = invert(_data); } @@ -320,8 +325,9 @@ struct transform3 { /// /// @param m is the rotation matrix /// @param v is the vector to be rotated - ALGEBRA_HOST_DEVICE - static inline auto rotate(const matrix44 &m, const vector3 &v) { + template + ALGEBRA_HOST_DEVICE static inline auto rotate(const matrix44 &m, + const vector3_type &v) { return m.x * v[0] + m.y * v[1] + m.z * v[2]; } @@ -339,9 +345,21 @@ struct transform3 { return submatrix; } - /// This method retrieves the translation of a transform + /// This method retrieves x axis + ALGEBRA_HOST_DEVICE + inline const auto &x() const { return _data.x; } + + /// This method retrieves y axis + ALGEBRA_HOST_DEVICE + inline const auto &y() const { return _data.y; } + + /// This method retrieves z axis + ALGEBRA_HOST_DEVICE + inline const auto &z() const { return _data.z; } + + /// This method retrieves the translation ALGEBRA_HOST_DEVICE - inline point3 translation() const { return _data.t; } + inline const auto &translation() const { return _data.t; } /// This method retrieves the 4x4 matrix of a transform ALGEBRA_HOST_DEVICE @@ -359,7 +377,8 @@ struct transform3 { /// @param v is the point to be transformed /// /// @return a global point - ALGEBRA_HOST_DEVICE inline auto point_to_global(const point3 &p) const { + template + ALGEBRA_HOST_DEVICE inline auto point_to_global(const point3_type &p) const { return _data.x * p[0] + _data.y * p[1] + _data.z * p[2] + _data.t; } @@ -372,7 +391,8 @@ struct transform3 { /// @param v is the point to be transformed /// /// @return a local point - ALGEBRA_HOST_DEVICE inline auto point_to_local(const point3 &p) const { + template + ALGEBRA_HOST_DEVICE inline auto point_to_local(const point3_type &p) const { return _data_inv.x * p[0] + _data_inv.y * p[1] + _data_inv.z * p[2] + _data_inv.t; @@ -381,12 +401,14 @@ struct transform3 { /// This method transform from a vector from the local 3D cartesian frame /// to the global 3D cartesian frame /// - /// @tparam vector_type 3D vector + /// @tparam vector3_type 3D vector /// /// @param v is the vector to be transformed /// /// @return a vector in global coordinates - ALGEBRA_HOST_DEVICE inline auto vector_to_global(const vector3 &v) const { + template + ALGEBRA_HOST_DEVICE inline auto vector_to_global( + const vector3_type &v) const { return rotate(_data, v); } @@ -394,15 +416,16 @@ struct transform3 { /// This method transform from a vector from the global 3D cartesian frame /// into the local 3D cartesian frame /// - /// @tparam vector_type 3D vector + /// @tparam vector3_type 3D vector /// /// @param v is the vector to be transformed /// /// @return a vector in global coordinates - ALGEBRA_HOST_DEVICE inline auto vector_to_local(const vector3 &v) const { + template + ALGEBRA_HOST_DEVICE inline auto vector_to_local(const vector3_type &v) const { return rotate(_data_inv, v); } }; // struct transform3 -} // namespace algebra::vc::math +} // namespace algebra::vc_aos::math diff --git a/math/vc/include/algebra/math/impl/vc_vector.hpp b/math/vc_aos/include/algebra/math/impl/vc_aos_vector.hpp similarity index 97% rename from math/vc/include/algebra/math/impl/vc_vector.hpp rename to math/vc_aos/include/algebra/math/impl/vc_aos_vector.hpp index 967717ac..e68d8bce 100644 --- a/math/vc/include/algebra/math/impl/vc_vector.hpp +++ b/math/vc_aos/include/algebra/math/impl/vc_aos_vector.hpp @@ -25,7 +25,7 @@ #include #include -namespace algebra::vc::math { +namespace algebra::vc_aos::math { /// Dot product between two input vectors /// @@ -87,4 +87,4 @@ ALGEBRA_HOST_DEVICE inline auto cross(const vector_type1 &a, a[0] * b[1] - b[0] * a[1], 0.f}; } -} // namespace algebra::vc::math +} // namespace algebra::vc_aos::math diff --git a/math/vc/include/algebra/math/vc.hpp b/math/vc_aos/include/algebra/math/vc_aos.hpp similarity index 57% rename from math/vc/include/algebra/math/vc.hpp rename to math/vc_aos/include/algebra/math/vc_aos.hpp index d07ee0a5..26550fbf 100644 --- a/math/vc/include/algebra/math/vc.hpp +++ b/math/vc_aos/include/algebra/math/vc_aos.hpp @@ -8,6 +8,6 @@ #pragma once // Project include(s). -#include "algebra/math/impl/vc_getter.hpp" -#include "algebra/math/impl/vc_transform3.hpp" -#include "algebra/math/impl/vc_vector.hpp" +#include "algebra/math/impl/vc_aos_getter.hpp" +#include "algebra/math/impl/vc_aos_transform3.hpp" +#include "algebra/math/impl/vc_aos_vector.hpp" diff --git a/math/vc_soa/include/algebra/math/impl/vc_soa_transform3.hpp b/math/vc_soa/include/algebra/math/impl/vc_soa_transform3.hpp index 70c2cb70..aee22c02 100644 --- a/math/vc_soa/include/algebra/math/impl/vc_soa_transform3.hpp +++ b/math/vc_soa/include/algebra/math/impl/vc_soa_transform3.hpp @@ -190,6 +190,18 @@ struct transform3 { return m.x * v[0] + m.y * v[1] + m.z * v[2]; } + /// This method retrieves x axis + ALGEBRA_HOST_DEVICE + inline const auto &x() const { return _data.x; } + + /// This method retrieves y axis + ALGEBRA_HOST_DEVICE + inline const auto &y() const { return _data.y; } + + /// This method retrieves z axis + ALGEBRA_HOST_DEVICE + inline const auto &z() const { return _data.z; } + /// @returns the translation of the transform ALGEBRA_HOST_DEVICE inline point3 translation() const { return _data.t; } diff --git a/storage/CMakeLists.txt b/storage/CMakeLists.txt index 6879addc..019ff865 100644 --- a/storage/CMakeLists.txt +++ b/storage/CMakeLists.txt @@ -14,7 +14,7 @@ if( ALGEBRA_PLUGINS_INCLUDE_SMATRIX ) add_subdirectory( smatrix ) endif() if( ALGEBRA_PLUGINS_INCLUDE_VC ) - add_subdirectory( vc ) + add_subdirectory( vc_aos ) if( NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang" ) add_subdirectory( vc_soa ) endif() diff --git a/storage/vc/CMakeLists.txt b/storage/vc_aos/CMakeLists.txt similarity index 75% rename from storage/vc/CMakeLists.txt rename to storage/vc_aos/CMakeLists.txt index 628c5aeb..fe278c62 100644 --- a/storage/vc/CMakeLists.txt +++ b/storage/vc_aos/CMakeLists.txt @@ -6,9 +6,8 @@ # Set up the library. algebra_add_library( algebra_vc_storage vc_storage - "include/algebra/storage/vc.hpp" - "include/algebra/storage/impl/vc_array4_wrapper.hpp" ) + "include/algebra/storage/vc_aos.hpp" ) target_link_libraries( algebra_vc_storage INTERFACE algebra::common algebra::common_storage Vc::Vc ) algebra_test_public_headers( algebra_vc_storage - "algebra/storage/vc.hpp" ) + "algebra/storage/vc_aos.hpp" ) diff --git a/storage/vc/include/algebra/storage/vc.hpp b/storage/vc_aos/include/algebra/storage/vc_aos.hpp similarity index 96% rename from storage/vc/include/algebra/storage/vc.hpp rename to storage/vc_aos/include/algebra/storage/vc_aos.hpp index 2b1d7a14..3c9a2061 100644 --- a/storage/vc/include/algebra/storage/vc.hpp +++ b/storage/vc_aos/include/algebra/storage/vc_aos.hpp @@ -23,7 +23,7 @@ #pragma warning(pop) #endif // MSVC -namespace algebra::vc { +namespace algebra::vc_aos { /// size type for Vc storage model using size_type = std::size_t; @@ -59,4 +59,4 @@ using vector6 = vector_type; template using vector8 = vector_type; -} // namespace algebra::vc +} // namespace algebra::vc_aos diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ceca2488..8b290f19 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -38,12 +38,12 @@ if( ALGEBRA_PLUGINS_INCLUDE_SMATRIX ) endif() if( ALGEBRA_PLUGINS_INCLUDE_VC ) - algebra_add_test( vc - "vc/vc_cmath.cpp" "vc/vc_vc.cpp" - LINK_LIBRARIES GTest::gtest_main algebra::tests_common - algebra::vc_cmath algebra::vc_vc ) - if( NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang" ) + algebra_add_test( vc_aos + "vc_aos/vc_cmath.cpp" "vc_aos/vc_aos.cpp" + LINK_LIBRARIES GTest::gtest_main algebra::tests_common + algebra::vc_cmath algebra::vc_aos ) + algebra_add_test( vc_soa "vc_soa/vc_soa.cpp" LINK_LIBRARIES GTest::gtest_main algebra::vc_soa ) diff --git a/tests/common/test_host_basics.hpp b/tests/common/test_host_basics.hpp index 5bc59022..619a23fb 100644 --- a/tests/common/test_host_basics.hpp +++ b/tests/common/test_host_basics.hpp @@ -62,14 +62,14 @@ TYPED_TEST_P(test_host_basics_vector, local_vectors) { ASSERT_NEAR(phi, M_PI_4, this->m_epsilon); typename TypeParam::scalar perp = algebra::getter::perp(vD); - ASSERT_NEAR(perp, std::sqrt(2.f), this->m_epsilon); + ASSERT_NEAR(perp, std::sqrt(2.), this->m_epsilon); typename TypeParam::scalar norm = algebra::getter::norm(vD); - ASSERT_NEAR(norm, std::sqrt(2.f), this->m_epsilon); + ASSERT_NEAR(norm, std::sqrt(2.), this->m_epsilon); typename TypeParam::vector2 vDnorm = algebra::vector::normalize(vD); - ASSERT_NEAR(vDnorm[0], 1.f / std::sqrt(2.f), this->m_epsilon); - ASSERT_NEAR(vDnorm[1], 1.f / std::sqrt(2.f), this->m_epsilon); + ASSERT_NEAR(vDnorm[0], 1. / std::sqrt(2.), this->m_epsilon); + ASSERT_NEAR(vDnorm[1], 1. / std::sqrt(2.), this->m_epsilon); } // This defines the vector3 test suite @@ -105,16 +105,16 @@ TYPED_TEST_P(test_host_basics_vector, vector3) { ASSERT_NEAR(phi, M_PI_4, this->m_epsilon); typename TypeParam::scalar theta = algebra::getter::theta(vD); - ASSERT_NEAR(theta, std::atan2(std::sqrt(2.f), 1.f), this->m_epsilon); + ASSERT_NEAR(theta, std::atan2(std::sqrt(2.), 1.), this->m_epsilon); typename TypeParam::scalar eta = algebra::getter::eta(vD); ASSERT_NEAR(eta, 0.65847891569137573, this->m_isclose); typename TypeParam::scalar perp = algebra::getter::perp(vD); - ASSERT_NEAR(perp, std::sqrt(2.f), this->m_epsilon); + ASSERT_NEAR(perp, std::sqrt(2.), this->m_epsilon); typename TypeParam::scalar norm = algebra::getter::norm(vD); - ASSERT_NEAR(norm, std::sqrt(3.f), this->m_epsilon); + ASSERT_NEAR(norm, std::sqrt(3.), this->m_epsilon); } // This defines the vector operation test suite @@ -124,9 +124,9 @@ TYPED_TEST_P(test_host_basics_vector, getter) { // Normalization typename TypeParam::vector3 v3n = algebra::vector::normalize(v3); - ASSERT_NEAR(v3n[0], 1.f / std::sqrt(3.f), this->m_epsilon); - ASSERT_NEAR(v3n[1], 1.f / std::sqrt(3.f), this->m_epsilon); - ASSERT_NEAR(v3n[2], 1.f / std::sqrt(3.f), this->m_epsilon); + ASSERT_NEAR(v3n[0], 1. / std::sqrt(3.), this->m_epsilon); + ASSERT_NEAR(v3n[1], 1. / std::sqrt(3.), this->m_epsilon); + ASSERT_NEAR(v3n[2], 1. / std::sqrt(3.), this->m_epsilon); // Cross product typename TypeParam::vector3 z = diff --git a/tests/vc/vc_vc.cpp b/tests/vc_aos/vc_aos.cpp similarity index 60% rename from tests/vc/vc_vc.cpp rename to tests/vc_aos/vc_aos.cpp index ca11ac28..e451569b 100644 --- a/tests/vc/vc_vc.cpp +++ b/tests/vc_aos/vc_aos.cpp @@ -6,7 +6,7 @@ */ // Project include(s). -#include "algebra/vc_vc.hpp" +#include "algebra/vc_aos.hpp" // Test include(s). #include "test_host_basics.hpp" @@ -23,9 +23,9 @@ struct test_specialisation_name { static std::string GetName(int i) { switch (i) { case 0: - return "vc_vc"; + return "vc_aos"; case 1: - return "vc_vc"; + return "vc_aos"; default: return "unknown"; } @@ -42,19 +42,21 @@ REGISTER_TYPED_TEST_SUITE_P(test_host_basics_transform, transform3, // Instantiate the test(s). typedef testing::Types< - test_types, algebra::vc::point3, - algebra::vc::vector2, algebra::vc::vector3, - algebra::vc::transform3, std::size_t, - algebra::vc::matrix_type, float>, - test_types, algebra::vc::point3, - algebra::vc::vector2, algebra::vc::vector3, - algebra::vc::transform3, std::size_t, - algebra::vc::matrix_type, double>> - vc_vc_types; + test_types, + algebra::vc_aos::point3, algebra::vc_aos::vector2, + algebra::vc_aos::vector3, + algebra::vc_aos::transform3, std::size_t, + algebra::vc_aos::matrix_type, float>, + test_types< + double, algebra::vc_aos::point2, + algebra::vc_aos::point3, algebra::vc_aos::vector2, + algebra::vc_aos::vector3, algebra::vc_aos::transform3, + std::size_t, algebra::vc_aos::matrix_type, double>> + vc_aos_types; INSTANTIATE_TYPED_TEST_SUITE_P(algebra_plugins, test_host_basics_vector, - vc_vc_types, test_specialisation_name); + vc_aos_types, test_specialisation_name); // @TODO: Implement /*INSTANTIATE_TYPED_TEST_SUITE_P(algebra_plugins, test_host_basics_matrix, array_cmath_types, test_specialisation_name);*/ INSTANTIATE_TYPED_TEST_SUITE_P(algebra_plugins, test_host_basics_transform, - vc_vc_types, test_specialisation_name); + vc_aos_types, test_specialisation_name); diff --git a/tests/vc/vc_cmath.cpp b/tests/vc_aos/vc_cmath.cpp similarity index 72% rename from tests/vc/vc_cmath.cpp rename to tests/vc_aos/vc_cmath.cpp index 4f05adbe..ae38f593 100644 --- a/tests/vc/vc_cmath.cpp +++ b/tests/vc_aos/vc_cmath.cpp @@ -41,14 +41,16 @@ matrix22); REGISTER_TYPED_TEST_SUITE_P(test_host_basics_transform, transform3, // Instantiate the test(s). typedef testing::Types< - test_types, algebra::vc::point3, - algebra::vc::vector2, algebra::vc::vector3, - algebra::vc::transform3, std::size_t, - algebra::vc::matrix_type, float>, - test_types, algebra::vc::point3, - algebra::vc::vector2, algebra::vc::vector3, - algebra::vc::transform3, std::size_t, - algebra::vc::matrix_type, double>> + test_types, + algebra::vc_aos::point3, algebra::vc_aos::vector2, + algebra::vc_aos::vector3, + algebra::vc_aos::transform3, std::size_t, + algebra::vc_aos::matrix_type, float>, + test_types< + double, algebra::vc_aos::point2, + algebra::vc_aos::point3, algebra::vc_aos::vector2, + algebra::vc_aos::vector3, algebra::vc_aos::transform3, + std::size_t, algebra::vc_aos::matrix_type, double>> vc_cmath_types; INSTANTIATE_TYPED_TEST_SUITE_P(algebra_plugins, test_host_basics_vector, vc_cmath_types, test_specialisation_name);