OmniSciDB  ba1bac9284
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PerfectHashTable Class Reference

#include <PerfectHashTable.h>

+ Inheritance diagram for PerfectHashTable:
+ Collaboration diagram for PerfectHashTable:

Public Member Functions

 PerfectHashTable (const Catalog_Namespace::Catalog *catalog, const HashType layout, const ExecutorDeviceType device_type, const size_t entry_count, const size_t emitted_keys_count)
 
 ~PerfectHashTable ()
 
size_t gpuReservedSize () const
 
void allocateGpuMemory (const size_t entries, const int device_id)
 
size_t getHashTableBufferSize (const ExecutorDeviceType device_type) const override
 
HashType getLayout () const override
 
int8_t * getCpuBuffer () override
 
int8_t * getGpuBuffer () const override
 
size_t getEntryCount () const override
 
size_t getEmittedKeysCount () const override
 
- Public Member Functions inherited from HashTable
virtual ~HashTable ()
 

Private Attributes

Data_Namespace::AbstractBuffergpu_hash_table_buff_ {nullptr}
 
const Catalog_Namespace::Catalogcatalog_
 
std::vector< int32_t > cpu_hash_table_buff_
 
HashType layout_
 
size_t entry_count_
 
size_t emitted_keys_count_
 

Additional Inherited Members

- Static Public Member Functions inherited from HashTable
static DecodedJoinHashBufferSet toSet (size_t key_component_count, size_t key_component_width, size_t entry_count, const int8_t *ptr1, const int8_t *ptr2, const int8_t *ptr3, const int8_t *ptr4, size_t buffer_size)
 Decode hash table into a std::set for easy inspection and validation. More...
 
static std::string toString (const std::string &type, const std::string &layout_type, size_t key_component_count, size_t key_component_width, size_t entry_count, const int8_t *ptr1, const int8_t *ptr2, const int8_t *ptr3, const int8_t *ptr4, size_t buffer_size, bool raw=false)
 Decode hash table into a human-readable string. More...
 

Detailed Description

Definition at line 24 of file PerfectHashTable.h.

Constructor & Destructor Documentation

PerfectHashTable::PerfectHashTable ( const Catalog_Namespace::Catalog catalog,
const HashType  layout,
const ExecutorDeviceType  device_type,
const size_t  entry_count,
const size_t  emitted_keys_count 
)
inline

Definition at line 27 of file PerfectHashTable.h.

References CPU, cpu_hash_table_buff_, emitted_keys_count_, entry_count_, layout_, and OneToOne.

32  : catalog_(catalog)
33  , layout_(layout)
34  , entry_count_(entry_count)
35  , emitted_keys_count_(emitted_keys_count) {
36  if (device_type == ExecutorDeviceType::CPU) {
38  ? entry_count_
40  }
41  }
std::vector< int32_t > cpu_hash_table_buff_
const Catalog_Namespace::Catalog * catalog_
PerfectHashTable::~PerfectHashTable ( )
inline

Definition at line 43 of file PerfectHashTable.h.

References catalog_, CHECK, Data_Namespace::DataMgr::free(), Catalog_Namespace::Catalog::getDataMgr(), and gpu_hash_table_buff_.

43  {
44  CHECK(catalog_);
45  auto& data_mgr = catalog_->getDataMgr();
47  data_mgr.free(gpu_hash_table_buff_);
48  }
49  }
Data_Namespace::DataMgr & getDataMgr() const
Definition: Catalog.h:223
Data_Namespace::AbstractBuffer * gpu_hash_table_buff_
#define CHECK(condition)
Definition: Logger.h:206
void free(AbstractBuffer *buffer)
Definition: DataMgr.cpp:469
const Catalog_Namespace::Catalog * catalog_

+ Here is the call graph for this function:

Member Function Documentation

void PerfectHashTable::allocateGpuMemory ( const size_t  entries,
const int  device_id 
)
inline

Definition at line 56 of file PerfectHashTable.h.

References CudaAllocator::allocGpuAbstractBuffer(), catalog_, CHECK, CHECK_GE, Catalog_Namespace::Catalog::getDataMgr(), and gpu_hash_table_buff_.

