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> 60 #include <Kokkos_ScratchSpace.hpp> 61 #include <Kokkos_MemoryTraits.hpp> 62 #include <impl/Kokkos_Tags.hpp> 92 typedef Cuda execution_space ;
94 #if defined( KOKKOS_USE_CUDA_UVM ) 95 typedef CudaUVMSpace memory_space ;
98 typedef CudaSpace memory_space ;
106 typedef memory_space::size_type size_type ;
109 typedef LayoutLeft array_layout ;
112 typedef ScratchMemorySpace< Cuda > scratch_memory_space ;
121 KOKKOS_INLINE_FUNCTION
static int in_parallel() {
122 #if defined( __CUDA_ARCH__ ) 161 static int is_initialized();
164 static void print_configuration( std::ostream & ,
const bool detail =
false );
172 explicit Cuda(
const int instance_id );
174 Cuda(
const Cuda & ) = default ;
175 Cuda( Cuda && ) = default ;
176 Cuda & operator = (
const Cuda & ) = default ;
177 Cuda & operator = ( Cuda && ) = default ;
183 struct SelectDevice {
185 SelectDevice() : cuda_device_id(0) {}
186 explicit SelectDevice(
int id ) : cuda_device_id( id ) {}
190 static void initialize(
const SelectDevice = SelectDevice()
191 ,
const size_t num_instances = 1 );
196 static size_type device_arch();
199 static size_type detect_device_count();
204 static std::vector<unsigned> detect_device_arch();
206 cudaStream_t cuda_stream()
const {
return m_stream ; }
207 int cuda_device()
const {
return m_device ; }
214 cudaStream_t m_stream ;
227 struct VerifyExecutionCanAccessMemorySpace
229 , Kokkos::Cuda::scratch_memory_space
232 enum { value =
true };
233 KOKKOS_INLINE_FUNCTION
static void verify(
void ) { }
234 KOKKOS_INLINE_FUNCTION
static void verify(
const void * ) { }
238 struct VerifyExecutionCanAccessMemorySpace
240 , Kokkos::Cuda::scratch_memory_space
243 enum { value =
false };
244 inline static void verify(
void ) { CudaSpace::access_error(); }
245 inline static void verify(
const void * p ) { CudaSpace::access_error(p); }
254 #include <Cuda/Kokkos_CudaExec.hpp> 255 #include <Cuda/Kokkos_Cuda_View.hpp> 257 #include <KokkosExp_View.hpp> 258 #include <Cuda/KokkosExp_Cuda_View.hpp> 260 #include <Cuda/Kokkos_Cuda_Parallel.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.