Skip to content

Commit

Permalink
Merge pull request #131 from niermann999/feat-generic-plugin2
Browse files Browse the repository at this point in the history
feat: generic plugin
  • Loading branch information
stephenswat authored Nov 20, 2024
2 parents d54e121 + 44706b9 commit d83f29e
Show file tree
Hide file tree
Showing 131 changed files with 3,488 additions and 3,289 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ for the R&D projects [detray](https://github.com/acts-project/detray) and

| Backend | CPU | CUDA | SYCL |
| ------------------------------------------------------------------------- | --- | ---- | ---- |
| cmath ||||
| generic ||||
| [Eigen](https://eigen.tuxfamily.org) ||||
| [SMatrix](https://root.cern.ch/doc/master/group__SMatrixGroup.html) ||||
| [VC](https://github.com/VcDevel/Vc) ||||
Expand Down
13 changes: 0 additions & 13 deletions benchmarks/array/array_getter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,6 @@ int main(int argc, char** argv) {
algebra::benchmark_base::configuration cfg{};
cfg.n_samples(100000);

using phi_f_t = vector_unaryOP_bm<array::vector3, float, bench_op::phi>;
using theta_f_t = vector_unaryOP_bm<array::vector3, float, bench_op::theta>;
using perp_f_t = vector_unaryOP_bm<array::vector3, float, bench_op::perp>;
using norm_f_t = vector_unaryOP_bm<array::vector3, float, bench_op::norm>;
using eta_f_t = vector_unaryOP_bm<array::vector3, float, bench_op::eta>;

using phi_d_t = vector_unaryOP_bm<array::vector3, double, bench_op::phi>;
using theta_d_t = vector_unaryOP_bm<array::vector3, double, bench_op::theta>;
using perp_d_t = vector_unaryOP_bm<array::vector3, double, bench_op::perp>;
using norm_d_t = vector_unaryOP_bm<array::vector3, double, bench_op::norm>;
using eta_d_t = vector_unaryOP_bm<array::vector3, double, bench_op::eta>;

std::cout << "-----------------------------------------------\n"
<< "Algebra-Plugins 'getter' benchmark (std::array)\n"
<< "-----------------------------------------------\n\n"
Expand All @@ -47,7 +35,6 @@ int main(int argc, char** argv) {
//
// Register all benchmarks
//
ALGEBRA_PLUGINS_REGISTER_GETTER_BENCH(cfg)

::benchmark::Initialize(&argc, argv);
::benchmark::RunSpecifiedBenchmarks();
Expand Down
12 changes: 12 additions & 0 deletions benchmarks/array/array_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,25 @@ int main(int argc, char** argv) {
algebra::benchmark_base::configuration cfg{};
cfg.n_samples(100000);

using phi_f_t = vector_unaryOP_bm<array::vector3, float, bench_op::phi>;
using theta_f_t = vector_unaryOP_bm<array::vector3, float, bench_op::theta>;
using perp_f_t = vector_unaryOP_bm<array::vector3, float, bench_op::perp>;
using norm_f_t = vector_unaryOP_bm<array::vector3, float, bench_op::norm>;
using eta_f_t = vector_unaryOP_bm<array::vector3, float, bench_op::eta>;

using add_f_t = vector_binaryOP_bm<array::vector3, float, bench_op::add>;
using sub_f_t = vector_binaryOP_bm<array::vector3, float, bench_op::sub>;
using dot_f_t = vector_binaryOP_bm<array::vector3, float, bench_op::dot>;
using cross_f_t = vector_binaryOP_bm<array::vector3, float, bench_op::cross>;
using normlz_f_t =
vector_unaryOP_bm<array::vector3, float, bench_op::normalize>;

using phi_d_t = vector_unaryOP_bm<array::vector3, double, bench_op::phi>;
using theta_d_t = vector_unaryOP_bm<array::vector3, double, bench_op::theta>;
using perp_d_t = vector_unaryOP_bm<array::vector3, double, bench_op::perp>;
using norm_d_t = vector_unaryOP_bm<array::vector3, double, bench_op::norm>;
using eta_d_t = vector_unaryOP_bm<array::vector3, double, bench_op::eta>;

using add_d_t = vector_binaryOP_bm<array::vector3, double, bench_op::add>;
using sub_d_t = vector_binaryOP_bm<array::vector3, double, bench_op::sub>;
using dot_d_t = vector_binaryOP_bm<array::vector3, double, bench_op::dot>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ inline void fill_random_trf(std::vector<transform3_t> &collection) {

// Gram-Schmidt projection
typename transform3_t::scalar_type coeff =
vector::dot(x_axis, z_axis) / getter::norm(x_axis);
vector::dot(x_axis, z_axis) / vector::norm(x_axis);
z_axis = x_axis - coeff * z_axis;

return transform3_t{t, x_axis, vector::normalize(z_axis)};
Expand Down
33 changes: 1 addition & 32 deletions benchmarks/common/include/benchmark/common/benchmark_getter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,5 @@
#include "benchmark_vector.hpp"
#include "register_benchmark.hpp"

namespace algebra::bench_op {

// Macro for declaring the predefined materials (with Density effect data)
#define ALGEBRA_PLUGINS_BENCH_GETTER(GETTER_NAME) \
struct GETTER_NAME { \
inline static const std::string name{#GETTER_NAME}; \
template <typename vector_t> \
auto operator()(const vector_t &a) const { \
return algebra::getter::GETTER_NAME(a); \
} \
};

// Functions to be benchmarked
ALGEBRA_PLUGINS_BENCH_GETTER(phi)
ALGEBRA_PLUGINS_BENCH_GETTER(theta)
ALGEBRA_PLUGINS_BENCH_GETTER(perp)
ALGEBRA_PLUGINS_BENCH_GETTER(norm)
ALGEBRA_PLUGINS_BENCH_GETTER(eta)

// Macro for registering all getter benchmarks
#define ALGEBRA_PLUGINS_REGISTER_GETTER_BENCH(CFG) \
algebra::register_benchmark<phi_f_t>(CFG, "_single"); \
algebra::register_benchmark<phi_d_t>(CFG, "_double"); \
algebra::register_benchmark<theta_f_t>(CFG, "_single"); \
algebra::register_benchmark<theta_d_t>(CFG, "_double"); \
algebra::register_benchmark<perp_f_t>(CFG, "_single"); \
algebra::register_benchmark<perp_d_t>(CFG, "_double"); \
algebra::register_benchmark<norm_f_t>(CFG, "_single"); \
algebra::register_benchmark<norm_d_t>(CFG, "_double"); \
algebra::register_benchmark<eta_f_t>(CFG, "_single"); \
algebra::register_benchmark<eta_d_t>(CFG, "_double");

namespace algebra::bench_op { /* TODO: Implement */
} // namespace algebra::bench_op
37 changes: 29 additions & 8 deletions benchmarks/common/include/benchmark/common/benchmark_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,23 @@ struct cross {
return algebra::vector::cross(a, b);
}
};
struct normalize {
inline static const std::string name{"normalize"};
template <typename vector_t>
auto operator()(const vector_t &a) const {
return algebra::vector::normalize(a);
}
};

// Macro for declaring vector unary ops
#define ALGEBRA_PLUGINS_BENCH_VECTOR(OP) \
struct OP { \
inline static const std::string name{#OP}; \
template <typename vector_t> \
auto operator()(const vector_t &a) const { \
return algebra::vector::OP(a); \
} \
};

ALGEBRA_PLUGINS_BENCH_VECTOR(phi)
ALGEBRA_PLUGINS_BENCH_VECTOR(theta)
ALGEBRA_PLUGINS_BENCH_VECTOR(eta)
ALGEBRA_PLUGINS_BENCH_VECTOR(perp)
ALGEBRA_PLUGINS_BENCH_VECTOR(norm)
ALGEBRA_PLUGINS_BENCH_VECTOR(normalize)

} // namespace bench_op

Expand All @@ -173,6 +183,17 @@ struct normalize {
algebra::register_benchmark<cross_f_t>(CFG, "_single"); \
algebra::register_benchmark<cross_d_t>(CFG, "_double"); \
algebra::register_benchmark<normlz_f_t>(CFG, "_single"); \
algebra::register_benchmark<normlz_d_t>(CFG, "_double");
algebra::register_benchmark<normlz_d_t>(CFG, "_double"); \
\
algebra::register_benchmark<phi_f_t>(CFG, "_single"); \
algebra::register_benchmark<phi_d_t>(CFG, "_double"); \
algebra::register_benchmark<theta_f_t>(CFG, "_single"); \
algebra::register_benchmark<theta_d_t>(CFG, "_double"); \
algebra::register_benchmark<perp_f_t>(CFG, "_single"); \
algebra::register_benchmark<perp_d_t>(CFG, "_double"); \
algebra::register_benchmark<norm_f_t>(CFG, "_single"); \
algebra::register_benchmark<norm_d_t>(CFG, "_double"); \
algebra::register_benchmark<eta_f_t>(CFG, "_single"); \
algebra::register_benchmark<eta_d_t>(CFG, "_double");

} // namespace algebra
14 changes: 0 additions & 14 deletions benchmarks/eigen/eigen_getter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,6 @@ int main(int argc, char** argv) {
algebra::benchmark_base::configuration cfg{};
cfg.n_samples(100000);

using phi_f_t = vector_unaryOP_bm<eigen::vector3, float, bench_op::phi>;
using theta_f_t = vector_unaryOP_bm<eigen::vector3, float, bench_op::theta>;
using perp_f_t = vector_unaryOP_bm<eigen::vector3, float, bench_op::perp>;
using norm_f_t = vector_unaryOP_bm<eigen::vector3, float, bench_op::norm>;
using eta_f_t = vector_unaryOP_bm<eigen::vector3, float, bench_op::eta>;

using phi_d_t = vector_unaryOP_bm<eigen::vector3, double, bench_op::phi>;
using theta_d_t = vector_unaryOP_bm<eigen::vector3, double, bench_op::theta>;
using perp_d_t = vector_unaryOP_bm<eigen::vector3, double, bench_op::perp>;
using norm_d_t = vector_unaryOP_bm<eigen::vector3, double, bench_op::norm>;
using eta_d_t = vector_unaryOP_bm<eigen::vector3, double, bench_op::eta>;

std::cout << "------------------------------------------\n"
<< "Algebra-Plugins 'getter' benchmark (Eigen)\n"
<< "------------------------------------------\n\n"
Expand All @@ -47,8 +35,6 @@ int main(int argc, char** argv) {
//
// Register all benchmarks
//
ALGEBRA_PLUGINS_REGISTER_GETTER_BENCH(cfg)

::benchmark::Initialize(&argc, argv);
::benchmark::RunSpecifiedBenchmarks();
::benchmark::Shutdown();
Expand Down
12 changes: 12 additions & 0 deletions benchmarks/eigen/eigen_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,25 @@ int main(int argc, char** argv) {
algebra::benchmark_base::configuration cfg{};
cfg.n_samples(100000);

using phi_f_t = vector_unaryOP_bm<eigen::vector3, float, bench_op::phi>;
using theta_f_t = vector_unaryOP_bm<eigen::vector3, float, bench_op::theta>;
using perp_f_t = vector_unaryOP_bm<eigen::vector3, float, bench_op::perp>;
using norm_f_t = vector_unaryOP_bm<eigen::vector3, float, bench_op::norm>;
using eta_f_t = vector_unaryOP_bm<eigen::vector3, float, bench_op::eta>;

using add_f_t = vector_binaryOP_bm<eigen::vector3, float, bench_op::add>;
using sub_f_t = vector_binaryOP_bm<eigen::vector3, float, bench_op::sub>;
using dot_f_t = vector_binaryOP_bm<eigen::vector3, float, bench_op::dot>;
using cross_f_t = vector_binaryOP_bm<eigen::vector3, float, bench_op::cross>;
using normlz_f_t =
vector_unaryOP_bm<eigen::vector3, float, bench_op::normalize>;

using phi_d_t = vector_unaryOP_bm<eigen::vector3, double, bench_op::phi>;
using theta_d_t = vector_unaryOP_bm<eigen::vector3, double, bench_op::theta>;
using perp_d_t = vector_unaryOP_bm<eigen::vector3, double, bench_op::perp>;
using norm_d_t = vector_unaryOP_bm<eigen::vector3, double, bench_op::norm>;
using eta_d_t = vector_unaryOP_bm<eigen::vector3, double, bench_op::eta>;

using add_d_t = vector_binaryOP_bm<eigen::vector3, double, bench_op::add>;
using sub_d_t = vector_binaryOP_bm<eigen::vector3, double, bench_op::sub>;
using dot_d_t = vector_binaryOP_bm<eigen::vector3, double, bench_op::dot>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ inline void fill_random_trf(std::vector<transform3_t> &collection) {

// Gram-Schmidt projection
typename transform3_t::scalar_type coeff =
vector::dot(x_axis, z_axis) / getter::norm(x_axis);
vector::dot(x_axis, z_axis) / vector::norm(x_axis);
z_axis = x_axis - coeff * z_axis;

return transform3_t{t, x_axis, vector::normalize(z_axis)};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ inline void fill_random_trf(std::vector<transform3_t> &collection) {

// Gram-Schmidt projection
typename transform3_t::scalar_type coeff =
vector::dot(x_axis, z_axis) / getter::norm(x_axis);
vector::dot(x_axis, z_axis) / vector::norm(x_axis);
z_axis = x_axis - coeff * z_axis;

return transform3_t{t, x_axis, vector::normalize(z_axis)};
Expand Down
13 changes: 0 additions & 13 deletions benchmarks/vc_aos/vc_aos_getter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,6 @@ int main(int argc, char** argv) {
algebra::benchmark_base::configuration cfg{};
cfg.n_samples(100000);

using phi_f_t = vector_unaryOP_bm<vc_aos::vector3, float, bench_op::phi>;
using theta_f_t = vector_unaryOP_bm<vc_aos::vector3, float, bench_op::theta>;
using perp_f_t = vector_unaryOP_bm<vc_aos::vector3, float, bench_op::perp>;
using norm_f_t = vector_unaryOP_bm<vc_aos::vector3, float, bench_op::norm>;
using eta_f_t = vector_unaryOP_bm<vc_aos::vector3, float, bench_op::eta>;

using phi_d_t = vector_unaryOP_bm<vc_aos::vector3, double, bench_op::phi>;
using theta_d_t = vector_unaryOP_bm<vc_aos::vector3, double, bench_op::theta>;
using perp_d_t = vector_unaryOP_bm<vc_aos::vector3, double, bench_op::perp>;
using norm_d_t = vector_unaryOP_bm<vc_aos::vector3, double, bench_op::norm>;
using eta_d_t = vector_unaryOP_bm<vc_aos::vector3, double, bench_op::eta>;

std::cout << "-------------------------------------------\n"
<< "Algebra-Plugins 'getter' benchmark (Vc AoS)\n"
<< "-------------------------------------------\n\n"
Expand All @@ -47,7 +35,6 @@ int main(int argc, char** argv) {
//
// Register all benchmarks
//
ALGEBRA_PLUGINS_REGISTER_GETTER_BENCH(cfg)

::benchmark::Initialize(&argc, argv);
::benchmark::RunSpecifiedBenchmarks();
Expand Down
14 changes: 13 additions & 1 deletion benchmarks/vc_aos/vc_aos_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,25 @@ int main(int argc, char** argv) {
algebra::benchmark_base::configuration cfg{};
cfg.n_samples(100000);

using phi_f_t = vector_unaryOP_bm<vc_aos::vector3, float, bench_op::phi>;
using theta_f_t = vector_unaryOP_bm<vc_aos::vector3, float, bench_op::theta>;
using perp_f_t = vector_unaryOP_bm<vc_aos::vector3, float, bench_op::perp>;
using norm_f_t = vector_unaryOP_bm<vc_aos::vector3, float, bench_op::norm>;
using eta_f_t = vector_unaryOP_bm<vc_aos::vector3, float, bench_op::eta>;

using add_f_t = vector_binaryOP_bm<vc_aos::vector3, float, bench_op::add>;
using sub_f_t = vector_binaryOP_bm<vc_aos::vector3, float, bench_op::sub>;
using dot_f_t = vector_binaryOP_bm<vc_aos::vector3, float, bench_op::dot>;
using cross_f_t = vector_binaryOP_bm<vc_aos::vector3, float, bench_op::cross>;
using normlz_f_t =
vector_unaryOP_bm<vc_aos::vector3, float, bench_op::normalize>;

using phi_d_t = vector_unaryOP_bm<vc_aos::vector3, double, bench_op::phi>;
using theta_d_t = vector_unaryOP_bm<vc_aos::vector3, double, bench_op::theta>;
using perp_d_t = vector_unaryOP_bm<vc_aos::vector3, double, bench_op::perp>;
using norm_d_t = vector_unaryOP_bm<vc_aos::vector3, double, bench_op::norm>;
using eta_d_t = vector_unaryOP_bm<vc_aos::vector3, double, bench_op::eta>;

using add_d_t = vector_binaryOP_bm<vc_aos::vector3, double, bench_op::add>;
using sub_d_t = vector_binaryOP_bm<vc_aos::vector3, double, bench_op::sub>;
using dot_d_t = vector_binaryOP_bm<vc_aos::vector3, double, bench_op::dot>;
Expand All @@ -40,7 +52,7 @@ int main(int argc, char** argv) {
vector_unaryOP_bm<vc_aos::vector3, double, bench_op::normalize>;

std::cout << "-------------------------------------------\n"
<< "Algebra-Plugins 'vector' benchmark (Vc SoA)\n"
<< "Algebra-Plugins 'vector' benchmark (Vc AoS)\n"
<< "-------------------------------------------\n\n"
<< cfg;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ inline void fill_random_trf(std::vector<transform3_t> &collection) {
t = vector::normalize(t);

// Gram-Schmidt projection
simd_vector_t coeff = vector::dot(x_axis, z_axis) / getter::norm(x_axis);
simd_vector_t coeff = vector::dot(x_axis, z_axis) / vector::norm(x_axis);
z_axis = x_axis - coeff * z_axis;

return transform3_t{t, x_axis, vector::normalize(z_axis)};
Expand Down
23 changes: 0 additions & 23 deletions benchmarks/vc_soa/vc_soa_getter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@ int main(int argc, char** argv) {
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<vc_soa::vector3, float, bench_op::phi>;
using theta_f_t = vector_unaryOP_bm<vc_soa::vector3, float, bench_op::theta>;
using perp_f_t = vector_unaryOP_bm<vc_soa::vector3, float, bench_op::perp>;
using norm_f_t = vector_unaryOP_bm<vc_soa::vector3, float, bench_op::norm>;
using eta_f_t = vector_unaryOP_bm<vc_soa::vector3, float, bench_op::eta>;

using phi_d_t = vector_unaryOP_bm<vc_soa::vector3, double, bench_op::phi>;
using theta_d_t = vector_unaryOP_bm<vc_soa::vector3, double, bench_op::theta>;
using perp_d_t = vector_unaryOP_bm<vc_soa::vector3, double, bench_op::perp>;
using norm_d_t = vector_unaryOP_bm<vc_soa::vector3, double, bench_op::norm>;
using eta_d_t = vector_unaryOP_bm<vc_soa::vector3, double, bench_op::eta>;

std::cout << "-------------------------------------------\n"
<< "Algebra-Plugins 'getter' benchmark (Vc SoA)\n"
<< "-------------------------------------------\n\n"
Expand All @@ -58,17 +46,6 @@ int main(int argc, char** argv) {
//
// Register all benchmarks
//
algebra::register_benchmark<phi_f_t>(cfg_s, "_single");
algebra::register_benchmark<phi_d_t>(cfg_d, "_double");
algebra::register_benchmark<theta_f_t>(cfg_s, "_single");
algebra::register_benchmark<theta_d_t>(cfg_d, "_double");
algebra::register_benchmark<perp_f_t>(cfg_s, "_single");
algebra::register_benchmark<perp_d_t>(cfg_d, "_double");
algebra::register_benchmark<norm_f_t>(cfg_s, "_single");
algebra::register_benchmark<norm_d_t>(cfg_d, "_double");
algebra::register_benchmark<eta_f_t>(cfg_s, "_single");
algebra::register_benchmark<eta_d_t>(cfg_d, "_double");

::benchmark::Initialize(&argc, argv);
::benchmark::RunSpecifiedBenchmarks();
::benchmark::Shutdown();
Expand Down
23 changes: 23 additions & 0 deletions benchmarks/vc_soa/vc_soa_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,25 @@ int main(int argc, char** argv) {
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<vc_soa::vector3, float, bench_op::phi>;
using theta_f_t = vector_unaryOP_bm<vc_soa::vector3, float, bench_op::theta>;
using perp_f_t = vector_unaryOP_bm<vc_soa::vector3, float, bench_op::perp>;
using norm_f_t = vector_unaryOP_bm<vc_soa::vector3, float, bench_op::norm>;
using eta_f_t = vector_unaryOP_bm<vc_soa::vector3, float, bench_op::eta>;

using add_f_t = vector_binaryOP_bm<vc_soa::vector3, float, bench_op::add>;
using sub_f_t = vector_binaryOP_bm<vc_soa::vector3, float, bench_op::sub>;
using dot_f_t = vector_binaryOP_bm<vc_soa::vector3, float, bench_op::dot>;
using cross_f_t = vector_binaryOP_bm<vc_soa::vector3, float, bench_op::cross>;
using normlz_f_t =
vector_unaryOP_bm<vc_soa::vector3, float, bench_op::normalize>;

using phi_d_t = vector_unaryOP_bm<vc_soa::vector3, double, bench_op::phi>;
using theta_d_t = vector_unaryOP_bm<vc_soa::vector3, double, bench_op::theta>;
using perp_d_t = vector_unaryOP_bm<vc_soa::vector3, double, bench_op::perp>;
using norm_d_t = vector_unaryOP_bm<vc_soa::vector3, double, bench_op::norm>;
using eta_d_t = vector_unaryOP_bm<vc_soa::vector3, double, bench_op::eta>;

using add_d_t = vector_binaryOP_bm<vc_soa::vector3, double, bench_op::add>;
using sub_d_t = vector_binaryOP_bm<vc_soa::vector3, double, bench_op::sub>;
using dot_d_t = vector_binaryOP_bm<vc_soa::vector3, double, bench_op::dot>;
Expand All @@ -58,6 +70,17 @@ int main(int argc, char** argv) {
//
// Register all benchmarks
//
algebra::register_benchmark<phi_f_t>(cfg_s, "_single");
algebra::register_benchmark<phi_d_t>(cfg_d, "_double");
algebra::register_benchmark<theta_f_t>(cfg_s, "_single");
algebra::register_benchmark<theta_d_t>(cfg_d, "_double");
algebra::register_benchmark<perp_f_t>(cfg_s, "_single");
algebra::register_benchmark<perp_d_t>(cfg_d, "_double");
algebra::register_benchmark<norm_f_t>(cfg_s, "_single");
algebra::register_benchmark<norm_d_t>(cfg_d, "_double");
algebra::register_benchmark<eta_f_t>(cfg_s, "_single");
algebra::register_benchmark<eta_d_t>(cfg_d, "_double");

algebra::register_benchmark<add_f_t>(cfg_s, "_single");
algebra::register_benchmark<add_d_t>(cfg_d, "_double");
algebra::register_benchmark<sub_f_t>(cfg_s, "_single");
Expand Down
4 changes: 4 additions & 0 deletions cmake/algebra-plugins-functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ function( algebra_add_benchmark name )
# Create the test executable.
set( bench_exe_name "algebra_benchmark_${name}" )
add_executable( ${bench_exe_name} ${ARG_UNPARSED_ARGUMENTS} )

target_compile_options( algebra_benchmark_${name} PRIVATE
"-march=native" "-ftree-vectorize")

if( ARG_LINK_LIBRARIES )
target_link_libraries( ${bench_exe_name} PRIVATE ${ARG_LINK_LIBRARIES} )
endif()
Expand Down
Loading

0 comments on commit d83f29e

Please sign in to comment.