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

#include <BaselineHashTable.h>

+ Inheritance diagram for BaselineHashTable:
+ Collaboration diagram for BaselineHashTable:

Public Member Functions

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

Private Attributes

std::vector< int8_t > cpu_hash_table_buff_
 
Data_Namespace::AbstractBuffergpu_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 27 of file BaselineHashTable.h.

Constructor & Destructor Documentation

BaselineHashTable::BaselineHashTable ( const Catalog_Namespace::Catalog catalog,
HashType  layout,
const size_t  entry_count,
const size_t  emitted_keys_count,
const size_t  hash_table_size 
)
inline

Definition at line 30 of file BaselineHashTable.h.

References cpu_hash_table_buff_.

35  : gpu_hash_table_buff_(nullptr)
36 #ifdef HAVE_CUDA
37  , device_id_(0)
38  , catalog_(catalog)
39 #endif
40  , layout_(layout)
41  , entry_count_(entry_count)
42  , emitted_keys_count_(emitted_keys_count) {
43  cpu_hash_table_buff_.resize(hash_table_size);
44  }
catalog_(nullptr)
std::vector< int8_t > cpu_hash_table_buff_
Data_Namespace::AbstractBuffer * gpu_hash_table_buff_
BaselineHashTable::BaselineHashTable ( const Catalog_Namespace::Catalog catalog,
HashType  layout,
const size_t  entry_count,
const size_t  emitted_keys_count,
const size_t  hash_table_size,
const size_t  device_id 
)
inline

Definition at line 47 of file BaselineHashTable.h.

References CudaAllocator::allocGpuAbstractBuffer(), catalog_(), CHECK, gpu_hash_table_buff_, and UNREACHABLE.

53  : gpu_hash_table_buff_(nullptr)
54 #ifdef HAVE_CUDA
55  , device_id_(device_id)
56  , catalog_(catalog)
57 #endif
58  , layout_(layout)
59  , entry_count_(entry_count)
60  , emitted_keys_count_(emitted_keys_count) {
61 #ifdef HAVE_CUDA
62  CHECK(catalog_);
63  auto& data_mgr = catalog_->getDataMgr();
65  CudaAllocator::allocGpuAbstractBuffer(&data_mgr, hash_table_size, device_id_);
66 #else
67  UNREACHABLE();
68 #endif
69  }
catalog_(nullptr)
#define UNREACHABLE()
Definition: Logger.h:250
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

+ Here is the call graph for this function:

BaselineHashTable::~BaselineHashTable ( )
inline

Definition at line 71 of file BaselineHashTable.h.

References catalog_(), CHECK, and gpu_hash_table_buff_.

71  {
72 #ifdef HAVE_CUDA
73  CHECK(catalog_);
74  auto& data_mgr = catalog_->getDataMgr();
76  data_mgr.free(gpu_hash_table_buff_);
77  }
78 #endif
79  }
catalog_(nullptr)
Data_Namespace::AbstractBuffer * gpu_hash_table_buff_
#define CHECK(condition)
Definition: Logger.h:206

+ Here is the call graph for this function:

Member Function Documentation

int8_t* BaselineHashTable::getCpuBuffer ( )
inlineoverridevirtual

Implements HashTable.

Definition at line 94 of file BaselineHashTable.h.

References cpu_hash_table_buff_.

94  {
95  return reinterpret_cast<int8_t*>(cpu_hash_table_buff_.data());
96  }
std::vector< int8_t > cpu_hash_table_buff_
size_t BaselineHashTable::getEmittedKeysCount ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 100 of file BaselineHashTable.h.

References emitted_keys_count_.

100 { return emitted_keys_count_; }
size_t BaselineHashTable::getEntryCount ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 99 of file BaselineHashTable.h.

References entry_count_.

99 { return entry_count_; }
int8_t* BaselineHashTable::getGpuBuffer ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 81 of file BaselineHashTable.h.

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

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

+ Here is the call graph for this function:

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

Implements HashTable.

Definition at line 85 of file BaselineHashTable.h.

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

85  {
86  if (device_type == ExecutorDeviceType::CPU) {
87  return cpu_hash_table_buff_.size() *
88  sizeof(decltype(cpu_hash_table_buff_)::value_type);
89  } else {
91  }
92  }
virtual size_t reservedSize() const =0
std::vector< int8_t > cpu_hash_table_buff_
Data_Namespace::AbstractBuffer * gpu_hash_table_buff_

+ Here is the call graph for this function:

HashType BaselineHashTable::getLayout ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 98 of file BaselineHashTable.h.

References layout_.

98 { return layout_; }

Member Data Documentation

std::vector<int8_t> BaselineHashTable::cpu_hash_table_buff_
private

Definition at line 103 of file BaselineHashTable.h.

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

size_t BaselineHashTable::emitted_keys_count_
private

Definition at line 113 of file BaselineHashTable.h.

Referenced by getEmittedKeysCount().

size_t BaselineHashTable::entry_count_
private

Definition at line 112 of file BaselineHashTable.h.

Referenced by getEntryCount().

Data_Namespace::AbstractBuffer* BaselineHashTable::gpu_hash_table_buff_
private
HashType BaselineHashTable::layout_
private

Definition at line 111 of file BaselineHashTable.h.

Referenced by getLayout().


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