-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkernelsBFS.cl
31 lines (28 loc) · 1018 Bytes
/
kernelsBFS.cl
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
__kernel void kernelBFS(global const int* g_graph_nodes_noe, global const int* g_graph_nodes_start,global const int* g_graph_edges,global int* g_graph_mask,global int* g_updating_graph_mask,global int* g_graph_visited,global int* g_cost,global int* no_of_nodes,global int* MAX_WIPG)
{
int tid = get_global_id(0);
if( tid < no_of_nodes[0] && g_graph_mask[tid]!=0)
{
g_graph_mask[tid]=0;
for(int i=g_graph_nodes_start[tid]; i<(g_graph_nodes_noe[tid] + g_graph_nodes_start[tid]); i++)
{
int id = g_graph_edges[i];
if(g_graph_visited[id]==0)
{
g_cost[id]=g_cost[tid]+1;
g_updating_graph_mask[id]=1;
}
}
}
}
__kernel void kernelBFS2( global int* g_graph_mask, global int *g_updating_graph_mask, global int* g_graph_visited, global int *g_over, global int* no_of_nodes, global int* MAX_WIPG)
{
int tid = get_global_id(0);
if( tid<no_of_nodes[0] && g_updating_graph_mask[tid]!=0)
{
g_graph_mask[tid]=1;
g_graph_visited[tid]=1;
g_over[0]=1;
g_updating_graph_mask[tid]=0;
}
}