GENIE
|
The declaration for class inv_table. More...
#include <inv_table.h>
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 |
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.
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.
|
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.
|
virtual |
The Destructor of the inv_table. It will also clear the related gpu memory.
Definition at line 55 of file inv_table.cu.
unsigned int genie::table::inv_table::_shift_bits_subsequence | ( | ) |
Definition at line 202 of file inv_table.cu.
void genie::table::inv_table::append | ( | inv_list & | inv | ) |
Append an inv_list to the inv_table.
inv | The 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.
void genie::table::inv_table::append | ( | inv_list * | inv | ) |
Append an inv_list to the inv_table.
inv | the refrence to the inv_list which will be appended. The appended inv_list will be addedto _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.
void genie::table::inv_table::append_sequence | ( | inv_list & | inv | ) |
append inv_list for sequence search
inv | The inv_list to append. |
Definition at line 130 of file inv_table.cu.
|
virtual |
Build the inv_table.
max_length | The maximum length of one segment in posting list array |
use_load_balance | The 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.
status genie::table::inv_table::build_status | ( | ) |
Definition at line 230 of file inv_table.cu.
|
virtual |
Definition at line 242 of file inv_table.cu.
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.
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.
bool genie::table::inv_table::cpy_data_to_gpu | ( | ) |
Copy vector _inv to gpu memory which is referenced by d_inv_p.
Definition at line 30 of file inv_table.cu.
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.
Definition at line 81 of file inv_table.cu.
unordered_map< int, int > * genie::table::inv_table::get_distinct_map | ( | int | dim | ) |
Definition at line 102 of file inv_table.cu.
int genie::table::inv_table::get_gram_length_sequence | ( | ) |
Get the gram length.
Definition at line 385 of file inv_table.cu.
int genie::table::inv_table::get_lowerbound_of_list | ( | int | attr_index | ) |
index | Specify index of the inverted list |
Definition at line 193 of file inv_table.cu.
int genie::table::inv_table::get_max_value_sequence | ( | ) |
int genie::table::inv_table::get_min_value_sequence | ( | ) |
Get the min value for sequences' elements in this inv_table.
Definition at line 359 of file inv_table.cu.
int genie::table::inv_table::get_posting_list_size | ( | int | attr_index, |
int | value | ||
) |
attr_index | The attribute id |
value | The value on that specific attribute |
This function is called when constructing query. Users do not need to call this function.
Definition at line 164 of file inv_table.cu.
int genie::table::inv_table::get_table_index | ( | ) | const |
return the index of this inv_table.
Definition at line 219 of file inv_table.cu.
int genie::table::inv_table::get_total_num_of_table | ( | ) | const |
return the total_num_of_table.
Definition at line 225 of file inv_table.cu.
int genie::table::inv_table::get_upperbound_of_list | ( | int | attr_index | ) |
index | Specify index of the inverted list |
Definition at line 184 of file inv_table.cu.
int genie::table::inv_table::i_size | ( | ) |
Definition at line 92 of file inv_table.cu.
|
virtual |
Reimplemented in genie::table::inv_compr_table.
Definition at line 248 of file inv_table.cu.
unordered_map< size_t, int > * genie::table::inv_table::inv_index_map | ( | ) |
Definition at line 255 of file inv_table.cu.
vector< inv_list > * genie::table::inv_table::inv_lists | ( | ) |
Definition at line 236 of file inv_table.cu.
|
virtual |
Reimplemented in genie::table::inv_compr_table.
Definition at line 261 of file inv_table.cu.
bool genie::table::inv_table::list_contain | ( | int | attr_index, |
int | value | ||
) |
Test whether a value is possible for an specific attribute.
attr_index | Id of attribute |
value | Value waiting to be tested |
Definition at line 173 of file inv_table.cu.
void genie::table::inv_table::load | ( | Archive & | ar, |
const unsigned int | version | ||
) |
Definition at line 69 of file serialization.cc.
int genie::table::inv_table::m_size | ( | ) |
Definition at line 86 of file inv_table.cu.
void genie::table::inv_table::save | ( | Archive & | ar, |
const unsigned int | version | ||
) | const |
Definition at line 95 of file serialization.cc.
void genie::table::inv_table::set_gram_length_sequence | ( | int | gram_length | ) |
Set length of each gram.
gram_length | The gram length to be set. |
Definition at line 378 of file inv_table.cu.
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()
max_value | The max value to be set. |
Definition at line 365 of file inv_table.cu.
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.
min_value | The value to be set as the minimum value. |
Definition at line 353 of file inv_table.cu.
void genie::table::inv_table::set_table_index | ( | int | attr_index | ) |
Set the table_index to 'index'.
index | The index value you wish to set. |
Actually, users do not need to call this function.
Definition at line 208 of file inv_table.cu.
void genie::table::inv_table::set_total_num_of_table | ( | int | num | ) |
Set the total_num_of_table to 'num'.
num | The 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.
int genie::table::inv_table::shifter | ( | ) |
Definition at line 97 of file inv_table.cu.
|
friend |
Definition at line 534 of file inv_table.h.
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.
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.
|
static |
Definition at line 61 of file inv_table.h.
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.