30 template<alpaka::concepts::Api T_Api, alpaka::concepts::DeviceKind T_DeviceKind>
34 using PlatformHandle =
ALPAKA_TYPEOF(internal::makePlatform(T_Api{}, T_DeviceKind{}));
36 internal::MakeDevice::Op<typename PlatformHandle::element_type>{}(
37 *std::declval<PlatformHandle>().get(),
39 DeviceHandle m_device;
42 friend struct alpaka::internal::GetName;
43 friend struct internal::GetNativeHandle;
49 return m_device.get();
52 template<
typename T_Device>
54 : m_device{
std::forward<
Handle<T_Device>>(internalDeviceHandle)}
60 static_assert(internal::concepts::Device<element_type>);
65 return alpaka::internal::GetName::Op<std::decay_t<
decltype(*m_device.get())>>{}(*m_device.get());
70 return internal::getNativeHandle(*m_device.get());
75 return this->
get() == other.
get();
80 return this->
get() != other.
get();
115 return Event{internal::MakeEvent::Op<std::decay_t<
decltype(*m_device.get())>>{}(*m_device.get())};
122 return internal::wait(*m_device.get());
133 return internal::GetDeviceProperties::Op<
ALPAKA_TYPEOF(*m_device.get())>{}(*m_device.get());
138 return internal::GetFreeGlobalMemBytes::Op<
ALPAKA_TYPEOF(*m_device.get())>{}(*m_device.get());
143 return T_DeviceKind{};
160 template<
typename T_Device>
164 template<
typename T_Device>
166 ALPAKA_TYPEOF(alpaka::internal::getApi(std::declval<T_Device>())),
167 ALPAKA_TYPEOF(alpaka::internal::getDeviceKind(std::declval<T_Device>()))>;
179 template<
typename T_Type>
182 Vec const extentsVec = extents;
183 return internal::Alloc::Op<T_Type, std::decay_t<
decltype(*device.
get())>,
ALPAKA_TYPEOF(extentsVec)>{}(
200 template<
typename T_Type>
203 Vec const extentsVec = extents;
204 return internal::AllocUnified::Op<T_Type, std::decay_t<
decltype(*device.
get())>,
ALPAKA_TYPEOF(extentsVec)>{}(
222 template<
typename T_Type,
typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
227 Vec const extentsVec = extents;
228 return internal::AllocUnified::
229 Op<T_Type, std::decay_t<
decltype(*queue.getDevice().
get())>,
ALPAKA_TYPEOF(extentsVec)>{}(
230 *queue.getDevice().
get(),
244 template<
typename T_Type>
247 Vec const extentsVec = extents;
248 return internal::AllocMapped::Op<T_Type, std::decay_t<
decltype(*device.
get())>,
ALPAKA_TYPEOF(extentsVec)>{}(
263 template<
typename T_Type,
typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
302 || internal::IsDataAccessible::SecondPath<
312 template<
typename T_Device, alpaka::concepts::QueueKind T_QueueKind>
316 *queue.getDevice().
get(),
318 || internal::IsDataAccessible::SecondPath<
329 template<
typename T_Api, alpaka::concepts::DeviceKind T_DeviceKind>
338 return internal::getFrameSpec(*device.
get(), usedExecutor, extents);
341 return internal::getFrameSpec(*device.
get(), executor, extents);
355 template<
typename T_DataType,
typename T_Api, alpaka::concepts::DeviceKind T_DeviceKind>
364 return internal::getSimdFrameSpec<T_DataType>(*device.
get(), usedExecutor, extents);
367 return internal::getSimdFrameSpec<T_DataType>(*device.
get(), executor, extents);
#define ALPAKA_TYPEOF(...)
Get the type of instance.
Concept to check for APIs.
Concept to check for an executor.
Interface concept for objects describing api-related multidimensional memory access.
Concept to check if a type is a queue kind.
Validates if T is a specialization of the unspecialized template type U.
Concept to check if a type is a vector or scalar variable.
Concept to check if something is a device.
Concept to check if a type is a FrameSpec.
constexpr AnyExecutor anyExecutor
Automatic executor selection.
Functionality which is usable on the host CPU controller thread.
bool isDataAccessible(concepts::Device auto const &device, alpaka::concepts::IView auto const &view)
Check if the given view is accessible on the given device.
constexpr auto defaultExecutor(internal::concepts::DeviceHandle auto deviceHandle)
Select a default executor for the given device.
constexpr concepts::FrameSpec auto getSimdFrameSpec(Device< T_Api, T_DeviceKind > const &device, alpaka::concepts::Executor auto executor, alpaka::concepts::VectorOrScalar auto const &extents)
Provides a frame specification to operate on a given index range.
std::shared_ptr< T > Handle
auto allocUnified(concepts::Device auto const &device, alpaka::concepts::VectorOrScalar auto const &extents)
Allocate memory on the given device with unified virtual memory.
constexpr concepts::FrameSpec auto getFrameSpec(Device< T_Api, T_DeviceKind > const &device, alpaka::concepts::Executor auto executor, alpaka::concepts::VectorOrScalar auto const &extents)
Provides a frame specification to operate on a given index range.
auto allocLike(concepts::Device auto const &device, auto const &view)
Allocate memory on the given device based on a view.
Device(Handle< T_Device > &&) -> Device< ALPAKA_TYPEOF(alpaka::internal::getApi(std::declval< T_Device >())), ALPAKA_TYPEOF(alpaka::internal::getDeviceKind(std::declval< T_Device >()))>
auto allocMapped(concepts::Device auto const &device, alpaka::concepts::VectorOrScalar auto const &extents)
Allocate pinned memory on the host which is mapped into the address space of the device.
auto alloc(concepts::Device auto const &device, alpaka::concepts::VectorOrScalar auto const &extents)
Allocate memory on the given device.
constexpr auto nonBlocking
typename GetValueType< T >::type GetValueType_t
constexpr decltype(auto) getDeviceKind(auto &&any)
Get the device type of an object.
constexpr decltype(auto) getApi(auto &&any)
Get the API an object depends on.
constexpr decltype(auto) get(concepts::SpecializationOf< Dict > auto &t) noexcept
Description of a specific device that one can schedule kernels on.
bool operator!=(Device const &other) const
bool operator==(Device const &other) const
auto makeQueue(alpaka::concepts::QueueKind auto kind)
Create a queue for this device.
constexpr auto getDeviceKind() const
auto getNativeHandle() const
void wait()
Blocks the caller until the given handle executes all work.
constexpr alpaka::concepts::Api auto getApi() const
size_t getFreeGlobalMemBytes() const
Device(Handle< T_Device > &&internalDeviceHandle)
std::string getName() const
typename DeviceHandle::element_type element_type
DeviceProperties getDeviceProperties() const
Properties of a given device.