From 74d24bef026d122aa32358db6a6eb433f46c6d3f Mon Sep 17 00:00:00 2001 From: jnke2016 Date: Tue, 9 Jan 2024 09:43:38 -0800 Subject: [PATCH] remove unsued variables --- cpp/src/community/k_truss_impl.cuh | 61 +++++++++++------------------- 1 file changed, 23 insertions(+), 38 deletions(-) diff --git a/cpp/src/community/k_truss_impl.cuh b/cpp/src/community/k_truss_impl.cuh index 558f13dc25e..39763fce100 100644 --- a/cpp/src/community/k_truss_impl.cuh +++ b/cpp/src/community/k_truss_impl.cuh @@ -59,8 +59,8 @@ struct exclude_self_loop_t { template struct in_k_plus_one_or_greater_t { - edge_t k; - __device__ bool operator()(edge_t core_number) const {return core_number >= k; } + edge_t k{}; + __device__ bool operator()(edge_t core_number) const {return core_number >= k+1; } }; template @@ -74,8 +74,6 @@ struct extract_k_plus_one_core_t { } }; - - template struct extract_low_to_high_degree_edges_t { __device__ thrust::optional> operator()(vertex_t src, @@ -171,13 +169,6 @@ struct extract_q_r { }; -template -struct K-trusss_less_t { - raft::device_span num_triangles{}; - edge_t k; - -}; - template struct find_intersection { size_t vertex_pair_buffer_size; @@ -322,7 +313,7 @@ void k_truss(raft::handle_t const& handle, ? std::make_optional>(cur_graph_view.vertex_partition_range_lasts()) : std::nullopt; - rmm::device_uvector core_numbers(cur_graph_view.number_of_vertices(), + rmm::device_uvector core_numbers(cur_graph_view.local_vertex_partition_range_size(), handle.get_stream()); core_number( handle, cur_graph_view, core_numbers.data(), k_core_degree_type_t::OUT, size_t{k+1}, size_t{k+1}); @@ -444,16 +435,10 @@ void k_truss(raft::handle_t const& handle, // 5. Decompress the resulting graph to an edge list and ind intersection of edge endpoints // for each partition using detail::nbr_intersection - rmm::device_uvector cur_graph_counts(size_t{0}, handle.get_stream()); { auto cur_graph_view = modified_graph_view ? *modified_graph_view : graph_view; - cur_graph_counts.resize(cur_graph_view.local_vertex_partition_range_size(), - handle.get_stream()); - rmm::device_uvector edgelist_srcs(0, handle.get_stream()); rmm::device_uvector edgelist_dsts(0, handle.get_stream()); - std::optional> edgelist_prop {std::nullopt}; - std::tie(edgelist_srcs, edgelist_dsts, std::ignore, std::ignore) = decompress_to_edgelist( handle, @@ -478,7 +463,7 @@ void k_truss(raft::handle_t const& handle, rmm::device_uvector r_nbr_intersection_property_values1(size_t{0}, handle.get_stream()); // FIXME: Initially each edge should have an edge property of 0 - std::tie(intersection_offsets, intersection_indices) = + auto[intersection_offsets, intersection_indices] = detail::nbr_intersection(handle, cur_graph_view, cugraph::edge_dummy_property_t{}.view(), @@ -496,15 +481,15 @@ void k_truss(raft::handle_t const& handle, // stores all the pairs (p, q), (p, r) and (q, r) - auto vertex_pair_buffer_ = allocate_dataframe_buffer>( + auto vertex_pair_buffer_tmp = allocate_dataframe_buffer>( intersection_indices.size() * 3, handle.get_stream()); // FIXME: optmize this part to not have to iterate over all the edges again // tabulate with the size of intersection_indices, and call binary search on intersection_offsets // to get (p, q). thrust::tabulate(handle.get_thrust_policy(), - get_dataframe_buffer_begin(vertex_pair_buffer_), - get_dataframe_buffer_begin(vertex_pair_buffer_) + intersection_indices.size(), + get_dataframe_buffer_begin(vertex_pair_buffer_tmp), + get_dataframe_buffer_begin(vertex_pair_buffer_tmp) + intersection_indices.size(), extract_p_q{ raft::device_span( intersection_offsets.data(), intersection_offsets.size()), @@ -516,8 +501,8 @@ void k_truss(raft::handle_t const& handle, // tabulate with the size of intersection_indices, and call binary search on intersection_offsets // to get (p, r). thrust::tabulate(handle.get_thrust_policy(), - get_dataframe_buffer_begin(vertex_pair_buffer_) + intersection_indices.size(), - get_dataframe_buffer_begin(vertex_pair_buffer_) + (2 * intersection_indices.size()), + get_dataframe_buffer_begin(vertex_pair_buffer_tmp) + intersection_indices.size(), + get_dataframe_buffer_begin(vertex_pair_buffer_tmp) + (2 * intersection_indices.size()), extract_p_r{ raft::device_span( intersection_offsets.data(), intersection_offsets.size()), @@ -529,8 +514,8 @@ void k_truss(raft::handle_t const& handle, // tabulate with the size of intersection_indices, and call binary search on intersection_offsets // to get (q, r). thrust::tabulate(handle.get_thrust_policy(), - get_dataframe_buffer_begin(vertex_pair_buffer_) + (2 * intersection_indices.size()), - get_dataframe_buffer_begin(vertex_pair_buffer_) + (3 * intersection_indices.size()), + get_dataframe_buffer_begin(vertex_pair_buffer_tmp) + (2 * intersection_indices.size()), + get_dataframe_buffer_begin(vertex_pair_buffer_tmp) + (3 * intersection_indices.size()), extract_q_r{ raft::device_span( intersection_offsets.data(), intersection_offsets.size()), @@ -540,25 +525,25 @@ void k_truss(raft::handle_t const& handle, }); printf("\nbefore sorting\n"); - raft::print_device_vector("src", std::get<0>(vertex_pair_buffer_).data(), std::get<0>(vertex_pair_buffer_).size(), std::cout); - raft::print_device_vector("dst", std::get<1>(vertex_pair_buffer_).data(), std::get<1>(vertex_pair_buffer_).size(), std::cout); + raft::print_device_vector("src", std::get<0>(vertex_pair_buffer_tmp).data(), std::get<0>(vertex_pair_buffer_tmp).size(), std::cout); + raft::print_device_vector("dst", std::get<1>(vertex_pair_buffer_tmp).data(), std::get<1>(vertex_pair_buffer_tmp).size(), std::cout); thrust::sort(handle.get_thrust_policy(), - get_dataframe_buffer_begin(vertex_pair_buffer_), - get_dataframe_buffer_end(vertex_pair_buffer_)); + get_dataframe_buffer_begin(vertex_pair_buffer_tmp), + get_dataframe_buffer_end(vertex_pair_buffer_tmp)); - rmm::device_uvector num_triangles_(3 * intersection_indices.size(), handle.get_stream()); + rmm::device_uvector num_triangles_tmp(3 * intersection_indices.size(), handle.get_stream()); - thrust::fill(handle.get_thrust_policy(), num_triangles_.begin(), num_triangles_.end(), size_t{1}); + thrust::fill(handle.get_thrust_policy(), num_triangles_tmp.begin(), num_triangles_tmp.end(), size_t{1}); rmm::device_uvector num_triangles(num_vertex_pairs, handle.get_stream()); thrust::reduce_by_key(handle.get_thrust_policy(), - get_dataframe_buffer_begin(vertex_pair_buffer_), - get_dataframe_buffer_end(vertex_pair_buffer_), - num_triangles_.begin(), + get_dataframe_buffer_begin(vertex_pair_buffer_tmp), + get_dataframe_buffer_end(vertex_pair_buffer_tmp), + num_triangles_tmp.begin(), get_dataframe_buffer_begin(vertex_pair_buffer), num_triangles.begin(), thrust::equal_to>{}); @@ -697,7 +682,7 @@ void k_truss(raft::handle_t const& handle, RAFT_CUDA_TRY(cudaDeviceSynchronize()); raft::print_device_vector( - "num_triangles_:", value_firsts[0], edge_counts[0], std::cout); + "num_triangles_tmp:", value_firsts[0], edge_counts[0], std::cout); vertex_pairs_begin = thrust::make_zip_iterator(std::get<0>(vertex_pair_buffer).begin(), std::get<1>(vertex_pair_buffer).begin()); // FIXME: not used below but used up printf("\nafter sorting\n"); @@ -768,7 +753,7 @@ void k_truss(raft::handle_t const& handle, thrust::tabulate(handle.get_thrust_policy(), intersection_size.begin(), intersection_size.end(), - find_intersection{ + find_intersection{ //find_intersection{ size_dataframe_buffer(vertex_pair_buffer), // FIXME: should we just do this inside the functor? num_invalid_edges, @@ -776,7 +761,7 @@ void k_truss(raft::handle_t const& handle, intersection_offsets.data(), intersection_offsets.size()), raft::device_span( intersection_indices.data(), intersection_indices.size()), - get_dataframe_buffer_begin(vertex_pair_buffer_), // FIXME: rename to vertex_pairs_buffer? maybe I should pass a pointer here 'get_dataframe_buffer_begin(vertex_pair_buffer)' + get_dataframe_buffer_begin(vertex_pair_buffer_tmp), // FIXME: rename to vertex_pairs_buffer? maybe I should pass a pointer here 'get_dataframe_buffer_begin(vertex_pair_buffer)' //vertex_pairs_begin, invalid_edge_first });