GENIE
genie::table::inv_table Class Reference

The declaration for class inv_table. More...

#include <inv_table.h>

Inheritance diagram for genie::table::inv_table:
genie::table::inv_compr_table

Public Types

enum  status { not_builded, builded }
 This enum var defines two statuses for a inv_table object, which is either builded or not_builded. More...
 

Public Member Functions

 inv_table ()
 Default constructor of the inv_table. More...
 
virtual ~inv_table ()
 The Destructor of the inv_table. It will also clear the related gpu memory. More...
 
std::unordered_map< int, int > * get_distinct_map (int dim)
 
void append_sequence (inv_list &inv)
 append inv_list for sequence search More...
 
void set_table_index (int attr_index)
 Set the table_index to 'index'. More...
 
void set_total_num_of_table (int num)
 Set the total_num_of_table to 'num'. More...
 
int get_table_index () const
 return the index of this inv_table. More...
 
int get_total_num_of_table () const
 return the total_num_of_table. More...
 
bool cpy_data_to_gpu ()
 Copy vector _inv to gpu memory which is referenced by d_inv_p. More...
 
void clear_gpu_mem ()
 clear the corresponding gpu memory referenced by d_inv_p More...
 
void clear ()
 Clear the inv_table. More...
 
bool empty ()
 Check whether the inv_table is empty. More...
 
int m_size ()
 
int i_size ()
 
int shifter ()
 
unsigned int _shift_bits_subsequence ()
 
void append (inv_list &inv)
 Append an inv_list to the inv_table. More...
 
void append (inv_list *inv)
 Append an inv_list to the inv_table. More...
 
status build_status ()
 
std::vector< inv_list > * inv_lists ()
 
virtual std::vector< int > * ck ()
 
virtual std::vector< int > * inv ()
 
std::unordered_map< size_t, int > * inv_index_map ()
 
virtual std::vector< int > * inv_pos ()
 
int get_upperbound_of_list (int attr_index)
 
int get_lowerbound_of_list (int attr_index)
 
virtual void build (size_t max_length, bool use_load_balance)
 Build the inv_table. More...
 
int get_posting_list_size (int attr_index, int value)
 
bool list_contain (int attr_index, int value)
 Test whether a value is possible for an specific attribute. More...
 
void set_min_value_sequence (int min_value)
 Used in sequence search. To set the min_value for all sequences' element. More...
 
int get_min_value_sequence ()
 Get the min value for sequences' elements in this inv_table. More...
 
void set_max_value_sequence (int max_value)
 Set the max value for all sequence. Compare to set_min_value_sequence() More...
 
int get_max_value_sequence ()
 Get the max value. More...
 
void set_gram_length_sequence (int gram_length)
 Set length of each gram. More...
 
int get_gram_length_sequence ()
 Get the gram length. More...
 
template<class Archive >
void load (Archive &ar, const unsigned int version)
 
template<class Archive >
void save (Archive &ar, const unsigned int version) const
 

Public Attributes

int * d_inv_p = NULL
 d_inv_p points to the start location for posting list array in GPU memory. More...
 
bool is_stored_in_gpu
 is_stored_in_gpu tell whether inverted index structure is pre-stored inside gpu memory More...
 
int shift_bits_sequence
 This variable is used to tell the number of bits shifted for recording gram in different position. More...
 

Static Public Attributes

static int max_inv_size = 0
 

Friends

class boost::serialization::access
 

Detailed Description

The declaration for class inv_table.

The inv_table class includes the inverted index structure for a specific dataset to be searched. Also this class contains information for constructing query on this set. In one word, this class manages all information about the inverted index.

Definition at line 41 of file inv_table.h.

Member Enumeration Documentation

◆ status

This enum var defines two statuses for a inv_table object, which is either builded or not_builded.

Enumerator
not_builded 
builded 

Definition at line 48 of file inv_table.h.

Constructor & Destructor Documentation

◆ inv_table()

genie::table::inv_table::inv_table ( )
inline

Default constructor of the inv_table.

It sets is_store_in_gpu to false, _shifter 16, _size -1, table_index 0, total_num_of_table 1 and _dim_size 0.

Definition at line 210 of file inv_table.h.

◆ ~inv_table()

genie::table::inv_table::~inv_table ( )
virtual

The Destructor of the inv_table. It will also clear the related gpu memory.

Definition at line 55 of file inv_table.cu.

Member Function Documentation

◆ _shift_bits_subsequence()

unsigned int genie::table::inv_table::_shift_bits_subsequence ( )
Returns
The shift bits for subsequence search. The way to combine rowID and offset of its element.

Definition at line 202 of file inv_table.cu.

