OmniSciDB
a5dc49c757
|
#include <DataMgr.h>
Classes | |
struct | SystemMemoryUsage |
Public Member Functions | |
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()) | |
~DataMgr () | |
AbstractBuffer * | createChunkBuffer (const ChunkKey &key, const MemoryLevel memoryLevel, const int deviceId=0, const size_t page_size=0) |
AbstractBuffer * | getChunkBuffer (const ChunkKey &key, const MemoryLevel memoryLevel, const int deviceId=0, const size_t numBytes=0) |
void | deleteChunk (const ChunkKey &key, const MemoryLevel mem_level, const int device_id) |
void | deleteChunksWithPrefix (const ChunkKey &keyPrefix) |
void | deleteChunksWithPrefix (const ChunkKey &keyPrefix, const MemoryLevel memLevel) |
AbstractBuffer * | alloc (const MemoryLevel memoryLevel, const int deviceId, const size_t numBytes) |
void | free (AbstractBuffer *buffer) |
void | copy (AbstractBuffer *destBuffer, AbstractBuffer *srcBuffer) |
bool | isBufferOnDevice (const ChunkKey &key, const MemoryLevel memLevel, const int deviceId) |
std::vector< MemoryInfo > | getMemoryInfo (const MemoryLevel memLevel) const |
std::vector< MemoryInfo > | getMemoryInfoUnlocked (const MemoryLevel memLevel) const |
std::string | dumpLevel (const MemoryLevel memLevel) |
void | clearMemory (const MemoryLevel memLevel) |
const std::map< ChunkKey, File_Namespace::FileBuffer * > & | getChunkMap () |
void | checkpoint (const int db_id, const int tb_id) |
void | checkpoint (const int db_id, const int table_id, const MemoryLevel memory_level) |
void | getChunkMetadataVecForKeyPrefix (ChunkMetadataVector &chunkMetadataVec, const ChunkKey &keyPrefix) |
bool | gpusPresent () const |
void | removeTableRelatedDS (const int db_id, const int tb_id) |
void | removeMutableTableDiskCacheData (const int db_id, const int tb_id) const |
void | setTableEpoch (const int db_id, const int tb_id, const int start_epoch) |
size_t | getTableEpoch (const int db_id, const int tb_id) |
void | resetTableEpochFloor (const int32_t db_id, const int32_t tb_id) |
CudaMgr_Namespace::CudaMgr * | getCudaMgr () const |
File_Namespace::GlobalFileMgr * | getGlobalFileMgr () const |
std::shared_ptr < ForeignStorageInterface > | getForeignStorageInterface () const |
SystemMemoryUsage | getSystemMemoryUsage () const |
PersistentStorageMgr * | getPersistentStorageMgr () const |
void | resetBufferMgrs (const File_Namespace::DiskCacheConfig &cache_config, const size_t num_reader_threads, const SystemParameters &sys_params) |
size_t | getCpuBufferPoolSize () const |
size_t | getGpuBufferPoolSize () const |
Buffer_Namespace::CpuBufferMgr * | getCpuBufferMgr () const |
Buffer_Namespace::GpuCudaBufferMgr * | getGpuBufferMgr (int32_t device_id) const |
Static Public Member Functions | |
static size_t | getTotalSystemMemory () |
static void | atExitHandler () |
Public Attributes | |
std::vector< int > | levelSizes_ |
Private Member Functions | |
void | populateMgrs (const SystemParameters &system_parameters, const size_t userSpecifiedNumReaderThreads, const File_Namespace::DiskCacheConfig &cache_config) |
void | convertDB (const std::string basePath) |
void | checkpoint () |
void | createTopLevelMetadata () 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) |
Private Attributes | |
std::vector< std::vector < AbstractBufferMgr * > > | bufferMgrs_ |
std::unique_ptr < CudaMgr_Namespace::CudaMgr > | cudaMgr_ |
std::string | dataDir_ |
bool | hasGpus_ |
size_t | reservedGpuMem_ |
std::mutex | buffer_access_mutex_ |
Friends | |
class | GlobalFileMgr |
|
explicit |
Definition at line 77 of file DataMgr.cpp.
Data_Namespace::DataMgr::~DataMgr | ( | ) |
Definition at line 114 of file DataMgr.cpp.
References Data_Namespace::anonymous_namespace{DataMgr.cpp}::at_exit_called, bufferMgrs_, clearMemory(), Data_Namespace::anonymous_namespace{DataMgr.cpp}::g_data_mgr_ptr, Data_Namespace::GPU_LEVEL, and hasGpus_.
AbstractBuffer * Data_Namespace::DataMgr::alloc | ( | const MemoryLevel | memoryLevel, |
const int | deviceId, | ||
const size_t | numBytes | ||
) |
Definition at line 605 of file DataMgr.cpp.
References buffer_access_mutex_, bufferMgrs_, CHECK_LT, and levelSizes_.
Referenced by CpuMgrArenaAllocator::allocate(), ThrustAllocator::allocate(), ThrustAllocator::allocateScopedBuffer(), CudaAllocator::allocGpuAbstractBuffer(), and InValuesBitmap::InValuesBitmap().
|
private |
Definition at line 215 of file DataMgr.cpp.
References bufferMgrs_, and cudaMgr_.
Referenced by populateMgrs().
|
static |
Definition at line 67 of file DataMgr.cpp.
References Data_Namespace::anonymous_namespace{DataMgr.cpp}::at_exit_called, clearMemory(), Data_Namespace::anonymous_namespace{DataMgr.cpp}::g_data_mgr_ptr, Data_Namespace::GPU_LEVEL, and hasGpus_.
void Data_Namespace::DataMgr::checkpoint | ( | const int | db_id, |
const int | tb_id | ||
) |
Definition at line 634 of file DataMgr.cpp.
References buffer_access_mutex_, and bufferMgrs_.
Referenced by UpdelRoll::stageUpdate().
void Data_Namespace::DataMgr::checkpoint | ( | const int | db_id, |
const int | table_id, | ||
const MemoryLevel | memory_level | ||
) |
Definition at line 646 of file DataMgr.cpp.
References buffer_access_mutex_, bufferMgrs_, CHECK_LT, and levelSizes_.
|
private |
Definition at line 657 of file DataMgr.cpp.
References buffer_access_mutex_, and bufferMgrs_.
Referenced by convertDB().
void Data_Namespace::DataMgr::clearMemory | ( | const MemoryLevel | memLevel | ) |
Definition at line 515 of file DataMgr.cpp.
References buffer_access_mutex_, bufferMgrs_, CHECK, cudaMgr_, Data_Namespace::GPU_LEVEL, LOG, and logger::WARNING.
Referenced by atExitHandler(), Executor::clearMemory(), and ~DataMgr().
|
private |
Definition at line 384 of file DataMgr.cpp.
References bufferMgrs_, CHECK, checkpoint(), logger::FATAL, getGlobalFileMgr(), logger::INFO, shared::kDataDirectoryName, and LOG.
void Data_Namespace::DataMgr::copy | ( | AbstractBuffer * | destBuffer, |
AbstractBuffer * | srcBuffer | ||
) |
Definition at line 620 of file DataMgr.cpp.
References Data_Namespace::AbstractBuffer::getDeviceId(), Data_Namespace::AbstractBuffer::getMemoryPtr(), Data_Namespace::AbstractBuffer::getType(), Data_Namespace::AbstractBuffer::size(), and Data_Namespace::AbstractBuffer::write().
AbstractBuffer * Data_Namespace::DataMgr::createChunkBuffer | ( | const ChunkKey & | key, |
const MemoryLevel | memoryLevel, | ||
const int | deviceId = 0 , |
||
const size_t | page_size = 0 |
||
) |
Definition at line 552 of file DataMgr.cpp.
References buffer_access_mutex_, and bufferMgrs_.
Referenced by Chunk_NS::Chunk::createChunkBuffer().
|
private |
Definition at line 414 of file DataMgr.cpp.
References bufferMgrs_, CHECK, and getGlobalFileMgr().
Referenced by resetBufferMgrs().
void Data_Namespace::DataMgr::deleteChunk | ( | const ChunkKey & | key, |
const MemoryLevel | mem_level, | ||
const int | device_id | ||
) |
Definition at line 597 of file DataMgr.cpp.
References buffer_access_mutex_, bufferMgrs_, and CHECK_LT.
Referenced by AlterTableAlterColumnCommandRecoveryMgr::cleanupClearChunk().
void Data_Namespace::DataMgr::deleteChunksWithPrefix | ( | const ChunkKey & | keyPrefix | ) |
Definition at line 572 of file DataMgr.cpp.
References buffer_access_mutex_, bufferMgrs_, and levelSizes_.
Referenced by AlterTableAlterColumnCommandRecoveryMgr::cleanupDropSourceGeoColumns(), foreign_storage::anonymous_namespace{ForeignTableRefresh.cpp}::clear_cpu_and_gpu_cache(), anonymous_namespace{TableOptimizer.cpp}::delete_cpu_chunks(), AlterTableAlterColumnCommandRecoveryMgr::recoverAlterTableAlterColumnFromFile(), AlterTableAlterColumnCommandRecoveryMgr::rollback(), and UpdelRoll::updateFragmenterAndCleanupChunks().
void Data_Namespace::DataMgr::deleteChunksWithPrefix | ( | const ChunkKey & | keyPrefix, |
const MemoryLevel | memLevel | ||
) |
Definition at line 584 of file DataMgr.cpp.
References buffer_access_mutex_, bufferMgrs_, and levelSizes_.
std::string Data_Namespace::DataMgr::dumpLevel | ( | const MemoryLevel | memLevel | ) |
Definition at line 499 of file DataMgr.cpp.
References buffer_access_mutex_, bufferMgrs_, cudaMgr_, and Data_Namespace::GPU_LEVEL.
void Data_Namespace::DataMgr::free | ( | AbstractBuffer * | buffer | ) |
Definition at line 614 of file DataMgr.cpp.
References buffer_access_mutex_, bufferMgrs_, Data_Namespace::AbstractBuffer::getDeviceId(), and Data_Namespace::AbstractBuffer::getType().
Referenced by UpdelRoll::cancelUpdate(), ThrustAllocator::deallocate(), CudaAllocator::free(), CudaAllocator::freeGpuAbstractBuffer(), BaselineHashTable::~BaselineHashTable(), CpuMgrArenaAllocator::~CpuMgrArenaAllocator(), CudaAllocator::~CudaAllocator(), InValuesBitmap::~InValuesBitmap(), PerfectHashTable::~PerfectHashTable(), StringDictionaryTranslationMgr::~StringDictionaryTranslationMgr(), ThrustAllocator::~ThrustAllocator(), and TreeModelPredictionMgr::~TreeModelPredictionMgr().
AbstractBuffer * Data_Namespace::DataMgr::getChunkBuffer | ( | const ChunkKey & | key, |
const MemoryLevel | memoryLevel, | ||
const int | deviceId = 0 , |
||
const size_t | numBytes = 0 |
||
) |
Definition at line 561 of file DataMgr.cpp.
References buffer_access_mutex_, bufferMgrs_, CHECK_LT, and levelSizes_.
Referenced by Chunk_NS::Chunk::getChunkBuffer().
const std::map<ChunkKey, File_Namespace::FileBuffer*>& Data_Namespace::DataMgr::getChunkMap | ( | ) |
void Data_Namespace::DataMgr::getChunkMetadataVecForKeyPrefix | ( | ChunkMetadataVector & | chunkMetadataVec, |
const ChunkKey & | keyPrefix | ||
) |
Definition at line 546 of file DataMgr.cpp.
References buffer_access_mutex_, and bufferMgrs_.
Referenced by AlterTableAlterColumnCommandRecoveryMgr::cleanupClearRemainingChunks(), TableOptimizer::vacuumFragments(), and anonymous_namespace{DdlCommandExecutor.cpp}::validate_alter_type_metadata().
Buffer_Namespace::CpuBufferMgr * Data_Namespace::DataMgr::getCpuBufferMgr | ( | ) | const |
Definition at line 750 of file DataMgr.cpp.
References bufferMgrs_, CHECK, and Data_Namespace::CPU_LEVEL.
Referenced by getCpuBufferPoolSize().
size_t Data_Namespace::DataMgr::getCpuBufferPoolSize | ( | ) | const |
Definition at line 733 of file DataMgr.cpp.
References getCpuBufferMgr(), and Buffer_Namespace::BufferMgr::getMaxSize().
|
inline |
Definition at line 177 of file DataMgr.h.
References cudaMgr_.
Referenced by Executor::blockSize(), copy_to_nvidia_gpu(), CudaAllocator::copyFromDevice(), CudaAllocator::copyToDevice(), CudaAllocator::CudaAllocator(), Executor::cudaMgr(), get_available_gpus(), Executor::gridSize(), Executor::isCPUOnly(), Executor::logSystemGPUMemoryStatus(), CudaAllocator::setDeviceMem(), and CudaAllocator::zeroDeviceMem().
std::shared_ptr< ForeignStorageInterface > Data_Namespace::DataMgr::getForeignStorageInterface | ( | ) | const |
Definition at line 707 of file DataMgr.cpp.
References bufferMgrs_.
File_Namespace::GlobalFileMgr * Data_Namespace::DataMgr::getGlobalFileMgr | ( | ) | const |
Definition at line 699 of file DataMgr.cpp.
References bufferMgrs_, and CHECK.
Referenced by convertDB(), createTopLevelMetadata(), TableArchiver::dumpTable(), anonymous_namespace{DdlCommandExecutor.cpp}::get_agg_storage_stats(), getTableEpoch(), foreign_storage::InternalStorageStatsDataWrapper::initializeObjectsForTable(), resetTableEpochFloor(), TableArchiver::restoreTable(), setTableEpoch(), and TableOptimizer::vacuumDeletedRows().
Buffer_Namespace::GpuCudaBufferMgr * Data_Namespace::DataMgr::getGpuBufferMgr | ( | int32_t | device_id | ) | const |
Definition at line 756 of file DataMgr.cpp.
References bufferMgrs_, CHECK_GT, and Data_Namespace::GPU_LEVEL.
size_t Data_Namespace::DataMgr::getGpuBufferPoolSize | ( | ) | const |
Definition at line 738 of file DataMgr.cpp.
References bufferMgrs_, and Data_Namespace::GPU_LEVEL.
std::vector< MemoryInfo > Data_Namespace::DataMgr::getMemoryInfo | ( | const MemoryLevel | memLevel | ) | const |
Definition at line 430 of file DataMgr.cpp.
References buffer_access_mutex_, and getMemoryInfoUnlocked().
Referenced by Executor::createKernels().
std::vector< MemoryInfo > Data_Namespace::DataMgr::getMemoryInfoUnlocked | ( | const MemoryLevel | memLevel | ) | const |
Definition at line 435 of file DataMgr.cpp.
References bufferMgrs_, CHECK, Data_Namespace::MemoryData::chunk_key, Data_Namespace::CPU_LEVEL, cudaMgr_, Buffer_Namespace::BufferMgr::getAllocated(), Buffer_Namespace::BufferMgr::getMaxSize(), Buffer_Namespace::BufferMgr::getPageSize(), Buffer_Namespace::BufferMgr::getSlabSegments(), Data_Namespace::GPU_LEVEL, hasGpus_, Data_Namespace::MemoryInfo::isAllocationCapped, Buffer_Namespace::BufferMgr::isAllocationCapped(), Data_Namespace::MemoryInfo::maxNumPages, Data_Namespace::MemoryData::memStatus, Data_Namespace::MemoryInfo::nodeMemoryData, Data_Namespace::MemoryInfo::numPageAllocated, Data_Namespace::MemoryData::numPages, Data_Namespace::MemoryInfo::pageSize, Data_Namespace::MemoryData::slabNum, Data_Namespace::MemoryData::startPage, and Data_Namespace::MemoryData::touch.
Referenced by getMemoryInfo().
PersistentStorageMgr * Data_Namespace::DataMgr::getPersistentStorageMgr | ( | ) | const |
Definition at line 729 of file DataMgr.cpp.
References bufferMgrs_, and Data_Namespace::DISK_LEVEL.
Referenced by Catalog_Namespace::anonymous_namespace{Catalog.cpp}::clear_cached_table_data(), removeMutableTableDiskCacheData(), and anonymous_namespace{RelAlgExecutor.cpp}::set_parallelism_hints().
DataMgr::SystemMemoryUsage Data_Namespace::DataMgr::getSystemMemoryUsage | ( | ) | const |
Definition at line 131 of file DataMgr.cpp.
References Data_Namespace::DataMgr::SystemMemoryUsage::avail_pages, Data_Namespace::DataMgr::SystemMemoryUsage::frag, Data_Namespace::DataMgr::SystemMemoryUsage::free, Data_Namespace::DataMgr::SystemMemoryUsage::high_blocks, Data_Namespace::ProcBuddyinfoParser::parseBuddyinfo(), Data_Namespace::DataMgr::SystemMemoryUsage::regular, Data_Namespace::DataMgr::SystemMemoryUsage::resident, Data_Namespace::DataMgr::SystemMemoryUsage::shared, Data_Namespace::DataMgr::SystemMemoryUsage::total, and Data_Namespace::DataMgr::SystemMemoryUsage::vtotal.
Referenced by anonymous_namespace{DBHandler.cpp}::log_system_cpu_memory_status(), and Executor::logSystemCPUMemoryStatus().
size_t Data_Namespace::DataMgr::getTableEpoch | ( | const int | db_id, |
const int | tb_id | ||
) |
Definition at line 685 of file DataMgr.cpp.
References bufferMgrs_, CHECK, and getGlobalFileMgr().
|
static |
Definition at line 192 of file DataMgr.cpp.
Referenced by populateMgrs().
|
inline |
Definition at line 170 of file DataMgr.h.
References hasGpus_.
Referenced by get_available_gpus().
bool Data_Namespace::DataMgr::isBufferOnDevice | ( | const ChunkKey & | key, |
const MemoryLevel | memLevel, | ||
const int | deviceId | ||
) |
Definition at line 539 of file DataMgr.cpp.
References buffer_access_mutex_, and bufferMgrs_.
Referenced by Chunk_NS::Chunk::isChunkOnDevice().
|
private |
Definition at line 273 of file DataMgr.cpp.
References allocateCpuBufferMgr(), SystemParameters::buffer_page_size, bufferMgrs_, CHECK_GT, SystemParameters::cpu_buffer_mem_bytes, cudaMgr_, dataDir_, SystemParameters::default_cpu_slab_size, SystemParameters::default_gpu_slab_size, Data_Namespace::DRAM, g_pmem_size, g_use_cpu_mem_pool_size_for_max_cpu_slab_size, Data_Namespace::anonymous_namespace{DataMgr.cpp}::get_slab_size(), getTotalSystemMemory(), SystemParameters::gpu_buffer_mem_bytes, hasGpus_, logger::INFO, levelSizes_, LOG, SystemParameters::max_cpu_slab_size, SystemParameters::max_gpu_slab_size, SystemParameters::min_cpu_slab_size, SystemParameters::min_gpu_slab_size, Data_Namespace::numCpuTiers, Data_Namespace::PMEM, reservedGpuMem_, and VLOG.
Referenced by resetBufferMgrs().
void Data_Namespace::DataMgr::removeMutableTableDiskCacheData | ( | const int | db_id, |
const int | tb_id | ||
) | const |
Definition at line 674 of file DataMgr.cpp.
References getPersistentStorageMgr(), and PersistentStorageMgr::removeMutableTableCacheData().
void Data_Namespace::DataMgr::removeTableRelatedDS | ( | const int | db_id, |
const int | tb_id | ||
) |
Definition at line 669 of file DataMgr.cpp.
References buffer_access_mutex_, and bufferMgrs_.
void Data_Namespace::DataMgr::resetBufferMgrs | ( | const File_Namespace::DiskCacheConfig & | cache_config, |
const size_t | num_reader_threads, | ||
const SystemParameters & | sys_params | ||
) |
Definition at line 249 of file DataMgr.cpp.
References bufferMgrs_, createTopLevelMetadata(), and populateMgrs().
void Data_Namespace::DataMgr::resetTableEpochFloor | ( | const int32_t | db_id, |
const int32_t | tb_id | ||
) |
Definition at line 692 of file DataMgr.cpp.
References bufferMgrs_, CHECK, and getGlobalFileMgr().
void Data_Namespace::DataMgr::setTableEpoch | ( | const int | db_id, |
const int | tb_id, | ||
const int | start_epoch | ||
) |
Definition at line 678 of file DataMgr.cpp.
References bufferMgrs_, CHECK, and getGlobalFileMgr().
|
mutableprivate |
Definition at line 238 of file DataMgr.h.
Referenced by alloc(), checkpoint(), clearMemory(), createChunkBuffer(), deleteChunk(), deleteChunksWithPrefix(), dumpLevel(), free(), getChunkBuffer(), getChunkMetadataVecForKeyPrefix(), getMemoryInfo(), isBufferOnDevice(), and removeTableRelatedDS().
|
private |
Definition at line 233 of file DataMgr.h.
Referenced by alloc(), allocateCpuBufferMgr(), checkpoint(), clearMemory(), convertDB(), createChunkBuffer(), createTopLevelMetadata(), deleteChunk(), deleteChunksWithPrefix(), dumpLevel(), free(), getChunkBuffer(), getChunkMetadataVecForKeyPrefix(), getCpuBufferMgr(), getForeignStorageInterface(), getGlobalFileMgr(), getGpuBufferMgr(), getGpuBufferPoolSize(), getMemoryInfoUnlocked(), getPersistentStorageMgr(), getTableEpoch(), isBufferOnDevice(), populateMgrs(), removeTableRelatedDS(), resetBufferMgrs(), resetTableEpochFloor(), setTableEpoch(), and ~DataMgr().
|
private |
Definition at line 234 of file DataMgr.h.
Referenced by allocateCpuBufferMgr(), clearMemory(), dumpLevel(), getCudaMgr(), getMemoryInfoUnlocked(), and populateMgrs().
|
private |
Definition at line 235 of file DataMgr.h.
Referenced by populateMgrs().
|
private |
Definition at line 236 of file DataMgr.h.
Referenced by atExitHandler(), getMemoryInfoUnlocked(), gpusPresent(), populateMgrs(), and ~DataMgr().
std::vector<int> Data_Namespace::DataMgr::levelSizes_ |
Definition at line 182 of file DataMgr.h.
Referenced by alloc(), checkpoint(), deleteChunksWithPrefix(), getChunkBuffer(), and populateMgrs().
|
private |
Definition at line 237 of file DataMgr.h.
Referenced by populateMgrs().