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; }
54inline constexpr AUTO_t AUTO{};
68template <
class ExecutionSpace,
class MemorySpace>
72class InitializationSettings;
77#include <KokkosCore_Config_FwdBackend.hpp>
87#if defined(__clang_analyzer__)
88#define KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION \
89 [[clang::annotate("DefaultExecutionSpace")]]
90#define KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION \
91 [[clang::annotate("DefaultHostExecutionSpace")]]
93#define KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION
94#define KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION
99#if defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_CUDA)
100using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Cuda;
101#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET)
102using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
103 Experimental::OpenMPTarget;
104#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HIP)
105using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = HIP;
106#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SYCL)
107using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = SYCL;
108#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENACC)
109using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
110 Experimental::OpenACC;
111#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP)
112using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = OpenMP;
113#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS)
114using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Threads;
115#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX)
116using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
117 Kokkos::Experimental::HPX;
118#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL)
119using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Serial;
122 "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."
125#if defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP)
126using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
128#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS)
129using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
131#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX)
132using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
133 Kokkos::Experimental::HPX;
134#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL)
135using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
137#elif defined(KOKKOS_ENABLE_OPENMP)
138using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
140#elif defined(KOKKOS_ENABLE_THREADS)
141using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
143#elif defined(KOKKOS_ENABLE_HPX)
144using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
145 Kokkos::Experimental::HPX;
146#elif defined(KOKKOS_ENABLE_SERIAL)
147using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
151 "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."
155#if defined(KOKKOS_ENABLE_CUDA)
156using SharedSpace = CudaUVMSpace;
157#define KOKKOS_HAS_SHARED_SPACE
158#elif defined(KOKKOS_ENABLE_HIP)
159using SharedSpace = HIPManagedSpace;
160#define KOKKOS_HAS_SHARED_SPACE
161#elif defined(KOKKOS_ENABLE_SYCL)
162using SharedSpace = SYCLSharedUSMSpace;
163#define KOKKOS_HAS_SHARED_SPACE
165#elif !defined(KOKKOS_ENABLE_OPENACC) && !defined(KOKKOS_ENABLE_OPENMPTARGET)
166using SharedSpace = HostSpace;
167#define KOKKOS_HAS_SHARED_SPACE
170inline constexpr bool has_shared_space =
171#if defined KOKKOS_HAS_SHARED_SPACE
177#if defined(KOKKOS_ENABLE_CUDA)
178using SharedHostPinnedSpace = CudaHostPinnedSpace;
179#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
180#elif defined(KOKKOS_ENABLE_HIP)
181using SharedHostPinnedSpace = HIPHostPinnedSpace;
182#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
183#elif defined(KOKKOS_ENABLE_SYCL)
184 using SharedHostPinnedSpace = SYCLHostUSMSpace;
185#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
186#elif !defined(KOKKOS_ENABLE_OPENACC) && !defined(KOKKOS_ENABLE_OPENMPTARGET)
187 using SharedHostPinnedSpace = HostSpace;
188#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
191inline constexpr bool has_shared_host_pinned_space =
192#if defined KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
207template <
class AccessSpace,
class MemorySpace>
208struct SpaceAccessibility;
213template <
class MemorySpace,
class AccessSpace,
214 bool = SpaceAccessibility<AccessSpace, MemorySpace>::accessible>
215struct RuntimeCheckMemoryAccessViolation {
216 KOKKOS_FUNCTION RuntimeCheckMemoryAccessViolation(
char const *
const) {}
221template <
class MemorySpace,
class AccessSpace>
222struct RuntimeCheckMemoryAccessViolation<MemorySpace, AccessSpace, false> {
223 KOKKOS_FUNCTION RuntimeCheckMemoryAccessViolation(
char const *
const msg) {
230template <
class MemorySpace>
231KOKKOS_FUNCTION
void runtime_check_memory_access_violation() {
233 RuntimeCheckMemoryAccessViolation<MemorySpace, DefaultHostExecutionSpace>(
234 "ERROR: attempt to access inaccessible memory space");))
236 (RuntimeCheckMemoryAccessViolation<MemorySpace, DefaultExecutionSpace>(
237 "ERROR: attempt to access inaccessible memory space");))
242template <class MemorySpace>
243KOKKOS_FUNCTION
void runtime_check_memory_access_violation(
244 char const *const msg) {
246 (
void)RuntimeCheckMemoryAccessViolation<MemorySpace,
247 DefaultHostExecutionSpace>(msg);))
248 KOKKOS_IF_ON_DEVICE((
250 RuntimeCheckMemoryAccessViolation<MemorySpace, DefaultExecutionSpace>(
260void fence(
const std::string &name =
"Kokkos::fence: Unnamed Global Fence");
267template <
class DataType,
class... Properties>
272template <
class DstSpace,
class SrcSpace,
273 class ExecutionSpace =
typename DstSpace::execution_space,
277template <
class ViewType,
class Layout =
typename ViewType::array_layout,
278 class ExecSpace =
typename ViewType::execution_space,
279 int Rank = ViewType::rank,
typename iType = int64_t>
282template <
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
283 int Rank,
typename iType>
286template <
class Functor,
class Policy>
287struct FunctorPolicyExecutionSpace;
296template <
class FunctorType,
class ExecPolicy,
297 class ExecutionSpace =
typename Impl::FunctorPolicyExecutionSpace<
298 FunctorType, ExecPolicy>::execution_space>
312class CombinedFunctorReducer;
328class ParallelScanWithTotal;
332template <
class ScalarType,
class Space = HostSpace>
334template <
class ScalarType,
class Space = HostSpace>
336template <
class ScalarType,
class Space = HostSpace>
338template <
class ScalarType,
class Space = HostSpace>
340template <
class ScalarType,
class Space = HostSpace>
342template <
class ScalarType,
class Index,
class Space = HostSpace>
344template <
class ScalarType,
class Index,
class Space = HostSpace>
346template <
class ScalarType,
class Index,
class Space = HostSpace>
348template <
class ScalarType,
class Space = HostSpace>
350template <
class ScalarType,
class Space = HostSpace>
352template <
class ScalarType,
class Space = HostSpace>
354template <
class ScalarType,
class Space = HostSpace>
357template <
class Scalar,
class Index,
class Space = HostSpace>
361struct MaxFirstLocCustomComparator;
363template <
class Scalar,
class Index,
class Space = HostSpace>
367struct MinFirstLocCustomComparator;
369template <
class Scalar,
class Index,
class Space = HostSpace>
370struct MinMaxFirstLastLoc;
373struct MinMaxFirstLastLocCustomComparator;
375template <
class Index,
class Space = HostSpace>
377template <
class Index,
class Space = HostSpace>
379template <
class Index,
class Space = HostSpace>
380struct StdIsPartitioned;
381template <
class Index,
class Space = HostSpace>
382struct StdPartitionPoint;
385#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE_FWD
386#undef KOKKOS_IMPL_PUBLIC_INCLUDE
387#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE_FWD
A thread safe view to a bitset.
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.