45 #ifndef KOKKOS_CORE_FWD_HPP
46 #define KOKKOS_CORE_FWD_HPP
52 #include <Kokkos_Macros.hpp>
53 #include <impl/Kokkos_Utilities.hpp>
55 #include <Kokkos_UniqueToken.hpp>
56 #include <Kokkos_MasterLock.hpp>
61 static_assert(
sizeof(
void *) == 8,
62 "Kokkos assumes 64-bit build; i.e., 8-byte pointers");
69 KOKKOS_INLINE_FUNCTION
70 constexpr
const AUTO_t &operator()()
const {
return *
this; }
76 constexpr AUTO_t AUTO = Kokkos::AUTO_t();
79 struct InvalidType {};
91 #ifdef KOKKOS_ENABLE_HBWSPACE
92 namespace Experimental {
98 #if defined(KOKKOS_ENABLE_SERIAL)
102 #if defined(KOKKOS_ENABLE_HPX)
103 namespace Experimental {
108 #if defined(KOKKOS_ENABLE_THREADS)
112 #if defined(KOKKOS_ENABLE_OPENMP)
116 #if defined(KOKKOS_ENABLE_OPENMPTARGET)
117 namespace Experimental {
119 class OpenMPTargetSpace;
123 #if defined(KOKKOS_ENABLE_ROCM)
124 namespace Experimental {
130 #if defined(KOKKOS_ENABLE_HIP)
131 namespace Experimental {
137 template <
class ExecutionSpace,
class MemorySpace>
142 #include "Cuda/Kokkos_Cuda_fwd.hpp"
154 #if defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_CUDA)
155 typedef Cuda DefaultExecutionSpace;
156 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET)
157 typedef Experimental::OpenMPTarget DefaultExecutionSpace;
158 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HIP)
159 typedef Experimental::HIP DefaultExecutionSpace;
160 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_ROCM)
161 typedef Experimental::ROCm DefaultExecutionSpace;
162 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP)
163 typedef OpenMP DefaultExecutionSpace;
164 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS)
165 typedef Threads DefaultExecutionSpace;
166 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX)
167 typedef Kokkos::Experimental::HPX DefaultExecutionSpace;
168 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL)
169 typedef Serial DefaultExecutionSpace;
172 "At least one of the following execution spaces must be defined in order to use Kokkos: Kokkos::Cuda, Kokkos::Experimental::HIP, Kokkos::Experimental::OpenMPTarget, Kokkos::OpenMP, Kokkos::Threads, Kokkos::Experimental::HPX, or Kokkos::Serial."
175 #if defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP)
176 typedef OpenMP DefaultHostExecutionSpace;
177 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS)
178 typedef Threads DefaultHostExecutionSpace;
179 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX)
180 typedef Kokkos::Experimental::HPX DefaultHostExecutionSpace;
181 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL)
182 typedef Serial DefaultHostExecutionSpace;
183 #elif defined(KOKKOS_ENABLE_OPENMP)
184 typedef OpenMP DefaultHostExecutionSpace;
185 #elif defined(KOKKOS_ENABLE_THREADS)
186 typedef Threads DefaultHostExecutionSpace;
187 #elif defined(KOKKOS_ENABLE_HPX)
188 typedef Kokkos::Experimental::HPX DefaultHostExecutionSpace;
189 #elif defined(KOKKOS_ENABLE_SERIAL)
190 typedef Serial DefaultHostExecutionSpace;
193 "At least one of the following execution spaces must be defined in order to use Kokkos: Kokkos::OpenMP, Kokkos::Threads, Kokkos::Experimental::HPX, or Kokkos::Serial."
207 #if defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_CUDA) && \
208 defined(KOKKOS_ENABLE_CUDA)
209 typedef Kokkos::CudaSpace ActiveExecutionMemorySpace;
210 #elif defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_ROCM_GPU)
212 #elif defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HIP_GPU)
213 typedef Kokkos::Experimental::HIPSpace ActiveExecutionMemorySpace;
214 #elif defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST)
217 typedef void ActiveExecutionMemorySpace;
220 template <
class ActiveSpace,
class MemorySpace>
221 struct VerifyExecutionCanAccessMemorySpace {
225 template <
class Space>
226 struct VerifyExecutionCanAccessMemorySpace<Space, Space> {
228 KOKKOS_INLINE_FUNCTION
static void verify(
void) {}
229 KOKKOS_INLINE_FUNCTION
static void verify(
const void *) {}
235 #define KOKKOS_RESTRICT_EXECUTION_TO_DATA(DATA_SPACE, DATA_PTR) \
236 Kokkos::Impl::VerifyExecutionCanAccessMemorySpace< \
237 Kokkos::Impl::ActiveExecutionMemorySpace, DATA_SPACE>::verify(DATA_PTR)
239 #define KOKKOS_RESTRICT_EXECUTION_TO_(DATA_SPACE) \
240 Kokkos::Impl::VerifyExecutionCanAccessMemorySpace< \
241 Kokkos::Impl::ActiveExecutionMemorySpace, DATA_SPACE>::verify()
255 template <
class DstSpace,
class SrcSpace,
256 class ExecutionSpace =
typename DstSpace::execution_space>
259 template <
class ViewType,
class Layout,
class ExecSpace,
int Rank,
261 struct ViewFillETIAvail;
263 template <
class ViewType,
class Layout =
typename ViewType::array_layout,
264 class ExecSpace =
typename ViewType::execution_space,
265 int Rank = ViewType::Rank,
typename iType = int64_t,
267 ViewFillETIAvail<ViewType, Layout, ExecSpace, Rank, iType>::value>
270 template <
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
271 int Rank,
typename iType>
272 struct ViewCopyETIAvail;
274 template <
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
275 int Rank,
typename iType,
276 bool EtiAvail = ViewCopyETIAvail<ViewTypeA, ViewTypeB, Layout,
277 ExecSpace, Rank, iType>::value>
280 template <
class Functor,
class Policy,
class EnableFunctor = void,
281 class EnablePolicy =
void>
291 template <
class FunctorType,
class ExecPolicy,
293 FunctorType, ExecPolicy>::execution_space>
301 template <
class FunctorType,
class ExecPolicy,
class ReducerType = InvalidType,
303 FunctorType, ExecPolicy>::execution_space>
312 template <
class FunctorType,
class ExecPolicy,
314 FunctorType, ExecPolicy>::execution_space>
317 template <
class FunctorType,
class ExecPolicy,
class ReturnType = InvalidType,
319 FunctorType, ExecPolicy>::execution_space>
320 class ParallelScanWithTotal;
324 template <
class ScalarType,
class Space = HostSpace>
326 template <
class ScalarType,
class Space = HostSpace>
328 template <
class ScalarType,
class Space = HostSpace>
330 template <
class ScalarType,
class Space = HostSpace>
332 template <
class ScalarType,
class Space = HostSpace>
334 template <
class ScalarType,
class Index,
class Space = HostSpace>
336 template <
class ScalarType,
class Index,
class Space = HostSpace>
338 template <
class ScalarType,
class Index,
class Space = HostSpace>
340 template <
class ScalarType,
class Space = HostSpace>
342 template <
class ScalarType,
class Space = HostSpace>
344 template <
class ScalarType,
class Space = HostSpace>
346 template <
class ScalarType,
class Space = HostSpace>
350 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
352 template <
class ScalarType>
354 template <
class ScalarType,
class Index>
355 struct MinMaxLocScalar;
356 template <
class ScalarType,
class Index>
359 namespace Experimental {
365 using Kokkos::MaxLoc;
367 using Kokkos::MinLoc;
368 using Kokkos::MinMax;
369 using Kokkos::MinMaxLoc;
370 using Kokkos::MinMaxLocScalar;
371 using Kokkos::MinMaxScalar;
374 using Kokkos::ValLocScalar;
Implementation detail of parallel_scan.
Memory management for host memory.
Implementation of the ParallelFor operator that has a partial specialization for the device...
Given a Functor and Execution Policy query an execution space.
Implementation detail of parallel_reduce.