Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-27 07:24:11

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 // Project include(s)
0010 // clang-format off
0011 #include "detray/benchmarks/types.hpp"
0012 #include "detray/benchmarks/cpu/matrix_benchmark.hpp"
0013 #include "detray/benchmarks/cpu/vector_benchmark.hpp"
0014 #include "detray/benchmarks/cpu/transform_benchmark.hpp"
0015 // clang-format on
0016 
0017 // Benchmark include
0018 #include <benchmark/benchmark.h>
0019 
0020 // System include(s)
0021 #include <iostream>
0022 
0023 using namespace detray::benchmarks;
0024 
0025 /// Run vector benchmarks
0026 int main(int argc, char** argv) {
0027   //
0028   // Prepare benchmarks
0029   //
0030   benchmark_base::configuration cfg{};
0031   cfg.n_samples(100000);
0032   // Leave this to google benchmark
0033   cfg.do_warmup(false);
0034 
0035   std::cout << "-----------------------------------------------\n"
0036             << "Detray linear algebra benchmark ("
0037             << detray::benchmarks::plugin_name << ")\n"
0038             << "-----------------------------------------------\n\n"
0039             << cfg;
0040 
0041 //
0042 // Define and register all benchmarks
0043 //
0044 #if DETRAY_ALGEBRA_ARRAY
0045   DETRAY_DEFINE_VECTOR_BENCH(detray::algebra::array)
0046   DETRAY_DEFINE_TRANSFORM_BENCH(detray::algebra::array)
0047   DETRAY_DEFINE_MATRIX_BENCH(detray::algebra::array)
0048 #elif DETRAY_ALGEBRA_EIGEN
0049   DETRAY_DEFINE_VECTOR_BENCH(detray::algebra::eigen)
0050   DETRAY_DEFINE_TRANSFORM_BENCH(detray::algebra::eigen)
0051   DETRAY_DEFINE_MATRIX_BENCH(detray::algebra::eigen)
0052 #elif DETRAY_ALGEBRA_FASTOR
0053   DETRAY_DEFINE_VECTOR_BENCH(detray::algebra::fastor)
0054   DETRAY_DEFINE_TRANSFORM_BENCH(detray::algebra::fastor)
0055   DETRAY_DEFINE_MATRIX_BENCH(detray::algebra::fastor)
0056 #elif DETRAY_ALGEBRA_SMATRIX
0057   DETRAY_DEFINE_VECTOR_BENCH(detray::algebra::smatrix)
0058   DETRAY_DEFINE_TRANSFORM_BENCH(detray::algebra::smatrix)
0059   DETRAY_DEFINE_MATRIX_BENCH(detray::algebra::smatrix)
0060 #elif DETRAY_ALGEBRA_VC_AOS
0061   DETRAY_DEFINE_VECTOR_BENCH(detray::algebra::vc_aos)
0062   DETRAY_DEFINE_TRANSFORM_BENCH(detray::algebra::vc_aos)
0063   DETRAY_DEFINE_MATRIX_BENCH(detray::algebra::vc_aos)
0064 #endif
0065 
0066   DETRAY_REGISTER_VECTOR_BENCH(cfg, cfg)
0067   DETRAY_REGISTER_TRANSFORM_BENCH(cfg, cfg)
0068   DETRAY_REGISTER_MATRIX_BENCH(cfg, cfg)
0069 
0070   ::benchmark::Initialize(&argc, argv);
0071   ::benchmark::RunSpecifiedBenchmarks();
0072   ::benchmark::Shutdown();
0073 }