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>
39#ifdef KOKKOS_IMPL_32BIT
40static_assert(
sizeof(
void *) == 4,
41 "Kokkos assumes 64-bit build; i.e., 4-byte pointers");
43static_assert(
sizeof(
void *) == 8,
44 "Kokkos assumes 64-bit build; i.e., 8-byte pointers");
51 KOKKOS_INLINE_FUNCTION
52 constexpr const AUTO_t &operator()()
const {
return *
this; }
58constexpr AUTO_t AUTO = Kokkos::AUTO_t();
73template <
class ExecutionSpace,
class MemorySpace>
77#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3
80class InitializationSettings;
85#include <KokkosCore_Config_FwdBackend.hpp>
95#if defined(__clang_analyzer__)
96#define KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION \
97 [[clang::annotate("DefaultExecutionSpace")]]
98#define KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION \
99 [[clang::annotate("DefaultHostExecutionSpace")]]
101#define KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION
102#define KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION
107#if defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_CUDA)
108using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Cuda;
109#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET)
110using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
111 Experimental::OpenMPTarget;
112#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HIP)
113using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = HIP;
114#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SYCL)
115using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
117#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENACC)
118using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
119 Experimental::OpenACC;
120#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP)
121using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = OpenMP;
122#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS)
123using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Threads;
124#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX)
125using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION =
126 Kokkos::Experimental::HPX;
127#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL)
128using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Serial;
131 "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."
134#if defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP)
135using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
137#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS)
138using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
140#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX)
141using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
142 Kokkos::Experimental::HPX;
143#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL)
144using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
146#elif defined(KOKKOS_ENABLE_OPENMP)
147using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
149#elif defined(KOKKOS_ENABLE_THREADS)
150using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
152#elif defined(KOKKOS_ENABLE_HPX)
153using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
154 Kokkos::Experimental::HPX;
155#elif defined(KOKKOS_ENABLE_SERIAL)
156using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION =
160 "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."
164#if defined(KOKKOS_ENABLE_CUDA)
165using SharedSpace = CudaUVMSpace;
166#define KOKKOS_HAS_SHARED_SPACE
167#elif defined(KOKKOS_ENABLE_HIP)
168using SharedSpace = HIPManagedSpace;
169#define KOKKOS_HAS_SHARED_SPACE
170#elif defined(KOKKOS_ENABLE_SYCL)
171using SharedSpace = Experimental::SYCLSharedUSMSpace;
172#define KOKKOS_HAS_SHARED_SPACE
174#elif !defined(KOKKOS_ENABLE_OPENACC) && !defined(KOKKOS_ENABLE_OPENMPTARGET)
176#define KOKKOS_HAS_SHARED_SPACE
179inline constexpr bool has_shared_space =
180#if defined KOKKOS_HAS_SHARED_SPACE
186#if defined(KOKKOS_ENABLE_CUDA)
187using SharedHostPinnedSpace = CudaHostPinnedSpace;
188#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
189#elif defined(KOKKOS_ENABLE_HIP)
190using SharedHostPinnedSpace = HIPHostPinnedSpace;
191#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
192#elif defined(KOKKOS_ENABLE_SYCL)
193 using SharedHostPinnedSpace = Experimental::SYCLHostUSMSpace;
194#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
195#elif !defined(KOKKOS_ENABLE_OPENACC) && !defined(KOKKOS_ENABLE_OPENMPTARGET)
197#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
200inline constexpr bool has_shared_host_pinned_space =
201#if defined KOKKOS_HAS_SHARED_HOST_PINNED_SPACE
216template <
class AccessSpace,
class MemorySpace>
222template <
class MemorySpace,
class AccessSpace,
223 bool = SpaceAccessibility<AccessSpace, MemorySpace>::accessible>
224struct RuntimeCheckMemoryAccessViolation {
225 KOKKOS_FUNCTION RuntimeCheckMemoryAccessViolation(
char const *
const) {}
230template <
class MemorySpace,
class AccessSpace>
231struct RuntimeCheckMemoryAccessViolation<MemorySpace, AccessSpace, false> {
232 KOKKOS_FUNCTION RuntimeCheckMemoryAccessViolation(
char const *
const msg) {
239template <
class MemorySpace>
240KOKKOS_FUNCTION
void runtime_check_memory_access_violation() {
242 RuntimeCheckMemoryAccessViolation<MemorySpace, DefaultHostExecutionSpace>(
243 "ERROR: attempt to access inaccessible memory space");))
245 (RuntimeCheckMemoryAccessViolation<MemorySpace, DefaultExecutionSpace>(
246 "ERROR: attempt to access inaccessible memory space");))
251template <
class MemorySpace>
252KOKKOS_FUNCTION
void runtime_check_memory_access_violation(
253 char const *
const msg) {
255 (
void)RuntimeCheckMemoryAccessViolation<MemorySpace,
256 DefaultHostExecutionSpace>(msg);))
257 KOKKOS_IF_ON_DEVICE((
259 RuntimeCheckMemoryAccessViolation<MemorySpace, DefaultExecutionSpace>(
265namespace Experimental {
266template <
class,
class,
class,
class>
278#ifdef KOKKOS_COMPILER_INTEL
280void fence(
const std::string &name);
282void fence(
const std::string &name =
"Kokkos::fence: Unnamed Global Fence");
290template <
class DataType,
class... Properties>
295template <
class DstSpace,
class SrcSpace,
296 class ExecutionSpace =
typename DstSpace::execution_space,
300template <
class ViewType,
class Layout =
typename ViewType::array_layout,
301 class ExecSpace =
typename ViewType::execution_space,
302 int Rank = ViewType::rank,
typename iType = int64_t>
305template <
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
306 int Rank,
typename iType>
309template <
class Functor,
class Policy>
319template <
class FunctorType,
class ExecPolicy,
320 class ExecutionSpace =
typename Impl::FunctorPolicyExecutionSpace<
321 FunctorType, ExecPolicy>::execution_space>
329template <
typename CombinedFunctorReducerType,
typename PolicyType,
330 typename ExecutionSpaceType>
333template <
typename FunctorType,
typename FunctorAnalysisReducerType,
334 typename Enable =
void>
335class CombinedFunctorReducer;
343template <
class FunctorType,
class ExecPolicy,
345 FunctorType, ExecPolicy>::execution_space>
348template <
class FunctorType,
class ExecPolicy,
class ReturnType = InvalidType,
350 FunctorType, ExecPolicy>::execution_space>
351class ParallelScanWithTotal;
355template <
class ScalarType,
class Space = HostSpace>
357template <
class ScalarType,
class Space = HostSpace>
359template <
class ScalarType,
class Space = HostSpace>
361template <
class ScalarType,
class Space = HostSpace>
363template <
class ScalarType,
class Space = HostSpace>
365template <
class ScalarType,
class Index,
class Space = HostSpace>
367template <
class ScalarType,
class Index,
class Space = HostSpace>
369template <
class ScalarType,
class Index,
class Space = HostSpace>
371template <
class ScalarType,
class Space = HostSpace>
373template <
class ScalarType,
class Space = HostSpace>
375template <
class ScalarType,
class Space = HostSpace>
377template <
class ScalarType,
class Space = HostSpace>
380template <
class Scalar,
class Index,
class Space = HostSpace>
382template <
class Scalar,
class Index,
class ComparatorType,
384struct MaxFirstLocCustomComparator;
386template <
class Scalar,
class Index,
class Space = HostSpace>
388template <
class Scalar,
class Index,
class ComparatorType,
390struct MinFirstLocCustomComparator;
392template <
class Scalar,
class Index,
class Space = HostSpace>
393struct MinMaxFirstLastLoc;
394template <
class Scalar,
class Index,
class ComparatorType,
396struct MinMaxFirstLastLocCustomComparator;
398template <
class Index,
class Space = HostSpace>
400template <
class Index,
class Space = HostSpace>
402template <
class Index,
class Space = HostSpace>
403struct StdIsPartitioned;
404template <
class Index,
class Space = HostSpace>
405struct StdPartitionPoint;
408#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE_FWD
409#undef KOKKOS_IMPL_PUBLIC_INCLUDE
410#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE_FWD
LogicalMemorySpace is a space that is identical to another space, but differentiable by name and temp...
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.
View to an array of data.
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 ?