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

[REVIEW] Improve memory scaling for low average vertex degree graphs & many GPUs #1823

Merged
merged 80 commits into from
Sep 22, 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
723688f
delete unused file
seunghwak Aug 19, 2021
a1ecbd2
Merge branch 'branch-21.10' of github.com:rapidsai/cugraph into fea_k…
seunghwak Aug 23, 2021
5b02cdb
Merge branch 'branch-21.10' of github.com:rapidsai/cugraph into fea_k…
seunghwak Aug 25, 2021
aaf7bb3
update headers to support row/col input properties wrapper
seunghwak Aug 26, 2021
06ed6c5
update to use the wrapper
seunghwak Aug 26, 2021
8be0108
resolve merge conflicts
seunghwak Aug 26, 2021
efb5e3a
Merge branch 'branch-21.10' of github.com:rapidsai/cugraph into fea_k…
seunghwak Aug 27, 2021
449150d
Merge branch 'branch-21.10' of github.com:rapidsai/cugraph into fea_k…
seunghwak Aug 27, 2021
32495c5
fix MG Louvain test compile errors
seunghwak Aug 31, 2021
9e4514c
clang-format
seunghwak Aug 31, 2021
be996b3
add thrust utility function to convert to/from std::tuple and to emul…
seunghwak Aug 31, 2021
2f65f41
added a wrapper class for row/col properties
seunghwak Aug 31, 2021
94717d9
update prims to use the row/col properties wrapper
seunghwak Aug 31, 2021
a6fec7e
update algorithms to use row/col properties wrapper
seunghwak Aug 31, 2021
770b424
resolve merge conflicts
seunghwak Aug 31, 2021
670d891
clang-format
seunghwak Aug 31, 2021
e2e4b13
replace rmm::exec_policy(hanlde.get_stream()) with handle.get_thrust_…
seunghwak Aug 31, 2021
a35d137
code refinements
seunghwak Sep 1, 2021
83d7313
code clean-up
seunghwak Sep 1, 2021
92972ed
clang-format
seunghwak Sep 1, 2021
f39d266
documentation update
seunghwak Sep 1, 2021
06c3fa9
bug fixes
seunghwak Sep 1, 2021
6fde1c0
additional bug fix
seunghwak Sep 1, 2021
2f88953
Merge branch 'upstream_pr1797' into fea_kv_pair_part1
seunghwak Sep 1, 2021
ab30776
Merge branch 'branch-21.10' of github.com:rapidsai/cugraph into fea_k…
seunghwak Sep 2, 2021
9d25030
MG WCC bug fix
seunghwak Sep 2, 2021
8d4e0db
Merge branch 'upstream_pr1802' into fea_kv_pair_part1
seunghwak Sep 2, 2021
dafa4ed
device lambda to struct functor
seunghwak Sep 2, 2021
e330c91
Merge branch 'branch-21.10' of github.com:rapidsai/cugraph into fea_k…
seunghwak Sep 2, 2021
0734f2a
cleanup multi-source BFS artifacts
seunghwak Sep 2, 2021
e7e3db1
add missing const
seunghwak Sep 2, 2021
559d270
additional fixes
seunghwak Sep 2, 2021
3248c7e
more fixes
seunghwak Sep 2, 2021
e47656c
Merge branch 'upstream_pr1804' into fea_kv_pair_part1
seunghwak Sep 2, 2021
ee07b2b
additional bug fixes
seunghwak Sep 4, 2021
38fefcd
Merge branch 'branch-21.10' of github.com:rapidsai/cugraph into fea_k…
seunghwak Sep 4, 2021
199ae2c
Merge branch 'upstream_pr1801' into enh_mem_scaling
seunghwak Sep 7, 2021
dc2b96b
Merge branch 'branch-21.10' of github.com:rapidsai/cugraph into enh_m…
seunghwak Sep 7, 2021
9880665
Merge branch 'branch-21.10' of github.com:rapidsai/cugraph into enh_m…
seunghwak Sep 8, 2021
44862f7
add optional variables storing local unique edge rows/columns to grap…
seunghwak Sep 8, 2021
a048442
update renumber_edgelist (in MG) to return # local unique edge rows/c…
seunghwak Sep 8, 2021
4cdf7c8
resolve merge conflicts
seunghwak Sep 8, 2021
ed46464
fix an erroneous comment
seunghwak Sep 8, 2021
51f1fec
update the renumber_edgelist caller
seunghwak Sep 8, 2021
8b07a3c
update MG graph_t callers
seunghwak Sep 8, 2021
f11be08
remove std::optional from the input parameter segment_offsets of MG g…
seunghwak Sep 8, 2021
529544c
update local unique edge rows/cols if using (key, value) pairs instea…
seunghwak Sep 9, 2021
a7946a3
resolve merge conflicts
seunghwak Sep 9, 2021
d2549cc
update graph_view to take optional local edge rows/cols
seunghwak Sep 9, 2021
6215eb3
refactor input parameters/return values of renumber_edgelist & graph_…
seunghwak Sep 10, 2021
acb4f44
Merge branch 'branch-21.10' of github.com:rapidsai/cugraph into enh_r…
seunghwak Sep 10, 2021
93e5839
cosmetics
seunghwak Sep 10, 2021
769d522
resolve merge conflicts
seunghwak Sep 10, 2021
d6a95c5
additional fixes after merge
seunghwak Sep 10, 2021
7d3a5ed
merge major&minor_properties
seunghwak Sep 14, 2021
322490d
update device_bcast to call bcast taking separate input and output it…
seunghwak Sep 14, 2021
1022012
compute unique edge row/col offsets in graph constructor
seunghwak Sep 14, 2021
d737d48
update copy_to_adj_matrix_row/col to handle (key, value) pairs
seunghwak Sep 14, 2021
540b973
update code calling device_bcast
seunghwak Sep 15, 2021
947ef7b
bug fix
seunghwak Sep 15, 2021
fa05277
resolve merge conflicts
seunghwak Sep 15, 2021
c7fdeed
resolve merge conflicst
seunghwak Sep 15, 2021
e2d5e58
bug fix
seunghwak Sep 15, 2021
593a310
update host_scalar_(all)reduce to take reduction op
seunghwak Sep 15, 2021
11a3053
clang-format
seunghwak Sep 15, 2021
3c5bb2d
additional clang-format
seunghwak Sep 15, 2021
a851818
bug fix (max reduction instead of erroneous sum reduction)
seunghwak Sep 15, 2021
cf52803
merge with PR1822
seunghwak Sep 15, 2021
74ee5c4
bug fix
seunghwak Sep 16, 2021
bf5bb5c
update row/col properties classes
seunghwak Sep 16, 2021
d5ee146
temp debug printouts
seunghwak Sep 16, 2021
e9b850a
undo debug printouts
seunghwak Sep 17, 2021
ec02b9d
bug fix
seunghwak Sep 17, 2021
82b6f75
bug fix
seunghwak Sep 17, 2021
2007fe1
fix compiler warning
seunghwak Sep 17, 2021
e264dc2
bug fix
seunghwak Sep 18, 2021
7871549
resolve merge conflicts
seunghwak Sep 19, 2021
28e0741
clnag-format
seunghwak Sep 19, 2021
f7af95b
adjust variable scope to free memory buffer when unnecessary
seunghwak Sep 19, 2021
78cfbda
disable (key, value) pairs
seunghwak Sep 19, 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
26 changes: 26 additions & 0 deletions cpp/include/cugraph/graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ struct graph_meta_t<vertex_t, edge_t, multi_gpu, std::enable_if_t<multi_gpu>> {

// segment offsets based on vertex degree, relevant only if vertex IDs are renumbered
std::optional<std::vector<vertex_t>> segment_offsets{std::nullopt};

vertex_t num_local_unique_edge_rows{};
vertex_t num_local_unique_edge_cols{};
};