◆ append() [1/2]

void genie::table::inv_table::append ( inv_list inv)

Append an inv_list to the inv_table.

Parameters
invThe refrence to the inv_list which will be appended. The appended inv_list will be added to _inv_lists. The first inv_list will set the _size to correct number. If _size is not equal to the size of inv_list or -1. This method will simply return and do nothing.

Definition at line 107 of file inv_table.cu.

◆ append() [2/2]

void genie::table::inv_table::append ( inv_list inv)

Append an inv_list to the inv_table.

Parameters
invthe refrence to the inv_list which will be appended.
The appended inv_list will be added
to _inv_lists. The first inv_list will set the _size to correct number. If _size is not equal to the size of inv_list or -1. This method will simply return and do nothing.

Definition at line 155 of file inv_table.cu.

◆ append_sequence()

void genie::table::inv_table::append_sequence ( inv_list inv)

append inv_list for sequence search

Parameters
invThe inv_list to append.

Definition at line 130 of file inv_table.cu.

◆ build()

void genie::table::inv_table::build ( size_t  max_length,
bool  use_load_balance 
)
virtual

Build the inv_table.

Parameters
max_lengthThe maximum length of one segment in posting list array
use_load_balanceThe flag to determine whether to do load balance

This method will merge all inv_lists to two vector _ck and _inv and set the _build_status to builded. Any query should only be done after the inv_table has been builded. If use_load_balance is true, the max_length will be used to divide posting list which is longer than max_length suggests. if use_load_balance is false, the max_length will be set to positive infinity before it is used

Reimplemented in genie::table::inv_compr_table.

Definition at line 268 of file inv_table.cu.

◆ build_status()

status genie::table::inv_table::build_status ( )
Returns
Building status of the inv_table.

Definition at line 230 of file inv_table.cu.

◆ ck()

vector< int > * genie::table::inv_table::ck ( )
virtual
Returns
The pointer points to _ck vector.

Definition at line 242 of file inv_table.cu.

◆ clear()

void genie::table::inv_table::clear ( )

Clear the inv_table.

The method removes all content in _inv_lists, _ck and _inv. It will release the corresponding gpu memory allocated as well. It also sets the _size back to -1.

Definition at line 47 of file inv_table.cu.

◆ clear_gpu_mem()

void genie::table::inv_table::clear_gpu_mem ( )

clear the corresponding gpu memory referenced by d_inv_p

Definition at line 69 of file inv_table.cu.

◆ cpy_data_to_gpu()

bool genie::table::inv_table::cpy_data_to_gpu ( )

Copy vector _inv to gpu memory which is referenced by d_inv_p.

Returns
True if transferring is successful.

Definition at line 30 of file inv_table.cu.

◆ empty()

bool genie::table::inv_table::empty ( )

Check whether the inv_table is empty.

If the _size is smaller than 0, the method returns true and returns false in the other case.

Returns
true if _size < 0 false if _size >= 0

Definition at line 81 of file inv_table.cu.

◆ get_distinct_map()

unordered_map< int, int > * genie::table::inv_table::get_distinct_map ( int  dim)

Definition at line 102 of file inv_table.cu.

◆ get_gram_length_sequence()

int genie::table::inv_table::get_gram_length_sequence ( )

Get the gram length.

Returns
The gram length used in this inv_table.

Definition at line 385 of file inv_table.cu.

◆ get_lowerbound_of_list()

int genie::table::inv_table::get_lowerbound_of_list ( int  attr_index)
Parameters
indexSpecify index of the inverted list
Returns
The minimum value of the inverted list at 'index'

Definition at line 193 of file inv_table.cu.

◆ get_max_value_sequence()

int genie::table::inv_table::get_max_value_sequence ( )

Get the max value.

Returns
The max value.

Definition at line 371 of file inv_table.cu.

◆ get_min_value_sequence()

int genie::table::inv_table::get_min_value_sequence ( )

Get the min value for sequences' elements in this inv_table.

Returns
The min value.

Definition at line 359 of file inv_table.cu.

◆ get_posting_list_size()

int genie::table::inv_table::get_posting_list_size ( int  attr_index,
int  value 
)
Parameters
attr_indexThe attribute id
valueThe value on that specific attribute

This function is called when constructing query. Users do not need to call this function.

Returns
The posting list length for an attribute-value pair

Definition at line 164 of file inv_table.cu.

◆ get_table_index()

int genie::table::inv_table::get_table_index ( ) const

return the index of this inv_table.

Returns
The index of this table.

Definition at line 219 of file inv_table.cu.

◆ get_total_num_of_table()

int genie::table::inv_table::get_total_num_of_table ( ) const

