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> 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 template <
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) 123 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Cuda;
124 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET) 125 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
126 Experimental::OpenMPTarget;
127 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HIP) 128 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
130 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SYCL) 131 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
133 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP) 134 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = OpenMP;
135 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS) 136 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Threads;
137 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX) 138 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
139 Kokkos::Experimental::HPX;
140 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL) 141 using 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) 148 using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
150 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS) 151 using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
153 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX) 154 using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
155 Kokkos::Experimental::HPX;
156 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL) 157 using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
159 #elif defined(KOKKOS_ENABLE_OPENMP) 160 using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
162 #elif defined(KOKKOS_ENABLE_THREADS) 163 using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
165 #elif defined(KOKKOS_ENABLE_HPX) 166 using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
167 Kokkos::Experimental::HPX;
168 #elif defined(KOKKOS_ENABLE_SERIAL) 169 using 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) 188 using ActiveExecutionMemorySpace = Kokkos::CudaSpace;
189 #elif defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_SYCL) 190 using ActiveExecutionMemorySpace = Kokkos::Experimental::SYCLDeviceUSMSpace;
191 #elif defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HIP_GPU) 192 using ActiveExecutionMemorySpace = Kokkos::Experimental::HIPSpace;
193 #elif defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST) 196 using ActiveExecutionMemorySpace = void;
199 template <
typename DstMemorySpace,
typename SrcMemorySpace>
200 struct MemorySpaceAccess;
202 template <
typename DstMemorySpace,
typename SrcMemorySpace,
204 SrcMemorySpace>::accessible>
205 struct verify_space {
206 KOKKOS_FUNCTION
static void check() {}
209 template <
typename DstMemorySpace,
typename SrcMemorySpace>
210 struct verify_space<DstMemorySpace, SrcMemorySpace, false> {
211 KOKKOS_FUNCTION
static void check() {
213 "Kokkos::View ERROR: attempt to access inaccessible memory space");
218 class ExecSpaceInitializerBase;
223 template <
class,
class,
class,
class>
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(); 247 template <
class DataType,
class... Properties>
252 template <
class DstSpace,
class SrcSpace,
253 class ExecutionSpace =
typename DstSpace::execution_space>
256 template <
class ViewType,
class Layout =
typename ViewType::array_layout,
257 class ExecSpace =
typename ViewType::execution_space,
258 int Rank = ViewType::Rank,
typename iType = int64_t>
261 template <
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
262 int Rank,
typename iType>
265 template <
class Functor,
class Policy>
275 template <
class FunctorType,
class ExecPolicy,
277 FunctorType, ExecPolicy>::execution_space>
285 template <
class FunctorType,
class ExecPolicy,
class ReducerType = InvalidType,
287 FunctorType, ExecPolicy>::execution_space>
296 template <
class FunctorType,
class ExecPolicy,
298 FunctorType, ExecPolicy>::execution_space>
301 template <
class FunctorType,
class ExecPolicy,
class ReturnType = InvalidType,
303 FunctorType, ExecPolicy>::execution_space>
304 class ParallelScanWithTotal;
308 template <
class ScalarType,
class Space = HostSpace>
310 template <
class ScalarType,
class Space = HostSpace>
312 template <
class ScalarType,
class Space = HostSpace>
314 template <
class ScalarType,
class Space = HostSpace>
316 template <
class ScalarType,
class Space = HostSpace>
318 template <
class ScalarType,
class Index,
class Space = HostSpace>
320 template <
class ScalarType,
class Index,
class Space = HostSpace>
322 template <
class ScalarType,
class Index,
class Space = HostSpace>
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>
Implementation detail of parallel_scan.
View to an array of data.
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.
LogicalMemorySpace is a space that is identical to another space, but differentiable by name and temp...
Access relationship between DstMemorySpace and SrcMemorySpace.