44 #ifndef KOKKOS_CORE_FWD_HPP
45 #define KOKKOS_CORE_FWD_HPP
51 #include <Kokkos_Macros.hpp>
52 #include <impl/Kokkos_Utilities.hpp>
54 #include <Kokkos_UniqueToken.hpp>
55 #include <Kokkos_MasterLock.hpp>
60 static_assert(
sizeof(
void*) == 8
61 ,
"Kokkos assumes 64-bit build; i.e., 8-byte pointers" );
68 KOKKOS_INLINE_FUNCTION
69 constexpr
const AUTO_t & operator()()
const {
return *
this; }
74 constexpr AUTO_t AUTO = Kokkos::AUTO_t();
77 struct InvalidType {};
89 #ifdef KOKKOS_ENABLE_HBWSPACE
90 namespace Experimental {
95 #if defined( KOKKOS_ENABLE_SERIAL )
99 #if defined( KOKKOS_ENABLE_QTHREADS )
103 #if defined( KOKKOS_ENABLE_THREADS )
107 #if defined( KOKKOS_ENABLE_OPENMP )
111 #if defined( KOKKOS_ENABLE_OPENMPTARGET )
112 namespace Experimental {
114 class OpenMPTargetSpace;
119 #if defined( KOKKOS_ENABLE_CUDA )
122 class CudaHostPinnedSpace;
126 #if defined( KOKKOS_ENABLE_ROCM )
127 namespace Experimental {
133 template<
class ExecutionSpace,
class MemorySpace>
147 #if defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_CUDA )
148 typedef Cuda DefaultExecutionSpace;
149 #elif defined ( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET )
150 typedef Experimental::OpenMPTarget DefaultExecutionSpace ;
151 #elif defined ( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_ROCM )
152 typedef Experimental::ROCm DefaultExecutionSpace ;
153 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP )
154 typedef OpenMP DefaultExecutionSpace;
155 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS )
156 typedef Threads DefaultExecutionSpace;
159 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL )
160 typedef Serial DefaultExecutionSpace;
162 # error "At least one of the following execution spaces must be defined in order to use Kokkos: Kokkos::Cuda, Kokkos::Experimental::OpenMPTarget, Kokkos::OpenMP, Kokkos::Threads, Kokkos::Qthreads, or Kokkos::Serial."
165 #if defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP )
166 typedef OpenMP DefaultHostExecutionSpace;
167 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS )
168 typedef Threads DefaultHostExecutionSpace;
171 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL )
172 typedef Serial DefaultHostExecutionSpace;
173 #elif defined( KOKKOS_ENABLE_OPENMP )
174 typedef OpenMP DefaultHostExecutionSpace;
175 #elif defined( KOKKOS_ENABLE_THREADS )
176 typedef Threads DefaultHostExecutionSpace;
179 #elif defined( KOKKOS_ENABLE_SERIAL )
180 typedef Serial DefaultHostExecutionSpace;
182 # error "At least one of the following execution spaces must be defined in order to use Kokkos: Kokkos::OpenMP, Kokkos::Threads, Kokkos::Qthreads, or Kokkos::Serial."
196 #if defined( KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_CUDA ) && defined( KOKKOS_ENABLE_CUDA )
197 typedef Kokkos::CudaSpace ActiveExecutionMemorySpace;
198 #elif defined( KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_ROCM_GPU )
200 #elif defined( KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST )
203 typedef void ActiveExecutionMemorySpace;
206 template<
class ActiveSpace,
class MemorySpace >
207 struct VerifyExecutionCanAccessMemorySpace {
211 template<
class Space >
212 struct VerifyExecutionCanAccessMemorySpace< Space, Space >
215 KOKKOS_INLINE_FUNCTION
static void verify(
void) {}
216 KOKKOS_INLINE_FUNCTION
static void verify(
const void *) {}
222 #define KOKKOS_RESTRICT_EXECUTION_TO_DATA( DATA_SPACE, DATA_PTR ) \
223 Kokkos::Impl::VerifyExecutionCanAccessMemorySpace< \
224 Kokkos::Impl::ActiveExecutionMemorySpace, DATA_SPACE >::verify( DATA_PTR )
226 #define KOKKOS_RESTRICT_EXECUTION_TO_( DATA_SPACE ) \
227 Kokkos::Impl::VerifyExecutionCanAccessMemorySpace< \
228 Kokkos::Impl::ActiveExecutionMemorySpace, DATA_SPACE >::verify()
242 template<
class DstSpace,
class SrcSpace,
class ExecutionSpace =
typename DstSpace::execution_space >
245 template<
class ViewType,
class Layout,
class ExecSpace,
int Rank,
typename iType>
246 struct ViewFillETIAvail;
248 template<
class ViewType,
class Layout =
typename ViewType::array_layout,
249 class ExecSpace =
typename ViewType::execution_space,
int Rank = ViewType::Rank,
typename iType = int64_t,
250 bool EtiAvail = ViewFillETIAvail<ViewType,Layout,ExecSpace,Rank,iType>::value>
253 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
int Rank,
typename iType>
254 struct ViewCopyETIAvail;
256 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
int Rank,
typename iType,
257 bool EtiAvail = ViewCopyETIAvail<ViewTypeA,ViewTypeB,Layout,ExecSpace,Rank,iType>::value>
260 template<
class Functor
262 ,
class EnableFunctor = void
263 ,
class EnablePolicy =
void
274 template<
class FunctorType,
class ExecPolicy,
class ExecutionSpace =
275 typename Impl::FunctorPolicyExecutionSpace< FunctorType, ExecPolicy >::execution_space
283 template<
class FunctorType,
class ExecPolicy,
class ReducerType = InvalidType,
class ExecutionSpace =
284 typename Impl::FunctorPolicyExecutionSpace< FunctorType, ExecPolicy >::execution_space
293 template<
class FunctorType,
class ExecPolicy,
class ExecutionSapce =
294 typename Impl::FunctorPolicyExecutionSpace< FunctorType, ExecPolicy >::execution_space
297 template<
class FunctorType,
class ExecPolicy,
class ReturnType = InvalidType,
class ExecutionSapce =
298 typename Impl::FunctorPolicyExecutionSpace< FunctorType, ExecPolicy >::execution_space
299 >
class ParallelScanWithTotal;
303 template<
class ScalarType ,
class Space = HostSpace>
struct Sum;
304 template<
class ScalarType ,
class Space = HostSpace>
struct Prod;
305 template<
class ScalarType ,
class Space = HostSpace>
struct Min;
306 template<
class ScalarType ,
class Space = HostSpace>
struct Max;
307 template<
class ScalarType ,
class Space = HostSpace>
struct MinMax;
308 template<
class ScalarType ,
class Index,
class Space = HostSpace>
struct MinLoc;
309 template<
class ScalarType ,
class Index,
class Space = HostSpace>
struct MaxLoc;
310 template<
class ScalarType ,
class Index,
class Space = HostSpace>
struct MinMaxLoc;
311 template<
class ScalarType ,
class Space = HostSpace>
struct BAnd;
312 template<
class ScalarType ,
class Space = HostSpace>
struct BOr;
313 template<
class ScalarType ,
class Space = HostSpace>
struct LAnd;
314 template<
class ScalarType ,
class Space = HostSpace>
struct LOr;
318 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
320 template<
class ScalarType>
struct MinMaxScalar;
321 template<
class ScalarType,
class Index>
struct MinMaxLocScalar;
322 template<
class ScalarType,
class Index>
struct ValLocScalar;
324 namespace Experimental {
329 using Kokkos::MinMax;
330 using Kokkos::MinLoc;
331 using Kokkos::MaxLoc;
332 using Kokkos::MinMaxLoc;
337 using Kokkos::MinMaxScalar;
338 using Kokkos::MinMaxLocScalar;
339 using Kokkos::ValLocScalar;
Implementation detail of parallel_scan.
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.