Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-08-15 01:07:43

0001 #ifndef HeterogeneousCore_AlpakaInterface_interface_getHostCachingAllocator_h
0002 #define HeterogeneousCore_AlpakaInterface_interface_getHostCachingAllocator_h
0003 
0004 #include "FWCore/Utilities/interface/thread_safety_macros.h"
0005 #include "HeterogeneousCore/AlpakaInterface/interface/AllocatorConfig.h"
0006 #include "HeterogeneousCore/AlpakaInterface/interface/CachingAllocator.h"
0007 #include "HeterogeneousCore/AlpakaInterface/interface/config.h"
0008 #include "HeterogeneousCore/AlpakaInterface/interface/host.h"
0009 #include "HeterogeneousCore/AlpakaInterface/interface/traits.h"
0010 
0011 namespace cms::alpakatools {
0012 
0013   template <typename TQueue, typename = std::enable_if_t<cms::alpakatools::is_queue_v<TQueue>>>
0014   inline CachingAllocator<alpaka_common::DevHost, TQueue>& getHostCachingAllocator() {
0015     // thread safe initialisation of the host allocator
0016     CMS_THREAD_SAFE static CachingAllocator<alpaka_common::DevHost, TQueue> allocator(
0017         host(),
0018         config::binGrowth,
0019         config::minBin,
0020         config::maxBin,
0021         config::maxCachedBytes,
0022         config::maxCachedFraction,
0023         false,   // reuseSameQueueAllocations
0024         false);  // debug
0025 
0026     // the public interface is thread safe
0027     return allocator;
0028   }
0029 
0030 }  // namespace cms::alpakatools
0031 
0032 #endif  // HeterogeneousCore_AlpakaInterface_interface_getHostCachingAllocator_h