5#include <Kokkos_Core.hpp>
17 auto fieldS = field.
view();
18 auto end = field.
size();
19 Kokkos::parallel_reduce(
21 Kokkos::RangePolicy<executor>(0, end),
22 KOKKOS_LAMBDA(
const localIdx i, T& lsum) { lsum += fieldS[i]; },
31 auto fieldS = field.
view();
32 auto end = field.
size();
33 Kokkos::parallel_reduce(
35 Kokkos::RangePolicy<executor>(0, end),
36 KOKKOS_LAMBDA(
const localIdx i, T& lsum) { lsum += fieldS[i]; },
45 auto fieldS = field.
view();
46 auto end = field.
size();
47 Kokkos::parallel_reduce(
49 Kokkos::RangePolicy<executor>(0, end),
50 KOKKOS_LAMBDA(
const localIdx i, T& lsum) { lsum += fieldS[i]; },
Executor for handling multicore CPU based parallelization.
Kokkos::DefaultHostExecutionSpace exec
Executor for GPU offloading.
Kokkos::DefaultExecutionSpace exec
Reference executor for serial CPU execution.
A class to contain the data and executors for a field and define some basic operations.
localIdx size() const
Gets the size of the field.
View< ValueType > view() &&=delete
void operator()(const SerialExecutor &exec, const Vector< T > &field, T &sum)
void operator()(const GPUExecutor &exec, const Vector< T > &field, T &sum) const
void operator()(const CPUExecutor &exec, const Vector< T > &field, T &sum)