-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmean.cpp
More file actions
35 lines (26 loc) · 844 Bytes
/
Copy pathmean.cpp
File metadata and controls
35 lines (26 loc) · 844 Bytes
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
#include <arrayfire.h>
#include <arrayfire_benchmark.h>
using af::array;
using af::randu;
auto meanBench(benchmark::State& state, af_dtype type, dim_t dim) {
array input = randu(state.range(0), state.range(1), type);
mean(input, dim);
af::sync();
for(auto _ : state) {
mean(input, dim);
af::sync();
}
}
int main(int argc, char **argv) {
af::benchmark::Initialize(&argc, argv);
af::benchmark::RegisterBenchmark("meand0", {(af_dtype)f32}, meanBench, 0)
->Ranges({{512, 1<<16}, {8, 1<<8}})
->Unit(benchmark::kMicrosecond)
->Iterations(10);
af::benchmark::RegisterBenchmark("meand1", {(af_dtype)f32}, meanBench, 1)
->Ranges({{512, 1 << 16}, {8, 1 << 8}})
->Unit(benchmark::kMicrosecond)
->Iterations(10);
af::benchmark::AFReporter r;
benchmark::RunSpecifiedBenchmarks(&r);
}