diff --git a/cpp/include/raft/sparse/mst/detail/mst_solver_inl.cuh b/cpp/include/raft/sparse/mst/detail/mst_solver_inl.cuh index 8b1307b377..0482b1c50f 100644 --- a/cpp/include/raft/sparse/mst/detail/mst_solver_inl.cuh +++ b/cpp/include/raft/sparse/mst/detail/mst_solver_inl.cuh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ #pragma once -#include #include #include "mst_kernels.cuh" @@ -36,7 +35,6 @@ namespace raft { namespace mst { -typedef std::chrono::high_resolution_clock Clock; // curand generator uniform inline curandStatus_t curand_generate_uniformX(curandGenerator_t generator, @@ -115,10 +113,6 @@ MST_solver::solve() RAFT_EXPECTS(offsets != nullptr, "Null offsets."); RAFT_EXPECTS(indices != nullptr, "Null indices."); RAFT_EXPECTS(weights != nullptr, "Null weights."); -#ifdef MST_TIME - double timer0 = 0, timer1 = 0, timer2 = 0, timer3 = 0, timer4 = 0, timer5 = 0; - auto start = Clock::now(); -#endif // Alterating the weights // this is done by identifying the lowest cost edge weight gap that is not 0, call this theta. @@ -126,11 +120,6 @@ MST_solver::solve() // range [0.0, theta) and add it to each edge weight. alteration(); -#ifdef MST_TIME - auto stop = Clock::now(); - timer0 = duration_us(stop - start); -#endif - auto max_mst_edges = symmetrize_output ? 2 * v - 2 : v - 1; Graph_COO mst_result(max_mst_edges, stream); @@ -140,69 +129,32 @@ MST_solver::solve() // track completion with mst_edge_found status and v as upper bound auto mst_iterations = iterations > 0 ? iterations : v; for (auto i = 0; i < mst_iterations; i++) { -#ifdef MST_TIME - start = Clock::now(); -#endif // Finds the minimum edge from each vertex to the lowest color // by working at each vertex of the supervertex min_edge_per_vertex(); -#ifdef MST_TIME - stop = Clock::now(); - timer1 += duration_us(stop - start); - start = Clock::now(); -#endif // Finds the minimum edge from each supervertex to the lowest color min_edge_per_supervertex(); -#ifdef MST_TIME - stop = Clock::now(); - timer2 += duration_us(stop - start); - start = Clock::now(); -#endif - // check if msf/mst done, count new edges added check_termination(); -#ifdef MST_TIME - stop = Clock::now(); - timer3 += duration_us(stop - start); -#endif - auto curr_mst_edge_count = mst_edge_count.value(stream); RAFT_EXPECTS(curr_mst_edge_count <= max_mst_edges, "Number of edges found by MST is invalid. This may be due to " "loss in precision. Try increasing precision of weights."); if (curr_mst_edge_count == prev_mst_edge_count.value(stream)) { -#ifdef MST_TIME - std::cout << "Iterations: " << i << std::endl; - std::cout << timer0 << "," << timer1 << "," << timer2 << "," << timer3 << "," << timer4 << "," - << timer5 << std::endl; -#endif // exit here when reaching steady state break; } -#ifdef MST_TIME - start = Clock::now(); -#endif // append the newly found MST edges to the final output append_src_dst_pair(mst_result.src.data(), mst_result.dst.data(), mst_result.weights.data()); -#ifdef MST_TIME - stop = Clock::now(); - timer4 += duration_us(stop - start); - start = Clock::now(); -#endif // updates colors of vertices by propagating the lower color to the higher label_prop(mst_result.src.data(), mst_result.dst.data()); -#ifdef MST_TIME - stop = Clock::now(); - timer5 += duration_us(stop - start); -#endif - // copy this iteration's results and store prev_mst_edge_count.set_value_async(curr_mst_edge_count, stream); } @@ -317,9 +269,6 @@ void MST_solver::label_prop(vertex_t* detail::final_color_indices<<>>( v, color_ptr, color_index); -#ifdef MST_TIME - std::cout << "Label prop iterations: " << i << std::endl; -#endif } // Finds the minimum edge from each vertex to the lowest color diff --git a/cpp/include/raft/sparse/mst/detail/utils.cuh b/cpp/include/raft/sparse/mst/detail/utils.cuh index 97a76e1d50..94ddf4ed94 100644 --- a/cpp/include/raft/sparse/mst/detail/utils.cuh +++ b/cpp/include/raft/sparse/mst/detail/utils.cuh @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ #include #include -#define MST_TIME namespace raft { namespace mst { @@ -31,25 +30,6 @@ __device__ idx_t get_1D_idx() return blockIdx.x * blockDim.x + threadIdx.x; } -// somewhat smart vector print -template -void printv(rmm::device_uvector& vec, const std::string& name = "", const size_t displ = 5) -{ -#ifdef MST_TIME - std::cout.precision(15); - std::cout << name << " size = " << vec.size() << std::endl; - if (displ < vec.size()) { - thrust::copy(vec.begin(), vec.begin() + displ, std::ostream_iterator(std::cout, " ")); - std::cout << " ... "; - thrust::copy(vec.end() - displ, vec.end(), std::ostream_iterator(std::cout, " ")); - } else { - thrust::copy(vec.begin(), vec.end(), std::ostream_iterator(std::cout, " ")); - } - std::cout << std::endl << std::endl; -#endif -} -#define duration_us(a) std::chrono::duration_cast(a).count() - } // namespace detail } // namespace mst } // namespace raft