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 <impl/Kokkos_Error.hpp>
30#include <impl/Kokkos_Utilities.hpp>
32#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
33#include <Kokkos_MasterLock.hpp>
39static_assert(
sizeof(
void *) == 8,
40 "Kokkos assumes 64-bit build; i.e., 8-byte pointers");
47 KOKKOS_INLINE_FUNCTION
48 constexpr const AUTO_t &operator()()
const {
return *
this; }
54constexpr AUTO_t AUTO = Kokkos::AUTO_t();
69template <
class ExecutionSpace,
class MemorySpace>
73#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
76class InitializationSettings;
81#include <KokkosCore_Config_FwdBackend.hpp>
91#if defined(__clang_analyzer__)
92#define KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION \
93 [[clang::annotate("DefaultExecutionSpace")]]
94#define KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION \
95 [[clang::annotate("DefaultHostExecutionSpace")]]
97#define KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION
98#define KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION
103#if defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_CUDA)
104using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Cuda;
105#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET)
106using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
107 Experimental::OpenMPTarget;
108#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HIP)
109using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = HIP;
110#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SYCL)
111using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
113#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENACC)
114using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
115 Experimental::OpenACC;
116#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP)
117using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = OpenMP;
118#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS)
119using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Threads;
120#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX)
121using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
122 Kokkos::Experimental::HPX;
123#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL)
124using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Serial;
127 "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."
130#if defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP)
131using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
133#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS)
134using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
136#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX)
137using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
138 Kokkos::Experimental::HPX;
139#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL)
140using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
142#elif defined(KOKKOS_ENABLE_OPENMP)
143using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
145#elif defined(KOKKOS_ENABLE_THREADS)
146using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
148#elif defined(KOKKOS_ENABLE_HPX)
149using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
150 Kokkos::Experimental::HPX;
151#elif defined(KOKKOS_ENABLE_SERIAL)
152using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
156 "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."
160#if defined(KOKKOS_ENABLE_CUDA)
161using SharedSpace = CudaUVMSpace;
162#define KOKKOS_HAS_SHARED_SPACE
163#elif defined(KOKKOS_ENABLE_HIP)
164using SharedSpace = HIPManagedSpace;
165#define KOKKOS_HAS_SHARED_SPACE
166#elif defined(KOKKOS_ENABLE_SYCL)
167using SharedSpace = Experimental::SYCLSharedUSMSpace;
168#define KOKKOS_HAS_SHARED_SPACE
170#elif !defined(KOKKOS_ENABLE_OPENACC) && !defined(KOKKOS_ENABLE_OPENMPTARGET)
171using SharedSpace = HostSpace;
172#define KOKKOS_HAS_SHARED_SPACE
175inline constexpr bool has_shared_space =
176#if defined KOKKOS_HAS_SHARED_SPACE
182#if defined(KOKKOS_ENABLE_CUDA)
183using SharedHostPinnedSpace = CudaHostPinnedSpace;
184#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
185#elif defined(KOKKOS_ENABLE_HIP)
186using SharedHostPinnedSpace = HIPHostPinnedSpace;
187#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
188#elif defined(KOKKOS_ENABLE_SYCL)
189 using SharedHostPinnedSpace = Experimental::SYCLHostUSMSpace;
190#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
191#elif !defined(KOKKOS_ENABLE_OPENACC) && !defined(KOKKOS_ENABLE_OPENMPTARGET)
192 using SharedHostPinnedSpace = HostSpace;
193#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
196inline constexpr bool has_shared_host_pinned_space =
197#if defined KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
212template <
class AccessSpace,
class MemorySpace>
213struct SpaceAccessibility;
218template <
class MemorySpace,
class AccessSpace,
219 bool = SpaceAccessibility<AccessSpace, MemorySpace>::accessible>
220struct RuntimeCheckMemoryAccessViolation {
221 KOKKOS_FUNCTION RuntimeCheckMemoryAccessViolation(
char const *
const) {}
226template <
class MemorySpace,
class AccessSpace>
227struct RuntimeCheckMemoryAccessViolation<MemorySpace, AccessSpace, false> {
228 KOKKOS_FUNCTION RuntimeCheckMemoryAccessViolation(
char const *
const msg) {
235template <
class MemorySpace>
236KOKKOS_FUNCTION
void runtime_check_memory_access_violation() {
238 RuntimeCheckMemoryAccessViolation<MemorySpace, DefaultHostExecutionSpace>(
239 "ERROR: attempt to access inaccessible memory space");))
241 (RuntimeCheckMemoryAccessViolation<MemorySpace, DefaultExecutionSpace>(
242 "ERROR: attempt to access inaccessible memory space");))
247template <class MemorySpace>
248KOKKOS_FUNCTION
void runtime_check_memory_access_violation(
249 char const *const msg) {
251 (
void)RuntimeCheckMemoryAccessViolation<MemorySpace,
252 DefaultHostExecutionSpace>(msg);))
253 KOKKOS_IF_ON_DEVICE((
255 RuntimeCheckMemoryAccessViolation<MemorySpace, DefaultExecutionSpace>(
262template <
class,
class,
class,
class>
263class LogicalMemorySpace;
274#ifdef KOKKOS_COMPILER_INTEL
276void fence(
const std::string &name);
278void fence(
const std::string &name =
"Kokkos::fence: Unnamed Global Fence");
286template <
class DataType,
class... Properties>
291template <
class DstSpace,
class SrcSpace,
292 class ExecutionSpace =
typename DstSpace::execution_space,
296template <
typename ExecutionSpace,
class DT,
class... DP>
299template <
class ViewType,
class Layout =
typename ViewType::array_layout,
300 class ExecSpace =
typename ViewType::execution_space,
301 int Rank = ViewType::Rank,
typename iType = int64_t>
304template <
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
305 int Rank,
typename iType>
308template <
class Functor,
class Policy>
309struct FunctorPolicyExecutionSpace;
318template <
class FunctorType,
class ExecPolicy,
319 class ExecutionSpace =
typename Impl::FunctorPolicyExecutionSpace<
320 FunctorType, ExecPolicy>::execution_space>
347class ParallelScanWithTotal;
351template <
class ScalarType,
class Space = HostSpace>
353template <
class ScalarType,
class Space = HostSpace>
355template <
class ScalarType,
class Space = HostSpace>
357template <
class ScalarType,
class Space = HostSpace>
359template <
class ScalarType,
class Space = HostSpace>
361template <
class ScalarType,
class Index,
class Space = HostSpace>
363template <
class ScalarType,
class Index,
class Space = HostSpace>
365template <
class ScalarType,
class Index,
class Space = HostSpace>
367template <
class ScalarType,
class Space = HostSpace>
369template <
class ScalarType,
class Space = HostSpace>
371template <
class ScalarType,
class Space = HostSpace>
373template <
class ScalarType,
class Space = HostSpace>
376template <
class Scalar,
class Index,
class Space = HostSpace>
380struct MaxFirstLocCustomComparator;
382template <
class Scalar,
class Index,
class Space = HostSpace>
386struct MinFirstLocCustomComparator;
388template <
class Scalar,
class Index,
class Space = HostSpace>
389struct MinMaxFirstLastLoc;
392struct MinMaxFirstLastLocCustomComparator;
394template <
class Index,
class Space = HostSpace>
396template <
class Index,
class Space = HostSpace>
398template <
class Index,
class Space = HostSpace>
399struct StdIsPartitioned;
400template <
class Index,
class Space = HostSpace>
401struct StdPartitionPoint;
404#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE_FWD
405#undef KOKKOS_IMPL_PUBLIC_INCLUDE
406#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.