-
Notifications
You must be signed in to change notification settings - Fork 12
/
expander.cuh
723 lines (661 loc) · 16.9 KB
/
expander.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
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
//Hang Dec/10/2013
//Hang Mar/05/2015
#include "comm.h"
__device__ void __sync_warp(int predicate){
while((!__all(predicate))){
;
}
}
//This kernel is executed by one thread
template<typename vertex_t,
typename index_t,
typename depth_t>
__global__ void init_expand_sort
(
vertex_t *src_list,
index_t src_grp_off,
depth_t *depth_merge,
comp_t *depth_comp_last,
comp_t *depth_comp_curr,
index_t num_agg_bfs,
vertex_t *parent_d,
index_t *adj_card_d,
index_t *ex_sml_sz_d,
index_t *ex_mid_sz_d,
index_t *ex_lrg_sz_d,
vertex_t *ex_sml_q,
vertex_t *ex_mid_q,
vertex_t *ex_lrg_q,
index_t vert_count,
index_t sml_shed,
index_t lrg_shed
)
{
// parent_d[src_v] =-1;
if(threadIdx.x==num_agg_bfs){
ex_sml_sz_d[0] = 0;
ex_mid_sz_d[0] = 0;
ex_lrg_sz_d[0] = num_agg_bfs;
}
if(threadIdx.x<num_agg_bfs){
vertex_t src_v=src_list[num_agg_bfs*src_grp_off+threadIdx.x];
// depth_merge[src_v*num_agg_bfs+threadIdx.x]= 0;
//
// index_t card = adj_card_d[src_v];
// if(!card) return;
//put all src into big queue since we have enough threads
//initally
ex_lrg_q[threadIdx.x]=src_v;
unsigned int status=1;
if(threadIdx.x<32){
status<<=threadIdx.x;
depth_comp_last[src_v].x=status;
depth_comp_curr[src_v].x=status;
}else if(threadIdx.x<64){
status<<=(threadIdx.x-32);
depth_comp_last[src_v].y=status;
depth_comp_curr[src_v].y=status;
}else if(threadIdx.x<96){
status<<=(threadIdx.x-64);
depth_comp_last[src_v].z=status;
depth_comp_curr[src_v].z=status;
}else if(threadIdx.x<128){
status<<=(threadIdx.x-96);
depth_comp_last[src_v].w=status;
depth_comp_curr[src_v].w=status;
}
}
return ;
}
template<typename vertex_t,
typename index_t,
typename depth_t>
void init_bfs(
vertex_t *src_v,
index_t src_grp_off,
tdata *gdata,
csr_graph ggraph,
index_t num_agg_bfs,
index_t sml_shed,
index_t lrg_shed
){
init_expand_sort
<vertex_t, index_t, depth_t>
<<<1,THDS_NUM>>>
(
ggraph->src_list,
src_grp_off,
ggraph->depth_merge,
ggraph->depth_comp_last,
ggraph->depth_comp_curr,
num_agg_bfs,
gdata[0]->parent_d,
ggraph->adj_card_d,
gdata[0]->ex_sml_sz_d,
gdata[0]->ex_mid_sz_d,
gdata[0]->ex_lrg_sz_d,
ggraph->ex_sml_q,
ggraph->ex_mid_q,
ggraph->ex_lrg_q,
ggraph->vert_count,
sml_shed,
lrg_shed
);
//cudaDeviceSynchronize();
// index_t vert_count=ggraph->vert_count;
// comp_t *d_status_curr,*d_status_last;
// cudaMallocHost((void **)&d_status_curr, sizeof(comp_t)*vert_count);
// cudaMallocHost((void **)&d_status_last, sizeof(comp_t)*vert_count);
// cudaMemcpy(d_status_curr, ggraph->depth_comp_curr,sizeof(comp_t)*vert_count,cudaMemcpyDeviceToHost);
// cudaMemcpy(d_status_last, ggraph->depth_comp_last,sizeof(comp_t)*vert_count,cudaMemcpyDeviceToHost);
//
// int ft_count=0; int diff=0;
// for(int i=0;i<vert_count;i++){
// if(d_status_curr[i]!=0) diff++;
// if(d_status_curr[i]!=0xffffffffffffffff && ggraph->adj_card[i]>0) ft_count++;
// }
// std::cout<<"ft_count-diff "<<ft_count<<" "<<diff<<"\n";
// cudaFreeHost(d_status_last);
// cudaFreeHost(d_status_curr);
//
}
//+----------------------
//|for ex_sml_q expansion
//+---------------------------
template<typename vertex_t,
typename index_t,
typename depth_t,
typename comp_t>
__global__ void td_expand_thd
(
comp_t *depth_comp_last,
comp_t *depth_comp_curr,
index_t num_agg_bfs,
vertex_t *parent_d,
depth_t curr_level,
index_t ex_sml_sz,
const vertex_t* __restrict__ ex_q_d,
const index_t* __restrict__ adj_card_d,
const index_t* __restrict__ beg_pos_d,
const vertex_t* __restrict__ adj_list_d
)
{
const index_t q_sz = ex_sml_sz;
const index_t GRNLTY = blockDim.x * gridDim.x;
index_t tid = threadIdx.x+blockIdx.x*blockDim.x;
//used for prefetching
vertex_t ex_ver_curr;
index_t card_curr;
index_t beg_pos_curr;
vertex_t adj_vert;
comp_t vert_depth,adj_depth;
unsigned int vert_depth_vec[4];
while(tid<q_sz)
{
ex_ver_curr = ex_q_d[tid];
card_curr = adj_card_d[ex_ver_curr];
beg_pos_curr= beg_pos_d[ex_ver_curr];
index_t lane= beg_pos_curr;
card_curr+= beg_pos_curr;
vert_depth=depth_comp_last[ex_ver_curr];
vert_depth_vec[0]=vert_depth.x;
vert_depth_vec[1]=vert_depth.y;
vert_depth_vec[2]=vert_depth.z;
vert_depth_vec[3]=vert_depth.w;
while(lane<card_curr)
{
adj_vert=adj_list_d[lane];
adj_depth=depth_comp_curr[adj_vert];
if((~(adj_depth.x))&vert_depth_vec[0])
atomicOr(&(depth_comp_curr[adj_vert].x),vert_depth_vec[0]);
if((~(adj_depth.y))&vert_depth_vec[1])
atomicOr(&(depth_comp_curr[adj_vert].y),vert_depth_vec[1]);
if((~(adj_depth.z))&vert_depth_vec[2])
atomicOr(&(depth_comp_curr[adj_vert].z),vert_depth_vec[2]);
if((~(adj_depth.w))&vert_depth_vec[3])
atomicOr(&(depth_comp_curr[adj_vert].w),vert_depth_vec[3]);
lane++;
}
tid += GRNLTY;
}
}
//+-----------------------
//|ex_mid_q expansion
//+------------------------------
template<typename vertex_t,
typename index_t,
typename depth_t,
typename comp_t>
__global__ void td_expand_warp
(
comp_t *depth_comp_last,
comp_t *depth_comp_curr,
index_t num_agg_bfs,
vertex_t *parent_d,
depth_t curr_level,
index_t ex_mid_sz,
const vertex_t* __restrict__ ex_q_d,
const index_t* __restrict__ adj_card_d,
const index_t* __restrict__ beg_pos_d,
const vertex_t* __restrict__ adj_list_d
)
{
const index_t q_sz = ex_mid_sz;
const index_t vec_sz = 32;
const index_t TID = threadIdx.x+blockIdx.x*blockDim.x;
const index_t lane_s = TID & (vec_sz-1);
const index_t GRNLTY = (blockDim.x*gridDim.x)/vec_sz;
index_t vec_id = TID/vec_sz;
vertex_t ex_ver_curr,adj_vert;
index_t card_curr;
index_t beg_pos_curr;
comp_t vert_depth,adj_depth;
unsigned int vert_depth_vec[4];
while(vec_id<q_sz)
{
ex_ver_curr = ex_q_d[vec_id];
beg_pos_curr= beg_pos_d[ex_ver_curr];
card_curr = adj_card_d[ex_ver_curr];
vert_depth=depth_comp_last[ex_ver_curr];
vert_depth_vec[0]=vert_depth.x;
vert_depth_vec[1]=vert_depth.y;
vert_depth_vec[2]=vert_depth.z;
vert_depth_vec[3]=vert_depth.w;
index_t lane= beg_pos_curr+lane_s;
card_curr+= beg_pos_curr;
while(lane<card_curr)
{
adj_vert=adj_list_d[lane];
adj_depth=depth_comp_curr[adj_vert];
if((~(adj_depth.x))&vert_depth_vec[0])
atomicOr(&(depth_comp_curr[adj_vert].x),vert_depth_vec[0]);
if((~(adj_depth.y))&vert_depth_vec[1])
atomicOr(&(depth_comp_curr[adj_vert].y),vert_depth_vec[1]);
if((~(adj_depth.z))&vert_depth_vec[2])
atomicOr(&(depth_comp_curr[adj_vert].z),vert_depth_vec[2]);
if((~(adj_depth.w))&vert_depth_vec[3])
atomicOr(&(depth_comp_curr[adj_vert].w),vert_depth_vec[3]);
lane+=vec_sz;
}
vec_id += GRNLTY;
}
}
//+-----------------------
//|ex_lrg_q expansion
//+------------------------------
template<typename vertex_t,
typename index_t,
typename depth_t,
typename comp_t>
__global__ void td_expand_cta
(
comp_t *depth_comp_last,
comp_t *depth_comp_curr,
index_t num_agg_bfs,
vertex_t *parent_d,
depth_t curr_level,
index_t ex_lrg_sz,
const vertex_t* __restrict__ ex_q_d,
const index_t* __restrict__ adj_card_d,
const index_t* __restrict__ beg_pos_d,
const vertex_t* __restrict__ adj_list_d
)
{
const index_t q_sz = ex_lrg_sz;
index_t vec_id = blockIdx.x;
vertex_t ex_ver_curr,adj_vert;
index_t card_curr;
index_t beg_pos_curr;
comp_t vert_depth,adj_depth;
unsigned int vert_depth_vec[4];
while(vec_id<q_sz)
{
ex_ver_curr = ex_q_d[vec_id];
beg_pos_curr= beg_pos_d[ex_ver_curr];
card_curr = adj_card_d[ex_ver_curr];
vert_depth=depth_comp_last[ex_ver_curr];
vert_depth_vec[0]=vert_depth.x;
vert_depth_vec[1]=vert_depth.y;
vert_depth_vec[2]=vert_depth.z;
vert_depth_vec[3]=vert_depth.w;
index_t lane= beg_pos_curr+threadIdx.x;
card_curr+= beg_pos_curr;
while(lane<card_curr)
{
adj_vert=adj_list_d[lane];
adj_depth=depth_comp_curr[adj_vert];
if((~(adj_depth.x))&vert_depth_vec[0])
atomicOr(&(depth_comp_curr[adj_vert].x),vert_depth_vec[0]);
if((~(adj_depth.y))&vert_depth_vec[1])
atomicOr(&(depth_comp_curr[adj_vert].y),vert_depth_vec[1]);
if((~(adj_depth.z))&vert_depth_vec[2])
atomicOr(&(depth_comp_curr[adj_vert].z),vert_depth_vec[2]);
if((~(adj_depth.w))&vert_depth_vec[3])
atomicOr(&(depth_comp_curr[adj_vert].w),vert_depth_vec[3]);
lane+=blockDim.x;
}
vec_id += gridDim.x;
}
}
//+------------------------
//|ex_mid_q expansion
//+------------------------------
template<typename vertex_t,
typename index_t,
typename depth_t,
typename comp_t>
__global__ void sw_expand_warp
(
comp_t *depth_comp_last,
comp_t *depth_comp_curr,
index_t num_agg_bfs,
vertex_t *parent_d,
depth_t curr_level,
index_t ex_sz,
const vertex_t* __restrict__ ex_q_d,
const index_t* __restrict__ adj_card_d,
const index_t* __restrict__ beg_pos_d,
const vertex_t* __restrict__ adj_list_d
)
{
const index_t q_sz = ex_sz;
const index_t vec_sz = 32;
const index_t TID = threadIdx.x+blockIdx.x*blockDim.x;
const index_t lane_s = TID & (vec_sz-1);
const index_t GRNLTY = (blockDim.x*gridDim.x)/vec_sz;
index_t vec_id = TID/vec_sz;
vertex_t ex_ver_curr;
index_t card_curr, card_curr_revised;
index_t beg_pos_curr;
unsigned int vert_depth_vec[4];
comp_t vert_depth;
while(vec_id<q_sz)
{
ex_ver_curr = ex_q_d[vec_id];
beg_pos_curr= beg_pos_d[ex_ver_curr];
card_curr = adj_card_d[ex_ver_curr];
vert_depth=depth_comp_curr[ex_ver_curr];
vert_depth_vec[0]=vert_depth.x;
vert_depth_vec[1]=vert_depth.y;
vert_depth_vec[2]=vert_depth.z;
vert_depth_vec[3]=vert_depth.w;
index_t lane= beg_pos_curr+lane_s;
//make sure all 32 threads can get into the voting loop
if(card_curr%vec_sz)
card_curr_revised = (((card_curr>>5)+1)<<5);
else
card_curr_revised = card_curr;
card_curr+= beg_pos_curr;
card_curr_revised+=beg_pos_curr;
while(lane<card_curr_revised)
{
/*if( vert_depth_vec[0]==0xffffffff &&
vert_depth_vec[1]==0xffffffff &&
vert_depth_vec[2]==0xffffffff &&
vert_depth_vec[3]==0xffffffff
) break;*/
if(lane<card_curr){
vert_depth=depth_comp_last[adj_list_d[lane]];
vert_depth_vec[0]|=vert_depth.x;
vert_depth_vec[1]|=vert_depth.y;
vert_depth_vec[2]|=vert_depth.z;
vert_depth_vec[3]|=vert_depth.w;
}
for(int i=16;i>=1;i>>=1){
vert_depth_vec[0]|=__shfl_xor((int)vert_depth_vec[0],i,32);
vert_depth_vec[1]|=__shfl_xor((int)vert_depth_vec[1],i,32);
vert_depth_vec[2]|=__shfl_xor((int)vert_depth_vec[2],i,32);
vert_depth_vec[3]|=__shfl_xor((int)vert_depth_vec[3],i,32);
}
lane+=vec_sz;
}
if(lane_s==0){
depth_comp_curr[ex_ver_curr].x=vert_depth_vec[0];
depth_comp_curr[ex_ver_curr].y=vert_depth_vec[1];
depth_comp_curr[ex_ver_curr].z=vert_depth_vec[2];
depth_comp_curr[ex_ver_curr].w=vert_depth_vec[3];
}
vec_id += GRNLTY;
}
}
//+------------------------
//|ex_mid_q expansion
//+------------------------------
template<typename vertex_t,
typename index_t,
typename depth_t,
typename comp_t>
__global__ void sw_expand_thd
(
comp_t *depth_comp_last,
comp_t *depth_comp_curr,
index_t num_agg_bfs,
vertex_t *parent_d,
depth_t curr_level,
index_t ex_sz,
const vertex_t* __restrict__ ex_q_d,
const index_t* __restrict__ adj_card_d,
const index_t* __restrict__ beg_pos_d,
const vertex_t* __restrict__ adj_list_d
)
{
const index_t q_sz = ex_sz;
index_t tid = threadIdx.x+blockIdx.x*blockDim.x;
const index_t GRNLTY = blockDim.x*gridDim.x;
vertex_t ex_ver_curr;
index_t card_curr;
index_t beg_pos_curr;
comp_t vert_depth;
unsigned int vert_depth_vec[4];
while(tid<q_sz)
{
ex_ver_curr = ex_q_d[tid];
card_curr = adj_card_d[ex_ver_curr];
beg_pos_curr= beg_pos_d[ex_ver_curr];
index_t lane= beg_pos_curr;
card_curr+= beg_pos_curr;
vert_depth=depth_comp_curr[ex_ver_curr];
vert_depth_vec[0]=vert_depth.x;
vert_depth_vec[1]=vert_depth.y;
vert_depth_vec[2]=vert_depth.z;
vert_depth_vec[3]=vert_depth.w;
while(lane<card_curr)
{
/*if( vert_depth_vec[0]==0xffffffff &&
vert_depth_vec[1]==0xffffffff &&
vert_depth_vec[2]==0xffffffff &&
vert_depth_vec[3]==0xffffffff
) break;*/
vert_depth=depth_comp_last[adj_list_d[lane]];
vert_depth_vec[0]|=vert_depth.x;
vert_depth_vec[1]|=vert_depth.y;
vert_depth_vec[2]|=vert_depth.z;
vert_depth_vec[3]|=vert_depth.w;
lane++;
}
depth_comp_curr[ex_ver_curr].x=vert_depth_vec[0];
depth_comp_curr[ex_ver_curr].y=vert_depth_vec[1];
depth_comp_curr[ex_ver_curr].z=vert_depth_vec[2];
depth_comp_curr[ex_ver_curr].w=vert_depth_vec[3];
tid += GRNLTY;
}
}
//+-----------------
//|CLFY_EXPAND_SORT
//+----------------------
template<typename vertex_t,
typename index_t,
typename depth_t>
void td_expand
(
tdata *gdata,
csr_graph ggraph,
index_t num_agg_bfs,
depth_t curr_level
)
{
td_expand_thd<vertex_t,index_t,depth_t,comp_t>
<<<BLKS_NUM, THDS_NUM, 0, gdata[0]->stream[0]>>>
(
ggraph->depth_comp_last,
ggraph->depth_comp_curr,
num_agg_bfs,
gdata[0]->parent_d,
curr_level,
gdata[0]->ex_sml_sz[0],
ggraph->ex_sml_q,
ggraph->adj_card_d,
ggraph->beg_pos_d,
ggraph->adj_list_d
);
td_expand_warp<vertex_t,index_t,depth_t,comp_t>
<<<BLKS_NUM, THDS_NUM, 0, gdata[0]->stream[1]>>>
(
ggraph->depth_comp_last,
ggraph->depth_comp_curr,
num_agg_bfs,
gdata[0]->parent_d,
curr_level,
gdata[0]->ex_mid_sz[0],
ggraph->ex_mid_q,
ggraph->adj_card_d,
ggraph->beg_pos_d,
ggraph->adj_list_d
);
td_expand_cta<vertex_t,index_t,depth_t,comp_t>
<<<BLKS_NUM, THDS_NUM, 0, gdata[0]->stream[2]>>>
(
ggraph->depth_comp_last,
ggraph->depth_comp_curr,
num_agg_bfs,
gdata[0]->parent_d,
curr_level,
gdata[0]->ex_lrg_sz[0],
ggraph->ex_lrg_q,
ggraph->adj_card_d,
ggraph->beg_pos_d,
ggraph->adj_list_d
);
for(index_t i=0;i<Q_CARD; i++)
cudaStreamSynchronize(gdata[0]->stream[i]);
}
//+----------------------
//|CLFY_EXPAND_SORT
//+----------------------
template<typename vertex_t,
typename index_t,
typename depth_t>
void bu_expand
(
tdata *gdata,
csr_graph ggraph,
index_t num_agg_bfs,
depth_t curr_level
)
{
sw_expand_thd<vertex_t,index_t,depth_t,comp_t>
<<<BLKS_NUM, THDS_NUM, 0, gdata[0]->stream[0]>>>
(
ggraph->depth_comp_last,
ggraph->depth_comp_curr,
num_agg_bfs,
gdata[0]->parent_d,
curr_level,
gdata[0]->ex_sml_sz[0],
ggraph->ex_sml_q,
ggraph->adj_card_d,
ggraph->beg_pos_d,
ggraph->adj_list_d
);
sw_expand_thd<vertex_t,index_t,depth_t,comp_t>
<<<BLKS_NUM, THDS_NUM, 0, gdata[0]->stream[1]>>>
(
ggraph->depth_comp_last,
ggraph->depth_comp_curr,
num_agg_bfs,
gdata[0]->parent_d,
curr_level,
gdata[0]->ex_mid_sz[0],
ggraph->ex_mid_q,
ggraph->adj_card_d,
ggraph->beg_pos_d,
ggraph->adj_list_d
);
sw_expand_thd<vertex_t,index_t,depth_t,comp_t>
<<<BLKS_NUM, THDS_NUM, 0, gdata[0]->stream[2]>>>
(
ggraph->depth_comp_last,
ggraph->depth_comp_curr,
num_agg_bfs,
gdata[0]->parent_d,
curr_level,
gdata[0]->ex_lrg_sz[0],
ggraph->ex_lrg_q,
ggraph->adj_card_d,
ggraph->beg_pos_d,
ggraph->adj_list_d
);
for(index_t i=0;i<Q_CARD; i++)
cudaStreamSynchronize(gdata[0]->stream[i]);
}
//+----------------------
//|CLFY_EXPAND_SORT
//+----------------------
template<typename vertex_t,
typename index_t,
typename depth_t,
typename comp_t>
void sw_expand
(
tdata *gdata,
csr_graph ggraph,
index_t num_agg_bfs,
depth_t curr_level
)
{
sw_expand_thd<vertex_t,index_t,depth_t,comp_t>
<<<BLKS_NUM, THDS_NUM, 0, gdata[0]->stream[0]>>>
(
ggraph->depth_comp_last,
ggraph->depth_comp_curr,
num_agg_bfs,
gdata[0]->parent_d,
curr_level,
gdata[0]->ex_sml_sz[0],
ggraph->ex_sml_q,
ggraph->adj_card_d,
ggraph->beg_pos_d,
ggraph->adj_list_d
);
sw_expand_warp<vertex_t,index_t,depth_t,comp_t>
<<<BLKS_NUM, THDS_NUM, 0, gdata[0]->stream[1]>>>
(
ggraph->depth_comp_last,
ggraph->depth_comp_curr,
num_agg_bfs,
gdata[0]->parent_d,
curr_level,
gdata[0]->ex_mid_sz[0],
ggraph->ex_mid_q,
ggraph->adj_card_d,
ggraph->beg_pos_d,
ggraph->adj_list_d
);
sw_expand_warp<vertex_t,index_t,depth_t,comp_t>
<<<BLKS_NUM, THDS_NUM, 0, gdata[0]->stream[2]>>>
(
ggraph->depth_comp_last,
ggraph->depth_comp_curr,
num_agg_bfs,
gdata[0]->parent_d,
curr_level,
gdata[0]->ex_lrg_sz[0],
ggraph->ex_lrg_q,
ggraph->adj_card_d,
ggraph->beg_pos_d,
ggraph->adj_list_d
);
for(index_t i=0;i<Q_CARD; i++)
cudaStreamSynchronize(gdata[0]->stream[i]);
}
template<typename vertex_t,
typename index_t,
typename depth_t,
typename comp_t>
void expander(
tdata *gdata,
csr_graph ggraph,
index_t num_agg_bfs,
index_t sw_level,
depth_t level
)
{
if(level<=sw_level)
td_expand
<vertex_t, index_t, depth_t>
(
gdata,
ggraph,
num_agg_bfs,
level
);
else if((level==sw_level+1||level==sw_level+2||level==sw_level+3))
sw_expand
<vertex_t, index_t, depth_t,comp_t>
(
gdata,
ggraph,
num_agg_bfs,
level
);
else{//also use merged fq
bu_expand//but do not consider imbalance issue
<vertex_t, index_t, depth_t>
(
gdata,
ggraph,
num_agg_bfs,
level
);
}
}