CMS 3D CMS Logo

getCachingHostAllocator.h
Go to the documentation of this file.
1 #ifndef HeterogeneousCore_CUDACore_src_getCachingHostAllocator
2 #define HeterogeneousCore_CUDACore_src_getCachingHostAllocator
3 
7 #include "CachingHostAllocator.h"
8 
10 
11 #include <iomanip>
12 
13 namespace cms::cuda::allocator {
15  LogDebug("CachingHostAllocator").log([](auto& log) {
16  log << "cub::CachingHostAllocator settings\n"
17  << " bin growth " << binGrowth << "\n"
18  << " min bin " << minBin << "\n"
19  << " max bin " << maxBin << "\n"
20  << " resulting bins:\n";
21  for (auto bin = minBin; bin <= maxBin; ++bin) {
23  if (binSize >= (1 << 30) and binSize % (1 << 30) == 0) {
24  log << " " << std::setw(8) << (binSize >> 30) << " GB\n";
25  } else if (binSize >= (1 << 20) and binSize % (1 << 20) == 0) {
26  log << " " << std::setw(8) << (binSize >> 20) << " MB\n";
27  } else if (binSize >= (1 << 10) and binSize % (1 << 10) == 0) {
28  log << " " << std::setw(8) << (binSize >> 10) << " kB\n";
29  } else {
30  log << " " << std::setw(9) << binSize << " B\n";
31  }
32  }
33  log << " maximum amount of cached memory: " << (minCachedBytes() >> 20) << " MB\n";
34  });
35 
36  // the public interface is thread safe
38  minBin,
39  maxBin,
41  false, // do not skip cleanup
42  debug};
43  return allocator;
44  }
45 } // namespace cms::cuda::allocator
46 
47 #endif
cms::cuda::allocator::minCachedBytes
size_t minCachedBytes()
Definition: getCachingDeviceAllocator.h:27
cms::cuda::allocator::minBin
constexpr unsigned int minBin
Definition: getCachingDeviceAllocator.h:18
MessageLogger.h
getCachingDeviceAllocator.h
notcub::CachingDeviceAllocator::IntPow
static unsigned int IntPow(unsigned int base, unsigned int exp)
Definition: CachingDeviceAllocator.h:216
CachingHostAllocator.h
CMS_THREAD_SAFE
#define CMS_THREAD_SAFE
Definition: thread_safety_macros.h:4
notcub::CachingHostAllocator
A simple caching allocator pinned host memory allocations.
Definition: CachingHostAllocator.h:124
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
thread_safety_macros.h
cms::cuda::allocator::maxBin
constexpr unsigned int maxBin
Definition: getCachingDeviceAllocator.h:20
cudaCheck.h
cms::cuda::allocator
Definition: deviceAllocatorStatus.h:8
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
cms::cuda::allocator::getCachingHostAllocator
notcub::CachingHostAllocator & getCachingHostAllocator()
Definition: getCachingHostAllocator.h:14
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
cms::cuda::allocator::debug
constexpr bool debug
Definition: getCachingDeviceAllocator.h:25
cms::cuda::allocator::binGrowth
constexpr unsigned int binGrowth
Definition: getCachingDeviceAllocator.h:16