From 2f2f192910280ee59489efc827d387715c6412cc Mon Sep 17 00:00:00 2001 From: Naim <naim@uib.no> Date: Thu, 8 Feb 2024 00:27:40 +0100 Subject: [PATCH] Louvain needs weighted input graphs --- .../cugraph_operations/graph_operations.cu | 14 ++++----- .../vertex_and_edge_partition.cu | 31 +++++++------------ .../mg_graph_algorithms.cpp | 2 +- .../sg_graph_algorithms.cpp | 2 +- 4 files changed, 19 insertions(+), 30 deletions(-) diff --git a/cpp/examples/cugraph_operations/graph_operations.cu b/cpp/examples/cugraph_operations/graph_operations.cu index 4440cb1cf47..f3cfa70aa6e 100644 --- a/cpp/examples/cugraph_operations/graph_operations.cu +++ b/cpp/examples/cugraph_operations/graph_operations.cu @@ -162,11 +162,10 @@ void perform_example_graph_operations(raft::handle_t const& handle, src_vertex_weights_cache.view(), dst_vertex_weights_cache.view(), (*edge_weight_view), - [new_to_original_id_map = (*renumber_map).data()] __device__( - auto src, auto dst, auto src_prop, auto dst_prop, auto edge_prop) { + [] __device__(auto src, auto dst, auto src_prop, auto dst_prop, auto edge_prop) { printf("\nsrc ---> %d dst = %d : src_prop = %f dst_prop = %f edge_prop = %f\n", - static_cast<int>(new_to_original_id_map[src]), - static_cast<int>(new_to_original_id_map[dst]), + static_cast<int>(src), + static_cast<int>(dst), static_cast<float>(src_prop), static_cast<float>(dst_prop), static_cast<float>(edge_prop)); @@ -205,11 +204,10 @@ void perform_example_graph_operations(raft::handle_t const& handle, src_vertex_weights_cache.view(), dst_vertex_weights_cache.view(), cugraph::edge_dummy_property_t{}.view(), - [new_to_original_id_map = (*renumber_map).data()] __device__( - auto src, auto dst, auto src_prop, auto dst_prop, auto) { + [] __device__(auto src, auto dst, auto src_prop, auto dst_prop, auto) { printf("\nsrc ---> %d dst = %d : src_prop = %f dst_prop = %f\n", - static_cast<int>(new_to_original_id_map[src]), - static_cast<int>(new_to_original_id_map[dst]), + static_cast<int>(src), + static_cast<int>(dst), static_cast<float>(src_prop), static_cast<float>(dst_prop)); return dst_prop; diff --git a/cpp/examples/graph_partition/vertex_and_edge_partition.cu b/cpp/examples/graph_partition/vertex_and_edge_partition.cu index fb53593b34e..5256ea3bee7 100644 --- a/cpp/examples/graph_partition/vertex_and_edge_partition.cu +++ b/cpp/examples/graph_partition/vertex_and_edge_partition.cu @@ -239,8 +239,7 @@ void look_into_vertex_and_edge_partitions(raft::handle_t const& handle, indices, major_range_first, is_weighted, - weights = weights_of_edges_stored_in_this_edge_partition.begin(), - new_to_original_id_map = (*renumber_map).data()] __device__(auto i) { + weights = weights_of_edges_stored_in_this_edge_partition.begin()] __device__(auto i) { auto v = major_range_first + i; auto deg_of_v_in_this_edge_partition = offsets[i + 1] - offsets[i]; @@ -248,16 +247,15 @@ void look_into_vertex_and_edge_partitions(raft::handle_t const& handle, thrust::seq, thrust::make_counting_iterator(edge_t{offsets[i]}), thrust::make_counting_iterator(edge_t{offsets[i + 1]}), - [comm_rank, ep_idx, v, indices, new_to_original_id_map, is_weighted, weights] __device__( - auto pos) { + [comm_rank, ep_idx, v, indices, is_weighted, weights] __device__(auto pos) { if (is_weighted) { printf( "\n[comm_rank = %d local edge partition id = %d] edge: source = %d " "destination = %d weight = %f\n", static_cast<int>(comm_rank), static_cast<int>(ep_idx), - static_cast<int>(new_to_original_id_map[v]), - static_cast<int>(new_to_original_id_map[indices[pos]]), + static_cast<int>(v), + static_cast<int>(indices[pos]), static_cast<float>(weights[pos])); } else { @@ -266,8 +264,8 @@ void look_into_vertex_and_edge_partitions(raft::handle_t const& handle, "destination = %d\n", static_cast<int>(comm_rank), static_cast<int>(ep_idx), - static_cast<int>(new_to_original_id_map[v]), - static_cast<int>(new_to_original_id_map[indices[pos]])); + static_cast<int>(v), + static_cast<int>(indices[pos])); } }); }); @@ -285,7 +283,6 @@ void look_into_vertex_and_edge_partitions(raft::handle_t const& handle, major_range_first, is_weighted, weights = weights_of_edges_stored_in_this_edge_partition.begin(), - new_to_original_id_map = (*renumber_map).data(), dcs_nzd_vertices = (*dcs_nzd_vertices), major_hypersparse_first = (*major_hypersparse_first)] __device__(auto i) { auto v = dcs_nzd_vertices[i]; @@ -296,21 +293,15 @@ void look_into_vertex_and_edge_partitions(raft::handle_t const& handle, thrust::seq, thrust::make_counting_iterator(edge_t{offsets[major_idx]}), thrust::make_counting_iterator(edge_t{offsets[major_idx + 1]}), - [comm_rank, - ep_idx, - v, - indices, - new_to_original_id_map, - is_weighted, - weights] __device__(auto pos) { + [comm_rank, ep_idx, v, indices, is_weighted, weights] __device__(auto pos) { if (is_weighted) { printf( "\n[comm_rank = %d local edge partition id = %d] edge: source = %d " "destination = %d weight = %f\n", static_cast<int>(comm_rank), static_cast<int>(ep_idx), - static_cast<int>(new_to_original_id_map[v]), - static_cast<int>(new_to_original_id_map[indices[pos]]), + static_cast<int>(v), + static_cast<int>(indices[pos]), static_cast<float>(weights[pos])); } else { @@ -319,8 +310,8 @@ void look_into_vertex_and_edge_partitions(raft::handle_t const& handle, "destination = %d\n", static_cast<int>(comm_rank), static_cast<int>(ep_idx), - static_cast<int>(new_to_original_id_map[v]), - static_cast<int>(new_to_original_id_map[indices[pos]])); + static_cast<int>(v), + static_cast<int>(indices[pos])); } }); }); diff --git a/cpp/examples/multi_gpu_application/mg_graph_algorithms.cpp b/cpp/examples/multi_gpu_application/mg_graph_algorithms.cpp index d0d116e3139..0754afdba7b 100644 --- a/cpp/examples/multi_gpu_application/mg_graph_algorithms.cpp +++ b/cpp/examples/multi_gpu_application/mg_graph_algorithms.cpp @@ -203,5 +203,5 @@ int main(int argc, char** argv) using weight_t = float; constexpr bool multi_gpu = true; - run_graph_algos<vertex_t, edge_t, weight_t, multi_gpu>(*handle, csv_graph_file_path, false); + run_graph_algos<vertex_t, edge_t, weight_t, multi_gpu>(*handle, csv_graph_file_path, true); } diff --git a/cpp/examples/single_gpu_application/sg_graph_algorithms.cpp b/cpp/examples/single_gpu_application/sg_graph_algorithms.cpp index 980c847baad..714e9de73cf 100644 --- a/cpp/examples/single_gpu_application/sg_graph_algorithms.cpp +++ b/cpp/examples/single_gpu_application/sg_graph_algorithms.cpp @@ -155,5 +155,5 @@ int main(int argc, char** argv) using edge_t = int32_t; using weight_t = float; - run_graph_algos<vertex_t, edge_t, weight_t, multi_gpu>(*handle, argv[1], false); + run_graph_algos<vertex_t, edge_t, weight_t, multi_gpu>(*handle, argv[1], true); }