File indexing completed on 2024-07-02 00:53:48
0001 #ifndef HeterogeneousCore_AlpakaInterface_interface_getHostCachingAllocator_h
0002 #define HeterogeneousCore_AlpakaInterface_interface_getHostCachingAllocator_h
0003
0004 #include <alpaka/alpaka.hpp>
0005
0006 #include "FWCore/Utilities/interface/thread_safety_macros.h"
0007 #include "HeterogeneousCore/AlpakaInterface/interface/AllocatorConfig.h"
0008 #include "HeterogeneousCore/AlpakaInterface/interface/CachingAllocator.h"
0009 #include "HeterogeneousCore/AlpakaInterface/interface/config.h"
0010 #include "HeterogeneousCore/AlpakaInterface/interface/host.h"
0011
0012 namespace cms::alpakatools {
0013
0014 template <typename TQueue, typename = std::enable_if_t<alpaka::isQueue<TQueue>>>
0015 inline CachingAllocator<alpaka_common::DevHost, TQueue>& getHostCachingAllocator(
0016 AllocatorConfig const& config = AllocatorConfig{}, bool debug = false) {
0017
0018 CMS_THREAD_SAFE static CachingAllocator<alpaka_common::DevHost, TQueue> allocator(
0019 host(),
0020 config,
0021 false,
0022 debug);
0023
0024
0025 return allocator;
0026 }
0027
0028 }
0029
0030 #endif