44 #ifndef KOKKOS_ROCM_HPP
45 #define KOKKOS_ROCM_HPP
47 #include <Kokkos_Core_fwd.hpp>
49 #if defined( KOKKOS_ENABLE_ROCM )
54 dim3(
int _x,
int _y,
int _z):x(_x),y(_y),z(_z) {};
57 #include <ROCm/hc_math_std.hpp>
63 #include <Kokkos_HostSpace.hpp>
64 #include <Kokkos_ROCmSpace.hpp>
65 #include <ROCm/Kokkos_ROCm_Exec.hpp>
66 #include <Kokkos_ScratchSpace.hpp>
69 #include <impl/Kokkos_Tags.hpp>
77 #if defined( __HCC_ACCELERATOR__ )
79 using namespace ::Concurrency::precise_math ;
94 namespace Experimental {
104 typedef ROCm execution_space ;
105 typedef ROCmSpace memory_space ;
106 typedef Kokkos::Device<execution_space,memory_space> device_type;
108 typedef LayoutLeft array_layout ;
109 typedef HostSpace::size_type size_type ;
111 typedef ScratchMemorySpace< ROCm > scratch_memory_space ;
117 ROCm( ROCm && ) = default ;
118 ROCm(
const ROCm & ) = default ;
119 ROCm & operator = ( ROCm && ) = default ;
120 ROCm & operator = (
const ROCm & ) = default ;
128 KOKKOS_INLINE_FUNCTION
static int in_parallel() {
129 #if defined( __HCC_ACCELERATOR__ )
137 static bool sleep() ;
143 static void fence() ;
154 struct SelectDevice {
156 SelectDevice() : rocm_device_id(1) {}
157 explicit SelectDevice(
int id ) : rocm_device_id( id+1 ) {}
160 int rocm_device()
const {
return m_device ; }
162 bool isAPU(
int device);
164 static void initialize(
const SelectDevice = SelectDevice());
166 static int is_initialized();
173 static int concurrency() ;
174 static const char* name();
186 struct MemorySpaceAccess
187 < Kokkos::Experimental::ROCmSpace
188 , Kokkos::Experimental::ROCm::scratch_memory_space
191 enum { assignable =
false };
192 enum { accessible =
true };
193 enum { deepcopy =
false };
197 struct VerifyExecutionCanAccessMemorySpace
198 < Kokkos::Experimental::ROCm::memory_space
199 , Kokkos::Experimental::ROCm::scratch_memory_space
202 enum { value =
true };
203 KOKKOS_INLINE_FUNCTION
static void verify(
void ) { }
204 KOKKOS_INLINE_FUNCTION
static void verify(
const void * ) { }
208 struct VerifyExecutionCanAccessMemorySpace
210 , Kokkos::Experimental::ROCm::scratch_memory_space
213 enum { value =
false };
214 inline static void verify(
void ) { Kokkos::Experimental::ROCmSpace::access_error(); }
215 inline static void verify(
const void * p ) { Kokkos::Experimental::ROCmSpace::access_error(p); }
225 #define threadIdx_x (hc_get_workitem_id(0))
226 #define threadIdx_y (hc_get_workitem_id(1))
227 #define threadIdx_z (hc_get_workitem_id(2))
229 #define blockIdx_x (hc_get_group_id(0))
230 #define blockIdx_y (hc_get_group_id(1))
231 #define blockIdx_z (hc_get_group_id(2))
233 #define blockDim_x (hc_get_group_size(0))
234 #define blockDim_y (hc_get_group_size(1))
235 #define blockDim_z (hc_get_group_size(2))
237 #define gridDim_x (hc_get_num_groups(0))
238 #define gridDim_y (hc_get_num_groups(1))
239 #define gridDim_z (hc_get_num_groups(2))
242 #include <ROCm/Kokkos_ROCm_Parallel.hpp>
243 #include <ROCm/Kokkos_ROCm_Task.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.