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