From 1f547dc25fdd6b224a742b9b6403339a779d6ae8 Mon Sep 17 00:00:00 2001 From: afender Date: Tue, 27 Oct 2020 18:17:26 -0500 Subject: [PATCH] looping! --- .../raft/sparse/mst/detail/mst_solver_inl.hpp | 52 ++++--------------- cpp/test/mst.cu | 2 +- 2 files changed, 11 insertions(+), 43 deletions(-) diff --git a/cpp/include/raft/sparse/mst/detail/mst_solver_inl.hpp b/cpp/include/raft/sparse/mst/detail/mst_solver_inl.hpp index fc8825b211..43eb5a9aab 100644 --- a/cpp/include/raft/sparse/mst/detail/mst_solver_inl.hpp +++ b/cpp/include/raft/sparse/mst/detail/mst_solver_inl.hpp @@ -57,52 +57,19 @@ void MST_solver::solve() { RAFT_EXPECTS(indices != nullptr, "Null indices."); RAFT_EXPECTS(weights != nullptr, "Null weights."); - min_edge_per_vertex(); - - detail::printv(successor); - - label_prop(); - - detail::printv(color); - - // Theorem : the minimum incident edge to any vertex has to be in the MST - // This is a segmented min scan/reduce - // cub::KeyValuePair* d_out = nullptr; - // void* cub_temp_storage = nullptr; - // size_t cub_temp_storage_bytes = 0; - // cub::DeviceSegmentedReduce::ArgMin(cub_temp_storage, cub_temp_storage_bytes, - // weights, d_out, v, offsets, offsets + 1); - // // FIXME RMM Allocate temporary storage - // cudaMalloc(&cub_temp_storage, cub_temp_storage_bytes); - // // Run argmin-reduction - // cub::DeviceSegmentedReduce::ArgMin(cub_temp_storage, cub_temp_storage_bytes, - // weights, d_out, v, offsets, offsets + 1); - // - // TODO: mst[offset[i]+key[i]]=true; (thrust)? - // Extract MST edge list by just filtering with the mask generated above? - - // bool mst_edge_found = true; // Boruvka original formulation says "while more than 1 supervertex remains" // Here we adjust it to support disconnected components (spanning forest) // track completion with mst_edge_found status. // should have max_iter ensure it always exits. - // for (auto i = 0; i < v; i++) { - // { - // updates colors of supervertices by propagating the lower color to the higher - // TODO - - // Finds the minimum outgoing edge from each supervertex to the lowest outgoing color - // by working at each vertex of the supervertex - // TODO - // segmented min with an extra check to discard edges leading to the same color - - // filter internal edges / remove cycles - // TODO - - // done - // if (!mst_edge_found) break; - // } - // } + for (auto i = 0; i < 2; i++) { + // Finds the minimum outgoing edge from each supervertex to the lowest outgoing color + // by working at each vertex of the supervertex + min_edge_per_vertex(); + detail::printv(successor); + // updates colors of supervertices by propagating the lower color to the higher + label_prop(); + detail::printv(color); + } } template @@ -133,6 +100,7 @@ void MST_solver::label_prop() { i++; } std::cout << "Label prop iterations : " << i << std::endl; + std::cout << "==================" << std::endl; } template diff --git a/cpp/test/mst.cu b/cpp/test/mst.cu index 62bda18151..43bd62a220 100644 --- a/cpp/test/mst.cu +++ b/cpp/test/mst.cu @@ -178,7 +178,7 @@ TEST_P(MSTTestSequential, Sequential) { } INSTANTIATE_TEST_SUITE_P(MSTTests, MSTTestSequential, - ::testing::ValuesIn(csr_in_h)); + ::testing::ValuesIn(csr_in2_h)); } // namespace mst } // namespace raft