// single-GPU version
Expand Down Expand Up @@ -136,6 +139,22 @@ class graph_t<vertex_t, edge_t, weight_t, store_transposed, multi_gpu, std::enab
this->get_graph_properties(),
partition_,
adj_matrix_partition_segment_offsets_,
local_sorted_unique_edge_rows_
? std::optional<vertex_t const*>{(*local_sorted_unique_edge_rows_).data()}
: std::nullopt,
local_sorted_unique_edge_rows_
? std::optional<vertex_t const*>{(*local_sorted_unique_edge_rows_).data() +
(*local_sorted_unique_edge_rows_).size()}
: std::nullopt,
local_sorted_unique_edge_row_offsets_,
local_sorted_unique_edge_cols_
? std::optional<vertex_t const*>{(*local_sorted_unique_edge_cols_).data()}
: std::nullopt,
local_sorted_unique_edge_cols_
? std::optional<vertex_t const*>{(*local_sorted_unique_edge_cols_).data() +
(*local_sorted_unique_edge_cols_).size()}
: std::nullopt,
local_sorted_unique_edge_col_offsets_,
},
false);
}
Expand All @@ -155,6 +174,13 @@ class graph_t<vertex_t, edge_t, weight_t, store_transposed, multi_gpu, std::enab
// segment offsets within the vertex partition based on vertex degree, relevant only if
// segment_offsets.size() > 0
std::optional<std::vector<vertex_t>> adj_matrix_partition_segment_offsets_{std::nullopt};

// if valid, store row/column properties in key/value pairs (this saves memory if # unique edge
// rows/cols << V / row_comm_size|col_comm_size).
std::optional<rmm::device_uvector<vertex_t>> local_sorted_unique_edge_rows_{std::nullopt};
std::optional<rmm::device_uvector<vertex_t>> local_sorted_unique_edge_cols_{std::nullopt};
std::optional<std::vector<vertex_t>> local_sorted_unique_edge_row_offsets_{std::nullopt};
std::optional<std::vector<vertex_t>> local_sorted_unique_edge_col_offsets_{std::nullopt};
};

