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 <cstddef>
5 #include <limits>
6 
7 namespace cms::alpakatools {
8 
9  namespace config {
10 
11  // bin growth factor (bin_growth in cub::CachingDeviceAllocator)
12  constexpr unsigned int binGrowth = 2;
13 
14  // smallest bin, corresponds to binGrowth^minBin bytes (min_bin in cub::CachingDeviceAllocator
15  constexpr unsigned int minBin = 8; // 256 bytes
16 
17  // 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.
18  constexpr unsigned int maxBin = 30; // 1 GB
19 
20  // total storage for the allocator; 0 means no limit.
21  constexpr size_t maxCachedBytes = 0;
22 
23  // fraction of total device memory taken for the allocator; 0 means no limit.
24  constexpr double maxCachedFraction = 0.8;
25 
26  // if both maxCachedBytes and maxCachedFraction are non-zero, the smallest resulting value is used.
27 
28  } // namespace config
29 
30 } // namespace cms::alpakatools
31 
32 #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