1 #ifndef HeterogeneousCore_AlpakaInterface_interface_devices_h 2 #define HeterogeneousCore_AlpakaInterface_interface_devices_h 7 #include <alpaka/alpaka.hpp> 16 template <
typename TPlatform,
typename = std::enable_if_t<is_platform_v<TPlatform>>>
18 using Platform = TPlatform;
19 using Device = alpaka::Dev<Platform>;
22 uint32_t
n = alpaka::getDevCount<Platform>();
24 for (uint32_t
i = 0;
i <
n; ++
i) {
25 devices.push_back(alpaka::getDevByIdx<Platform>(
i));
26 assert(alpaka::getNativeHandle(
devices.back()) == static_cast<int>(
i));
35 template <
typename TPlatform,
typename = std::enable_if_t<is_platform_v<TPlatform>>>
36 inline std::vector<alpaka::Dev<TPlatform>>
const&
devices() {
37 static const auto devices = detail::enumerate_devices<TPlatform>();
43 #endif // HeterogeneousCore_AlpakaInterface_interface_devices_h