-
Notifications
You must be signed in to change notification settings - Fork 12
/
gpu_ibfs.cuh
121 lines (108 loc) · 2.83 KB
/
gpu_ibfs.cuh
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
/*
* Copyright 2016 The George Washington University
* Written by Hang Liu
* Directed by Prof. Howie Huang
*
* https://www.seas.gwu.edu/~howie/
* Contact: [email protected]
*
*
* Please cite the following paper:
*
* Hang Liu, H. Howie Huang and Yang Hu. 2016. iBFS: Concurrent Breadth-First Search on GPUs. Proceedings of the 2016 International Conference on Management of Data. ACM.
*
* This file is part of iBFS.
*
* iBFS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iBFS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with iBFS. If not, see <http://www.gnu.org/licenses/>.
*/
//Graph format: Json based format: [src_id, src_weigh,[[connected_ver_0, edge_weight],[connected_ver_1, edge_weight],[connected_ver_2, edge_weight]]]
//Storage format:
//struct{
// int: src_ver
// Arr: [ver_0|ver_1|ver_2|...]
// Int: num_conn_ver
// }
#ifndef GPU_IBFS_H
#define GPU_IBFS_H
#include <fstream>
#include <string>
#include <iostream>
#include <sstream>
#include <queue>
#include "util.h"
#include "wtime.h"
#include "graph.h"
class gpu_ibfs{
//variable
public:
const graph *g;
vertex_t* src_list_d;
vertex_t* adj_list_d;
index_t* beg_pos_d;
vertex_t* ex_sml_q_d;
vertex_t* ex_mid_q_d;
vertex_t* ex_lrg_q_d;
index_t* cat_sml_sz_d;
index_t* cat_mid_sz_d;
index_t* cat_lrg_sz_d;
index_t* cat_sml_off_d;
index_t* cat_mid_off_d;
index_t* cat_lrg_off_d;
index_t *ex_sml_sz;
index_t *ex_mid_sz;
index_t *ex_lrg_sz;
index_t *ex_sml_sz_d;
index_t *ex_mid_sz_d;
index_t *ex_lrg_sz_d;
comp_t *depth_comp_last;
comp_t *depth_comp_curr;
cudaStream_t *stream, gstream;
index_t sml_shed;
index_t lrg_shed;
index_t gpu_count;
index_t *gpu_ranger;
index_t joint_count;
index_t bit_count;
index_t concurr_count;
index_t sw_level;
bool *is_done;
bool *is_done_d;
//constructor
public:
gpu_ibfs(){};
gpu_ibfs(
const graph *g,
index_t concurr_count,
depth_t sw_level,
index_t gpu_count,
index_t sml_shed,
index_t lrg_shed);
~gpu_ibfs(){};
//functions
public:
int write_result();
void traversal(index_t src_grp_off);
void init_bfs(index_t src_grp_off);
void debugger(index_t);
//expander series
void expander(depth_t level);
void bu_expand(depth_t level);
void td_expand(depth_t level);
void sw_expand(depth_t level);
//inspector series
void inspector(depth_t level);
void td_inspect(depth_t level);
void sw_inspect(depth_t level);
};
#endif