45#ifndef KOKKOS_CORE_FWD_HPP
46#define KOKKOS_CORE_FWD_HPP
52#include <Kokkos_Macros.hpp>
53#include <impl/Kokkos_Error.hpp>
54#include <impl/Kokkos_Utilities.hpp>
56#include <Kokkos_MasterLock.hpp>
61static_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; }
76constexpr AUTO_t AUTO = Kokkos::AUTO_t();
91template <
class ExecutionSpace,
class MemorySpace>
100#include <KokkosCore_Config_FwdBackend.hpp>
110#if defined(__clang_analyzer__)
111#define KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION \
112 [[clang::annotate("DefaultExecutionSpace")]]
113#define KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION \
114 [[clang::annotate("DefaultHostExecutionSpace")]]
116#define KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION
117#define KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION
122#if defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_CUDA)
123using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Cuda;
124#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET)
125using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
126 Experimental::OpenMPTarget;
127#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HIP)
128using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
130#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SYCL)
131using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
133#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP)
134using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = OpenMP;
135#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS)
136using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Threads;
137#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX)
138using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
139 Kokkos::Experimental::HPX;
140#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL)
141using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Serial;
144 "At least one of the following execution spaces must be defined in order to use Kokkos: Kokkos::Cuda, Kokkos::Experimental::HIP, Kokkos::Experimental::SYCL, Kokkos::Experimental::OpenMPTarget, Kokkos::OpenMP, Kokkos::Threads, Kokkos::Experimental::HPX, or Kokkos::Serial."
147#if defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP)
148using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
150#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS)
151using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
153#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX)
154using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
155 Kokkos::Experimental::HPX;
156#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL)
157using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
159#elif defined(KOKKOS_ENABLE_OPENMP)
160using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
162#elif defined(KOKKOS_ENABLE_THREADS)
163using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
165#elif defined(KOKKOS_ENABLE_HPX)
166using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
167 Kokkos::Experimental::HPX;
168#elif defined(KOKKOS_ENABLE_SERIAL)
169using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
173 "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."
186#if defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_CUDA) && \
187 defined(KOKKOS_ENABLE_CUDA)
188using ActiveExecutionMemorySpace = Kokkos::CudaSpace;
189#elif defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_SYCL)
190using ActiveExecutionMemorySpace = Kokkos::Experimental::SYCLDeviceUSMSpace;
191#elif defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HIP_GPU)
192using ActiveExecutionMemorySpace = Kokkos::Experimental::HIPSpace;
193#elif defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST)
196using ActiveExecutionMemorySpace = void;
199template <
typename DstMemorySpace,
typename SrcMemorySpace>
200struct MemorySpaceAccess;
202template <
typename DstMemorySpace,
typename SrcMemorySpace,
204 SrcMemorySpace>::accessible>
206 KOKKOS_FUNCTION
static void check() {}
209template <
typename DstMemorySpace,
typename SrcMemorySpace>
210struct verify_space<DstMemorySpace, SrcMemorySpace, false> {
211 KOKKOS_FUNCTION
static void check() {
213 "Kokkos::View ERROR: attempt to access inaccessible memory space");
218class ExecSpaceInitializerBase;
223template <
class,
class,
class,
class>
224class LogicalMemorySpace;
229#define KOKKOS_RESTRICT_EXECUTION_TO_DATA(DATA_SPACE, DATA_PTR) \
230 Kokkos::Impl::verify_space<Kokkos::Impl::ActiveExecutionMemorySpace, \
231 DATA_SPACE>::check();
233#define KOKKOS_RESTRICT_EXECUTION_TO_(DATA_SPACE) \
234 Kokkos::Impl::verify_space<Kokkos::Impl::ActiveExecutionMemorySpace, \
235 DATA_SPACE>::check();
247template <
class DataType,
class... Properties>
252template <
class DstSpace,
class SrcSpace,
253 class ExecutionSpace =
typename DstSpace::execution_space>
256template <
class ViewType,
class Layout =
typename ViewType::array_layout,
257 class ExecSpace =
typename ViewType::execution_space,
258 int Rank = ViewType::Rank,
typename iType = int64_t>
261template <
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
262 int Rank,
typename iType>
265template <
class Functor,
class Policy>
266struct FunctorPolicyExecutionSpace;
275template <
class FunctorType,
class ExecPolicy,
276 class ExecutionSpace =
typename Impl::FunctorPolicyExecutionSpace<
277 FunctorType, ExecPolicy>::execution_space>
285template <
class FunctorType,
class ExecPolicy,
class ReducerType = InvalidType,
287 FunctorType, ExecPolicy>::execution_space>
296template <
class FunctorType,
class ExecPolicy,
298 FunctorType, ExecPolicy>::execution_space>
301template <
class FunctorType,
class ExecPolicy,
class ReturnType = InvalidType,
303 FunctorType, ExecPolicy>::execution_space>
304class ParallelScanWithTotal;
308template <
class ScalarType,
class Space = HostSpace>
310template <
class ScalarType,
class Space = HostSpace>
312template <
class ScalarType,
class Space = HostSpace>
314template <
class ScalarType,
class Space = HostSpace>
316template <
class ScalarType,
class Space = HostSpace>
318template <
class ScalarType,
class Index,
class Space = HostSpace>
320template <
class ScalarType,
class Index,
class Space = HostSpace>
322template <
class ScalarType,
class Index,
class Space = HostSpace>
324template <
class ScalarType,
class Space = HostSpace>
326template <
class ScalarType,
class Space = HostSpace>
328template <
class ScalarType,
class Space = HostSpace>
330template <
class ScalarType,
class Space = HostSpace>
Memory management for host memory.
Implementation of the ParallelFor operator that has a partial specialization for the device.
Implementation detail of parallel_reduce.
Implementation detail of parallel_scan.
Given a Functor and Execution Policy query an execution space.
Access relationship between DstMemorySpace and SrcMemorySpace.