Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix stan installation as a third party lib
- Loading branch information
Showing
4 changed files
with
136 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
src/shogun/mathematics/linalg/backend/eigen/BasicOps_benchmark.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* 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_scale(benchmark::State& state) | ||
{ | ||
for (auto _ : state) | ||
{ | ||
SGVector<T> v(state.range(0)); | ||
linalg::scale(v, T(12.3)); | ||
} | ||
} | ||
|
||
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_scale(benchmark::State& state) | ||
{ | ||
for (auto _ : state) | ||
{ | ||
SGVector<T> v(state.range(0)); | ||
v.scale(T(12.3)); | ||
} | ||
} | ||
|
||
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_scale, int32_t)->Range(8, 8<<10); | ||
BENCHMARK_TEMPLATE(BM_LinAlg_SGVector_scale, int64_t)->Range(8, 8<<10); | ||
BENCHMARK_TEMPLATE(BM_LinAlg_SGVector_scale, float32_t)->Range(8, 8<<10); | ||
BENCHMARK_TEMPLATE(BM_LinAlg_SGVector_scale, float64_t)->Range(8, 8<<10); | ||
|
||
BENCHMARK_TEMPLATE(BM_SGVector_scale, int32_t)->Range(8, 8<<10); | ||
BENCHMARK_TEMPLATE(BM_SGVector_scale, int64_t)->Range(8, 8<<10); | ||
BENCHMARK_TEMPLATE(BM_SGVector_scale, float32_t)->Range(8, 8<<10); | ||
BENCHMARK_TEMPLATE(BM_SGVector_scale, float64_t)->Range(8, 8<<10); | ||
|
||
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); | ||
|
||
|
||
} |
44 changes: 44 additions & 0 deletions
44
src/shogun/mathematics/linalg/backend/eigen/Misc_benchmark.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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); | ||
|
||
} |