// single-GPU version
Expand Down
9 changes: 6 additions & 3 deletions cpp/include/cugraph/graph_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ struct renumber_meta_t<vertex_t, edge_t, multi_gpu, std::enable_if_t<multi_gpu>>
edge_t number_of_edges{};
partition_t<vertex_t> partition{};
std::vector<vertex_t> segment_offsets{};

vertex_t num_local_unique_edge_majors{};
vertex_t num_local_unique_edge_minors{};
};

template <typename vertex_t, typename edge_t, bool multi_gpu>
Expand Down Expand Up @@ -88,9 +91,9 @@ struct renumber_meta_t<vertex_t, edge_t, multi_gpu, std::enable_if_t<!multi_gpu>
* Tuple of labels (vertex IDs before renumbering) for the entire set of vertices (assigned to this
* process in multi-GPU) and meta-data collected while renumbering. The meta-data includes total
* number of vertices, total number of edges, partition_t object storing graph partitioning
* information, and vertex partition segment offsets (a vertex partition is partitioned to multiple
* segments based on vertex degrees). This meta-data is expected to be used in graph construction &
* graph primitives.
* information, vertex partition segment offsets (a vertex partition is partitioned to multiple
* segments based on vertex degrees), and the number of local unique edge major & minor vertex IDs.
* This meta-data is expected to be used in graph construction & graph primitives.
*/
template <typename vertex_t, typename edge_t, bool multi_gpu>
std::enable_if_t<
Expand Down
27 changes: 26 additions & 1 deletion cpp/include/cugraph/graph_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ namespace detail {

using namespace cugraph::visitors;

// FIXME: threshold values require tuning (currently disabled)
// use (key, value) pairs to store row/column properties if (unique edge rows/cols) over (V /
// row_comm_size|col_comm_size) is smaller than the threshold value
double constexpr row_col_properties_kv_pair_fill_ratio_threshold = 0.0;

// FIXME: threshold values require tuning
// use the hypersparse format (currently, DCSR or DCSC) for the vertices with their degrees smaller
// than col_comm_size * hypersparse_threshold_ratio, should be less than 1.0
Expand Down Expand Up @@ -300,6 +305,13 @@ struct graph_view_meta_t<vertex_t, edge_t, multi_gpu, std::enable_if_t<multi_gpu

// segment offsets based on vertex degree, relevant only if vertex IDs are renumbered
std::optional<std::vector<vertex_t>> adj_matrix_partition_segment_offsets{};

std::optional<vertex_t const*> local_sorted_unique_edge_row_first{std::nullopt};
std::optional<vertex_t const*> local_sorted_unique_edge_row_last{std::nullopt};
std::optional<std::vector<vertex_t>> local_sorted_unique_edge_row_offsets{std::nullopt};
std::optional<vertex_t const*> local_sorted_unique_edge_col_first{std::nullopt};
std::optional<vertex_t const*> local_sorted_unique_edge_col_last{std::nullopt};
std::optional<std::vector<vertex_t>> local_sorted_unique_edge_col_offsets{std::nullopt};
};

// single-GPU version
Expand Down Expand Up @@ -587,6 +599,11 @@ class graph_view_t<vertex_t,
return local_sorted_unique_edge_row_last_;
}

std::optional<std::vector<vertex_t>> get_local_sorted_unique_edge_row_offsets() const
{
return local_sorted_unique_edge_row_offsets_;
}

std::optional<vertex_t const*> get_local_sorted_unique_edge_col_begin() const
{
return local_sorted_unique_edge_col_first_;
Expand All @@ -597,6 +614,11 @@ class graph_view_t<vertex_t,
return local_sorted_unique_edge_col_last_;
}

std::optional<std::vector<vertex_t>> get_local_sorted_unique_edge_col_offsets() const
{
return local_sorted_unique_edge_col_offsets_;
}

private:
std::vector<edge_t const*> adj_matrix_partition_offsets_{};
std::vector<vertex_t const*> adj_matrix_partition_indices_{};
Expand All @@ -613,11 +635,14 @@ class graph_view_t<vertex_t,
// segment offsets based on vertex degree, relevant only if vertex IDs are renumbered
std::optional<std::vector<vertex_t>> adj_matrix_partition_segment_offsets_{};

// FIXME: to be implemented.
// if valid, store row/column properties in key/value pairs (this saves memory if # unique edge
// rows/cols << V / row_comm_size|col_comm_size).
std::optional<vertex_t const*> local_sorted_unique_edge_row_first_{std::nullopt};
std::optional<vertex_t const*> local_sorted_unique_edge_row_last_{std::nullopt};
std::optional<std::vector<vertex_t>> local_sorted_unique_edge_row_offsets_{std::nullopt};
std::optional<vertex_t const*> local_sorted_unique_edge_col_first_{std::nullopt};
std::optional<vertex_t const*> local_sorted_unique_edge_col_last_{std::nullopt};
std::optional<std::vector<vertex_t>> local_sorted_unique_edge_col_offsets_{std::nullopt};
};

// single-GPU version
Expand Down
Loading