src
HeterogeneousCore
AlpakaInterface
interface
getHostCachingAllocator.h
Go to the documentation of this file.
1
#ifndef HeterogeneousCore_AlpakaInterface_interface_getHostCachingAllocator_h
2
#define HeterogeneousCore_AlpakaInterface_interface_getHostCachingAllocator_h
3
4
#include <alpaka/alpaka.hpp>
5
6
#include "
FWCore/Utilities/interface/thread_safety_macros.h
"
7
#include "
HeterogeneousCore/AlpakaInterface/interface/AllocatorConfig.h
"
8
#include "
HeterogeneousCore/AlpakaInterface/interface/CachingAllocator.h
"
9
#include "
HeterogeneousCore/AlpakaInterface/interface/config.h
"
10
#include "
HeterogeneousCore/AlpakaInterface/interface/host.h
"
11
#include "
HeterogeneousCore/AlpakaInterface/interface/traits.h
"
12
13
namespace
cms::alpakatools
{
14
15
template
<
typename
TQueue,
typename
= std::enable_if_t<alpaka::isQueue<TQueue>>>
16
inline
CachingAllocator<alpaka_common::DevHost, TQueue>
&
getHostCachingAllocator
() {
17
// thread safe initialisation of the host allocator
18
CMS_THREAD_SAFE
static
CachingAllocator<alpaka_common::DevHost, TQueue>
allocator(
19
host
(),
20
config::binGrowth
,
21
config::minBin
,
22
config::maxBin
,
23
config::maxCachedBytes
,
24
config::maxCachedFraction
,
25
false
,
// reuseSameQueueAllocations
26
false
);
// debug
27
28
// the public interface is thread safe
29
return
allocator;
30
}
31
32
}
// namespace cms::alpakatools
33
34
#endif // HeterogeneousCore_AlpakaInterface_interface_getHostCachingAllocator_h
cms::alpakatools::getHostCachingAllocator
CachingAllocator< alpaka_common::DevHost, TQueue > & getHostCachingAllocator()
Definition:
getHostCachingAllocator.h:16
cms::alpakatools::config::minBin
constexpr unsigned int minBin
Definition:
AllocatorConfig.h:14
CachingAllocator.h
thread_safety_macros.h
cms::alpakatools::config::maxBin
constexpr unsigned int maxBin
Definition:
AllocatorConfig.h:17
cms::alpakatools
Definition:
PortableCollection.h:44
cms::alpakatools::config::maxCachedFraction
constexpr double maxCachedFraction
Definition:
AllocatorConfig.h:23
host.h
CMS_THREAD_SAFE
#define CMS_THREAD_SAFE
cms::alpakatools::config::maxCachedBytes
constexpr size_t maxCachedBytes
Definition:
AllocatorConfig.h:20
traits.h
cms::alpakatools::host
alpaka::DevCpu const & host()
Definition:
host.h:24
cms::alpakatools::CachingAllocator
Definition:
CachingAllocator.h:86
cms::alpakatools::config::binGrowth
constexpr unsigned int binGrowth
Definition:
AllocatorConfig.h:11
config.h
AllocatorConfig.h
Generated for CMSSW Reference Manual by
1.8.14