1 #ifndef HeterogeneousCore_AlpakaInterface_interface_getDeviceCachingAllocator_h 2 #define HeterogeneousCore_AlpakaInterface_interface_getDeviceCachingAllocator_h 7 #include <alpaka/alpaka.hpp> 19 template <
typename TDev,
21 typename = std::enable_if_t<alpaka::isDevice<TDev> and alpaka::isQueue<TQueue>>>
24 auto const&
devices = cms::alpakatools::devices<alpaka::Pltf<TDev>>();
28 auto ptr = std::allocator<Allocator>().allocate(
size);
34 #if __cplusplus >= 202002L 53 std::destroy_at(ptr +
index);
57 std::allocator<Allocator>().deallocate(ptr,
size);
64 for (
size_t i =
size;
i > 0; --
i) {
65 std::destroy_at(ptr +
i - 1);
67 std::allocator<Allocator>().deallocate(ptr,
size);
70 return std::unique_ptr<Allocator[], decltype(deleter)>(ptr,
deleter);
75 template <
typename TDev,
77 typename = std::enable_if_t<alpaka::isDevice<TDev> and alpaka::isQueue<TQueue>>>
80 CMS_THREAD_SAFE static auto allocators = detail::allocate_device_allocators<TDev, TQueue>();
82 size_t const index = alpaka::getNativeHandle(device);
86 return allocators[
index];
91 #endif // HeterogeneousCore_AlpakaInterface_interface_getDeviceCachingAllocator_h
std::unique_ptr< GeometricDet > construct(DDCompactView const &cpv, std::vector< int > const &detidShifts)