1 #ifndef HeterogeneousCore_AlpakaInterface_interface_getDeviceCachingAllocator_h 2 #define HeterogeneousCore_AlpakaInterface_interface_getDeviceCachingAllocator_h 17 template <
typename TDev,
19 typename = std::enable_if_t<cms::alpakatools::is_device_v<TDev> and cms::alpakatools::is_queue_v<TQueue>>>
22 auto const&
devices = cms::alpakatools::devices<alpaka::Pltf<TDev>>();
26 auto ptr = std::allocator<Allocator>().allocate(
size);
32 #if __cplusplus >= 202002L 51 std::destroy_at(ptr +
index);
55 std::allocator<Allocator>().deallocate(ptr,
size);
62 for (
size_t i =
size;
i > 0; --
i) {
63 std::destroy_at(ptr +
i - 1);
65 std::allocator<Allocator>().deallocate(ptr,
size);
68 return std::unique_ptr<Allocator[], decltype(deleter)>(ptr,
deleter);
73 template <
typename TDev,
75 typename = std::enable_if_t<cms::alpakatools::is_device_v<TDev> and cms::alpakatools::is_queue_v<TQueue>>>
78 CMS_THREAD_SAFE static auto allocators = detail::allocate_device_allocators<TDev, TQueue>();
80 size_t const index = alpaka::getNativeHandle(device);
84 return allocators[
index];
89 #endif // HeterogeneousCore_AlpakaInterface_interface_getDeviceCachingAllocator_h
std::unique_ptr< GeometricDet > construct(DDCompactView const &cpv, std::vector< int > const &detidShifts)