-
Notifications
You must be signed in to change notification settings - Fork 2
/
Spec_main.cpp
158 lines (119 loc) · 6.63 KB
/
Spec_main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#include "minimal_tests.hpp"
bool print_pass() {
std::cout << "Passed tests!" << std::endl;
return true;
}
auto get_fp_ratios() -> bool {
using itemType = uint64_t;
using spare_item = uint64_t;
using temp_hash = hashTable_Aligned<spare_item, 4>;
using Table_Dict256_Ver5 = Dict256_Ver5<spare_item, itemType>;
using Table_Dict256_Ver6 = Dict256_Ver6<itemType>;
single_fp_rates<Table_Dict256_Ver5, itemType>(std::ceil((1ull << 20ul) * 0.94), 1ull << 21ul, 11, 1);
const size_t fp_capacity = std::ceil((1ull << 23u) + 1);
const size_t fp_lookups = (1ull << 25u);
const size_t bits_per_element = 8;
vector<itemType> fp_v_add, fp_v_find; //, v_delete;
vector<vector<itemType> *> fp_elements{&fp_v_add, &fp_v_find};//, &v_delete};
init_elements(fp_capacity, fp_lookups, &fp_elements, false);
single_fp_rates_probabilistic<Table_Dict256_Ver5, itemType>(fp_capacity, fp_lookups, 8, &fp_elements);
single_fp_rates_probabilistic<Table_Dict256_Ver5, itemType>(fp_capacity, fp_lookups, 8, &fp_elements);
return true;
}
void heavy_validation() {
using itemType = uint64_t;
using Table_Dict256_Ver6 = Dict256_Ver6<itemType>;
bool temp = validation_test_single<Table_Dict256_Ver6, itemType>(0x1111, 0x1111);
assert(temp);
std::cout << "passed: \t" << 0x1111 << std::endl;
temp = validation_test_single<Table_Dict256_Ver6, itemType>(0x1'1111, 0x1'1111);
assert(temp);
std::cout << "passed \t" << 0x11111 << std::endl;
// temp = validation_test_single<Table_Dict256_Ver6, itemType>(0x2'1111,0x2'1111);
// assert(temp);
// std::cout << "passed \t" << 0x21111 << std::endl;
// temp = validation_test_single<Table_Dict256_Ver6, itemType>(0x4'1111,0x4'1111);
// assert(temp);
// std::cout << "passed \t" << 0x41111 << std::endl;
// temp = validation_test_single<Table_Dict256_Ver6, itemType>(0x8'1111,0x8'1111);
// assert(temp);
// std::cout << "passed \t" << 0x81111 << std::endl;
temp = validation_test_single<Table_Dict256_Ver6, itemType>(0x11'1111, 0x11'1111);
assert(temp);
std::cout << "passed \t" << 0x11'1111 << std::endl;
temp = validation_test_single<Table_Dict256_Ver6, itemType>(0x21'1111, 0x21'1111);
assert(temp);
std::cout << "passed \t" << 0x21'1111 << std::endl;
temp = validation_test_single<Table_Dict256_Ver6, itemType>(0x41'1111, 0x41'1111);
assert(temp);
std::cout << "passed \t" << 0x41'1111 << std::endl;
temp = validation_test_single<Table_Dict256_Ver6, itemType>(0x81'1111, 0x81'1111);
assert(temp);
std::cout << "passed \t" << 0x81'1111 << std::endl;
for (size_t i = 0; i < 16; i++) {
temp = validation_test_single<Table_Dict256_Ver6, itemType>(0x111'1111, 0x111'1111);
assert(temp);
std::cout << "passed \t" << 0x81'1111 << std::endl;
}
}
void valgrind_check() {
using Table_Dict256_Ver7 = Dict256_Ver7<uint64_t>;
auto filter = FilterAPI<Table_Dict256_Ver7>::ConstructFromAddCount(15435038UL);
// return 0;
}
int main(int argc, char **argv) {
// valgrind_check();
// return 0;
using itemType = uint64_t;
using spare_item = uint64_t;
using temp_hash = hashTable_Aligned<spare_item, 4>;
using Table_CF = cuckoofilter::CuckooFilter<uint64_t, BITS_PER_ELEMENT_MACRO, cuckoofilter::SingleTable>;
using Table_Dict256_Ver5 = Dict256_Ver5<spare_item, itemType>;
// using Table_Dict256_Ver6 = Dict256_Ver6<itemType>;
using Table_Dict256_Ver7 = Dict256_Ver7<itemType>;
using Table_Dict256_Ver6_db = Dict256_Ver6_DB<itemType>;
assert((default_validation_test_single<Table_Dict256_Ver5, itemType>()));
// return 0;
assert((default_validation_test_single<Table_Dict256_Ver7, itemType>()));
assert((default_validation_test_single<Table_Dict256_Ver7, itemType>()));
assert((default_validation_test_single_with_deletions<Table_Dict256_Ver7, itemType>()));
assert((default_validation_test_single_with_deletions<Table_Dict256_Ver7, itemType>()));
// return 0;
// get_fp_ratios();
// constexpr size_t max_filter_capacity = 7381975UL * 2UL; // load is .88
constexpr size_t max_filter_capacity = 15435038UL; // load is .92
constexpr size_t lookup_reps = 124822484;
// constexpr size_t max_filter_capacity = 154350UL; // load is .92
// constexpr size_t lookup_reps = 1248224;
constexpr size_t bits_per_element = 8;
constexpr size_t bench_precision = 16;
vector<itemType> v_add, v_find, v_delete;
vector<vector<itemType> *> elements{&v_add, &v_find, &v_delete};
fill_vec(elements.at(0), max_filter_capacity);
fill_vec(elements.at(1), lookup_reps);
// size_t del_size = 0;
constexpr size_t del_size = 1.0 * max_filter_capacity / (double) (bench_precision);
fill_vec(elements.at(2), del_size);
// constexpr size_t del_size = 1;
// size_t del_size = 1;
// auto temp = elements.at(2)->size();
// assert(elements.at(2)->size() == del_size);
// single_bench<Table_CF, itemType>(max_filter_capacity, lookup_reps, bench_precision, false, false);
// single_bench<Table_Dict256_Ver7, itemType>(max_filter_capacity, lookup_reps, bench_precision, false, false);
single_bench<Table_Dict256_Ver7, itemType>(max_filter_capacity, bench_precision, false, &elements);
// single_bench<Table_CF, itemType>(max_filter_capacity, bench_precision, false, &elements);
single_bench<Table_Dict256_Ver7, itemType>(max_filter_capacity, bench_precision, false, &elements);
// single_bench<Table_CF, itemType>(max_filter_capacity, bench_precision, false, &elements);
single_bench<Table_Dict256_Ver7, itemType>(max_filter_capacity, bench_precision, false, &elements);
return 0;
single_bench<Table_CF, itemType>(max_filter_capacity, lookup_reps, bench_precision, false, true);
single_bench<Table_Dict256_Ver7, itemType>(max_filter_capacity, lookup_reps, bench_precision, false, true);
single_bench<Table_CF, itemType>(max_filter_capacity, lookup_reps, bench_precision, false, true);
single_bench<Table_Dict256_Ver7, itemType>(max_filter_capacity, lookup_reps, bench_precision, false, true);
single_bench<Table_CF, itemType>(max_filter_capacity, lookup_reps, bench_precision, false, true);
// single_bench<Table_Dict256_Ver7, itemType>(max_filter_capacity, bench_precision, false, &elements);
// single_bench<Table_Dict256_Ver5, itemType>(max_filter_capacity, bench_precision, false, &elements);
// single_bench<Table_Dict256_Ver7, itemType>(max_filter_capacity, bench_precision, false, &elements);
// single_bench<Table_Dict256_Ver5, itemType>(max_filter_capacity, bench_precision, false, &elements);
return 0;
}