-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Misc_benchmark.cc
44 lines (36 loc) · 1.06 KB
/
Misc_benchmark.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* This software is distributed under BSD 3-clause license (see LICENSE file).
*
* Authors: Viktor Gal
*/
#include <benchmark/benchmark.h>
#include "shogun/mathematics/linalg/LinalgNamespace.h"
namespace shogun
{
template<typename T>
void BM_LinAlg_SGVector_zero(benchmark::State& state)
{
for (auto _ : state)
{
SGVector<T> v(state.range(0));
linalg::zero(v);
}
}
template<typename T>
void BM_SGVector_zero(benchmark::State& state)
{
for (auto _ : state)
{
SGVector<T> v(state.range(0));
v.zero();
}
}
BENCHMARK_TEMPLATE(BM_LinAlg_SGVector_zero, int32_t)->Range(8, 8<<10);
BENCHMARK_TEMPLATE(BM_LinAlg_SGVector_zero, int64_t)->Range(8, 8<<10);
BENCHMARK_TEMPLATE(BM_LinAlg_SGVector_zero, float32_t)->Range(8, 8<<10);
BENCHMARK_TEMPLATE(BM_LinAlg_SGVector_zero, float64_t)->Range(8, 8<<10);
BENCHMARK_TEMPLATE(BM_SGVector_zero, int32_t)->Range(8, 8<<10);
BENCHMARK_TEMPLATE(BM_SGVector_zero, int64_t)->Range(8, 8<<10);
BENCHMARK_TEMPLATE(BM_SGVector_zero, float32_t)->Range(8, 8<<10);
BENCHMARK_TEMPLATE(BM_SGVector_zero, float64_t)->Range(8, 8<<10);
}