9 #ifndef GPUGenie_inv_table_h 10 #define GPUGenie_inv_table_h 14 #include <unordered_map> 17 #include <boost/serialization/access.hpp> 18 #include <boost/serialization/split_member.hpp> 23 typedef unsigned long long u64;
31 class inv_compr_table;
95 int total_num_of_table;
125 std::vector<inv_list> _inv_lists;
132 std::vector<std::unordered_map<int, int> > _distinct_map;
138 std::vector<int> inv_list_upperbound;
143 std::vector<int> inv_list_lowerbound;
149 std::vector<std::vector<int> > posting_list_size;
156 std::vector<int> _ck;
164 std::vector<int> _inv;
169 std::unordered_map<size_t, int> _inv_index_map;
174 std::vector<int> _inv_pos;
181 unsigned int shift_bits_subsequence;
186 int min_value_sequence;
194 int max_value_sequence;
199 int gram_length_sequence;
210 inv_table():is_stored_in_gpu(false),shift_bits_sequence(0),
211 table_index(0),total_num_of_table(1),
212 _build_status(
not_builded), _shifter(16),_size(-1),_dim_size(0),
213 shift_bits_subsequence(0),
214 min_value_sequence(0), max_value_sequence(0), gram_length_sequence(1)
376 std::vector<inv_list>*
383 virtual std::vector<int>*
390 virtual std::vector<int>*
397 std::unordered_map<size_t, int>*
404 virtual std::vector<int>*
446 virtual build(
size_t max_length,
bool use_load_balance);
525 template <
class Archive>
526 void load(Archive &ar,
const unsigned int version);
528 template <
class Archive>
529 void save(Archive &ar,
const unsigned int version)
const;
531 BOOST_SERIALIZATION_SPLIT_MEMBER()
int get_gram_length_sequence()
Get the gram length.
bool cpy_data_to_gpu()
Copy vector _inv to gpu memory which is referenced by d_inv_p.
std::unordered_map< size_t, int > * inv_index_map()
This is the top-level namespace of the project.
void set_gram_length_sequence(int gram_length)
Set length of each gram.
virtual std::vector< int > * inv_pos()
void clear_gpu_mem()
clear the corresponding gpu memory referenced by d_inv_p
int * d_inv_p
d_inv_p points to the start location for posting list array in GPU memory.
virtual ~inv_table()
The Destructor of the inv_table. It will also clear the related gpu memory.
int get_upperbound_of_list(int attr_index)
The declaration for class inv_table.
status
This enum var defines two statuses for a inv_table object, which is either builded or not_builded...
int get_total_num_of_table() const
return the total_num_of_table.
std::unordered_map< int, int > * get_distinct_map(int dim)
int get_table_index() const
return the index of this inv_table.
virtual std::vector< int > * ck()
void append(inv_list &inv)
Append an inv_list to the inv_table.
int get_min_value_sequence()
Get the min value for sequences' elements in this inv_table.
virtual void build(size_t max_length, bool use_load_balance)
Build the inv_table.
void clear()
Clear the inv_table.
int shift_bits_sequence
This variable is used to tell the number of bits shifted for recording gram in different position...
int get_lowerbound_of_list(int attr_index)
unsigned int _shift_bits_subsequence()
friend class boost::serialization::access
int get_posting_list_size(int attr_index, int value)
virtual std::vector< int > * inv()
bool is_stored_in_gpu
is_stored_in_gpu tell whether inverted index structure is pre-stored inside gpu memory ...
void set_table_index(int attr_index)
Set the table_index to 'index'.
void load(Archive &ar, const unsigned int version)
void set_min_value_sequence(int min_value)
Used in sequence search. To set the min_value for all sequences' element.
void set_total_num_of_table(int num)
Set the total_num_of_table to 'num'.
void save(Archive &ar, const unsigned int version) const
Declaration of inv_list class.
inv_table()
Default constructor of the inv_table.
This class manages one inverted list.
bool empty()
Check whether the inv_table is empty.
int get_max_value_sequence()
Get the max value.
bool list_contain(int attr_index, int value)
Test whether a value is possible for an specific attribute.
std::vector< inv_list > * inv_lists()
void set_max_value_sequence(int max_value)
Set the max value for all sequence. Compare to set_min_value_sequence()
void append_sequence(inv_list &inv)
append inv_list for sequence search