-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathreduce.cpp
More file actions
42 lines (34 loc) · 959 Bytes
/
Copy pathreduce.cpp
File metadata and controls
42 lines (34 loc) · 959 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
36
37
38
39
40
41
42
#include <arrayfire_benchmark.h>
#include <arrayfire.h>
#include <vector>
using af::array;
using af::randu;
using std::vector;
using af::sum;
void sumBench(benchmark::State& state, af_dtype type) {
af::dim4 dataDimensions(state.range(0));
array x = randu(dataDimensions, type);
af::sync();
array output;
output = sum(x);
output.eval();
af::sync();
for (auto _ : state) {
output = sum(x);
output.eval();
af::sync();
}
}
int main(int argc, char** argv) {
vector<af_dtype> types = {f32, f64};
benchmark::Initialize(&argc, argv);
af::benchmark::RegisterBenchmark("sum", types, sumBench)
// ->RangeMultiplier(2)
->Ranges({{8, 1<<26}, {8, 1<<12}})
->ArgNames({"dim0", "dim1"})
//->Iterations(2)
->Unit(benchmark::kMicrosecond);
//af::benchmark::AFJSONReporter r;
af::benchmark::AFReporter r;
benchmark::RunSpecifiedBenchmarks(&r);
}