44 #ifndef KOKKOS_CUDA_HPP 45 #define KOKKOS_CUDA_HPP 47 #include <Kokkos_Core_fwd.hpp> 51 #if defined( KOKKOS_HAVE_CUDA ) 56 #include <Kokkos_CudaSpace.hpp> 59 #include <Kokkos_TaskScheduler.hpp> 61 #include <Kokkos_ScratchSpace.hpp> 62 #include <Kokkos_MemoryTraits.hpp> 63 #include <impl/Kokkos_Tags.hpp> 65 #include <KokkosExp_MDRangePolicy.hpp> 95 typedef Cuda execution_space ;
97 #if defined( KOKKOS_USE_CUDA_UVM ) 98 typedef CudaUVMSpace memory_space ;
101 typedef CudaSpace memory_space ;
109 typedef memory_space::size_type size_type ;
112 typedef LayoutLeft array_layout ;
115 typedef ScratchMemorySpace< Cuda > scratch_memory_space ;
124 KOKKOS_INLINE_FUNCTION
static int in_parallel() {
125 #if defined( __CUDA_ARCH__ ) 164 static int is_initialized();
167 static int concurrency();
170 static void print_configuration( std::ostream & ,
const bool detail =
false );
178 explicit Cuda(
const int instance_id );
180 Cuda( Cuda && ) = default ;
181 Cuda(
const Cuda & ) = default ;
182 Cuda & operator = ( Cuda && ) = default ;
183 Cuda & operator = (
const Cuda & ) = default ;
189 struct SelectDevice {
191 SelectDevice() : cuda_device_id(0) {}
192 explicit SelectDevice(
int id ) : cuda_device_id( id ) {}
196 static void initialize(
const SelectDevice = SelectDevice()
197 ,
const size_t num_instances = 1 );
202 static size_type device_arch();
205 static size_type detect_device_count();
210 static std::vector<unsigned> detect_device_arch();
212 cudaStream_t cuda_stream()
const {
return m_stream ; }
213 int cuda_device()
const {
return m_device ; }
220 cudaStream_t m_stream ;
233 struct VerifyExecutionCanAccessMemorySpace
235 , Kokkos::Cuda::scratch_memory_space
238 enum { value =
true };
239 KOKKOS_INLINE_FUNCTION
static void verify(
void ) { }
240 KOKKOS_INLINE_FUNCTION
static void verify(
const void * ) { }
244 struct VerifyExecutionCanAccessMemorySpace
246 , Kokkos::Cuda::scratch_memory_space
249 enum { value =
false };
250 inline static void verify(
void ) { CudaSpace::access_error(); }
251 inline static void verify(
const void * p ) { CudaSpace::access_error(p); }
260 #include <Cuda/Kokkos_CudaExec.hpp> 261 #include <Cuda/Kokkos_Cuda_View.hpp> 262 #include <Cuda/Kokkos_Cuda_Parallel.hpp> 263 #include <Cuda/Kokkos_Cuda_Task.hpp> Memory space for main process and CPU execution spaces.
Declaration of various MemoryLayout options.
Declaration of parallel operators.
void finalize()
Finalize the spaces that were initialized via Kokkos::initialize.