44 #ifndef KOKKOS_CUDA_HPP
45 #define KOKKOS_CUDA_HPP
47 #include <Kokkos_Macros.hpp>
48 #if defined( KOKKOS_ENABLE_CUDA )
50 #include <Kokkos_Core_fwd.hpp>
55 #include <Kokkos_CudaSpace.hpp>
58 #include <Kokkos_TaskScheduler.hpp>
60 #include <Kokkos_ScratchSpace.hpp>
61 #include <Kokkos_MemoryTraits.hpp>
62 #include <impl/Kokkos_Tags.hpp>
93 typedef Cuda execution_space ;
95 #if defined( KOKKOS_ENABLE_CUDA_UVM )
96 typedef CudaUVMSpace memory_space ;
99 typedef CudaSpace memory_space ;
104 typedef Kokkos::Device<execution_space,memory_space> device_type;
107 typedef memory_space::size_type size_type ;
110 typedef LayoutLeft array_layout ;
113 typedef ScratchMemorySpace< Cuda > scratch_memory_space ;
122 KOKKOS_INLINE_FUNCTION
static int in_parallel() {
123 #if defined( __CUDA_ARCH__ )
159 static int concurrency();
170 explicit Cuda(
const int instance_id );
172 Cuda( Cuda && ) = default ;
173 Cuda(
const Cuda & ) = default ;
174 Cuda & operator = ( Cuda && ) = default ;
175 Cuda & operator = (
const Cuda & ) = default ;
181 struct SelectDevice {
183 SelectDevice() : cuda_device_id(0) {}
184 explicit SelectDevice(
int id ) : cuda_device_id( id ) {}
187 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
192 static int is_initialized();
195 static void initialize(
const SelectDevice = SelectDevice()
196 ,
const size_t num_instances = 1 );
198 static void impl_finalize();
202 static int impl_is_initialized();
205 static void impl_initialize(
const SelectDevice = SelectDevice()
206 ,
const size_t num_instances = 1 );
212 static size_type device_arch();
215 static size_type detect_device_count();
220 static std::vector<unsigned> detect_device_arch();
222 cudaStream_t cuda_stream()
const {
return m_stream ; }
223 int cuda_device()
const {
return m_device ; }
228 static const char* name();
233 cudaStream_t m_stream ;
245 struct MemorySpaceAccess
247 , Kokkos::Cuda::scratch_memory_space
250 enum { assignable =
false };
251 enum { accessible =
true };
252 enum { deepcopy =
false };
255 #if defined( KOKKOS_ENABLE_CUDA_UVM )
264 struct MemorySpaceAccess
265 < Kokkos::CudaUVMSpace
266 , Kokkos::Cuda::scratch_memory_space
269 enum { assignable =
false };
270 enum { accessible =
true };
271 enum { deepcopy =
false };
278 struct VerifyExecutionCanAccessMemorySpace
280 , Kokkos::Cuda::scratch_memory_space
283 enum { value =
true };
284 KOKKOS_INLINE_FUNCTION
static void verify(
void ) { }
285 KOKKOS_INLINE_FUNCTION
static void verify(
const void * ) { }
289 struct VerifyExecutionCanAccessMemorySpace
291 , Kokkos::Cuda::scratch_memory_space
294 enum { value =
false };
295 inline static void verify(
void ) { CudaSpace::access_error(); }
296 inline static void verify(
const void * p ) { CudaSpace::access_error(p); }
305 #include <Cuda/Kokkos_CudaExec.hpp>
306 #include <Cuda/Kokkos_Cuda_View.hpp>
307 #include <Cuda/Kokkos_Cuda_Team.hpp>
308 #include <Cuda/Kokkos_Cuda_Parallel.hpp>
309 #include <Cuda/Kokkos_Cuda_Task.hpp>
310 #include <Cuda/Kokkos_Cuda_UniqueToken.hpp>
312 #include <KokkosExp_MDRangePolicy.hpp>
void print_configuration(std::ostream &, const bool detail=false)
Print "Bill of Materials".
Declaration of various MemoryLayout options.
Declaration of parallel operators.
void finalize()
Finalize the spaces that were initialized via Kokkos::initialize.