alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
Device.hpp
Go to the documentation of this file.
1/* Copyright 2024 René Widera
2 * SPDX-License-Identifier: MPL-2.0
3 */
4
5#pragma once
6
11#include "executor.hpp"
12
13#if ALPAKA_LANG_ONEAPI
14
15# include <sycl/sycl.hpp>
16
18{
19 template<typename T_Platform>
20 struct IsExecutorSupportedBy::Op<alpaka::exec::OneApi, alpaka::onHost::syclGeneric::Device<T_Platform>>
21 : std::true_type
22 {
23 };
24} // namespace alpaka::onHost::trait
25
27{
28 template<typename T_Platform>
29 struct GetFreeGlobalMemBytes::Op<syclGeneric::Device<T_Platform>>
30 {
31 size_t operator()(syclGeneric::Device<T_Platform> const& device) const
32 {
33 /* OneApi for CPU is not defining the ext_intel_free_memory aspect, therefore we fall back to query it
34 * directly from the host.
35 */
36 if constexpr(ALPAKA_TYPEOF(device.getDeviceKind()){} == deviceKind::cpu)
37 {
39 }
40
41 sycl::device const dev = std::get<0>(device.getNativeHandle());
42 return dev.get_info<sycl::ext::intel::info::device::free_memory>();
43 }
44 };
45} // namespace alpaka::onHost::internal
46
47#endif
#define ALPAKA_TYPEOF(...)
Get the type of instance.
Definition common.hpp:153
constexpr auto cpu
Definition tag.hpp:170
constexpr auto alpaka
Definition fn.hpp:66
constexpr Device device
Definition scope.hpp:70
auto getFreeGlobalMemBytes() -> std::size_t
Definition sysInfo.hpp:210
Device(Handle< T_Device > &&) -> Device< ALPAKA_TYPEOF(alpaka::internal::getApi(std::declval< T_Device >())), ALPAKA_TYPEOF(alpaka::internal::getDeviceKind(std::declval< T_Device >()))>
size_t operator()(auto const &device) const