1 #ifndef HeterogeneousCore_AlpakaCore_interface_QueueCache_h 2 #define HeterogeneousCore_AlpakaCore_interface_QueueCache_h 7 #include <alpaka/alpaka.hpp> 16 template <
typename Queue>
18 #ifdef ALPAKA_ACC_GPU_CUDA_ENABLED 19 friend class alpaka_cuda_async::AlpakaService;
21 #ifdef ALPAKA_ACC_GPU_HIP_ENABLED 22 friend class alpaka_rocm_async::AlpakaService;
24 #ifdef ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED 25 friend class alpaka_serial_sync::AlpakaService;
27 #ifdef ALPAKA_ACC_CPU_B_TBB_T_SEQ_ENABLED 28 friend class alpaka_tbb_async::AlpakaService;
42 std::shared_ptr<Queue>
get(
Device const& dev) {
43 return cache_[alpaka::getNativeHandle(dev)].makeOrGet([dev]() {
return std::make_unique<Queue>(dev); });
55 cache_.resize(alpaka::getDevCount<Platform>());
58 std::vector<edm::ReusableObjectHolder<Queue>>
cache_;
63 template <
typename Queue>
72 #endif // HeterogeneousCore_AlpakaCore_interface_QueueCache_h