40 #include <unordered_map>
43 namespace File_Namespace {
48 namespace CudaMgr_Namespace {
54 namespace Buffer_Namespace {
56 class GpuCudaBufferMgr;
59 namespace Data_Namespace {
80 std::unordered_map<std::string, size_t>
items_;
84 std::ifstream
f(
"/proc/meminfo");
88 for (
const std::string&
line :
split(ss.str(),
"\n")) {
93 CHECK(nv.size() == 2) <<
"unexpected line format in /proc/meminfo: " <<
line;
95 auto v =
split(value);
96 CHECK(v.size() == 1 || v.size() == 2)
97 <<
"unexpected line format in /proc/meminfo: " <<
line;
100 CHECK(v[1] ==
"kb") <<
"unexpected unit suffix in /proc/meminfo: " <<
line;
101 items_[
name] *= 1024;
130 const std::string& dataDir,
132 std::unique_ptr<CudaMgr_Namespace::CudaMgr> cudaMgr,
134 const size_t reservedGpuMem = (1 << 27),
135 const size_t numReaderThreads = 0,
141 const int deviceId = 0,
142 const size_t page_size = 0);
145 const int deviceId = 0,
146 const size_t numBytes = 0);
152 const size_t numBytes);
164 const std::map<ChunkKey, File_Namespace::FileBuffer*>&
getChunkMap();
173 void setTableEpoch(
const int db_id,
const int tb_id,
const int start_epoch);
204 const size_t num_reader_threads,
220 const size_t userSpecifiedNumReaderThreads,
222 void convertDB(
const std::string basePath);
226 size_t total_cpu_size,
227 size_t min_cpu_slab_size,
228 size_t max_cpu_slab_size,
229 size_t default_cpu_slab_size,
231 const std::vector<size_t>& cpu_tier_sizes);
234 std::unique_ptr<CudaMgr_Namespace::CudaMgr>
cudaMgr_;
double getFragmentationPercent() const
CudaMgr_Namespace::CudaMgr * getCudaMgr() const
auto operator[](const std::string &name)
std::mutex buffer_access_mutex_
std::vector< int > ChunkKey
std::vector< MemoryData > nodeMemoryData
Buffer_Namespace::MemStatus memStatus
std::unordered_map< std::string, size_t > items_
void deleteChunk(const ChunkKey &key, const MemoryLevel mem_level, const int device_id)
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
std::vector< int > levelSizes_
std::ostream & operator<<(std::ostream &os, const DataMgr::SystemMemoryUsage &mem_info)
SystemMemoryUsage getSystemMemoryUsage() const
PersistentStorageMgr * getPersistentStorageMgr() const
void clearMemory(const MemoryLevel memLevel)
std::vector< MemoryInfo > getMemoryInfoUnlocked(const MemoryLevel memLevel) const
void resetTableEpochFloor(const int32_t db_id, const int32_t tb_id)
std::string dumpLevel(const MemoryLevel memLevel)
size_t getCpuBufferPoolSize() const
void convertDB(const std::string basePath)
size_t getGpuBufferPoolSize() const
void allocateCpuBufferMgr(int32_t device_id, size_t total_cpu_size, size_t min_cpu_slab_size, size_t max_cpu_slab_size, size_t default_cpu_slab_size, size_t page_size, const std::vector< size_t > &cpu_tier_sizes)
static size_t getTotalSystemMemory()
size_t getTableEpoch(const int db_id, const int tb_id)
Buffer_Namespace::GpuCudaBufferMgr * getGpuBufferMgr(int32_t device_id) const
std::shared_ptr< ForeignStorageInterface > getForeignStorageInterface() const
void createTopLevelMetadata() const
static void atExitHandler()
void removeMutableTableDiskCacheData(const int db_id, const int tb_id) const
std::unique_ptr< CudaMgr_Namespace::CudaMgr > cudaMgr_
void getChunkMetadataVecForKeyPrefix(ChunkMetadataVector &chunkMetadataVec, const ChunkKey &keyPrefix)
void populateMgrs(const SystemParameters &system_parameters, const size_t userSpecifiedNumReaderThreads, const File_Namespace::DiskCacheConfig &cache_config)
const std::map< ChunkKey, File_Namespace::FileBuffer * > & getChunkMap()
An AbstractBuffer is a unit of data management for a data manager.
This file includes the class specification for the buffer manager (BufferMgr), and related data struc...
File_Namespace::GlobalFileMgr * getGlobalFileMgr() const
Parse /proc/meminfo into key/value pairs.
void deleteChunksWithPrefix(const ChunkKey &keyPrefix)
size_t getSumHighestBlocks() const
bool isBufferOnDevice(const ChunkKey &key, const MemoryLevel memLevel, const int deviceId)
AbstractBuffer * getChunkBuffer(const ChunkKey &key, const MemoryLevel memoryLevel, const int deviceId=0, const size_t numBytes=0)
torch::Tensor f(torch::Tensor x, torch::Tensor W_target, torch::Tensor b_target)
std::vector< MemoryInfo > getMemoryInfo(const MemoryLevel memLevel) const
void removeTableRelatedDS(const int db_id, const int tb_id)
DataMgr(const std::string &dataDir, const SystemParameters &system_parameters, std::unique_ptr< CudaMgr_Namespace::CudaMgr > cudaMgr, const bool useGpus, const size_t reservedGpuMem=(1<< 27), const size_t numReaderThreads=0, const File_Namespace::DiskCacheConfig cacheConfig=File_Namespace::DiskCacheConfig())
Buffer_Namespace::CpuBufferMgr * getCpuBufferMgr() const
void copy(AbstractBuffer *destBuffer, AbstractBuffer *srcBuffer)
void resetBufferMgrs(const File_Namespace::DiskCacheConfig &cache_config, const size_t num_reader_threads, const SystemParameters &sys_params)
std::vector< int32_t > chunk_key
AbstractBuffer * createChunkBuffer(const ChunkKey &key, const MemoryLevel memoryLevel, const int deviceId=0, const size_t page_size=0)
size_t sum_highest_blocks_
void free(AbstractBuffer *buffer)
Parse /proc/buddyinfo into a few fragmentation-related data.
void setTableEpoch(const int db_id, const int tb_id, const int start_epoch)
size_t getSumAvailPages() const
friend class GlobalFileMgr
AbstractBuffer * alloc(const MemoryLevel memoryLevel, const int deviceId, const size_t numBytes)