Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gpma_bfs
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Recolic
gpma_bfs
Commits
52152bf9
There was an error fetching the commit references. Please try again later.
Commit
52152bf9
authored
5 years ago
by
Recolic Keghart
Browse files
Options
Downloads
Patches
Plain Diff
add some comments. However, you MUST rely on paper document for bfs alg
parent
dbaf4c81
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gpma_bfs.cuh
+10
-6
10 additions, 6 deletions
gpma_bfs.cuh
with
10 additions
and
6 deletions
gpma_bfs.cuh
+
10
−
6
View file @
52152bf9
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#define FULL_MASK 0xffffffff
#define FULL_MASK 0xffffffff
// For every node in NodeQ, push its neighbor node to EdgeQ.
template
<
SIZE_TYPE
THREADS_NUM
>
template
<
SIZE_TYPE
THREADS_NUM
>
__global__
void
gpma_bfs_gather_kernel
(
SIZE_TYPE
*
node_queue
,
SIZE_TYPE
*
node_queue_offset
,
SIZE_TYPE
*
edge_queue
,
SIZE_TYPE
*
edge_queue_offset
,
KEY_TYPE
*
keys
,
VALUE_TYPE
*
values
,
SIZE_TYPE
*
row_offsets
)
{
__global__
void
gpma_bfs_gather_kernel
(
SIZE_TYPE
*
node_queue
,
SIZE_TYPE
*
node_queue_offset
,
SIZE_TYPE
*
edge_queue
,
SIZE_TYPE
*
edge_queue_offset
,
KEY_TYPE
*
keys
,
VALUE_TYPE
*
values
,
SIZE_TYPE
*
row_offsets
)
{
...
@@ -56,22 +57,25 @@ __global__ void gpma_bfs_gather_kernel(SIZE_TYPE *node_queue, SIZE_TYPE *node_qu
...
@@ -56,22 +57,25 @@ __global__ void gpma_bfs_gather_kernel(SIZE_TYPE *node_queue, SIZE_TYPE *node_qu
SIZE_TYPE
block_aggregate
;
SIZE_TYPE
block_aggregate
;
while
(
__syncthreads_or
(
gather
<
gather_end
))
{
while
(
__syncthreads_or
(
gather
<
gather_end
))
{
if
(
gather
<
gather_end
)
{
if
(
gather
<
gather_end
)
{
// RDEBUG: ACTUAL LOGIC BEGIN
KEY_TYPE
cur_key
=
keys
[
gather
];
KEY_TYPE
cur_key
=
keys
[
gather
];
VALUE_TYPE
cur_value
=
values
[
gather
];
VALUE_TYPE
cur_value
=
values
[
gather
];
neighbour
=
(
SIZE_TYPE
)(
cur_key
&
COL_IDX_NONE
);
neighbour
=
(
SIZE_TYPE
)(
cur_key
&
COL_IDX_NONE
);
// get low 32b, which is Edge.TO.
thread_data_in
=
(
neighbour
==
COL_IDX_NONE
||
cur_value
==
VALUE_NONE
)
?
0
:
1
;
thread_data_in
=
(
neighbour
==
COL_IDX_NONE
||
cur_value
==
VALUE_NONE
)
?
0
:
1
;
// DO NOTHING if NULL.
}
else
}
else
thread_data_in
=
0
;
thread_data_in
=
0
;
// NOTHING TO DO.
__syncthreads
();
__syncthreads
();
BlockScan
(
block_temp_storage
).
ExclusiveSum
(
thread_data_in
,
thread_data_out
,
block_aggregate
);
BlockScan
(
block_temp_storage
).
ExclusiveSum
(
thread_data_in
,
thread_data_out
,
block_aggregate
);
// block_aggregate stores the final sum of all threads: how many valid task in this turn?
__syncthreads
();
__syncthreads
();
if
(
0
==
thread_id
)
{
if
(
0
==
thread_id
)
{
output_cta_offset
=
atomicAdd
(
edge_queue_offset
,
block_aggregate
);
output_cta_offset
=
atomicAdd
(
edge_queue_offset
,
block_aggregate
);
}
}
__syncthreads
();
__syncthreads
();
if
(
thread_data_in
)
if
(
thread_data_in
)
edge_queue
[
output_cta_offset
+
thread_data_out
]
=
neighbour
;
edge_queue
[
output_cta_offset
+
thread_data_out
]
=
neighbour
;
// THE ONLY USEFUL STATEMENT!
// RDEBUG: ACTUAL LOGIC END
gather
+=
THREADS_NUM
;
gather
+=
THREADS_NUM
;
}
}
}
}
...
@@ -122,7 +126,7 @@ __global__ void gpma_bfs_gather_kernel(SIZE_TYPE *node_queue, SIZE_TYPE *node_qu
...
@@ -122,7 +126,7 @@ __global__ void gpma_bfs_gather_kernel(SIZE_TYPE *node_queue, SIZE_TYPE *node_qu
SIZE_TYPE
total
;
SIZE_TYPE
total
;
SIZE_TYPE
remain
;
SIZE_TYPE
remain
;
__syncthreads
();
__syncthreads
();
BlockScan
(
block_temp_storage
).
ExclusiveSum
(
thread_data
,
rsv_rank
,
total
);
BlockScan
(
block_temp_storage
).
ExclusiveSum
(
thread_data
,
rsv_rank
,
total
);
// total = how many tasks left in this block?
__syncthreads
();
__syncthreads
();
SIZE_TYPE
cta_progress
=
0
;
SIZE_TYPE
cta_progress
=
0
;
...
@@ -202,7 +206,7 @@ __global__ void gpma_bfs_contract_kernel(SIZE_TYPE *edge_queue, SIZE_TYPE *edge_
...
@@ -202,7 +206,7 @@ __global__ void gpma_bfs_contract_kernel(SIZE_TYPE *edge_queue, SIZE_TYPE *edge_
neighbour
=
edge_queue
[
cta_offset
+
thread_id
];
neighbour
=
edge_queue
[
cta_offset
+
thread_id
];
// warp cull
// warp cull
SIZE_TYPE
hash
=
neighbour
&
127
;
SIZE_TYPE
hash
=
neighbour
&
127
;
// 0x7f
warp_cache
[
warp_id
][
hash
]
=
neighbour
;
warp_cache
[
warp_id
][
hash
]
=
neighbour
;
SIZE_TYPE
retrieved
=
warp_cache
[
warp_id
][
hash
];
SIZE_TYPE
retrieved
=
warp_cache
[
warp_id
][
hash
];
if
(
retrieved
==
neighbour
)
{
if
(
retrieved
==
neighbour
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment