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

#include <PerfectHashTable.h>

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

Public Member Functions

 PerfectHashTable (Data_Namespace::DataMgr *data_mgr, const HashType layout, const ExecutorDeviceType device_type, const size_t entry_count, const size_t emitted_keys_count)
 
 ~PerfectHashTable () override
 
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
 
void setHashEntryInfo (HashEntryInfo &hash_entry_info)
 
void setColumnNumElems (size_t elem)
 
HashEntryInfo getHashEntryInfo () const
 
size_t getColumnNumElems () const
 
- Public Member Functions inherited from HashTable
virtual ~HashTable ()
 

Private Attributes

Data_Namespace::AbstractBuffergpu_hash_table_buff_ {nullptr}
 
Data_Namespace::DataMgrdata_mgr_
 
std::unique_ptr< int32_t[]> cpu_hash_table_buff_
 
size_t cpu_hash_table_buff_size_
 
HashType layout_
 
size_t entry_count_
 
size_t emitted_keys_count_
 
HashEntryInfo hash_entry_info_
 
size_t column_num_elems_
 

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 25 of file PerfectHashTable.h.

Constructor & Destructor Documentation

PerfectHashTable::PerfectHashTable ( Data_Namespace::DataMgr data_mgr,
const HashType  layout,
const ExecutorDeviceType  device_type,
const size_t  entry_count,
const size_t  emitted_keys_count 
)
inline

Definition at line 28 of file PerfectHashTable.h.

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

33  : data_mgr_(data_mgr)
34  , layout_(layout)
35  , entry_count_(entry_count)
36  , emitted_keys_count_(emitted_keys_count) {
37  if (device_type == ExecutorDeviceType::CPU) {
39  ? entry_count_
42  }
43  }
size_t cpu_hash_table_buff_size_
std::unique_ptr< int32_t[]> cpu_hash_table_buff_
Data_Namespace::DataMgr * data_mgr_
PerfectHashTable::~PerfectHashTable ( )
inlineoverride

Definition at line 45 of file PerfectHashTable.h.

References CHECK, data_mgr_, Data_Namespace::DataMgr::free(), and gpu_hash_table_buff_.

45  {
49  }
50  }
Data_Namespace::AbstractBuffer * gpu_hash_table_buff_
#define CHECK(condition)
Definition: Logger.h:222
void free(AbstractBuffer *buffer)
Definition: DataMgr.cpp:525
Data_Namespace::DataMgr * data_mgr_

+ 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 57 of file PerfectHashTable.h.

References CudaAllocator::allocGpuAbstractBuffer(), CHECK, CHECK_GE, data_mgr_, and gpu_hash_table_buff_.

57  {
58  CHECK_GE(device_id, 0);
61  data_mgr_, entries * sizeof(int32_t), device_id);
62  }
#define CHECK_GE(x, y)
Definition: Logger.h:235
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:222
Data_Namespace::DataMgr * data_mgr_

+ Here is the call graph for this function:

size_t PerfectHashTable::getColumnNumElems ( ) const
inline

Definition at line 95 of file PerfectHashTable.h.

References column_num_elems_.

95 { return column_num_elems_; }
int8_t* PerfectHashTable::getCpuBuffer ( )
inlineoverridevirtual

Implements HashTable.

Definition at line 75 of file PerfectHashTable.h.

References cpu_hash_table_buff_.

75  {
76  return reinterpret_cast<int8_t*>(cpu_hash_table_buff_.get());
77  }
std::unique_ptr< int32_t[]> cpu_hash_table_buff_
size_t PerfectHashTable::getEmittedKeysCount ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 85 of file PerfectHashTable.h.

References emitted_keys_count_.

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

Implements HashTable.

Definition at line 83 of file PerfectHashTable.h.

References entry_count_.

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

Implements HashTable.

Definition at line 79 of file PerfectHashTable.h.

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

79  {
81  }
virtual int8_t * getMemoryPtr()=0
Data_Namespace::AbstractBuffer * gpu_hash_table_buff_

+ Here is the call graph for this function:

HashEntryInfo PerfectHashTable::getHashEntryInfo ( ) const
inline

Definition at line 93 of file PerfectHashTable.h.

References hash_entry_info_.

93 { return hash_entry_info_; }
HashEntryInfo hash_entry_info_
size_t PerfectHashTable::getHashTableBufferSize ( const ExecutorDeviceType  device_type) const
inlineoverridevirtual

Implements HashTable.

Definition at line 64 of file PerfectHashTable.h.

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

64  {
65  if (device_type == ExecutorDeviceType::CPU) {
67  sizeof(decltype(cpu_hash_table_buff_)::element_type);
68  } else {
70  }
71  }
size_t cpu_hash_table_buff_size_
std::unique_ptr< int32_t[]> cpu_hash_table_buff_
virtual size_t reservedSize() const =0
Data_Namespace::AbstractBuffer * gpu_hash_table_buff_

+ Here is the call graph for this function:

HashType PerfectHashTable::getLayout ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 73 of file PerfectHashTable.h.

References layout_.

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

Definition at line 52 of file PerfectHashTable.h.

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

52  {
55  }
virtual size_t reservedSize() const =0
Data_Namespace::AbstractBuffer * gpu_hash_table_buff_
#define CHECK(condition)
Definition: Logger.h:222

+ Here is the call graph for this function:

void PerfectHashTable::setColumnNumElems ( size_t  elem)
inline

Definition at line 91 of file PerfectHashTable.h.

References column_num_elems_.

91 { column_num_elems_ = elem; }
void PerfectHashTable::setHashEntryInfo ( HashEntryInfo hash_entry_info)
inline

Definition at line 87 of file PerfectHashTable.h.

References hash_entry_info_.

87  {
88  hash_entry_info_ = hash_entry_info;
89  }
HashEntryInfo hash_entry_info_

Member Data Documentation

size_t PerfectHashTable::column_num_elems_
private

Definition at line 108 of file PerfectHashTable.h.

Referenced by getColumnNumElems(), and setColumnNumElems().

std::unique_ptr<int32_t[]> PerfectHashTable::cpu_hash_table_buff_
private

Definition at line 100 of file PerfectHashTable.h.

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

size_t PerfectHashTable::cpu_hash_table_buff_size_
private

Definition at line 101 of file PerfectHashTable.h.

Referenced by getHashTableBufferSize(), and PerfectHashTable().

Data_Namespace::DataMgr* PerfectHashTable::data_mgr_
private

Definition at line 99 of file PerfectHashTable.h.

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

size_t PerfectHashTable::emitted_keys_count_
private

Definition at line 105 of file PerfectHashTable.h.

Referenced by getEmittedKeysCount(), and PerfectHashTable().

size_t PerfectHashTable::entry_count_
private

Definition at line 104 of file PerfectHashTable.h.

Referenced by getEntryCount(), and PerfectHashTable().

Data_Namespace::AbstractBuffer* PerfectHashTable::gpu_hash_table_buff_ {nullptr}
private
HashEntryInfo PerfectHashTable::hash_entry_info_
private

Definition at line 107 of file PerfectHashTable.h.

Referenced by getHashEntryInfo(), and setHashEntryInfo().

HashType PerfectHashTable::layout_
private

Definition at line 103 of file PerfectHashTable.h.

Referenced by getLayout(), and PerfectHashTable().


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