Project
Loading...
Searching...
No Matches
benchmark_GandivaExpressions.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
16#include "Framework/Logger.h"
17
18#include <benchmark/benchmark.h>
19#include <random>
20
21using namespace o2::framework;
22using namespace arrow;
23using namespace o2::soa;
24
25namespace test
26{
27DECLARE_SOA_COLUMN(X, x, float, "x");
28DECLARE_SOA_COLUMN(Y, y, float, "y");
29DECLARE_SOA_COLUMN(Z, z, float, "z");
30DECLARE_SOA_COLUMN(cD, cd, float, "cd");
31DECLARE_SOA_DYNAMIC_COLUMN(D, d, [](float x, float y, float z) { return std::sqrt(x * x + y * y + z * z); });
32} // namespace test
33
36
37const static size_t maxrows = 100;
38
39static std::default_random_engine e(1234567890);
40static std::normal_distribution<float> G;
41
42auto createTable = [](size_t nrows) {
43 static TableBuilder builder;
44 auto static rowWriter = builder.persist<float, float, float>({"x", "y", "z"});
45
46 for (auto i = 0u; i < nrows; ++i) {
47 rowWriter(0, G(e), G(e), G(e));
48 }
49 auto table = builder.finalize();
50
51 return TT{table};
52};
53
54static void BM_DirectCalculation(benchmark::State& state)
55{
56 state.PauseTiming();
57 auto tt = createTable(state.range(0));
58 state.ResumeTiming();
59 benchmark::DoNotOptimize(tt);
60}
61
62static void BM_GandivaExpression(benchmark::State& state)
63{
64 state.PauseTiming();
65 auto tt = createTable(state.range(0));
66 state.ResumeTiming();
67 benchmark::DoNotOptimize(tt);
68}
69
70BENCHMARK(BM_DirectCalculation)->Arg(maxrows);
71BENCHMARK(BM_GandivaExpression)->Arg(maxrows);
72
#define DECLARE_SOA_DYNAMIC_COLUMN(_Name_, _Getter_,...)
Definition ASoA.h:3108
#define DECLARE_SOA_COLUMN(_Name_, _Getter_, _Type_)
Definition ASoA.h:2440
int32_t i
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
configStandalone Reconstruction rec_tpc float
SurfaceTrackState state
BENCHMARK_MAIN()
BENCHMARK(BM_DirectCalculation) -> Arg(maxrows)
auto persist(std::array< char const *, sizeof...(ARGS)+1 > const &columnNames)
std::shared_ptr< arrow::Table > finalize()
GLint GLenum GLint x
Definition glcorearb.h:403
GLint y
Definition glcorearb.h:270
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
FIXME: do not use data model tables.