39#ifndef PECLET_CORE_COMMON_HOST_PARALLEL_HPP
40#define PECLET_CORE_COMMON_HOST_PARALLEL_HPP
42#if !defined(PECLET_CORE_HOST_PARALLEL_KOKKOS)
43#if defined(__has_include)
44#if __has_include(<Kokkos_Core.hpp>)
45#define PECLET_CORE_HOST_PARALLEL_KOKKOS 1
47#define PECLET_CORE_HOST_PARALLEL_KOKKOS 0
49#elif defined(KOKKOS_VERSION)
50#define PECLET_CORE_HOST_PARALLEL_KOKKOS 1
52#define PECLET_CORE_HOST_PARALLEL_KOKKOS 0
61#if PECLET_CORE_HOST_PARALLEL_KOKKOS
74#if PECLET_CORE_HOST_PARALLEL_KOKKOS
75 return Kokkos::is_initialized();
88#if PECLET_CORE_HOST_PARALLEL_KOKKOS
89 if (Kokkos::is_initialized()) {
90 using HostExec = Kokkos::DefaultHostExecutionSpace;
91 Kokkos::parallel_for(
"peclet::core::hostParFor", Kokkos::RangePolicy<HostExec>(0, n),
92 [&body](
const Index i) { body(i); });
93 Kokkos::fence(
"peclet::core::hostParFor");
97 for (
Index i = 0; i < n; ++i)
115#if PECLET_CORE_HOST_PARALLEL_KOKKOS
116 if (Kokkos::is_initialized()) {
117 using HostExec = Kokkos::DefaultHostExecutionSpace;
118 Kokkos::parallel_scan(
119 "peclet::core::hostParScan", Kokkos::RangePolicy<HostExec>(0, n),
120 [&body](
const Index i,
Index& update,
const bool final) { body(i, update,
final); });
121 Kokkos::fence(
"peclet::core::hostParScan");
126 for (
Index i = 0; i < n; ++i)
127 body(i, update,
true);
void hostParFor(Index n, Body &&body)
Parallel for (Index i = 0; i < n; ++i) body(i); over the Kokkos HOST execution space.
void hostParScan(Index n, Body &&body)
Exclusive integer scan over the host space: body(i, update, final) where update carries the running s...
bool hostParallelActive()
Is the parallel backend actually live for this process? (Kokkos compiled in AND initialized....
std::int64_t Index
Signed index type for grids and particles (supersedes block_decomposer's long int IndxT).