return the total_num_of_table.

Returns
The total number of tables in the table array for one dataset.

Definition at line 225 of file inv_table.cu.

◆ get_upperbound_of_list()

int genie::table::inv_table::get_upperbound_of_list ( int  attr_index)
Parameters
indexSpecify index of the inverted list
Returns
The maximum value of the inverted list at 'index'

Definition at line 184 of file inv_table.cu.

◆ i_size()

int genie::table::inv_table::i_size ( )
Returns
The number of instances(data points)

Definition at line 92 of file inv_table.cu.

◆ inv()

vector< int > * genie::table::inv_table::inv ( )
virtual
Returns
The pointer points to _inv vector.

Reimplemented in genie::table::inv_compr_table.

Definition at line 248 of file inv_table.cu.

◆ inv_index_map()

unordered_map< size_t, int > * genie::table::inv_table::inv_index_map ( )
Returns
The pointer points to _inv_index_map map.

Definition at line 255 of file inv_table.cu.

◆ inv_lists()

vector< inv_list > * genie::table::inv_table::inv_lists ( )
Returns
The pointer points to _inv_lists vector.

Definition at line 236 of file inv_table.cu.

◆ inv_pos()

vector< int > * genie::table::inv_table::inv_pos ( )
virtual
Returns
The pointer points to _inv_pos vector.

Reimplemented in genie::table::inv_compr_table.

Definition at line 261 of file inv_table.cu.

◆ list_contain()

bool genie::table::inv_table::list_contain ( int  attr_index,
int  value 
)

Test whether a value is possible for an specific attribute.

Parameters
attr_indexId of attribute
valueValue waiting to be tested
Returns
True if value is in the range allowed by the attribute

Definition at line 173 of file inv_table.cu.

◆ load()

template<class Archive >
void genie::table::inv_table::load ( Archive &  ar,
const unsigned int  version 
)

Definition at line 69 of file serialization.cc.

◆ m_size()

int genie::table::inv_table::m_size ( )
Returns
The number of dimensions.

Definition at line 86 of file inv_table.cu.

◆ save()

template<class Archive >
void genie::table::inv_table::save ( Archive &  ar,
const unsigned int  version 
) const

Definition at line 95 of file serialization.cc.

◆ set_gram_length_sequence()

void genie::table::inv_table::set_gram_length_sequence ( int  gram_length)

Set length of each gram.

Parameters
gram_lengthThe gram length to be set.

Definition at line 378 of file inv_table.cu.

◆ set_max_value_sequence()

void genie::table::inv_table::set_max_value_sequence ( int  max_value)

Set the max value for all sequence. Compare to set_min_value_sequence()

Parameters
max_valueThe max value to be set.

Definition at line 365 of file inv_table.cu.

◆ set_min_value_sequence()

void genie::table::inv_table::set_min_value_sequence ( int  min_value)

Used in sequence search. To set the min_value for all sequences' element.

Parameters
min_valueThe value to be set as the minimum value.

Definition at line 353 of file inv_table.cu.

◆ set_table_index()

void genie::table::inv_table::set_table_index ( int  attr_index)

Set the table_index to 'index'.

Parameters
indexThe index value you wish to set.

Actually, users do not need to call this function.

Definition at line 208 of file inv_table.cu.

◆ set_total_num_of_table()

void genie::table::inv_table::set_total_num_of_table ( int  num)

Set the total_num_of_table to 'num'.

Parameters
numThe total number of tables you wish to set.

Actually, users do not need to call this function.

Definition at line 213 of file inv_table.cu.

◆ shifter()

int genie::table::inv_table::shifter ( )
Returns
The shifter.

Definition at line 97 of file inv_table.cu.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 534 of file inv_table.h.

Member Data Documentation

◆ d_inv_p

int * genie::table::inv_table::d_inv_p = NULL

d_inv_p points to the start location for posting list array in GPU memory.

Definition at line 55 of file inv_table.h.

◆ is_stored_in_gpu

bool genie::table::inv_table::is_stored_in_gpu

is_stored_in_gpu tell whether inverted index structure is pre-stored inside gpu memory

If true, data is pre-stored inside gpu so that you can launch queries multiple times. only need to transfer data to device once. If false, you have to transfer data to device every time you launch a query. (Here, one query means one execution of search)

Definition at line 70 of file inv_table.h.

◆ max_inv_size

int genie::table::inv_table::max_inv_size = 0
static

Definition at line 61 of file inv_table.h.

◆ shift_bits_sequence

int genie::table::inv_table::shift_bits_sequence

This variable is used to tell the number of bits shifted for recording gram in different position.

Definition at line 75 of file inv_table.h.


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