-
Notifications
You must be signed in to change notification settings - Fork 0
/
benchmark_access.cpp
40 lines (30 loc) · 1.09 KB
/
benchmark_access.cpp
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
#include <Kokkos_Core.hpp>
#include <benchmark/benchmark.h>
#include <brak/wrapper_array.hpp>
#include <brak/wrapper_subview.hpp>
void benchmark_set_wrapper_subview(benchmark::State &state) {
Kokkos::View<int ********, Kokkos::DefaultHostExecutionSpace::memory_space>
data{"data", 2, 2, 2, 2, 2, 2, 2, 2};
brak::WrapperSubview dataWrapper{data};
while (state.KeepRunning()) {
dataWrapper[1][1][1][1][1][1][1][1] = 10;
}
}
BENCHMARK(benchmark_set_wrapper_subview);
void benchmark_set_wrapper_array(benchmark::State &state) {
Kokkos::View<int ********, Kokkos::DefaultHostExecutionSpace::memory_space>
data{"data", 2, 2, 2, 2, 2, 2, 2, 2};
brak::WrapperArray dataWrapper{data};
while (state.KeepRunning()) {
dataWrapper[1][1][1][1][1][1][1][1] = 10;
}
}
BENCHMARK(benchmark_set_wrapper_array);
void benchmark_set_view(benchmark::State &state) {
Kokkos::View<int ********, Kokkos::DefaultHostExecutionSpace::memory_space>
data{"data", 2, 2, 2, 2, 2, 2, 2, 2};
while (state.KeepRunning()) {
data(1, 1, 1, 1, 1, 1, 1, 1) = 10;
}
}
BENCHMARK(benchmark_set_view);