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_HPX )
104 namespace Experimental {
109 #if defined( KOKKOS_ENABLE_THREADS )
113 #if defined( KOKKOS_ENABLE_OPENMP )
117 #if defined( KOKKOS_ENABLE_OPENMPTARGET )
118 namespace Experimental {
120 class OpenMPTargetSpace;
125 #if defined( KOKKOS_ENABLE_CUDA )
128 class CudaHostPinnedSpace;
132 #if defined( KOKKOS_ENABLE_ROCM )
133 namespace Experimental {
139 template<
class ExecutionSpace,
class MemorySpace>
153 #if defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_CUDA )
154 typedef Cuda DefaultExecutionSpace;
155 #elif defined ( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET )
156 typedef Experimental::OpenMPTarget DefaultExecutionSpace ;
157 #elif defined ( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_ROCM )
158 typedef Experimental::ROCm DefaultExecutionSpace ;
159 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP )
160 typedef OpenMP DefaultExecutionSpace;
161 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS )
162 typedef Threads DefaultExecutionSpace;
165 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HPX )
166 typedef Kokkos::Experimental::HPX DefaultExecutionSpace;
167 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL )
168 typedef Serial DefaultExecutionSpace;
170 # 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."
173 #if defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP )
174 typedef OpenMP DefaultHostExecutionSpace;
175 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS )
176 typedef Threads DefaultHostExecutionSpace;
179 #elif defined( KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL )
180 typedef Serial DefaultHostExecutionSpace;
181 #elif defined( KOKKOS_ENABLE_OPENMP )
182 typedef OpenMP DefaultHostExecutionSpace;
183 #elif defined( KOKKOS_ENABLE_THREADS )
184 typedef Threads DefaultHostExecutionSpace;
187 #elif defined( KOKKOS_ENABLE_HPX )
188 typedef Kokkos::Experimental::HPX DefaultHostExecutionSpace;
189 #elif defined( KOKKOS_ENABLE_SERIAL )
190 typedef Serial DefaultHostExecutionSpace;
192 # 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."
206 #if defined( KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_CUDA ) && defined( KOKKOS_ENABLE_CUDA )
207 typedef Kokkos::CudaSpace ActiveExecutionMemorySpace;
208 #elif defined( KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_ROCM_GPU )
210 #elif defined( KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST )
213 typedef void ActiveExecutionMemorySpace;
216 template<
class ActiveSpace,
class MemorySpace >
217 struct VerifyExecutionCanAccessMemorySpace {
221 template<
class Space >
222 struct VerifyExecutionCanAccessMemorySpace< Space, Space >
225 KOKKOS_INLINE_FUNCTION
static void verify(
void) {}
226 KOKKOS_INLINE_FUNCTION
static void verify(
const void *) {}
232 #define KOKKOS_RESTRICT_EXECUTION_TO_DATA( DATA_SPACE, DATA_PTR ) \
233 Kokkos::Impl::VerifyExecutionCanAccessMemorySpace< \
234 Kokkos::Impl::ActiveExecutionMemorySpace, DATA_SPACE >::verify( DATA_PTR )
236 #define KOKKOS_RESTRICT_EXECUTION_TO_( DATA_SPACE ) \
237 Kokkos::Impl::VerifyExecutionCanAccessMemorySpace< \
238 Kokkos::Impl::ActiveExecutionMemorySpace, DATA_SPACE >::verify()
252 template<
class DstSpace,
class SrcSpace,
class ExecutionSpace =
typename DstSpace::execution_space >
255 template<
class ViewType,
class Layout,
class ExecSpace,
int Rank,
typename iType>
256 struct ViewFillETIAvail;
258 template<
class ViewType,
class Layout =
typename ViewType::array_layout,
259 class ExecSpace =
typename ViewType::execution_space,
int Rank = ViewType::Rank,
typename iType = int64_t,
260 bool EtiAvail = ViewFillETIAvail<ViewType,Layout,ExecSpace,Rank,iType>::value>
263 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
int Rank,
typename iType>
264 struct ViewCopyETIAvail;
266 template<
class ViewTypeA,
class ViewTypeB,
class Layout,
class ExecSpace,
int Rank,
typename iType,
267 bool EtiAvail = ViewCopyETIAvail<ViewTypeA,ViewTypeB,Layout,ExecSpace,Rank,iType>::value>
270 template<
class Functor
272 ,
class EnableFunctor = void
273 ,
class EnablePolicy =
void
284 template<
class FunctorType,
class ExecPolicy,
class ExecutionSpace =
285 typename Impl::FunctorPolicyExecutionSpace< FunctorType, ExecPolicy >::execution_space
293 template<
class FunctorType,
class ExecPolicy,
class ReducerType = InvalidType,
class ExecutionSpace =
294 typename Impl::FunctorPolicyExecutionSpace< FunctorType, ExecPolicy >::execution_space
303 template<
class FunctorType,
class ExecPolicy,
class ExecutionSapce =
304 typename Impl::FunctorPolicyExecutionSpace< FunctorType, ExecPolicy >::execution_space
307 template<
class FunctorType,
class ExecPolicy,
class ReturnType = InvalidType,
class ExecutionSapce =
308 typename Impl::FunctorPolicyExecutionSpace< FunctorType, ExecPolicy >::execution_space
309 >
class ParallelScanWithTotal;
313 template<
class ScalarType ,
class Space = HostSpace>
struct Sum;
314 template<
class ScalarType ,
class Space = HostSpace>
struct Prod;
315 template<
class ScalarType ,
class Space = HostSpace>
struct Min;
316 template<
class ScalarType ,
class Space = HostSpace>
struct Max;
317 template<
class ScalarType ,
class Space = HostSpace>
struct MinMax;
318 template<
class ScalarType ,
class Index,
class Space = HostSpace>
struct MinLoc;
319 template<
class ScalarType ,
class Index,
class Space = HostSpace>
struct MaxLoc;
320 template<
class ScalarType ,
class Index,
class Space = HostSpace>
struct MinMaxLoc;
321 template<
class ScalarType ,
class Space = HostSpace>
struct BAnd;
322 template<
class ScalarType ,
class Space = HostSpace>
struct BOr;
323 template<
class ScalarType ,
class Space = HostSpace>
struct LAnd;
324 template<
class ScalarType ,
class Space = HostSpace>
struct LOr;
328 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
330 template<
class ScalarType>
struct MinMaxScalar;
331 template<
class ScalarType,
class Index>
struct MinMaxLocScalar;
332 template<
class ScalarType,
class Index>
struct ValLocScalar;
334 namespace Experimental {
339 using Kokkos::MinMax;
340 using Kokkos::MinLoc;
341 using Kokkos::MaxLoc;
342 using Kokkos::MinMaxLoc;
347 using Kokkos::MinMaxScalar;
348 using Kokkos::MinMaxLocScalar;
349 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.