Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-03 04:17:57

0001 #ifndef HeterogeneousCore_AlpakaInterface_interface_AllocatorConfig_h
0002 #define HeterogeneousCore_AlpakaInterface_interface_AllocatorConfig_h
0003 
0004 #include <cstddef>
0005 #include <cstdint>
0006 #include <limits>
0007 
0008 namespace cms::alpakatools {
0009 
0010   struct AllocatorConfig {
0011     // Bin growth factor (bin_growth in cub::CachingDeviceAllocator)
0012     unsigned int binGrowth = 2;
0013 
0014     // Smallest bin, corresponds to binGrowth^minBin bytes (min_bin in cub::CachingDeviceAllocator
0015     unsigned int minBin = 8;  // 256 bytes
0016 
0017     // Largest bin, corresponds to binGrowth^maxBin bytes (max_bin in cub::CachingDeviceAllocator).
0018     // Note that unlike in cub, allocations larger than binGrowth^maxBin are set to fail.
0019     unsigned int maxBin = 30;  // 1 GB
0020 
0021     // Total storage for the allocator; 0 means no limit.
0022     size_t maxCachedBytes = 0;
0023 
0024     // Fraction of total device memory taken for the allocator; 0 means no limit.
0025     // If both maxCachedBytes and maxCachedFraction are non-zero, the smallest resulting value is used.
0026     double maxCachedFraction = 0.8;
0027 
0028     // Fill all newly allocated or re-used memory blocks with fillAllocationValue.
0029     bool fillAllocations = false;
0030 
0031     // Fill only the re-used memory blocks with fillReallocationValue.
0032     // If both fillAllocations and fillReallocations are true, fillAllocationValue is used for newly allocated blocks and fillReallocationValue is used for re-allocated blocks.
0033     bool fillReallocations = false;
0034 
0035     // Fill memory blocks with fillDeallocationValue before freeing or caching them for re-use
0036     bool fillDeallocations = false;
0037 
0038     // Fill memory blocks with fillCacheValue before caching them for re-use.
0039     // If both fillDeallocations and fillCaches are true, fillDeallocationValue is used for blocks about to be freed and fillCacheValue is used for blocks about to be cached.
0040     bool fillCaches = false;
0041 
0042     // Byte value used to fill all newly allocated or re-used memory blocks
0043     uint8_t fillAllocationValue = 0xA5;
0044 
0045     // Byte value used to fill all re-used memory blocks
0046     uint8_t fillReallocationValue = 0x69;
0047 
0048     // Byte value used to fill all deallocated or cached memory blocks
0049     uint8_t fillDeallocationValue = 0x5A;
0050 
0051     // Byte value used to fill all cached memory blocks
0052     uint8_t fillCacheValue = 0x96;
0053   };
0054 
0055 }  // namespace cms::alpakatools
0056 
0057 #endif  // HeterogeneousCore_AlpakaInterface_interface_AllocatorConfig_h