CMS 3D CMS Logo

AllocatorConfig.h
Go to the documentation of this file.
1 #ifndef HeterogeneousCore_AlpakaInterface_interface_AllocatorConfig_h
2 #define HeterogeneousCore_AlpakaInterface_interface_AllocatorConfig_h
3 
4 #include <limits>
5 
6 namespace cms::alpakatools {
7 
8  namespace config {
9 
10  // bin growth factor (bin_growth in cub::CachingDeviceAllocator)
11  constexpr unsigned int binGrowth = 2;
12 
13  // smallest bin, corresponds to binGrowth^minBin bytes (min_bin in cub::CachingDeviceAllocator
14  constexpr unsigned int minBin = 8; // 256 bytes
15 
16  // largest bin, corresponds to binGrowth^maxBin bytes (max_bin in cub::CachingDeviceAllocator). Note that unlike in cub, allocations larger than binGrowth^maxBin are set to fail.
17  constexpr unsigned int maxBin = 30; // 1 GB
18 
19  // total storage for the allocator; 0 means no limit.
20  constexpr size_t maxCachedBytes = 0;
21 
22  // fraction of total device memory taken for the allocator; 0 means no limit.
23  constexpr double maxCachedFraction = 0.8;
24 
25  // if both maxCachedBytes and maxCachedFraction are non-zero, the smallest resulting value is used.
26 
27  } // namespace config
28 
29 } // namespace cms::alpakatools
30 
31 #endif // HeterogeneousCore_AlpakaInterface_interface_AllocatorConfig_h
constexpr unsigned int minBin
Definition: config.py:1
constexpr unsigned int maxBin
constexpr double maxCachedFraction
constexpr size_t maxCachedBytes
constexpr unsigned int binGrowth