/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
HeterogeneousCore/AlpakaInterface/interface/devices.h
30 строк
1 KB
Andrea Bocci
Update Alpaka to version 1.1.0
12 фев 2024, 13:29
Не верифицирован
12 фев 2024, 13:29
9bfce46
Код
Авторство
О чём код?
#ifndef HeterogeneousCore_AlpakaInterface_interface_devices_h #define HeterogeneousCore_AlpakaInterface_interface_devices_h #include <vector> #include <alpaka/alpaka.hpp> #include "HeterogeneousCore/AlpakaInterface/interface/config.h" namespace cms::alpakatools { // returns the alpaka accelerator platform template <typename TPlatform, typename = std::enable_if_t<alpaka::isPlatform<TPlatform>>> inline TPlatform const& platform() { // initialise the platform the first time that this function is called static const auto platform = TPlatform{}; return platform; } // return the alpaka accelerator devices for the given platform template <typename TPlatform, typename = std::enable_if_t<alpaka::isPlatform<TPlatform>>> inline std::vector<alpaka::Dev<TPlatform>> const& devices() { // enumerate all devices the first time that this function is called static const auto devices = alpaka::getDevs(platform<TPlatform>()); return devices; } } // namespace cms::alpakatools #endif // HeterogeneousCore_AlpakaInterface_interface_devices_h