-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.cpp
102 lines (78 loc) · 3.07 KB
/
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
#include <algorithm>
#include <chrono>
#include <cstring>
#include <iostream>
#include <string>
#include <unordered_map>
#include <cuda_runtime.h>
#include "utils/CLI11.hpp"
#include "utils/config.h"
#include "utils/globals.h"
#include "utils/cuda_helpers.h"
#include "utils/mem_pool.h"
#include "graph/graph.h"
#include "structures/hashed_tries.h"
#include "structures/hashed_trie_manager.h"
#include "processing/plan.h"
#include "execution/execution.h"
int main(int argc, char** argv) {
CLI::App app{"App description"};
std::string query_path, data_path, method = "BFS-DFS";
bool filtering_3rd = true, adaptive_ordering = true, load_balancing = true;
uint32_t filtering_order_start_v = UINT32_MAX;
uint32_t gpu_num = 0u;
app.add_option("-q", query_path, "query graph path")->required();
app.add_option("-d", data_path, "data graph path")->required();
app.add_option("-m", method, "enumeration method");
app.add_option("--f3", filtering_3rd, "enable the third filtering step or not");
app.add_option("--f3start", filtering_order_start_v, "start vertex of the third filtering step");
app.add_option("--ao", adaptive_ordering, "enable adaptive ordering or not");
app.add_option("--lb", load_balancing, "enable load balancing or not");
app.add_option("--gpu", gpu_num, "gpu number");
CLI11_PARSE(app, argc, argv);
cudaSetDevice(gpu_num);
copyConfig(adaptive_ordering, load_balancing);
/*************** read graph ***************/
std::unordered_map<uint32_t, uint32_t> label_map;
Graph query_graph(query_path, label_map);
Graph data_graph(data_path, label_map);
GraphGPU query_graph_gpu(query_graph);
GraphGPU data_graph_gpu(data_graph);
GraphUtils query_utils;
query_utils.Set(query_graph);
copyGraphMeta(query_graph, data_graph, query_utils);
/*************** filtering ***************/
HashedTries hashed_tries {};
TIME_INIT();
TIME_START();
HashedTrieManager manager(query_graph, query_graph_gpu, data_graph_gpu, hashed_tries);
TIME_END();
PRINT_LOCAL_TIME("Build Cuckoo Tries");
copyTries(hashed_tries);
TIME_START();
manager.Filter(hashed_tries, filtering_3rd, filtering_order_start_v);
TIME_END();
PRINT_LOCAL_TIME("Filtering");
manager.GetCardinalities(hashed_tries);
manager.Print();
manager.Deallocate();
query_graph_gpu.Deallocate();
data_graph_gpu.Deallocate();
Plan plan(query_graph, manager.h_compacted_vs_sizes_, method);
plan.Print(query_graph);
/*************** memory pool ***************/
std::cout << '\n';
MEM_INIT();
PRINT_MEM_INFO("Before Allocation");
MemPool pool {};
pool.Alloc(MAX_RES_MEM_SPACE / sizeof(uint32_t));
PoolElem res = pool.TryMax();
unsigned long long int res_size = 0;
PRINT_MEM_INFO("After allocation");
std::cout << std::endl;;
/*************** enumeration ***************/
matchDFSGroup(manager, plan, pool, res, res_size);
std::cout << "# Matches: " << res_size << "\nEnd." << std::endl;
pool.Free();
manager.DeallocateTries(hashed_tries);
}