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