17 #ifndef KOKKOS_CORE_FWD_HPP
18 #define KOKKOS_CORE_FWD_HPP
19 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
20 #define KOKKOS_IMPL_PUBLIC_INCLUDE
21 #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE_FWD
28 #include <Kokkos_Macros.hpp>
29 #include <Kokkos_Printf.hpp>
30 #include <impl/Kokkos_Error.hpp>
31 #include <impl/Kokkos_Utilities.hpp>
36 #ifdef KOKKOS_IMPL_32BIT
37 static_assert(
sizeof(
void *) == 4,
38 "Kokkos assumes 64-bit build; i.e., 4-byte pointers");
40 static_assert(
sizeof(
void *) == 8,
41 "Kokkos assumes 64-bit build; i.e., 8-byte pointers");
48 KOKKOS_INLINE_FUNCTION
49 constexpr
const AUTO_t &operator()()
const {
return *
this; }
55 constexpr AUTO_t AUTO = Kokkos::AUTO_t();
58 struct InvalidType {};
70 template <
class ExecutionSpace,
class MemorySpace>
74 class InitializationSettings;
79 #include <KokkosCore_Config_FwdBackend.hpp>
89 #if defined(__clang_analyzer__)
90 #define KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION \
91 [[clang::annotate("DefaultExecutionSpace")]]
92 #define KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION \
93 [[clang::annotate("DefaultHostExecutionSpace")]]
95 #define KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION
96 #define KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION
101 #if defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_CUDA)
102 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Cuda;
103 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET)
104 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
105 Experimental::OpenMPTarget;
106 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HIP)
107 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = HIP;
108 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SYCL)
109 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
111 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENACC)
112 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
113 Experimental::OpenACC;
114 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP)
115 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = OpenMP;
116 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS)
117 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Threads;
118 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX)
119 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
120 Kokkos::Experimental::HPX;
121 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL)
122 using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Serial;
125 "At least one of the following execution spaces must be defined in order to use Kokkos: Kokkos::Cuda, Kokkos::HIP, Kokkos::Experimental::SYCL, Kokkos::Experimental::OpenMPTarget, Kokkos::Experimental::OpenACC, Kokkos::OpenMP, Kokkos::Threads, Kokkos::Experimental::HPX, or Kokkos::Serial."
128 #if defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP)
129 using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
131 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS)
132 using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
134 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX)
135 using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
136 Kokkos::Experimental::HPX;
137 #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL)
138 using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
140 #elif defined(KOKKOS_ENABLE_OPENMP)
141 using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
143 #elif defined(KOKKOS_ENABLE_THREADS)
144 using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
146 #elif defined(KOKKOS_ENABLE_HPX)
147 using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
148 Kokkos::Experimental::HPX;
149 #elif defined(KOKKOS_ENABLE_SERIAL)
150 using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
154 "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."
158 #if defined(KOKKOS_ENABLE_CUDA)
159 using SharedSpace = CudaUVMSpace;
160 #define KOKKOS_HAS_SHARED_SPACE
161 #elif defined(KOKKOS_ENABLE_HIP)
162 using SharedSpace = HIPManagedSpace;
163 #define KOKKOS_HAS_SHARED_SPACE
164 #elif defined(KOKKOS_ENABLE_SYCL)
165 using SharedSpace = Experimental::SYCLSharedUSMSpace;
166 #define KOKKOS_HAS_SHARED_SPACE
168 #elif !defined(KOKKOS_ENABLE_OPENACC) && !defined(KOKKOS_ENABLE_OPENMPTARGET)
169 using SharedSpace = HostSpace;
170 #define KOKKOS_HAS_SHARED_SPACE
173 inline constexpr
bool has_shared_space =
174 #if defined KOKKOS_HAS_SHARED_SPACE
180 #if defined(KOKKOS_ENABLE_CUDA)
181 using SharedHostPinnedSpace = CudaHostPinnedSpace;
182 #define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
183 #elif defined(KOKKOS_ENABLE_HIP)
184 using SharedHostPinnedSpace = HIPHostPinnedSpace;
185 #define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
186 #elif defined(KOKKOS_ENABLE_SYCL)
187 using SharedHostPinnedSpace = Experimental::SYCLHostUSMSpace;
188 #define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
189 #elif !defined(KOKKOS_ENABLE_OPENACC) && !defined(KOKKOS_ENABLE_OPENMPTARGET)
190 using SharedHostPinnedSpace = HostSpace;
191 #define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
194 inline constexpr
bool has_shared_host_pinned_space =
195 #if defined KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
210 template <
class AccessSpace,
class MemorySpace>
211 struct SpaceAccessibility;
216 template <
class MemorySpace,
class AccessSpace,
217 bool = SpaceAccessibility<AccessSpace, MemorySpace>::accessible>
218 struct RuntimeCheckMemoryAccessViolation {
219 KOKKOS_FUNCTION RuntimeCheckMemoryAccessViolation(
char const *
const) {}
224 template <
class MemorySpace,
class AccessSpace>
225 struct RuntimeCheckMemoryAccessViolation<MemorySpace, AccessSpace, false> {
226 KOKKOS_FUNCTION RuntimeCheckMemoryAccessViolation(
char const *
const msg) {
233 template <
class MemorySpace>
234 KOKKOS_FUNCTION
void runtime_check_memory_access_violation() {
236 RuntimeCheckMemoryAccessViolation<MemorySpace, DefaultHostExecutionSpace>(
237 "ERROR: attempt to access inaccessible memory space");))
239 (RuntimeCheckMemoryAccessViolation<MemorySpace, DefaultExecutionSpace>(
240 "ERROR: attempt to access inaccessible memory space");))
245 template <class MemorySpace>
246 KOKKOS_FUNCTION
void runtime_check_memory_access_violation(
247 char const *const msg) {
249 (
void)RuntimeCheckMemoryAccessViolation<MemorySpace,
250 DefaultHostExecutionSpace>(msg);))
251 KOKKOS_IF_ON_DEVICE((
253 RuntimeCheckMemoryAccessViolation<MemorySpace, DefaultExecutionSpace>(
266 #ifdef KOKKOS_COMPILER_INTEL
268 void fence(
const std::string &name);
270 void fence(
const std::string &name =
"Kokkos::fence: Unnamed Global Fence");
278 template <
class DataType,
class... Properties>
283 template <
class DstSpace,
class SrcSpace,
284 class ExecutionSpace =
typename DstSpace::execution_space,
288 template <
class ViewType,
class Layout =
typename ViewType::array_layout,
289 class ExecSpace =
typename ViewType::execution_space,
290 int Rank = ViewType::rank,
typename iType = int64_t>
293 template <
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
294 int Rank,
typename iType>
297 template <
class Functor,
class Policy>
307 template <
class FunctorType,
class ExecPolicy,
309 FunctorType, ExecPolicy>::execution_space>
317 template <
typename CombinedFunctorReducerType,
typename PolicyType,
318 typename ExecutionSpaceType>
321 template <
typename FunctorType,
typename FunctorAnalysisReducerType,
322 typename Enable =
void>
323 class CombinedFunctorReducer;
331 template <
class FunctorType,
class ExecPolicy,
333 FunctorType, ExecPolicy>::execution_space>
336 template <
class FunctorType,
class ExecPolicy,
class ReturnType = InvalidType,
338 FunctorType, ExecPolicy>::execution_space>
339 class ParallelScanWithTotal;
343 template <
class ScalarType,
class Space = HostSpace>
345 template <
class ScalarType,
class Space = HostSpace>
347 template <
class ScalarType,
class Space = HostSpace>
349 template <
class ScalarType,
class Space = HostSpace>
351 template <
class ScalarType,
class Space = HostSpace>
353 template <
class ScalarType,
class Index,
class Space = HostSpace>
355 template <
class ScalarType,
class Index,
class Space = HostSpace>
357 template <
class ScalarType,
class Index,
class Space = HostSpace>
359 template <
class ScalarType,
class Space = HostSpace>
361 template <
class ScalarType,
class Space = HostSpace>
363 template <
class ScalarType,
class Space = HostSpace>
365 template <
class ScalarType,
class Space = HostSpace>
368 template <
class Scalar,
class Index,
class Space = HostSpace>
370 template <
class Scalar,
class Index,
class ComparatorType,
372 struct MaxFirstLocCustomComparator;
374 template <
class Scalar,
class Index,
class Space = HostSpace>
376 template <
class Scalar,
class Index,
class ComparatorType,
378 struct MinFirstLocCustomComparator;
380 template <
class Scalar,
class Index,
class Space = HostSpace>
381 struct MinMaxFirstLastLoc;
382 template <
class Scalar,
class Index,
class ComparatorType,
384 struct MinMaxFirstLastLocCustomComparator;
386 template <
class Index,
class Space = HostSpace>
388 template <
class Index,
class Space = HostSpace>
390 template <
class Index,
class Space = HostSpace>
391 struct StdIsPartitioned;
392 template <
class Index,
class Space = HostSpace>
393 struct StdPartitionPoint;
396 #ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE_FWD
397 #undef KOKKOS_IMPL_PUBLIC_INCLUDE
398 #undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE_FWD
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.