Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update graph partitioning scheme #1443

Merged
merged 80 commits into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
026387e
switch the graph partitioning scheme in graph(_view)_t
seunghwak Feb 23, 2021
41a238b
switch the graph partitioning schme in patter accelerator headers and…
seunghwak Feb 24, 2021
187a5f9
function renaming
seunghwak Feb 26, 2021
cfe54ce
add additional utility functions to graph_view_t
seunghwak Feb 26, 2021
efc58c6
cosmetic updates
seunghwak Feb 26, 2021
2e5e45c
switch the graph partitioning scheme in graph functions
seunghwak Feb 26, 2021
dbc83eb
Merge branch 'branch-0.19' of github.com:rapidsai/cugraph into enh_pa…
seunghwak Feb 26, 2021
8c30949
compile error fixes
seunghwak Mar 1, 2021
110a287
Merge branch 'branch-0.19' of github.com:rapidsai/cugraph into enh_pa…
seunghwak Mar 3, 2021
1062b73
Merge branch 'branch-0.19' of github.com:rapidsai/cugraph into enh_pa…
seunghwak Mar 4, 2021
b11fe16
Merge branch 'branch-0.19' of github.com:rapidsai/cugraph into enh_pa…
seunghwak Mar 5, 2021
764900a
Merge branch 'branch-0.19' of github.com:rapidsai/cugraph into enh_pa…
seunghwak Mar 5, 2021
3ddff4c
fix compile errors
seunghwak Mar 6, 2021
a71b045
refactor groupby and count based on key_to_id_op
seunghwak Mar 8, 2021
d5d9a17
fix compile error due to recent API changes
seunghwak Mar 8, 2021
42fafb4
Merge branch 'branch-0.19' of github.com:rapidsai/cugraph into enh_pa…
seunghwak Mar 11, 2021
e0efcd5
fix variable naming inconsistencies
seunghwak Mar 11, 2021
0656ef7
resolve merge conflicts
seunghwak Mar 15, 2021
5098224
minor cosmetic updates
seunghwak Mar 15, 2021
7b36f8a
update python binding (C++ part) to accomodate new partitioning scheme
seunghwak Mar 16, 2021
e5c17f3
bug fixes
seunghwak Mar 17, 2021
8d4f967
bug fixes
seunghwak Mar 17, 2021
1367b7a
Merge branch 'branch-0.19' of github.com:rapidsai/cugraph into enh_pa…
seunghwak Mar 17, 2021
9c6f1b2
Merge branch 'branch-0.19' of github.com:rapidsai/cugraph into enh_pa…
seunghwak Mar 17, 2021
d23c877
update BFS, SSSP, Katz, PageRank tests to promote performance testing
seunghwak Mar 17, 2021
e3add17
bug fix
seunghwak Mar 17, 2021
550ef1e
add test renumber utilities
seunghwak Mar 18, 2021
14026e0
update SG C++ BFS/SSSP/PageRank/Katz
seunghwak Mar 18, 2021
af41187
CMake update for adding test renumber utilities
seunghwak Mar 18, 2021
0eb0b88
update MG C++ PageRank tests to promote performance testing
seunghwak Mar 19, 2021
97356b0
Merge branch 'branch-0.19' of github.com:rapidsai/cugraph into enh_pa…
seunghwak Mar 19, 2021
aa5ed5d
cut memory footprint in renumber_edgelist
seunghwak Mar 19, 2021
8e365fe
update SG/MG C++ testing infrastructures
seunghwak Mar 20, 2021
f329e65
add overflow check
seunghwak Mar 20, 2021
70000e1
reduce R-mat graph size to avoid malloc failure when running tests in…
seunghwak Mar 21, 2021
bc2eda6
cosmetic updates
seunghwak Mar 21, 2021
52d96bf
add compute_max_(in_out)_(degree|weight_sum)
seunghwak Mar 21, 2021
eafecd9
move is_valid_vertex from tests/utilities/test_utilities.hpp to inclu…
seunghwak Mar 23, 2021
d5dbc28
add renumber/unrenumber vertex utility functions
seunghwak Mar 23, 2021
78105ba
mark is_valid_vertex as __host__ __device__ function
seunghwak Mar 23, 2021
a1e7638
refactor test utilities related to (un)renumber and update renumber u…
seunghwak Mar 23, 2021
0a2fbe6
several cosmetic and cleanup updates
seunghwak Mar 24, 2021
0ab187c
temporary workaround for a cuco bug
seunghwak Mar 24, 2021
f88de2b
minor tweaks
seunghwak Mar 25, 2021
ddb735c
update update_frontier_v_push_if_out_nbr to use dataframe_buffer.cuh
seunghwak Mar 25, 2021
f7b7471
update buffer use in update_frontier_v_push_if_out_nbr
seunghwak Mar 26, 2021
e536b13
workaround for cuco static_map bugs
seunghwak Mar 26, 2021
177e9d8
add MG Katz, BFS, and SSSP tests
seunghwak Mar 26, 2021
c646e6b
Merge branch 'branch-0.19' of github.com:rapidsai/cugraph into enh_pa…
seunghwak Mar 26, 2021
3df52a2
bug fix
seunghwak Mar 26, 2021
4e3f49d
resolve merge conflicts
seunghwak Mar 30, 2021
456a564
move generate_graph_from_edgelist test utility function out from the …
seunghwak Mar 30, 2021
f8cb8b5
fix compile error
seunghwak Mar 30, 2021
5b4a021
Merge branch 'branch-0.19' of github.com:rapidsai/cugraph into enh_pa…
seunghwak Mar 30, 2021
dc2c0a1
bug fix
seunghwak Mar 30, 2021
b0f7f20
cosmetic update
seunghwak Mar 30, 2021
5903dec
bug fix
seunghwak Mar 31, 2021
1a8994d
remove default value for the stream input parameter in add_level
seunghwak Apr 1, 2021
ab1fb12
explicitly take is_weighted in graph construction than using p_weight…
seunghwak Apr 1, 2021
eaa6dfe
minor fixes
seunghwak Apr 1, 2021
fc7cf27
bug fixes for Louvain related graph primitives
seunghwak Apr 1, 2021
f825d2c
explicitly take is_weighted on graph constrution
seunghwak Apr 1, 2021
1c819a3
louvain bug fixes
seunghwak Apr 1, 2021
b4d0793
throw an exception if unweighted graph is passed to SSSP
seunghwak Apr 1, 2021
be8fbbb
update populate_graph_container to take explicit is_weighted parameter
seunghwak Apr 1, 2021
541467d
update populate_graph_container to take extra is_weighted input param…
seunghwak Apr 1, 2021
6c247f5
update python binding for the C++ updates
seunghwak Apr 1, 2021
35e31a1
Merge branch 'branch-0.19' of github.com:rapidsai/cugraph into enh_pa…
seunghwak Apr 1, 2021
6d65486
clang-format
seunghwak Apr 1, 2021
a7b6c8e
python binding bug fix
seunghwak Apr 2, 2021
496ff03
rename num_partition_edges to num_local_edges as with the new partiti…
seunghwak Apr 2, 2021
156aa3d
python binding bug fix in handling weights
seunghwak Apr 2, 2021
7a4153e
Merge branch 'branch-0.19' of github.com:rapidsai/cugraph into enh_pa…
seunghwak Apr 2, 2021
4d77b84
bug fix
seunghwak Apr 2, 2021
fdb309a
bug fix for a corner case in expensive check for renumber_edgelist
seunghwak Apr 4, 2021
d40320c
workaround for cuco static_map kernel launch with 0 grid size
seunghwak Apr 4, 2021
ac15619
Merge branch 'branch-0.19' of github.com:rapidsai/cugraph into enh_pa…
seunghwak Apr 4, 2021
6f2a8d6
remove unnecessary code
seunghwak Apr 5, 2021
462331e
remove unnecessary synchronization
seunghwak Apr 5, 2021
3f311af
Merge branch 'branch-0.19' of github.com:rapidsai/cugraph into enh_pa…
seunghwak Apr 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ add_library(cugraph SHARED
src/experimental/graph_view.cu
src/experimental/coarsen_graph.cu
src/experimental/renumber_edgelist.cu
src/experimental/renumber_utils.cu
src/experimental/relabel.cu
src/experimental/induced_subgraph.cu
src/experimental/bfs.cu
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/dendrogram.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Dendrogram {
public:
void add_level(vertex_t first_index,
vertex_t num_verts,
cudaStream_t stream = 0,
cudaStream_t stream,
rmm::mr::device_memory_resource *mr = rmm::mr::get_current_device_resource())
{
level_ptr_.push_back(std::make_unique<rmm::device_uvector<vertex_t>>(num_verts, stream, mr));
Expand Down
80 changes: 28 additions & 52 deletions cpp/include/experimental/detail/graph_utils.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -56,65 +56,32 @@ rmm::device_uvector<edge_t> compute_major_degrees(
rmm::device_uvector<edge_t> degrees(0, handle.get_stream());

vertex_t max_num_local_degrees{0};
for (int i = 0; i < (partition.is_hypergraph_partitioned() ? col_comm_size : row_comm_size);
++i) {
auto vertex_partition_idx = partition.is_hypergraph_partitioned()
? static_cast<size_t>(i * row_comm_size + row_comm_rank)
: static_cast<size_t>(col_comm_rank * row_comm_size + i);
for (int i = 0; i < col_comm_size; ++i) {
auto vertex_partition_idx = static_cast<size_t>(i * row_comm_size + row_comm_rank);
auto vertex_partition_size = partition.get_vertex_partition_size(vertex_partition_idx);
max_num_local_degrees = std::max(max_num_local_degrees, vertex_partition_size);
if (i == (partition.is_hypergraph_partitioned() ? col_comm_rank : row_comm_rank)) {
degrees.resize(vertex_partition_size, handle.get_stream());
}
if (i == col_comm_rank) { degrees.resize(vertex_partition_size, handle.get_stream()); }
}
local_degrees.resize(max_num_local_degrees, handle.get_stream());
for (int i = 0; i < (partition.is_hypergraph_partitioned() ? col_comm_size : row_comm_size);
++i) {
auto vertex_partition_idx = partition.is_hypergraph_partitioned()
? static_cast<size_t>(i * row_comm_size + row_comm_rank)
: static_cast<size_t>(col_comm_rank * row_comm_size + i);
for (int i = 0; i < col_comm_size; ++i) {
auto vertex_partition_idx = static_cast<size_t>(i * row_comm_size + row_comm_rank);
vertex_t major_first{};
vertex_t major_last{};
std::tie(major_first, major_last) = partition.get_vertex_partition_range(vertex_partition_idx);
auto p_offsets =
partition.is_hypergraph_partitioned()
? adj_matrix_partition_offsets[i]
: adj_matrix_partition_offsets[0] +
(major_first - partition.get_vertex_partition_first(col_comm_rank * row_comm_size));
auto p_offsets = adj_matrix_partition_offsets[i];
thrust::transform(rmm::exec_policy(handle.get_stream())->on(handle.get_stream()),
thrust::make_counting_iterator(vertex_t{0}),
thrust::make_counting_iterator(major_last - major_first),
local_degrees.data(),
[p_offsets] __device__(auto i) { return p_offsets[i + 1] - p_offsets[i]; });
if (partition.is_hypergraph_partitioned()) {
col_comm.reduce(local_degrees.data(),
i == col_comm_rank ? degrees.data() : static_cast<edge_t *>(nullptr),
static_cast<size_t>(major_last - major_first),
raft::comms::op_t::SUM,
i,
handle.get_stream());
} else {
row_comm.reduce(local_degrees.data(),
i == row_comm_rank ? degrees.data() : static_cast<edge_t *>(nullptr),
static_cast<size_t>(major_last - major_first),
raft::comms::op_t::SUM,
i,
handle.get_stream());
}
col_comm.reduce(local_degrees.data(),
i == col_comm_rank ? degrees.data() : static_cast<edge_t *>(nullptr),
static_cast<size_t>(major_last - major_first),
raft::comms::op_t::SUM,
i,
handle.get_stream());
}

raft::comms::status_t status{};
if (partition.is_hypergraph_partitioned()) {
status =
col_comm.sync_stream(handle.get_stream()); // this is neessary as local_degrees will become
// out-of-scope once this function returns.
} else {
status =
row_comm.sync_stream(handle.get_stream()); // this is neessary as local_degrees will become
// out-of-scope once this function returns.
}
CUGRAPH_EXPECTS(status == raft::comms::status_t::SUCCESS, "sync_stream() failure.");

return degrees;
}

Expand Down Expand Up @@ -170,7 +137,6 @@ struct compute_gpu_id_from_vertex_t {

template <typename vertex_t>
struct compute_gpu_id_from_edge_t {
bool hypergraph_partitioned{false};
int comm_size{0};
int row_comm_size{0};
int col_comm_size{0};
Expand All @@ -180,12 +146,22 @@ struct compute_gpu_id_from_edge_t {
cuco::detail::MurmurHash3_32<vertex_t> hash_func{};
auto major_comm_rank = static_cast<int>(hash_func(major) % comm_size);
auto minor_comm_rank = static_cast<int>(hash_func(minor) % comm_size);
if (hypergraph_partitioned) {
return (minor_comm_rank / col_comm_size) * row_comm_size + (major_comm_rank % row_comm_size);
} else {
return (major_comm_rank - (major_comm_rank % row_comm_size)) +
(minor_comm_rank / col_comm_size);
}
return (minor_comm_rank / row_comm_size) * row_comm_size + (major_comm_rank % row_comm_size);
}
};

template <typename vertex_t>
struct compute_partition_id_from_edge_t {
int comm_size{0};
int row_comm_size{0};
int col_comm_size{0};

__device__ int operator()(vertex_t major, vertex_t minor) const
{
cuco::detail::MurmurHash3_32<vertex_t> hash_func{};
auto major_comm_rank = static_cast<int>(hash_func(major) % comm_size);
auto minor_comm_rank = static_cast<int>(hash_func(minor) % comm_size);
return major_comm_rank * col_comm_size + minor_comm_rank / row_comm_size;
}
};

Expand Down
14 changes: 14 additions & 0 deletions cpp/include/experimental/graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,20 @@ template <typename edge_t>
struct invalid_edge_id : invalid_idx<edge_t> {
};

template <typename vertex_t>
__host__ __device__ std::enable_if_t<std::is_signed<vertex_t>::value, bool> is_valid_vertex(
vertex_t num_vertices, vertex_t v)
{
return (v >= 0) && (v < num_vertices);
}

template <typename vertex_t>
__host__ __device__ std::enable_if_t<std::is_unsigned<vertex_t>::value, bool> is_valid_vertex(
vertex_t num_vertices, vertex_t v)
{
return v < num_vertices;
}

} // namespace experimental
} // namespace cugraph

Expand Down
Loading