56  {
57  CHECK(catalog_);
58  auto& data_mgr = catalog_->getDataMgr();
59  CHECK_GE(device_id, 0);
62  &data_mgr, entries * sizeof(int32_t), device_id);
63  }
Data_Namespace::DataMgr & getDataMgr() const
Definition: Catalog.h:223
#define CHECK_GE(x, y)
Definition: Logger.h:219
Data_Namespace::AbstractBuffer * gpu_hash_table_buff_
static Data_Namespace::AbstractBuffer * allocGpuAbstractBuffer(Data_Namespace::DataMgr *data_mgr, const size_t num_bytes, const int device_id)
#define CHECK(condition)
Definition: Logger.h:206
const Catalog_Namespace::Catalog * catalog_

+ Here is the call graph for this function:

int8_t* PerfectHashTable::getCpuBuffer ( )
inlineoverridevirtual

Implements HashTable.

Definition at line 76 of file PerfectHashTable.h.

References cpu_hash_table_buff_.

76  {
77  return reinterpret_cast<int8_t*>(cpu_hash_table_buff_.data());
78  }
std::vector< int32_t > cpu_hash_table_buff_
size_t PerfectHashTable::getEmittedKeysCount ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 86 of file PerfectHashTable.h.

References emitted_keys_count_.

86 { return emitted_keys_count_; }
size_t PerfectHashTable::getEntryCount ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 84 of file PerfectHashTable.h.

References entry_count_.

84 { return entry_count_; }
int8_t* PerfectHashTable::getGpuBuffer ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 80 of file PerfectHashTable.h.

References Data_Namespace::AbstractBuffer::getMemoryPtr(), and gpu_hash_table_buff_.

80  {
82  }
virtual int8_t * getMemoryPtr()=0
Data_Namespace::AbstractBuffer * gpu_hash_table_buff_

+ Here is the call graph for this function:

size_t PerfectHashTable::getHashTableBufferSize ( const ExecutorDeviceType  device_type) const
inlineoverridevirtual

Implements HashTable.

Definition at line 65 of file PerfectHashTable.h.

References CPU, cpu_hash_table_buff_, gpu_hash_table_buff_, and Data_Namespace::AbstractBuffer::reservedSize().

65  {
66  if (device_type == ExecutorDeviceType::CPU) {
67  return cpu_hash_table_buff_.size() *
68  sizeof(decltype(cpu_hash_table_buff_)::value_type);
69  } else {
71  }
72  }
virtual size_t reservedSize() const =0
Data_Namespace::AbstractBuffer * gpu_hash_table_buff_
std::vector< int32_t > cpu_hash_table_buff_

+ Here is the call graph for this function:

HashType PerfectHashTable::getLayout ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 74 of file PerfectHashTable.h.

References layout_.

74 { return layout_; }
size_t PerfectHashTable::gpuReservedSize ( ) const
inline

Definition at line 51 of file PerfectHashTable.h.

References CHECK, gpu_hash_table_buff_, and Data_Namespace::AbstractBuffer::reservedSize().

51  {
54  }
virtual size_t reservedSize() const =0
Data_Namespace::AbstractBuffer * gpu_hash_table_buff_
#define CHECK(condition)
Definition: Logger.h:206

+ Here is the call graph for this function:

Member Data Documentation

const Catalog_Namespace::Catalog* PerfectHashTable::catalog_
private

Definition at line 90 of file PerfectHashTable.h.

Referenced by allocateGpuMemory(), and ~PerfectHashTable().

std::vector<int32_t> PerfectHashTable::cpu_hash_table_buff_
private

Definition at line 91 of file PerfectHashTable.h.

Referenced by getCpuBuffer(), getHashTableBufferSize(), and PerfectHashTable().

size_t PerfectHashTable::emitted_keys_count_
private

Definition at line 95 of file PerfectHashTable.h.

Referenced by getEmittedKeysCount(), and PerfectHashTable().

size_t PerfectHashTable::entry_count_
private

Definition at line 94 of file PerfectHashTable.h.

Referenced by getEntryCount(), and PerfectHashTable().

Data_Namespace::AbstractBuffer* PerfectHashTable::gpu_hash_table_buff_ {nullptr}
private
HashType PerfectHashTable::layout_
private

Definition at line 93 of file PerfectHashTable.h.

Referenced by getLayout(), and PerfectHashTable().


The documentation for this class was generated from the following file: