CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
getCachingHostAllocator.h
Go to the documentation of this file.
1 #ifndef HeterogeneousCore_CUDACore_src_getCachingHostAllocator
2 #define HeterogeneousCore_CUDACore_src_getCachingHostAllocator
3 
8 
10 #include "CachingHostAllocator.h"
11 #include "cachingAllocatorCommon.h"
12 
13 #include <iomanip>
14 
15 namespace cms::cuda::allocator {
17  LogDebug("CachingHostAllocator").log([](auto& log) {
18  log << "cub::CachingHostAllocator settings\n"
19  << " bin growth " << binGrowth << "\n"
20  << " min bin " << minBin << "\n"
21  << " max bin " << maxBin << "\n"
22  << " resulting bins:\n";
23  for (auto bin = minBin; bin <= maxBin; ++bin) {
25  if (binSize >= (1 << 30) and binSize % (1 << 30) == 0) {
26  log << " " << std::setw(8) << (binSize >> 30) << " GB\n";
27  } else if (binSize >= (1 << 20) and binSize % (1 << 20) == 0) {
28  log << " " << std::setw(8) << (binSize >> 20) << " MB\n";
29  } else if (binSize >= (1 << 10) and binSize % (1 << 10) == 0) {
30  log << " " << std::setw(8) << (binSize >> 10) << " kB\n";
31  } else {
32  log << " " << std::setw(9) << binSize << " B\n";
33  }
34  }
35  log << " maximum amount of cached memory: " << (minCachedBytes() >> 20) << " MB\n";
36  });
37 
38  // the public interface is thread safe
40  minBin,
41  maxBin,
43  false, // do not skip cleanup
44  debug};
45  return allocator;
46  }
47 } // namespace cms::cuda::allocator
48 
49 #endif
static std::vector< std::string > checklist log
constexpr unsigned int maxBin
static unsigned int IntPow(unsigned int base, unsigned int exp)
#define CMS_THREAD_SAFE
notcub::CachingHostAllocator & getCachingHostAllocator()
constexpr unsigned int binGrowth
A simple caching allocator pinned host memory allocations.
constexpr unsigned int minBin
#define LogDebug(id)