Skip to content
Snippets Groups Projects
Commit 2ee992ae authored by Panos Adamidis's avatar Panos Adamidis
Browse files

Adding scenario scenario 1cmacro

parent 43d76091
No related branches found
Tags v1.3
No related merge requests found
......@@ -119,6 +119,35 @@ void scenario_1c(double* array, int nblocks, int nlev, int nproma) {
}
void scenario_1cmacro(double* array, int nblocks, int nlev, int nproma) {
std::cout << "scenario 1cmacro: +ACC CPU:LayoutLeft GPU:LayoutLeft; as ICON pointer view(array, ncells, nlev); d_view(jc, jk) ----- " << std::endl;
using space_t = Kokkos::DefaultExecutionSpace::memory_space;
int ncells = nblocks*nproma;
#if defined(DEMO_DEVICE)
Kokkos::View<double**, Kokkos::LayoutLeft> d_view(array, ncells, nlev);
#else
Kokkos::View<double**, Kokkos::LayoutLeft, Kokkos::MemoryUnmanaged> d_view(array, ncells, nlev);
#endif
timer.reset();
Kokkos::parallel_for(
"", Kokkos::RangePolicy<>(0, ncells), KOKKOS_LAMBDA(const int jc) {
for (int jk = 0; jk < nlev; ++jk) {
int p = jk * ncells + jc;
check_bounds_2d(jc, jk, d_view.extent(0), d_view.extent(1));
d_view(jc, jk) = p;
}
});
Kokkos::fence();
printf("Time = %f ms\n\n", timer.seconds() * 1000);
}
void scenario_2(double* array, int nblocks, int nlev, int nproma, bool print = true) {
if (print)
std::cout << "scenario 2: Right layout; view(array, nproma, nlev, nblocks); d_view(jc, jk, jb) ----- " << std::endl;
......@@ -605,6 +634,10 @@ int main() {
std::function<void(double*, int, int, int)> s_1c = scenario_1c;
openacc_calls(array, nblocks, nlev, nproma, s_1c);
memset(array, 0.0, sizeof(array));
std::function<void(double*, int, int, int)> s_1cmacro = scenario_1cmacro;
openacc_calls(array, nblocks, nlev, nproma, s_1cmacro);
memset(array, 0.0, sizeof(array));
std::function<void(double*, int, int, int)> s_7b = scenario_7b;
openacc_calls(array, nblocks, nlev, nproma, s_7b);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment