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

looping! #1

Merged
merged 1 commit into from
Oct 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
52 changes: 10 additions & 42 deletions cpp/include/raft/sparse/mst/detail/mst_solver_inl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,52 +57,19 @@ void MST_solver<vertex_t, edge_t, weight_t>::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<vertex_t, weight_t>* 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 <typename vertex_t, typename edge_t, typename weight_t>
Expand Down Expand Up @@ -133,6 +100,7 @@ void MST_solver<vertex_t, edge_t, weight_t>::label_prop() {
i++;
}
std::cout << "Label prop iterations : " << i << std::endl;
std::cout << "==================" << std::endl;
}

template <typename vertex_t, typename edge_t, typename weight_t>
Expand Down
2 changes: 1 addition & 1 deletion cpp/test/mst.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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