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
37static_assert(
sizeof(
void *) == 4,
38 "Kokkos assumes 64-bit build; i.e., 4-byte pointers");
40static_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; }
55constexpr AUTO_t AUTO = Kokkos::AUTO_t();
70template <
class ExecutionSpace,
class MemorySpace>
74class 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)
102using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Cuda;
103#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET)
104using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
105 Experimental::OpenMPTarget;
106#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HIP)
107using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = HIP;
108#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SYCL)
109using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = SYCL;
110#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENACC)
111using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
112 Experimental::OpenACC;
113#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP)
114using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = OpenMP;
115#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS)
116using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Threads;
117#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX)
118using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
119 Kokkos::Experimental::HPX;
120#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL)
121using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Serial;
124 "At least one of the following execution spaces must be defined in order to use Kokkos: Kokkos::Cuda, Kokkos::HIP, Kokkos::SYCL, Kokkos::Experimental::OpenMPTarget, Kokkos::Experimental::OpenACC, Kokkos::OpenMP, Kokkos::Threads, Kokkos::Experimental::HPX, or Kokkos::Serial."
127#if defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP)
128using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
130#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS)
131using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
133#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX)
134using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
135 Kokkos::Experimental::HPX;
136#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL)
137using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
139#elif defined(KOKKOS_ENABLE_OPENMP)
140using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
142#elif defined(KOKKOS_ENABLE_THREADS)
143using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
145#elif defined(KOKKOS_ENABLE_HPX)
146using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
147 Kokkos::Experimental::HPX;
148#elif defined(KOKKOS_ENABLE_SERIAL)
149using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
153 "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."
157#if defined(KOKKOS_ENABLE_CUDA)
158using SharedSpace = CudaUVMSpace;
159#define KOKKOS_HAS_SHARED_SPACE
160#elif defined(KOKKOS_ENABLE_HIP)
161using SharedSpace = HIPManagedSpace;
162#define KOKKOS_HAS_SHARED_SPACE
163#elif defined(KOKKOS_ENABLE_SYCL)
164using SharedSpace = SYCLSharedUSMSpace;
165#define KOKKOS_HAS_SHARED_SPACE
167#elif !defined(KOKKOS_ENABLE_OPENACC) && !defined(KOKKOS_ENABLE_OPENMPTARGET)
169#define KOKKOS_HAS_SHARED_SPACE
172inline constexpr bool has_shared_space =
173#if defined KOKKOS_HAS_SHARED_SPACE
179#if defined(KOKKOS_ENABLE_CUDA)
180using SharedHostPinnedSpace = CudaHostPinnedSpace;
181#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
182#elif defined(KOKKOS_ENABLE_HIP)
183using SharedHostPinnedSpace = HIPHostPinnedSpace;
184#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
185#elif defined(KOKKOS_ENABLE_SYCL)
186 using SharedHostPinnedSpace = SYCLHostUSMSpace;
187#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
188#elif !defined(KOKKOS_ENABLE_OPENACC) && !defined(KOKKOS_ENABLE_OPENMPTARGET)
190#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
193inline constexpr bool has_shared_host_pinned_space =
194#if defined KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
209template <
class AccessSpace,
class MemorySpace>
215template <
class MemorySpace,
class AccessSpace,
216 bool = SpaceAccessibility<AccessSpace, MemorySpace>::accessible>
217struct RuntimeCheckMemoryAccessViolation {
218 KOKKOS_FUNCTION RuntimeCheckMemoryAccessViolation(
char const *
const) {}
223template <
class MemorySpace,
class AccessSpace>
224struct RuntimeCheckMemoryAccessViolation<MemorySpace, AccessSpace, false> {
225 KOKKOS_FUNCTION RuntimeCheckMemoryAccessViolation(
char const *
const msg) {
232template <
class MemorySpace>
233KOKKOS_FUNCTION
void runtime_check_memory_access_violation() {
235 RuntimeCheckMemoryAccessViolation<MemorySpace, DefaultHostExecutionSpace>(
236 "ERROR: attempt to access inaccessible memory space");))
238 (RuntimeCheckMemoryAccessViolation<MemorySpace, DefaultExecutionSpace>(
239 "ERROR: attempt to access inaccessible memory space");))
244template <
class MemorySpace>
245KOKKOS_FUNCTION
void runtime_check_memory_access_violation(
246 char const *
const msg) {
248 (
void)RuntimeCheckMemoryAccessViolation<MemorySpace,
249 DefaultHostExecutionSpace>(msg);))
250 KOKKOS_IF_ON_DEVICE((
252 RuntimeCheckMemoryAccessViolation<MemorySpace, DefaultExecutionSpace>(
265#ifdef KOKKOS_COMPILER_INTEL
267void fence(
const std::string &name);
269void fence(
const std::string &name =
"Kokkos::fence: Unnamed Global Fence");
277template <
class DataType,
class... Properties>
282template <
class DstSpace,
class SrcSpace,
283 class ExecutionSpace =
typename DstSpace::execution_space,
287template <
class ViewType,
class Layout =
typename ViewType::array_layout,
288 class ExecSpace =
typename ViewType::execution_space,
289 int Rank = ViewType::rank,
typename iType = int64_t>
292template <
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
293 int Rank,
typename iType>
296template <
class Functor,
class Policy>
306template <
class FunctorType,
class ExecPolicy,
307 class ExecutionSpace =
typename Impl::FunctorPolicyExecutionSpace<
308 FunctorType, ExecPolicy>::execution_space>
316template <
typename CombinedFunctorReducerType,
typename PolicyType,
317 typename ExecutionSpaceType>
320template <
typename FunctorType,
typename FunctorAnalysisReducerType,
321 typename Enable =
void>
322class CombinedFunctorReducer;
330template <
class FunctorType,
class ExecPolicy,
332 FunctorType, ExecPolicy>::execution_space>
335template <
class FunctorType,
class ExecPolicy,
class ReturnType = InvalidType,
337 FunctorType, ExecPolicy>::execution_space>
338class ParallelScanWithTotal;
342template <
class ScalarType,
class Space = HostSpace>
344template <
class ScalarType,
class Space = HostSpace>
346template <
class ScalarType,
class Space = HostSpace>
348template <
class ScalarType,
class Space = HostSpace>
350template <
class ScalarType,
class Space = HostSpace>
352template <
class ScalarType,
class Index,
class Space = HostSpace>
354template <
class ScalarType,
class Index,
class Space = HostSpace>
356template <
class ScalarType,
class Index,
class Space = HostSpace>
358template <
class ScalarType,
class Space = HostSpace>
360template <
class ScalarType,
class Space = HostSpace>
362template <
class ScalarType,
class Space = HostSpace>
364template <
class ScalarType,
class Space = HostSpace>
367template <
class Scalar,
class Index,
class Space = HostSpace>
369template <
class Scalar,
class Index,
class ComparatorType,
371struct MaxFirstLocCustomComparator;
373template <
class Scalar,
class Index,
class Space = HostSpace>
375template <
class Scalar,
class Index,
class ComparatorType,
377struct MinFirstLocCustomComparator;
379template <
class Scalar,
class Index,
class Space = HostSpace>
380struct MinMaxFirstLastLoc;
381template <
class Scalar,
class Index,
class ComparatorType,
383struct MinMaxFirstLastLocCustomComparator;
385template <
class Index,
class Space = HostSpace>
387template <
class Index,
class Space = HostSpace>
389template <
class Index,
class Space = HostSpace>
390struct StdIsPartitioned;
391template <
class Index,
class Space = HostSpace>
392struct StdPartitionPoint;
395#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE_FWD
396#undef KOKKOS_IMPL_PUBLIC_INCLUDE
397#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE_FWD
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.
ScopeGuard Some user scope issues have been identified with some Kokkos::finalize calls; ScopeGuard a...
Given a Functor and Execution Policy query an execution space.
Can AccessSpace access MemorySpace ?