From 9f38b83249b48bfe5c5a02c8ef4ea5dc2c46ba5f Mon Sep 17 00:00:00 2001 From: Luc Berger-Vergiat Date: Thu, 9 Jun 2022 18:01:06 -0600 Subject: [PATCH 1/4] KokkosSparse Utils: changing namespace The sparse utils now live in the KokkosSparse_Utils.hpp header but they have not moved to the KokkosSparse namespace which is not very consistent. The changes made here fix that issue and deprecate the only struct that was defined in KokkosKernels but not in the Impl namespace --- perf_test/graph/KokkosGraph_mis_d2.cpp | 2 +- perf_test/sparse/KokkosSparse_block_pcg.cpp | 4 +- .../sparse/KokkosSparse_sptrsv_supernode.cpp | 3 +- src/graph/KokkosGraph_Distance2Color.hpp | 4 +- .../impl/KokkosGraph_Distance2MIS_impl.hpp | 2 +- src/sparse/KokkosSparse_Utils.hpp | 216 +++--------------- src/sparse/KokkosSparse_gauss_seidel.hpp | 18 +- .../impl/KokkosSparse_gauss_seidel_impl.hpp | 6 +- .../impl/KokkosSparse_gauss_seidel_spec.hpp | 20 +- unit_test/graph/Test_Graph_graph_color.hpp | 2 +- .../Test_Graph_graph_color_distance2.hpp | 2 +- unit_test/sparse/Test_Sparse_Transpose.hpp | 8 +- .../sparse/Test_Sparse_block_gauss_seidel.hpp | 23 +- unit_test/sparse/Test_Sparse_spgemm.hpp | 2 +- 14 files changed, 86 insertions(+), 226 deletions(-) diff --git a/perf_test/graph/KokkosGraph_mis_d2.cpp b/perf_test/graph/KokkosGraph_mis_d2.cpp index dfe7715a1d..df5e28b315 100644 --- a/perf_test/graph/KokkosGraph_mis_d2.cpp +++ b/perf_test/graph/KokkosGraph_mis_d2.cpp @@ -258,7 +258,7 @@ void run_mis2(const MIS2Parameters& params) { std::cout << "I/O time: " << t.seconds() << " s\n"; t.reset(); // Symmetrize the matrix just in case - crsMat_t At_in = KokkosKernels::Impl::transpose_matrix(A_in); + crsMat_t At_in = KokkosSparse::Impl::transpose_matrix(A_in); crsMat_t A; KKH kkh; const default_scalar one = Kokkos::ArithTraits::one(); diff --git a/perf_test/sparse/KokkosSparse_block_pcg.cpp b/perf_test/sparse/KokkosSparse_block_pcg.cpp index 8e453b4d01..5664e943fb 100644 --- a/perf_test/sparse/KokkosSparse_block_pcg.cpp +++ b/perf_test/sparse/KokkosSparse_block_pcg.cpp @@ -322,7 +322,7 @@ void run_experiment( // typedef typename lno_nnz_view_t::value_type lno_t; // typedef typename lno_view_t::value_type size_type; // typedef typename scalar_view_t::value_type scalar_t; - KokkosKernels::Impl::kk_create_blockcrs_formated_point_crsmatrix( + KokkosSparse::Impl::kk_create_blockcrs_formated_point_crsmatrix( block_size, crsmat.numRows(), crsmat.numCols(), crsmat.graph.row_map, crsmat.graph.entries, crsmat.values, out_r, out_c, pf_rm, pf_e, pf_v); @@ -349,7 +349,7 @@ void run_experiment( scalar_view_t bf_v; size_t but_r, but_c; - KokkosKernels::Impl::kk_create_blockcrs_from_blockcrs_formatted_point_crs( + KokkosSparse::Impl::kk_create_blockcrs_from_blockcrs_formatted_point_crs( block_size, out_r, out_c, pf_rm, pf_e, pf_v, but_r, but_c, bf_rm, bf_e, bf_v); diff --git a/perf_test/sparse/KokkosSparse_sptrsv_supernode.cpp b/perf_test/sparse/KokkosSparse_sptrsv_supernode.cpp index ad8e1ba8b9..fcfc66b74e 100644 --- a/perf_test/sparse/KokkosSparse_sptrsv_supernode.cpp +++ b/perf_test/sparse/KokkosSparse_sptrsv_supernode.cpp @@ -63,6 +63,7 @@ using namespace KokkosKernels; using namespace KokkosKernels::Impl; using namespace KokkosKernels::Experimental; using namespace KokkosSparse; +using namespace KokkosSparse::Impl; using namespace KokkosSparse::Experimental; using namespace KokkosSparse::PerfTest::Experimental; @@ -154,7 +155,7 @@ int test_sptrsv_perf(std::vector tests, bool verbose, cols_view_t entries("colmap_view", nnzL); values_view_t values("values_view", nnzL); // transpose L - transpose_matrix(nrows, nrows, row_mapM, entriesM, valuesM, row_map, entries, values); diff --git a/src/graph/KokkosGraph_Distance2Color.hpp b/src/graph/KokkosGraph_Distance2Color.hpp index 211ad42f63..7bf19452b4 100644 --- a/src/graph/KokkosGraph_Distance2Color.hpp +++ b/src/graph/KokkosGraph_Distance2Color.hpp @@ -157,7 +157,7 @@ void bipartite_color_rows(KernelHandle *handle, // Compute the transpose col_map = TRowmap("Col map", num_columns + 1); col_entries = TEntries("Col entries", nnz); - KokkosKernels::Impl::transpose_graph( num_rows, num_columns, row_map, row_entries, col_map, col_entries); } @@ -235,7 +235,7 @@ void bipartite_color_columns(KernelHandle *handle, TRowmap col_map("Col map", num_columns + 1); TEntries col_entries( Kokkos::view_alloc(Kokkos::WithoutInitializing, "Col entries"), nnz); - KokkosKernels::Impl::transpose_graph( num_rows, num_columns, row_map, row_entries, col_map, col_entries); // Get unmanaged views for both graph and its transpose diff --git a/src/graph/impl/KokkosGraph_Distance2MIS_impl.hpp b/src/graph/impl/KokkosGraph_Distance2MIS_impl.hpp index 041a2f861b..195d08dc0a 100644 --- a/src/graph/impl/KokkosGraph_Distance2MIS_impl.hpp +++ b/src/graph/impl/KokkosGraph_Distance2MIS_impl.hpp @@ -598,7 +598,7 @@ struct D2_MIS_FixedPriority { Kokkos::view_alloc(Kokkos::WithoutInitializing, "RowStatus"), numVerts); colStatus = status_view_t( Kokkos::view_alloc(Kokkos::WithoutInitializing, "ColStatus"), numVerts); - KokkosKernels::Impl::graph_min_max_degree( + KokkosSparse::Impl::graph_min_max_degree( rowmap, minDegree, maxDegree); // Compute row statuses Kokkos::parallel_for(range_pol(0, numVerts), diff --git a/src/sparse/KokkosSparse_Utils.hpp b/src/sparse/KokkosSparse_Utils.hpp index 323ae7846f..c84c928d05 100644 --- a/src/sparse/KokkosSparse_Utils.hpp +++ b/src/sparse/KokkosSparse_Utils.hpp @@ -57,9 +57,9 @@ #include #endif -namespace KokkosKernels { +namespace KokkosSparse { -enum SparseMatrixFormat { +enum SparseMatrixFormat { BlockCRS, BSR, CRS = BlockCRS, // convenience alias: for block_size=1 or no-blocks there is @@ -425,11 +425,11 @@ void transpose_matrix( // determine vector lanes per thread int thread_size = kk_get_suggested_vector_size( - num_rows, nnz, kk_get_exec_space_type()); + num_rows, nnz, KokkosKernels::Impl::kk_get_exec_space_type()); // determine threads per team int team_size = kk_get_suggested_team_size( - thread_size, kk_get_exec_space_type()); + thread_size, KokkosKernels::Impl::kk_get_exec_space_type()); TransposeFunctor_t tm(num_rows, num_cols, xadj, adj, vals, t_xadj, t_adj, t_vals, tmp_row_view, true, team_size); @@ -439,7 +439,7 @@ void transpose_matrix( team_size, thread_size), tm); - kk_exclusive_parallel_prefix_sum(num_cols + 1, + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum(num_cols + 1, t_xadj); Kokkos::deep_copy(tmp_row_view, t_xadj); @@ -508,11 +508,11 @@ void transpose_graph( // determine vector lanes per thread int thread_size = kk_get_suggested_vector_size( - num_rows, nnz, kk_get_exec_space_type()); + num_rows, nnz, KokkosKernels::Impl::kk_get_exec_space_type()); // determine threads per team int team_size = kk_get_suggested_team_size( - thread_size, kk_get_exec_space_type()); + thread_size, KokkosKernels::Impl::kk_get_exec_space_type()); TransposeFunctor_t tm(num_rows, num_cols, xadj, adj, tmp1, t_xadj, t_adj, tmp2, tmp_row_view, false, team_size); @@ -522,7 +522,7 @@ void transpose_graph( team_size, thread_size), tm); - kk_exclusive_parallel_prefix_sum(num_cols + 1, + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum(num_cols + 1, t_xadj); Kokkos::deep_copy(tmp_row_view, t_xadj); @@ -715,7 +715,7 @@ void kk_create_reverse_map( // kk_inclusive_parallel_prefix_sum(tmp_reverse_size + 1, tmp_color_xadj); - kk_exclusive_parallel_prefix_sum( + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum( tmp_reverse_size + 1, tmp_color_xadj); MyExecSpace().fence(); @@ -750,7 +750,7 @@ void kk_create_reverse_map( // kk_inclusive_parallel_prefix_sum(num_reverse_elements + 1, reverse_map_xadj); - kk_exclusive_parallel_prefix_sum( + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum( num_reverse_elements + 1, tmp_color_xadj); MyExecSpace().fence(); @@ -843,7 +843,7 @@ inline size_t kk_is_d1_coloring_valid( typename in_nnz_view_t::non_const_value_type num_rows, typename in_nnz_view_t::non_const_value_type /*num_cols*/, in_row_view_t xadj, in_nnz_view_t adj, in_color_view_t v_colors) { - ExecSpaceType my_exec_space = kk_get_exec_space_type(); + KokkosKernels::Impl::ExecSpaceType my_exec_space = KokkosKernels::Impl::kk_get_exec_space_type(); int vector_size = kk_get_suggested_vector_size(num_rows, adj.extent(0), my_exec_space); int suggested_team_size = @@ -926,160 +926,6 @@ void graph_min_max_degree(const rowmap_t &rowmap, ordinal_t &min_degree, max_degree = result.max_val; } -/* -template -struct IncidenceMatrix{ - - struct FillTag{}; - - typedef struct FillTag FillTag; - - typedef Kokkos::TeamPolicy team_fill_policy_t ; - typedef Kokkos::TeamPolicy > dynamic_team_fill_policy_t ; typedef -typename team_fill_policy_t::member_type team_fill_member_t ; - - typedef typename in_nnz_view_t::non_const_value_type nnz_lno_t; - typedef typename in_row_view_t::non_const_value_type size_type; - - - typename in_nnz_view_t::non_const_value_type num_rows; - in_row_view_t xadj; - in_nnz_view_t adj; - out_nnz_view_t t_adj; //allocated - typename in_row_view_t::non_const_type tmp_txadj; - nnz_lno_t team_work_size; - - IncidenceMatrix( - nnz_lno_t num_rows_, - in_row_view_t xadj_, - in_nnz_view_t adj_, - out_nnz_view_t t_adj_, - typename in_row_view_t::non_const_type tmp_txadj_, - nnz_lno_t team_row_work_size_): - num_rows(num_rows_), - xadj(xadj_), adj(adj_), - t_adj(t_adj_), - tmp_txadj(tmp_txadj_), team_work_size(team_row_work_size_) {} - - - KOKKOS_INLINE_FUNCTION - void operator()(const FillTag&, const team_fill_member_t & teamMember) const { - const nnz_lno_t team_row_begin = teamMember.league_rank() * team_work_size; - const nnz_lno_t team_row_end = KOKKOSKERNELS_MACRO_MIN(team_row_begin + -team_work_size, num_rows); - - - Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember,team_row_begin,team_row_end), -[&] (const nnz_lno_t& row_index) { const size_type col_begin = xadj[row_index]; - const size_type col_end = xadj[row_index + 1]; - const nnz_lno_t left_work = col_end - col_begin; - Kokkos::parallel_for( - Kokkos::ThreadVectorRange(teamMember, left_work), - [&] (nnz_lno_t i) { - const size_type adjind = i + col_begin; - const nnz_lno_t colIndex = adj[adjind]; - if (row_index < colIndex){ - - const size_type pos = -Kokkos::atomic_fetch_add(&(tmp_txadj(colIndex)),1); t_adj(adjind) = adjind; - t_adj(pos) = adjind; - } - }); - //} - }); - } -}; -*/ -/** - * \brief function returns transpose of the given graph. - * \param num_rows: num rows in input graph - * \param num_cols: num cols in input graph - * \param xadj: row pointers of the input graph - * \param adj: column indices of the input graph - * \param t_xadj: output, the row indices of the output graph. MUST BE - * INITIALIZED WITH ZEROES. \param t_adj: output, column indices. No need for - * initializations. \param vector_size: suggested vector size, optional. if -1, - * kernel will decide. \param suggested_team_size: suggested team size, - * optional. if -1, kernel will decide. \param team_work_chunk_size: suggested - * work size of a team, optional. if -1, kernel will decide. \param - * use_dynamic_scheduling: whether to use dynamic scheduling. Default is true. - */ -/* -template -inline void kk_create_incidence_matrix( - typename in_nnz_view_t::non_const_value_type num_rows, - in_row_view_t xadj, - in_nnz_view_t adj, - out_nnz_view_t i_adj, //pre-allocated -- no need for initialize -- size is -same as adj int vector_size = -1, int suggested_team_size = -1, typename -in_nnz_view_t::non_const_value_type team_work_chunk_size = -1, bool -use_dynamic_scheduling = true - ){ - - - typedef typename in_row_view_t::non_const_type tmp_row_view_t; - //allocate some memory for work for row pointers - tmp_row_view_t tmp_row_view(Kokkos::view_alloc(Kokkos::WithoutInitializing, -"tmp_row_view"), num_rows + 1); - - Kokkos::deep_copy(tmp_row_view, xadj); - - in_nnz_view_t tmp1; - out_nnz_view_t tmp2; - - //create the functor for tranpose. - typedef IncidenceMatrix < - in_row_view_t, in_nnz_view_t, in_nnz_view_t, - out_nnz_view_t, MyExecSpace> IncidenceMatrix_Functor_t; - - IncidenceMatrix_Functor_t tm ( num_rows, xadj, adj, - t_adj, tmp_row_view, - false, - team_work_chunk_size); - - - typedef typename IncidenceMatrix_Functor_t::team_fill_policy_t fill_tp_t; - typedef typename IncidenceMatrix_Functor_t::dynamic_team_fill_policy_t -d_fill_tp_t; - - typename in_row_view_t::non_const_value_type nnz = adj.extent(0); - - //set the vector size, if not suggested. - if (vector_size == -1) - vector_size = kk_get_suggested_vector_size(num_rows, nnz, -kk_get_exec_space_type()); - - //set the team size, if not suggested. - if (suggested_team_size == -1) - suggested_team_size = kk_get_suggested_team_size(vector_size, -kk_get_exec_space_type()); - - //set the chunk size, if not suggested. - if (team_work_chunk_size == -1) - team_work_chunk_size = suggested_team_size; - - - - if (use_dynamic_scheduling){ - Kokkos::parallel_for( fill_tp_t(num_rows / team_work_chunk_size + 1 , -suggested_team_size, vector_size), tm); - } - else { - Kokkos::parallel_for( d_fill_tp_t(num_rows / team_work_chunk_size + 1 , -suggested_team_size, vector_size), tm); - } - MyExecSpace().fence(); - -} -*/ - template void kk_get_lower_triangle_count_sequential(const lno_t nv, const size_type *in_xadj, @@ -1140,7 +986,7 @@ struct LowerTriangularMatrix { scalar_t *t_vals; const lno_t team_work_size; - const ExecSpaceType exec_space; + const KokkosKernels::Impl::ExecSpaceType exec_space; const bool is_lower; LowerTriangularMatrix(const lno_t num_rows_, const size_type *xadj_, @@ -1157,7 +1003,7 @@ struct LowerTriangularMatrix { t_adj(t_adj_), t_vals(out_vals_), team_work_size(team_row_work_size_), - exec_space(kk_get_exec_space_type()), + exec_space(KokkosKernels::Impl::kk_get_exec_space_type()), is_lower(is_lower_) {} KOKKOS_INLINE_FUNCTION @@ -1274,9 +1120,9 @@ void kk_get_lower_triangle_count_parallel( bool use_dynamic_scheduling = false, int chunksize = 4, bool is_lower = true) { const int vector_size = kk_get_suggested_vector_size( - nv, ne, kk_get_exec_space_type()); + nv, ne, KokkosKernels::Impl::kk_get_exec_space_type()); const int suggested_team_size = kk_get_suggested_team_size( - vector_size, kk_get_exec_space_type()); + vector_size, KokkosKernels::Impl::kk_get_exec_space_type()); const int team_work_chunk_size = suggested_team_size * chunksize; typedef LowerTriangularMatrix ltm_t; @@ -1439,9 +1285,9 @@ void kk_get_lower_triangle_fill_parallel( bool use_dynamic_scheduling = false, bool chunksize = 4, bool is_lower = true) { const int vector_size = kk_get_suggested_vector_size( - nv, ne, kk_get_exec_space_type()); + nv, ne, KokkosKernels::Impl::kk_get_exec_space_type()); const int suggested_team_size = kk_get_suggested_team_size( - vector_size, kk_get_exec_space_type()); + vector_size, KokkosKernels::Impl::kk_get_exec_space_type()); const int team_work_chunk_size = suggested_team_size * chunksize; typedef LowerTriangularMatrix @@ -1573,7 +1419,7 @@ crstmat_t kk_get_lower_triangle( nr, ne, rowmap, entries, new_row_map.data(), new_indices, use_dynamic_scheduling, chunksize); - kk_exclusive_parallel_prefix_sum(nr + 1, + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum(nr + 1, new_row_map); exec_space().fence(); @@ -1630,7 +1476,7 @@ crstmat_t kk_get_lower_crs_matrix( nr, ne, rowmap, entries, new_row_map.data(), new_indices, use_dynamic_scheduling, chunksize); - kk_exclusive_parallel_prefix_sum(nr + 1, + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum(nr + 1, new_row_map); exec_space().fence(); @@ -1683,7 +1529,7 @@ graph_t kk_get_lower_crs_graph(graph_t in_crs_matrix, kk_get_lower_triangle_count( nr, ne, rowmap, entries, new_row_map.data(), new_indices); - kk_exclusive_parallel_prefix_sum(nr + 1, + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum(nr + 1, new_row_map); exec_space().fence(); @@ -1736,7 +1582,7 @@ void kk_get_lower_triangle(typename cols_view_t::non_const_value_type nr, nr, ne, rowmap, entries, out_rowmap.data(), new_indices.data(), use_dynamic_scheduling, chunksize, is_lower); - kk_exclusive_parallel_prefix_sum(nr + 1, + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum(nr + 1, out_rowmap); exec_space().fence(); @@ -1844,7 +1690,7 @@ void kk_create_incidence_matrix_from_original_matrix( permutation.data(), use_dynamic_scheduling, chunksize, sort_decreasing_order); exec_space().fence(); - kk_exclusive_parallel_prefix_sum(nr + 1, + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum(nr + 1, out_rowmap); // kk_print_1Dview(out_rowmap, false, 20); @@ -2069,21 +1915,21 @@ template struct MatrixTraits< KokkosSparse::CrsMatrix> { - static constexpr auto format = KokkosKernels::CRS; + static constexpr auto format = KokkosSparse::CRS; }; template struct MatrixTraits> { - static constexpr auto format = KokkosKernels::BlockCRS; + static constexpr auto format = KokkosSparse::BlockCRS; }; template struct MatrixTraits> { - static constexpr auto format = KokkosKernels::BSR; + static constexpr auto format = KokkosSparse::BSR; }; template @@ -2120,6 +1966,18 @@ struct MatrixConverter { }; } // namespace Impl +} // namespace KokkosSparse + +namespace KokkosKernels { + +enum [[deprecated]] SparseMatrixFormat { + BlockCRS, + BSR, + CRS = BlockCRS, // convenience alias: for block_size=1 or no-blocks there is + // no difference in value ordering (so the format tag becomes + // irrelevant) +}; + } // namespace KokkosKernels #endif diff --git a/src/sparse/KokkosSparse_gauss_seidel.hpp b/src/sparse/KokkosSparse_gauss_seidel.hpp index efe70dd1c5..1df960860b 100644 --- a/src/sparse/KokkosSparse_gauss_seidel.hpp +++ b/src/sparse/KokkosSparse_gauss_seidel.hpp @@ -132,7 +132,7 @@ void block_gauss_seidel_symbolic( is_graph_symmetric); } -template void gauss_seidel_numeric(KernelHandle *handle, @@ -207,7 +207,7 @@ void gauss_seidel_numeric(KernelHandle *handle, is_graph_symmetric); } -template void gauss_seidel_numeric(KernelHandle *handle, @@ -286,7 +286,7 @@ void gauss_seidel_numeric(KernelHandle *handle, is_graph_symmetric); } -template void block_gauss_seidel_numeric( @@ -307,7 +307,7 @@ void block_gauss_seidel_numeric( values, is_graph_symmetric); } -template @@ -437,7 +437,7 @@ void symmetric_gauss_seidel_apply( update_y_vector, omega, numIter, true, true); } -template @@ -471,7 +471,7 @@ void symmetric_block_gauss_seidel_apply( handle, num_rows, num_cols, row_map, entries, values, x_lhs_output_vec, y_rhs_input_vec, init_zero_x_vector, update_y_vector, omega, numIter); } -template @@ -603,7 +603,7 @@ void forward_sweep_gauss_seidel_apply( update_y_vector, omega, numIter, true, false); } -template @@ -637,7 +637,7 @@ void forward_sweep_block_gauss_seidel_apply( handle, num_rows, num_cols, row_map, entries, values, x_lhs_output_vec, y_rhs_input_vec, init_zero_x_vector, update_y_vector, omega, numIter); } -template @@ -769,7 +769,7 @@ void backward_sweep_gauss_seidel_apply( update_y_vector, omega, numIter, false, true); } -template diff --git a/src/sparse/impl/KokkosSparse_gauss_seidel_impl.hpp b/src/sparse/impl/KokkosSparse_gauss_seidel_impl.hpp index abedbe80ed..137b75b3f7 100644 --- a/src/sparse/impl/KokkosSparse_gauss_seidel_impl.hpp +++ b/src/sparse/impl/KokkosSparse_gauss_seidel_impl.hpp @@ -63,7 +63,7 @@ namespace Impl { template + KokkosSparse::SparseMatrixFormat format = KokkosSparse::CRS> class PointGaussSeidel { public: typedef lno_row_view_t_ in_lno_row_view_t; @@ -137,7 +137,7 @@ class PointGaussSeidel { pool_memory_space; typedef - typename KokkosKernels::Impl::MatrixRowIndex + typename KokkosSparse::Impl::MatrixRowIndex RowIndex; private: @@ -1105,7 +1105,7 @@ class PointGaussSeidel { // std::cout << "level_2_mem:" << level_2_mem << std::endl; size_type num_large_rows = 0; - KokkosKernels::Impl::kk_reduce_numrows_larger_than_threshold< + KokkosSparse::Impl::kk_reduce_numrows_larger_than_threshold< row_lno_persistent_work_view_t, MyExecSpace>( brows, permuted_xadj, num_values_in_l1, num_large_rows); num_big_rows = KOKKOSKERNELS_MACRO_MIN( diff --git a/src/sparse/impl/KokkosSparse_gauss_seidel_spec.hpp b/src/sparse/impl/KokkosSparse_gauss_seidel_spec.hpp index 182d33a2e7..5af78f96c5 100644 --- a/src/sparse/impl/KokkosSparse_gauss_seidel_spec.hpp +++ b/src/sparse/impl/KokkosSparse_gauss_seidel_spec.hpp @@ -161,7 +161,7 @@ struct GAUSS_SEIDEL_SYMBOLIC { }; template < - class KernelHandle, KokkosKernels::SparseMatrixFormat format, + class KernelHandle, KokkosSparse::SparseMatrixFormat format, class a_size_view_t_, class a_lno_view_t, class a_scalar_view_t, bool tpl_spec_avail = gauss_seidel_numeric_tpl_spec_avail< KernelHandle, a_size_view_t_, a_lno_view_t, a_scalar_view_t>::value, @@ -180,7 +180,7 @@ struct GAUSS_SEIDEL_NUMERIC { a_scalar_view_t given_inverse_diagonal, bool is_graph_symmetric); }; -template struct GAUSS_SEIDEL_NUMERIC struct GAUSS_SEIDEL_APPLY, \ - KokkosKernels::BlockCRS, \ + KokkosSparse::BlockCRS, \ Kokkos::View, \ Kokkos::MemoryTraits >, \ @@ -416,7 +416,7 @@ struct GAUSS_SEIDEL_APPLY, \ - KokkosKernels::BSR, \ + KokkosSparse::BSR, \ Kokkos::View, \ Kokkos::MemoryTraits >, \ @@ -435,7 +435,7 @@ struct GAUSS_SEIDEL_APPLY, \ - KokkosKernels::BlockCRS, \ + KokkosSparse::BlockCRS, \ Kokkos::View, \ Kokkos::MemoryTraits >, \ @@ -456,7 +456,7 @@ struct GAUSS_SEIDEL_APPLY, \ - KokkosKernels::BSR, \ + KokkosSparse::BSR, \ Kokkos::View, \ Kokkos::MemoryTraits >, \ @@ -481,7 +481,7 @@ struct GAUSS_SEIDEL_APPLY, \ - KokkosKernels::BlockCRS, \ + KokkosSparse::BlockCRS, \ Kokkos::View, \ Kokkos::MemoryTraits >, \ @@ -502,7 +502,7 @@ struct GAUSS_SEIDEL_APPLY, \ - KokkosKernels::BSR, \ + KokkosSparse::BSR, \ Kokkos::View, \ Kokkos::MemoryTraits >, \ diff --git a/unit_test/graph/Test_Graph_graph_color.hpp b/unit_test/graph/Test_Graph_graph_color.hpp index da86546862..b9e675ef98 100644 --- a/unit_test/graph/Test_Graph_graph_color.hpp +++ b/unit_test/graph/Test_Graph_graph_color.hpp @@ -168,7 +168,7 @@ void test_coloring(lno_t numRows, size_type nnz, lno_t bandwidth, const lno_t num_rows_1 = input_mat.numRows(); const lno_t num_cols_1 = input_mat.numCols(); - lno_t num_conflict = KokkosKernels::Impl::kk_is_d1_coloring_valid< + lno_t num_conflict = KokkosSparse::Impl::kk_is_d1_coloring_valid< lno_view_t, lno_nnz_view_t, color_view_t, typename device::execution_space>( num_rows_1, num_cols_1, input_mat.graph.row_map, diff --git a/unit_test/graph/Test_Graph_graph_color_distance2.hpp b/unit_test/graph/Test_Graph_graph_color_distance2.hpp index 45444cd136..bca2855fea 100644 --- a/unit_test/graph/Test_Graph_graph_color_distance2.hpp +++ b/unit_test/graph/Test_Graph_graph_color_distance2.hpp @@ -278,7 +278,7 @@ void test_bipartite(lno_t numRows, lno_t numCols, size_type nnz, auto G = A.graph; rowmap_t t_rowmap("rowmap^T", numCols + 1); entries_t t_entries("entries^T", G.entries.extent(0)); - KokkosKernels::Impl::transpose_graph( numRows, numCols, G.row_map, G.entries, t_rowmap, t_entries); // TODO: remove me, shouldn't be needed even with UVM diff --git a/unit_test/sparse/Test_Sparse_Transpose.hpp b/unit_test/sparse/Test_Sparse_Transpose.hpp index 7431d0c485..f210873999 100644 --- a/unit_test/sparse/Test_Sparse_Transpose.hpp +++ b/unit_test/sparse/Test_Sparse_Transpose.hpp @@ -104,22 +104,22 @@ void testTranspose(int numRows, int numCols, bool doValues) { Kokkos::view_alloc(Kokkos::WithoutInitializing, "Values^T"), input_mat.values.extent(0)); if (doValues) { - KokkosKernels::Impl::transpose_matrix( numRows, numCols, input_mat.graph.row_map, input_mat.graph.entries, input_mat.values, t_rowmap, t_entries, t_values); - KokkosKernels::Impl::transpose_matrix( numCols, numRows, t_rowmap, t_entries, t_values, tt_rowmap, tt_entries, tt_values); } else { - KokkosKernels::Impl::transpose_graph( numRows, numCols, input_mat.graph.row_map, input_mat.graph.entries, t_rowmap, t_entries); - KokkosKernels::Impl::transpose_graph( numCols, numRows, t_rowmap, t_entries, tt_rowmap, tt_entries); } diff --git a/unit_test/sparse/Test_Sparse_block_gauss_seidel.hpp b/unit_test/sparse/Test_Sparse_block_gauss_seidel.hpp index 0f4c9b0d67..3db10f71b1 100644 --- a/unit_test/sparse/Test_Sparse_block_gauss_seidel.hpp +++ b/unit_test/sparse/Test_Sparse_block_gauss_seidel.hpp @@ -71,6 +71,7 @@ using namespace KokkosKernels; using namespace KokkosKernels::Impl; using namespace KokkosKernels::Experimental; using namespace KokkosSparse; +using namespace KokkosSparse::Impl; using namespace KokkosSparse::Experimental; namespace Test { @@ -176,7 +177,7 @@ int run_block_gauss_seidel_1( } // namespace Test -template void test_block_gauss_seidel_rank1(lno_t numRows, size_type nnz, lno_t bandwidth, lno_t row_size_variance) { @@ -212,7 +213,7 @@ void test_block_gauss_seidel_rank1(lno_t numRows, size_type nnz, // this makes consecutive 5 rows to have same columns. // it will add scalar 0's for those entries that does not exists. // the result is still a point crs matrix. - KokkosKernels::Impl::kk_create_blockcrs_formated_point_crsmatrix( + KokkosSparse::Impl::kk_create_blockcrs_formated_point_crsmatrix( block_size, crsmat.numRows(), crsmat.numCols(), crsmat.graph.row_map, crsmat.graph.entries, crsmat.values, out_r, out_c, pf_rm, pf_e, pf_v); graph_t static_graph2(pf_e, pf_rm); @@ -263,7 +264,7 @@ void test_block_gauss_seidel_rank1(lno_t numRows, size_type nnz, // device::execution_space::finalize(); } -template void test_block_gauss_seidel_rank2(lno_t numRows, size_type nnz, lno_t bandwidth, lno_t row_size_variance) { @@ -300,7 +301,7 @@ void test_block_gauss_seidel_rank2(lno_t numRows, size_type nnz, // this makes consecutive 5 rows to have same columns. // it will add scalar 0's for those entries that does not exists. // the result is still a point crs matrix. - KokkosKernels::Impl::kk_create_blockcrs_formated_point_crsmatrix( + KokkosSparse::Impl::kk_create_blockcrs_formated_point_crsmatrix( block_size, crsmat.numRows(), crsmat.numCols(), crsmat.graph.row_map, crsmat.graph.entries, crsmat.values, out_r, out_c, pf_rm, pf_e, pf_v); graph_t static_graph2(pf_e, pf_rm); @@ -373,7 +374,7 @@ void test_block_gauss_seidel_rank2(lno_t numRows, size_type nnz, // device::execution_space::finalize(); } -template void test_block_gauss_seidel_empty() { using namespace Test; @@ -421,37 +422,37 @@ void test_block_gauss_seidel_empty() { TEST_F( \ TestCategory, \ sparse_blockcrs_gauss_seidel_rank1##_##SCALAR##_##ORDINAL##_##OFFSET##_##DEVICE) { \ - test_block_gauss_seidel_rank1( \ + test_block_gauss_seidel_rank1( \ 500, 500 * 10, 70, 3); \ } \ TEST_F( \ TestCategory, \ sparse_blockcrs_gauss_seidel_rank2_##SCALAR##_##ORDINAL##_##OFFSET##_##DEVICE) { \ - test_block_gauss_seidel_rank2( \ + test_block_gauss_seidel_rank2( \ 500, 500 * 10, 70, 3); \ } \ TEST_F( \ TestCategory, \ sparse_blockcrs_gauss_seidel_empty_##SCALAR##_##ORDINAL##_##OFFSET##_##DEVICE) { \ - test_block_gauss_seidel_empty(); \ } \ TEST_F( \ TestCategory, \ sparse_bsr_gauss_seidel_rank1_##SCALAR##_##ORDINAL##_##OFFSET##_##DEVICE) { \ - test_block_gauss_seidel_rank1( \ + test_block_gauss_seidel_rank1( \ 500, 500 * 10, 70, 3); \ } \ TEST_F( \ TestCategory, \ sparse_bsr_gauss_seidel_rank2_##SCALAR##_##ORDINAL##_##OFFSET##_##DEVICE) { \ - test_block_gauss_seidel_rank2( \ + test_block_gauss_seidel_rank2( \ 500, 500 * 10, 70, 3); \ } \ TEST_F( \ TestCategory, \ sparse_bsr_gauss_seidel_empty_##SCALAR##_##ORDINAL##_##OFFSET##_##DEVICE) { \ - test_block_gauss_seidel_empty(); \ + test_block_gauss_seidel_empty(); \ } #include diff --git a/unit_test/sparse/Test_Sparse_spgemm.hpp b/unit_test/sparse/Test_Sparse_spgemm.hpp index 35473046d8..f52306ef74 100644 --- a/unit_test/sparse/Test_Sparse_spgemm.hpp +++ b/unit_test/sparse/Test_Sparse_spgemm.hpp @@ -403,7 +403,7 @@ void test_issue402() { lno_view_t Browmap("B = A^T rowmap", numRows + 1); lno_nnz_view_t Bentries("B = A^T entries", nnz); scalar_view_t Bvalues("B = A^T values", nnz); - KokkosKernels::Impl::transpose_matrix< + KokkosSparse::Impl::transpose_matrix< lno_view_t, lno_nnz_view_t, scalar_view_t, lno_view_t, lno_nnz_view_t, scalar_view_t, lno_view_t, typename device::execution_space>( numRows, numRows, Arowmap, Aentries, Avalues, Browmap, Bentries, Bvalues); From 86ea70283537a14972e18d4c7a9a9e5366c989e6 Mon Sep 17 00:00:00 2001 From: Luc Berger-Vergiat Date: Thu, 9 Jun 2022 17:49:50 -0600 Subject: [PATCH 2/4] KokkosSparse Utils: applying clang-format --- .../sparse/KokkosSparse_sptrsv_supernode.cpp | 8 +- src/graph/KokkosGraph_Distance2Color.hpp | 4 +- src/sparse/KokkosSparse_Utils.hpp | 74 +++++++++++-------- .../Test_Graph_graph_color_distance2.hpp | 2 +- unit_test/sparse/Test_Sparse_Transpose.hpp | 12 +-- .../sparse/Test_Sparse_block_gauss_seidel.hpp | 35 ++++----- 6 files changed, 75 insertions(+), 60 deletions(-) diff --git a/perf_test/sparse/KokkosSparse_sptrsv_supernode.cpp b/perf_test/sparse/KokkosSparse_sptrsv_supernode.cpp index fcfc66b74e..612b327d5f 100644 --- a/perf_test/sparse/KokkosSparse_sptrsv_supernode.cpp +++ b/perf_test/sparse/KokkosSparse_sptrsv_supernode.cpp @@ -155,10 +155,10 @@ int test_sptrsv_perf(std::vector tests, bool verbose, cols_view_t entries("colmap_view", nnzL); values_view_t values("values_view", nnzL); // transpose L - KokkosSparse::Impl::transpose_matrix(nrows, nrows, row_mapM, entriesM, - valuesM, row_map, entries, values); + KokkosSparse::Impl::transpose_matrix< + in_row_map_view_t, in_cols_view_t, in_values_view_t, row_map_view_t, + cols_view_t, values_view_t, row_map_view_t, host_execution_space>( + nrows, nrows, row_mapM, entriesM, valuesM, row_map, entries, values); // store L in CSC host_graph_t static_graph(entries, row_map); diff --git a/src/graph/KokkosGraph_Distance2Color.hpp b/src/graph/KokkosGraph_Distance2Color.hpp index 7bf19452b4..dbfd1b40e9 100644 --- a/src/graph/KokkosGraph_Distance2Color.hpp +++ b/src/graph/KokkosGraph_Distance2Color.hpp @@ -158,7 +158,7 @@ void bipartite_color_rows(KernelHandle *handle, col_map = TRowmap("Col map", num_columns + 1); col_entries = TEntries("Col entries", nnz); KokkosSparse::Impl::transpose_graph( + TRowmap, execution_space>( num_rows, num_columns, row_map, row_entries, col_map, col_entries); } InternalRowmap rowmap_internal(row_map.data(), row_map.extent(0)); @@ -236,7 +236,7 @@ void bipartite_color_columns(KernelHandle *handle, TEntries col_entries( Kokkos::view_alloc(Kokkos::WithoutInitializing, "Col entries"), nnz); KokkosSparse::Impl::transpose_graph( + TRowmap, execution_space>( num_rows, num_columns, row_map, row_entries, col_map, col_entries); // Get unmanaged views for both graph and its transpose InternalRowmap colmap_internal(col_map.data(), col_map.extent(0)); diff --git a/src/sparse/KokkosSparse_Utils.hpp b/src/sparse/KokkosSparse_Utils.hpp index c84c928d05..0ad7102dd5 100644 --- a/src/sparse/KokkosSparse_Utils.hpp +++ b/src/sparse/KokkosSparse_Utils.hpp @@ -59,7 +59,7 @@ namespace KokkosSparse { -enum SparseMatrixFormat { +enum SparseMatrixFormat { BlockCRS, BSR, CRS = BlockCRS, // convenience alias: for block_size=1 or no-blocks there is @@ -425,7 +425,8 @@ void transpose_matrix( // determine vector lanes per thread int thread_size = kk_get_suggested_vector_size( - num_rows, nnz, KokkosKernels::Impl::kk_get_exec_space_type()); + num_rows, nnz, + KokkosKernels::Impl::kk_get_exec_space_type()); // determine threads per team int team_size = kk_get_suggested_team_size( @@ -439,8 +440,9 @@ void transpose_matrix( team_size, thread_size), tm); - KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum(num_cols + 1, - t_xadj); + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum( + num_cols + 1, t_xadj); Kokkos::deep_copy(tmp_row_view, t_xadj); @@ -508,7 +510,8 @@ void transpose_graph( // determine vector lanes per thread int thread_size = kk_get_suggested_vector_size( - num_rows, nnz, KokkosKernels::Impl::kk_get_exec_space_type()); + num_rows, nnz, + KokkosKernels::Impl::kk_get_exec_space_type()); // determine threads per team int team_size = kk_get_suggested_team_size( @@ -522,8 +525,9 @@ void transpose_graph( team_size, thread_size), tm); - KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum(num_cols + 1, - t_xadj); + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum( + num_cols + 1, t_xadj); Kokkos::deep_copy(tmp_row_view, t_xadj); @@ -715,7 +719,8 @@ void kk_create_reverse_map( // kk_inclusive_parallel_prefix_sum(tmp_reverse_size + 1, tmp_color_xadj); - KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum( + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum( tmp_reverse_size + 1, tmp_color_xadj); MyExecSpace().fence(); @@ -750,7 +755,8 @@ void kk_create_reverse_map( // kk_inclusive_parallel_prefix_sum(num_reverse_elements + 1, reverse_map_xadj); - KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum( + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum( num_reverse_elements + 1, tmp_color_xadj); MyExecSpace().fence(); @@ -843,7 +849,8 @@ inline size_t kk_is_d1_coloring_valid( typename in_nnz_view_t::non_const_value_type num_rows, typename in_nnz_view_t::non_const_value_type /*num_cols*/, in_row_view_t xadj, in_nnz_view_t adj, in_color_view_t v_colors) { - KokkosKernels::Impl::ExecSpaceType my_exec_space = KokkosKernels::Impl::kk_get_exec_space_type(); + KokkosKernels::Impl::ExecSpaceType my_exec_space = + KokkosKernels::Impl::kk_get_exec_space_type(); int vector_size = kk_get_suggested_vector_size(num_rows, adj.extent(0), my_exec_space); int suggested_team_size = @@ -1003,7 +1010,8 @@ struct LowerTriangularMatrix { t_adj(t_adj_), t_vals(out_vals_), team_work_size(team_row_work_size_), - exec_space(KokkosKernels::Impl::kk_get_exec_space_type()), + exec_space( + KokkosKernels::Impl::kk_get_exec_space_type()), is_lower(is_lower_) {} KOKKOS_INLINE_FUNCTION @@ -1122,7 +1130,8 @@ void kk_get_lower_triangle_count_parallel( const int vector_size = kk_get_suggested_vector_size( nv, ne, KokkosKernels::Impl::kk_get_exec_space_type()); const int suggested_team_size = kk_get_suggested_team_size( - vector_size, KokkosKernels::Impl::kk_get_exec_space_type()); + vector_size, + KokkosKernels::Impl::kk_get_exec_space_type()); const int team_work_chunk_size = suggested_team_size * chunksize; typedef LowerTriangularMatrix ltm_t; @@ -1287,7 +1296,8 @@ void kk_get_lower_triangle_fill_parallel( const int vector_size = kk_get_suggested_vector_size( nv, ne, KokkosKernels::Impl::kk_get_exec_space_type()); const int suggested_team_size = kk_get_suggested_team_size( - vector_size, KokkosKernels::Impl::kk_get_exec_space_type()); + vector_size, + KokkosKernels::Impl::kk_get_exec_space_type()); const int team_work_chunk_size = suggested_team_size * chunksize; typedef LowerTriangularMatrix @@ -1419,8 +1429,9 @@ crstmat_t kk_get_lower_triangle( nr, ne, rowmap, entries, new_row_map.data(), new_indices, use_dynamic_scheduling, chunksize); - KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum(nr + 1, - new_row_map); + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum( + nr + 1, new_row_map); exec_space().fence(); auto ll_size = Kokkos::subview(new_row_map, nr); @@ -1476,8 +1487,9 @@ crstmat_t kk_get_lower_crs_matrix( nr, ne, rowmap, entries, new_row_map.data(), new_indices, use_dynamic_scheduling, chunksize); - KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum(nr + 1, - new_row_map); + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum( + nr + 1, new_row_map); exec_space().fence(); auto ll_size = Kokkos::subview(new_row_map, nr); @@ -1529,8 +1541,9 @@ graph_t kk_get_lower_crs_graph(graph_t in_crs_matrix, kk_get_lower_triangle_count( nr, ne, rowmap, entries, new_row_map.data(), new_indices); - KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum(nr + 1, - new_row_map); + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum( + nr + 1, new_row_map); exec_space().fence(); auto ll_size = Kokkos::subview(new_row_map, nr); @@ -1582,8 +1595,9 @@ void kk_get_lower_triangle(typename cols_view_t::non_const_value_type nr, nr, ne, rowmap, entries, out_rowmap.data(), new_indices.data(), use_dynamic_scheduling, chunksize, is_lower); - KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum(nr + 1, - out_rowmap); + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum(nr + 1, + out_rowmap); exec_space().fence(); auto ll_size = Kokkos::subview(out_rowmap, nr); @@ -1690,8 +1704,9 @@ void kk_create_incidence_matrix_from_original_matrix( permutation.data(), use_dynamic_scheduling, chunksize, sort_decreasing_order); exec_space().fence(); - KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum(nr + 1, - out_rowmap); + KokkosKernels::Impl::kk_exclusive_parallel_prefix_sum(nr + 1, + out_rowmap); // kk_print_1Dview(out_rowmap, false, 20); @@ -1966,16 +1981,15 @@ struct MatrixConverter { }; } // namespace Impl -} // namespace KokkosSparse +} // namespace KokkosSparse namespace KokkosKernels { -enum [[deprecated]] SparseMatrixFormat { - BlockCRS, - BSR, - CRS = BlockCRS, // convenience alias: for block_size=1 or no-blocks there is - // no difference in value ordering (so the format tag becomes - // irrelevant) +enum [[deprecated]] SparseMatrixFormat{ + BlockCRS, BSR, + CRS = BlockCRS, // convenience alias: for block_size=1 or no-blocks there + // is no difference in value ordering (so the format tag + // becomes irrelevant) }; } // namespace KokkosKernels diff --git a/unit_test/graph/Test_Graph_graph_color_distance2.hpp b/unit_test/graph/Test_Graph_graph_color_distance2.hpp index bca2855fea..c78e8c2f5f 100644 --- a/unit_test/graph/Test_Graph_graph_color_distance2.hpp +++ b/unit_test/graph/Test_Graph_graph_color_distance2.hpp @@ -279,7 +279,7 @@ void test_bipartite(lno_t numRows, lno_t numCols, size_type nnz, rowmap_t t_rowmap("rowmap^T", numCols + 1); entries_t t_entries("entries^T", G.entries.extent(0)); KokkosSparse::Impl::transpose_graph( + entries_t, rowmap_t, execution_space>( numRows, numCols, G.row_map, G.entries, t_rowmap, t_entries); // TODO: remove me, shouldn't be needed even with UVM execution_space().fence(); diff --git a/unit_test/sparse/Test_Sparse_Transpose.hpp b/unit_test/sparse/Test_Sparse_Transpose.hpp index f210873999..530614eace 100644 --- a/unit_test/sparse/Test_Sparse_Transpose.hpp +++ b/unit_test/sparse/Test_Sparse_Transpose.hpp @@ -105,22 +105,22 @@ void testTranspose(int numRows, int numCols, bool doValues) { input_mat.values.extent(0)); if (doValues) { KokkosSparse::Impl::transpose_matrix( + rowmap_t, entries_t, values_t, + rowmap_t, exec_space>( numRows, numCols, input_mat.graph.row_map, input_mat.graph.entries, input_mat.values, t_rowmap, t_entries, t_values); KokkosSparse::Impl::transpose_matrix( + rowmap_t, entries_t, values_t, + rowmap_t, exec_space>( numCols, numRows, t_rowmap, t_entries, t_values, tt_rowmap, tt_entries, tt_values); } else { KokkosSparse::Impl::transpose_graph( + entries_t, rowmap_t, exec_space>( numRows, numCols, input_mat.graph.row_map, input_mat.graph.entries, t_rowmap, t_entries); KokkosSparse::Impl::transpose_graph( + entries_t, rowmap_t, exec_space>( numCols, numRows, t_rowmap, t_entries, tt_rowmap, tt_entries); } // Sort both the transpose-transpose, and the original matrix (to compare diff --git a/unit_test/sparse/Test_Sparse_block_gauss_seidel.hpp b/unit_test/sparse/Test_Sparse_block_gauss_seidel.hpp index 3db10f71b1..9092e78d79 100644 --- a/unit_test/sparse/Test_Sparse_block_gauss_seidel.hpp +++ b/unit_test/sparse/Test_Sparse_block_gauss_seidel.hpp @@ -177,8 +177,8 @@ int run_block_gauss_seidel_1( } // namespace Test -template +template void test_block_gauss_seidel_rank1(lno_t numRows, size_type nnz, lno_t bandwidth, lno_t row_size_variance) { using namespace Test; @@ -264,8 +264,8 @@ void test_block_gauss_seidel_rank1(lno_t numRows, size_type nnz, // device::execution_space::finalize(); } -template +template void test_block_gauss_seidel_rank2(lno_t numRows, size_type nnz, lno_t bandwidth, lno_t row_size_variance) { using namespace Test; @@ -374,8 +374,8 @@ void test_block_gauss_seidel_rank2(lno_t numRows, size_type nnz, // device::execution_space::finalize(); } -template +template void test_block_gauss_seidel_empty() { using namespace Test; typedef @@ -422,37 +422,38 @@ void test_block_gauss_seidel_empty() { TEST_F( \ TestCategory, \ sparse_blockcrs_gauss_seidel_rank1##_##SCALAR##_##ORDINAL##_##OFFSET##_##DEVICE) { \ - test_block_gauss_seidel_rank1( \ - 500, 500 * 10, 70, 3); \ + test_block_gauss_seidel_rank1(500, 500 * 10, 70, 3); \ } \ TEST_F( \ TestCategory, \ sparse_blockcrs_gauss_seidel_rank2_##SCALAR##_##ORDINAL##_##OFFSET##_##DEVICE) { \ - test_block_gauss_seidel_rank2( \ - 500, 500 * 10, 70, 3); \ + test_block_gauss_seidel_rank2(500, 500 * 10, 70, 3); \ } \ TEST_F( \ TestCategory, \ sparse_blockcrs_gauss_seidel_empty_##SCALAR##_##ORDINAL##_##OFFSET##_##DEVICE) { \ - test_block_gauss_seidel_empty(); \ + test_block_gauss_seidel_empty(); \ } \ TEST_F( \ TestCategory, \ sparse_bsr_gauss_seidel_rank1_##SCALAR##_##ORDINAL##_##OFFSET##_##DEVICE) { \ - test_block_gauss_seidel_rank1( \ - 500, 500 * 10, 70, 3); \ + test_block_gauss_seidel_rank1(500, 500 * 10, 70, 3); \ } \ TEST_F( \ TestCategory, \ sparse_bsr_gauss_seidel_rank2_##SCALAR##_##ORDINAL##_##OFFSET##_##DEVICE) { \ - test_block_gauss_seidel_rank2( \ - 500, 500 * 10, 70, 3); \ + test_block_gauss_seidel_rank2(500, 500 * 10, 70, 3); \ } \ TEST_F( \ TestCategory, \ sparse_bsr_gauss_seidel_empty_##SCALAR##_##ORDINAL##_##OFFSET##_##DEVICE) { \ - test_block_gauss_seidel_empty(); \ + test_block_gauss_seidel_empty(); \ } #include From 35e2f621c2eb4b7bc858162db4532457ab292aef Mon Sep 17 00:00:00 2001 From: Luc Berger-Vergiat Date: Wed, 13 Jul 2022 18:11:37 -0600 Subject: [PATCH 3/4] Sparse Utils: fixing some spelling and alias namespaces Using namespace alias is preferable to importing the content of namespaces since it avoids potential clashes. Of course using fully specified function names is also fine. Signed-off-by: Luc Berger-Vergiat --- perf_test/sparse/KokkosSparse_block_pcg.cpp | 2 +- .../sparse/KokkosSparse_sptrsv_supernode.cpp | 33 ++++----- src/sparse/KokkosSparse_Utils.hpp | 6 +- .../sparse/Test_Sparse_block_gauss_seidel.hpp | 68 ++++++++----------- 4 files changed, 46 insertions(+), 63 deletions(-) diff --git a/perf_test/sparse/KokkosSparse_block_pcg.cpp b/perf_test/sparse/KokkosSparse_block_pcg.cpp index 5664e943fb..a1758c1ae7 100644 --- a/perf_test/sparse/KokkosSparse_block_pcg.cpp +++ b/perf_test/sparse/KokkosSparse_block_pcg.cpp @@ -322,7 +322,7 @@ void run_experiment( // typedef typename lno_nnz_view_t::value_type lno_t; // typedef typename lno_view_t::value_type size_type; // typedef typename scalar_view_t::value_type scalar_t; - KokkosSparse::Impl::kk_create_blockcrs_formated_point_crsmatrix( + KokkosSparse::Impl::kk_create_blockcrs_formatted_point_crsmatrix( block_size, crsmat.numRows(), crsmat.numCols(), crsmat.graph.row_map, crsmat.graph.entries, crsmat.values, out_r, out_c, pf_rm, pf_e, pf_v); diff --git a/perf_test/sparse/KokkosSparse_sptrsv_supernode.cpp b/perf_test/sparse/KokkosSparse_sptrsv_supernode.cpp index 612b327d5f..b7eb39d68e 100644 --- a/perf_test/sparse/KokkosSparse_sptrsv_supernode.cpp +++ b/perf_test/sparse/KokkosSparse_sptrsv_supernode.cpp @@ -59,13 +59,8 @@ #include "KokkosSparse_sptrsv_aux.hpp" -using namespace KokkosKernels; -using namespace KokkosKernels::Impl; -using namespace KokkosKernels::Experimental; -using namespace KokkosSparse; -using namespace KokkosSparse::Impl; -using namespace KokkosSparse::Experimental; -using namespace KokkosSparse::PerfTest::Experimental; +namespace KSExp = KokkosSparse::Experimental; +namespace KSPTE = KokkosSparse::PerfTest::Experimental; enum { CUSPARSE, @@ -213,23 +208,23 @@ int test_sptrsv_perf(std::vector tests, bool verbose, if (test == SUPERNODAL_NAIVE) { std::cout << " > create handle for SUPERNODAL_NAIVE" << std::endl << std::endl; - khL.create_sptrsv_handle(SPTRSVAlgorithm::SUPERNODAL_NAIVE, nrows, + khL.create_sptrsv_handle(KSExp::SPTRSVAlgorithm::SUPERNODAL_NAIVE, nrows, true); - khU.create_sptrsv_handle(SPTRSVAlgorithm::SUPERNODAL_NAIVE, nrows, + khU.create_sptrsv_handle(KSExp::SPTRSVAlgorithm::SUPERNODAL_NAIVE, nrows, true); } else if (test == SUPERNODAL_DAG) { std::cout << " > create handle for SUPERNODAL_DAG" << std::endl << std::endl; - khL.create_sptrsv_handle(SPTRSVAlgorithm::SUPERNODAL_DAG, nrows, + khL.create_sptrsv_handle(KSExp::SPTRSVAlgorithm::SUPERNODAL_DAG, nrows, true); - khU.create_sptrsv_handle(SPTRSVAlgorithm::SUPERNODAL_DAG, nrows, + khU.create_sptrsv_handle(KSExp::SPTRSVAlgorithm::SUPERNODAL_DAG, nrows, true); } else if (test == SUPERNODAL_SPMV_DAG) { std::cout << " > create handle for SUPERNODAL_SPMV_DAG" << std::endl << std::endl; - khL.create_sptrsv_handle(SPTRSVAlgorithm::SUPERNODAL_SPMV_DAG, + khL.create_sptrsv_handle(KSExp::SPTRSVAlgorithm::SUPERNODAL_SPMV_DAG, nrows, true); - khU.create_sptrsv_handle(SPTRSVAlgorithm::SUPERNODAL_SPMV_DAG, + khU.create_sptrsv_handle(KSExp::SPTRSVAlgorithm::SUPERNODAL_SPMV_DAG, nrows, true); } // verbose (optional, default is false) @@ -255,13 +250,13 @@ int test_sptrsv_perf(std::vector tests, bool verbose, // graph/dag) khU.get_sptrsv_handle()->set_column_major( !khL.get_sptrsv_handle()->is_column_major()); - sptrsv_supernodal_symbolic(nsuper, supercols.data(), etree, L.graph, - &khL, L.graph, &khU); + KSExp::sptrsv_supernodal_symbolic(nsuper, supercols.data(), etree, L.graph, + &khL, L.graph, &khU); // ============================================== // do numeric compute (copy numerical values from SuperLU data // structure to our sptrsv data structure) - sptrsv_compute(&khL, L); + KSExp::sptrsv_compute(&khL, L); // ============================================== // Preaparing for the first solve @@ -285,7 +280,7 @@ int test_sptrsv_perf(std::vector tests, bool verbose, // ============================================== // do L solve timer.reset(); - sptrsv_solve(&khL, sol, rhs); + KSExp::sptrsv_solve(&khL, sol, rhs); Kokkos::fence(); std::cout << " > Lower-TRI: " << std::endl; std::cout << " Solve Time : " << timer.seconds() << std::endl; @@ -297,7 +292,7 @@ int test_sptrsv_perf(std::vector tests, bool verbose, // Error Check ** on host ** Kokkos::fence(); std::cout << std::endl; - if (!check_errors(tol, A, rhs_host, sol_host)) { + if (!KSPTE::check_errors(tol, A, rhs_host, sol_host)) { num_failed++; } @@ -309,7 +304,7 @@ int test_sptrsv_perf(std::vector tests, bool verbose, Kokkos::fence(); for (int i = 0; i < loop; i++) { timer.reset(); - sptrsv_solve(&khL, sol, rhs); + KSExp::sptrsv_solve(&khL, sol, rhs); Kokkos::fence(); double time = timer.seconds(); ave_time += time; diff --git a/src/sparse/KokkosSparse_Utils.hpp b/src/sparse/KokkosSparse_Utils.hpp index 0ad7102dd5..db656c959b 100644 --- a/src/sparse/KokkosSparse_Utils.hpp +++ b/src/sparse/KokkosSparse_Utils.hpp @@ -72,7 +72,7 @@ namespace Impl { template -void kk_create_blockcrs_formated_point_crsmatrix( +void kk_create_blockcrs_formatted_point_crsmatrix( int block_size, size_t num_rows, size_t num_cols, in_row_view_t in_xadj, in_nnz_view_t in_adj, in_val_view_t in_vals, @@ -1958,7 +1958,7 @@ struct MatrixConverter { KokkosSparse::CrsMatrix, typename blockCrsMat_t = KokkosSparse::Experimental::BlockCrsMatrix< scalar_t, lno_t, device, void, size_type>> - static blockCrsMat_t from_blockcrs_formated_point_crsmatrix( + static blockCrsMat_t from_blockcrs_formatted_point_crsmatrix( const KokkosSparse::CrsMatrix &mtx, lno_t block_size) { @@ -1972,7 +1972,7 @@ struct MatrixConverter { typename device, typename bsrMtx_t = KokkosSparse::Experimental::BsrMatrix< scalar_t, lno_t, device, void, size_type>> - static bsrMtx_t from_blockcrs_formated_point_crsmatrix( + static bsrMtx_t from_blockcrs_formatted_point_crsmatrix( const KokkosSparse::CrsMatrix &mtx, lno_t block_size) { diff --git a/unit_test/sparse/Test_Sparse_block_gauss_seidel.hpp b/unit_test/sparse/Test_Sparse_block_gauss_seidel.hpp index 9092e78d79..b0c57ccf7e 100644 --- a/unit_test/sparse/Test_Sparse_block_gauss_seidel.hpp +++ b/unit_test/sparse/Test_Sparse_block_gauss_seidel.hpp @@ -59,20 +59,10 @@ #include #include "KokkosSparse_gauss_seidel.hpp" -// #ifndef kokkos_complex_double -// #define kokkos_complex_double Kokkos::complex -// #define kokkos_complex_float Kokkos::complex -// #endif +using kokkos_complex_double = Kokkos::complex; +using kokkos_complex_float = Kokkos::complex; -typedef Kokkos::complex kokkos_complex_double; -typedef Kokkos::complex kokkos_complex_float; - -using namespace KokkosKernels; -using namespace KokkosKernels::Impl; -using namespace KokkosKernels::Experimental; -using namespace KokkosSparse; -using namespace KokkosSparse::Impl; -using namespace KokkosSparse::Experimental; +namespace KSExp = KokkosSparse::Experimental; namespace Test { @@ -92,7 +82,7 @@ struct GSTestParams { // Note: GS_DEFAULT is same as GS_TEAM and - for blocks - as GS_PERMUTED // Note: GS_TWOSTAGE and GS_CLUSTER are not supported for blocks - std::vector gs_algorithms = {GS_DEFAULT}; + std::vector gs_algorithms = {KokkosSparse::GS_DEFAULT}; std::vector shmem_sizes = { 32128, 2008 // make the shmem small on gpus so that it will test 2 level @@ -121,12 +111,11 @@ int run_block_gauss_seidel_1( typedef typename lno_nnz_view_t::value_type lno_t; typedef typename scalar_view_t::value_type scalar_t; - constexpr auto format = MatrixTraits::format; + constexpr auto format = KokkosSparse::Impl::MatrixTraits::format; - typedef KokkosKernelsHandle< + using KernelHandle = KokkosKernels::Experimental::KokkosKernelsHandle< size_type, lno_t, scalar_t, typename mtx_t::execution_space, - typename mtx_t::memory_space, typename mtx_t::memory_space> - KernelHandle; + typename mtx_t::memory_space, typename mtx_t::memory_space>; KernelHandle kh; kh.set_team_work_size(16); kh.set_shmem_size(shmem_size); @@ -138,33 +127,33 @@ int run_block_gauss_seidel_1( const int apply_count = 100; if (!skip_symbolic) { - block_gauss_seidel_symbolic(&kh, num_rows_1, num_cols_1, block_size, + KSExp::block_gauss_seidel_symbolic(&kh, num_rows_1, num_cols_1, block_size, input_mat.graph.row_map, input_mat.graph.entries, is_symmetric_graph); } if (!skip_numeric) { - block_gauss_seidel_numeric( + KSExp::block_gauss_seidel_numeric( &kh, num_rows_1, num_cols_1, block_size, input_mat.graph.row_map, input_mat.graph.entries, input_mat.values, is_symmetric_graph); } switch (apply_type) { case Test::forward_sweep: - forward_sweep_block_gauss_seidel_apply( + KSExp::forward_sweep_block_gauss_seidel_apply( &kh, num_rows_1, num_cols_1, block_size, input_mat.graph.row_map, input_mat.graph.entries, input_mat.values, x_vector, y_vector, false, true, omega, apply_count); break; case Test::backward_sweep: - backward_sweep_block_gauss_seidel_apply( + KSExp::backward_sweep_block_gauss_seidel_apply( &kh, num_rows_1, num_cols_1, block_size, input_mat.graph.row_map, input_mat.graph.entries, input_mat.values, x_vector, y_vector, false, true, omega, apply_count); break; case Test::symmetric: default: - symmetric_block_gauss_seidel_apply( + KSExp::symmetric_block_gauss_seidel_apply( &kh, num_rows_1, num_cols_1, block_size, input_mat.graph.row_map, input_mat.graph.entries, input_mat.values, x_vector, y_vector, false, true, omega, apply_count); @@ -183,9 +172,9 @@ void test_block_gauss_seidel_rank1(lno_t numRows, size_type nnz, lno_t bandwidth, lno_t row_size_variance) { using namespace Test; srand(245); - typedef - typename KokkosSparse::CrsMatrix - crsMat_t; + using crsMat_t = + typename KokkosSparse::CrsMatrix; + using MatrixConverter = KokkosSparse::Impl::MatrixConverter; typedef typename device::execution_space exec_space; typedef typename crsMat_t::StaticCrsGraphType graph_t; @@ -213,7 +202,7 @@ void test_block_gauss_seidel_rank1(lno_t numRows, size_type nnz, // this makes consecutive 5 rows to have same columns. // it will add scalar 0's for those entries that does not exists. // the result is still a point crs matrix. - KokkosSparse::Impl::kk_create_blockcrs_formated_point_crsmatrix( + KokkosSparse::Impl::kk_create_blockcrs_formatted_point_crsmatrix( block_size, crsmat.numRows(), crsmat.numCols(), crsmat.graph.row_map, crsmat.graph.entries, crsmat.values, out_r, out_c, pf_rm, pf_e, pf_v); graph_t static_graph2(pf_e, pf_rm); @@ -221,7 +210,7 @@ void test_block_gauss_seidel_rank1(lno_t numRows, size_type nnz, // this converts the previous generated matrix to block matrix. auto input_mat = - MatrixConverter::from_blockcrs_formated_point_crsmatrix( + MatrixConverter::from_blockcrs_formatted_point_crsmatrix( crsmat2, block_size); lno_t nv = ((crsmat2.numRows() + block_size - 1) / block_size) * block_size; @@ -270,9 +259,9 @@ void test_block_gauss_seidel_rank2(lno_t numRows, size_type nnz, lno_t bandwidth, lno_t row_size_variance) { using namespace Test; srand(245); - typedef - typename KokkosSparse::CrsMatrix - crsMat_t; + using crsMat_t = + typename KokkosSparse::CrsMatrix; + using MatrixConverter = KokkosSparse::Impl::MatrixConverter; typedef typename device::execution_space exec_space; typedef typename crsMat_t::StaticCrsGraphType graph_t; @@ -301,14 +290,14 @@ void test_block_gauss_seidel_rank2(lno_t numRows, size_type nnz, // this makes consecutive 5 rows to have same columns. // it will add scalar 0's for those entries that does not exists. // the result is still a point crs matrix. - KokkosSparse::Impl::kk_create_blockcrs_formated_point_crsmatrix( + KokkosSparse::Impl::kk_create_blockcrs_formatted_point_crsmatrix( block_size, crsmat.numRows(), crsmat.numCols(), crsmat.graph.row_map, crsmat.graph.entries, crsmat.values, out_r, out_c, pf_rm, pf_e, pf_v); graph_t static_graph2(pf_e, pf_rm); crsMat_t crsmat2("CrsMatrix2", out_c, pf_v, static_graph2); auto input_mat = - MatrixConverter::from_blockcrs_formated_point_crsmatrix( + MatrixConverter::from_blockcrs_formatted_point_crsmatrix( crsmat2, block_size); lno_t nv = ((crsmat2.numRows() + block_size - 1) / block_size) * block_size; @@ -385,10 +374,9 @@ void test_block_gauss_seidel_empty() { typedef typename graph_t::row_map_type::non_const_type row_map_type; typedef typename graph_t::entries_type::non_const_type entries_type; typedef typename crsMat_t::values_type::non_const_type scalar_view_t; - typedef KokkosKernelsHandle< + using KernelHandle = KokkosKernels::Experimental::KokkosKernelsHandle< size_type, lno_t, scalar_t, typename device::execution_space, - typename device::memory_space, typename device::memory_space> - KernelHandle; + typename device::memory_space, typename device::memory_space>; // The rowmap of a zero-row matrix can be length 0 or 1, so Gauss-Seidel // should work with both (the setup and apply are essentially no-ops but they // shouldn't crash or throw exceptions) For this test, create size-0 and @@ -396,7 +384,7 @@ void test_block_gauss_seidel_empty() { // which can trigger different bugs. for (const int rowmapLen : {0, 1, 5}) { KernelHandle kh; - kh.create_gs_handle(GS_DEFAULT); + kh.create_gs_handle(KokkosSparse::GS_DEFAULT); const auto num_rows = KOKKOSKERNELS_MACRO_MAX(0, rowmapLen - 1); const lno_t block_size = 1; // irrelevant (no values here) // initialized to 0 @@ -404,14 +392,14 @@ void test_block_gauss_seidel_empty() { entries_type entries("Entries", 0); scalar_view_t values("Values", 0); // also, make sure graph symmetrization doesn't crash on zero rows - block_gauss_seidel_symbolic(&kh, num_rows, num_rows, block_size, rowmap, + KSExp::block_gauss_seidel_symbolic(&kh, num_rows, num_rows, block_size, rowmap, entries, false); - block_gauss_seidel_numeric(&kh, num_rows, num_rows, block_size, + KSExp::block_gauss_seidel_numeric(&kh, num_rows, num_rows, block_size, rowmap, entries, values, false); scalar_view_t x("X", num_rows); scalar_view_t y("Y", num_rows); scalar_t omega(0.9); - symmetric_block_gauss_seidel_apply( + KSExp::symmetric_block_gauss_seidel_apply( &kh, num_rows, num_rows, block_size, rowmap, entries, values, x, y, false, true, omega, 3); kh.destroy_gs_handle(); From 9f3c4bc8b36f0bf9b7f23dde55f37318f5de11b1 Mon Sep 17 00:00:00 2001 From: Luc Berger-Vergiat Date: Thu, 14 Jul 2022 09:09:42 -0600 Subject: [PATCH 4/4] KokkosSparse: applying clang format to Utils --- .../sparse/KokkosSparse_sptrsv_supernode.cpp | 28 +++++++------- .../sparse/Test_Sparse_block_gauss_seidel.hpp | 37 +++++++++---------- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/perf_test/sparse/KokkosSparse_sptrsv_supernode.cpp b/perf_test/sparse/KokkosSparse_sptrsv_supernode.cpp index b7eb39d68e..b77f0b1d07 100644 --- a/perf_test/sparse/KokkosSparse_sptrsv_supernode.cpp +++ b/perf_test/sparse/KokkosSparse_sptrsv_supernode.cpp @@ -208,24 +208,24 @@ int test_sptrsv_perf(std::vector tests, bool verbose, if (test == SUPERNODAL_NAIVE) { std::cout << " > create handle for SUPERNODAL_NAIVE" << std::endl << std::endl; - khL.create_sptrsv_handle(KSExp::SPTRSVAlgorithm::SUPERNODAL_NAIVE, nrows, - true); - khU.create_sptrsv_handle(KSExp::SPTRSVAlgorithm::SUPERNODAL_NAIVE, nrows, - true); + khL.create_sptrsv_handle(KSExp::SPTRSVAlgorithm::SUPERNODAL_NAIVE, + nrows, true); + khU.create_sptrsv_handle(KSExp::SPTRSVAlgorithm::SUPERNODAL_NAIVE, + nrows, true); } else if (test == SUPERNODAL_DAG) { std::cout << " > create handle for SUPERNODAL_DAG" << std::endl << std::endl; - khL.create_sptrsv_handle(KSExp::SPTRSVAlgorithm::SUPERNODAL_DAG, nrows, - true); - khU.create_sptrsv_handle(KSExp::SPTRSVAlgorithm::SUPERNODAL_DAG, nrows, - true); + khL.create_sptrsv_handle(KSExp::SPTRSVAlgorithm::SUPERNODAL_DAG, + nrows, true); + khU.create_sptrsv_handle(KSExp::SPTRSVAlgorithm::SUPERNODAL_DAG, + nrows, true); } else if (test == SUPERNODAL_SPMV_DAG) { std::cout << " > create handle for SUPERNODAL_SPMV_DAG" << std::endl << std::endl; - khL.create_sptrsv_handle(KSExp::SPTRSVAlgorithm::SUPERNODAL_SPMV_DAG, - nrows, true); - khU.create_sptrsv_handle(KSExp::SPTRSVAlgorithm::SUPERNODAL_SPMV_DAG, - nrows, true); + khL.create_sptrsv_handle( + KSExp::SPTRSVAlgorithm::SUPERNODAL_SPMV_DAG, nrows, true); + khU.create_sptrsv_handle( + KSExp::SPTRSVAlgorithm::SUPERNODAL_SPMV_DAG, nrows, true); } // verbose (optional, default is false) khL.set_sptrsv_verbose(verbose); @@ -250,8 +250,8 @@ int test_sptrsv_perf(std::vector tests, bool verbose, // graph/dag) khU.get_sptrsv_handle()->set_column_major( !khL.get_sptrsv_handle()->is_column_major()); - KSExp::sptrsv_supernodal_symbolic(nsuper, supercols.data(), etree, L.graph, - &khL, L.graph, &khU); + KSExp::sptrsv_supernodal_symbolic(nsuper, supercols.data(), etree, + L.graph, &khL, L.graph, &khU); // ============================================== // do numeric compute (copy numerical values from SuperLU data diff --git a/unit_test/sparse/Test_Sparse_block_gauss_seidel.hpp b/unit_test/sparse/Test_Sparse_block_gauss_seidel.hpp index b0c57ccf7e..51e0899529 100644 --- a/unit_test/sparse/Test_Sparse_block_gauss_seidel.hpp +++ b/unit_test/sparse/Test_Sparse_block_gauss_seidel.hpp @@ -82,8 +82,9 @@ struct GSTestParams { // Note: GS_DEFAULT is same as GS_TEAM and - for blocks - as GS_PERMUTED // Note: GS_TWOSTAGE and GS_CLUSTER are not supported for blocks - std::vector gs_algorithms = {KokkosSparse::GS_DEFAULT}; - std::vector shmem_sizes = { + std::vector gs_algorithms = { + KokkosSparse::GS_DEFAULT}; + std::vector shmem_sizes = { 32128, 2008 // make the shmem small on gpus so that it will test 2 level // algorithm. @@ -127,9 +128,9 @@ int run_block_gauss_seidel_1( const int apply_count = 100; if (!skip_symbolic) { - KSExp::block_gauss_seidel_symbolic(&kh, num_rows_1, num_cols_1, block_size, - input_mat.graph.row_map, - input_mat.graph.entries, is_symmetric_graph); + KSExp::block_gauss_seidel_symbolic( + &kh, num_rows_1, num_cols_1, block_size, input_mat.graph.row_map, + input_mat.graph.entries, is_symmetric_graph); } if (!skip_numeric) { @@ -172,8 +173,8 @@ void test_block_gauss_seidel_rank1(lno_t numRows, size_type nnz, lno_t bandwidth, lno_t row_size_variance) { using namespace Test; srand(245); - using crsMat_t = - typename KokkosSparse::CrsMatrix; + using crsMat_t = typename KokkosSparse::CrsMatrix; using MatrixConverter = KokkosSparse::Impl::MatrixConverter; typedef typename device::execution_space exec_space; @@ -209,9 +210,8 @@ void test_block_gauss_seidel_rank1(lno_t numRows, size_type nnz, crsMat_t crsmat2("CrsMatrix2", out_c, pf_v, static_graph2); // this converts the previous generated matrix to block matrix. - auto input_mat = - MatrixConverter::from_blockcrs_formatted_point_crsmatrix( - crsmat2, block_size); + auto input_mat = MatrixConverter::from_blockcrs_formatted_point_crsmatrix( + crsmat2, block_size); lno_t nv = ((crsmat2.numRows() + block_size - 1) / block_size) * block_size; @@ -259,8 +259,8 @@ void test_block_gauss_seidel_rank2(lno_t numRows, size_type nnz, lno_t bandwidth, lno_t row_size_variance) { using namespace Test; srand(245); - using crsMat_t = - typename KokkosSparse::CrsMatrix; + using crsMat_t = typename KokkosSparse::CrsMatrix; using MatrixConverter = KokkosSparse::Impl::MatrixConverter; typedef typename device::execution_space exec_space; @@ -296,9 +296,8 @@ void test_block_gauss_seidel_rank2(lno_t numRows, size_type nnz, graph_t static_graph2(pf_e, pf_rm); crsMat_t crsmat2("CrsMatrix2", out_c, pf_v, static_graph2); - auto input_mat = - MatrixConverter::from_blockcrs_formatted_point_crsmatrix( - crsmat2, block_size); + auto input_mat = MatrixConverter::from_blockcrs_formatted_point_crsmatrix( + crsmat2, block_size); lno_t nv = ((crsmat2.numRows() + block_size - 1) / block_size) * block_size; @@ -392,10 +391,10 @@ void test_block_gauss_seidel_empty() { entries_type entries("Entries", 0); scalar_view_t values("Values", 0); // also, make sure graph symmetrization doesn't crash on zero rows - KSExp::block_gauss_seidel_symbolic(&kh, num_rows, num_rows, block_size, rowmap, - entries, false); - KSExp::block_gauss_seidel_numeric(&kh, num_rows, num_rows, block_size, - rowmap, entries, values, false); + KSExp::block_gauss_seidel_symbolic(&kh, num_rows, num_rows, block_size, + rowmap, entries, false); + KSExp::block_gauss_seidel_numeric( + &kh, num_rows, num_rows, block_size, rowmap, entries, values, false); scalar_view_t x("X", num_rows); scalar_view_t y("Y", num_rows); scalar_t omega(0.9);