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

Sparse utils namespace #1439

Merged
merged 4 commits into from
Jul 14, 2022
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
2 changes: 1 addition & 1 deletion perf_test/graph/KokkosGraph_mis_d2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<default_scalar>::one();
Expand Down
4 changes: 2 additions & 2 deletions perf_test/sparse/KokkosSparse_block_pcg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_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);

Expand All @@ -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);

Expand Down
52 changes: 24 additions & 28 deletions perf_test/sparse/KokkosSparse_sptrsv_supernode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,8 @@

#include "KokkosSparse_sptrsv_aux.hpp"

using namespace KokkosKernels;
using namespace KokkosKernels::Impl;
using namespace KokkosKernels::Experimental;
using namespace KokkosSparse;
using namespace KokkosSparse::Experimental;
using namespace KokkosSparse::PerfTest::Experimental;
namespace KSExp = KokkosSparse::Experimental;
namespace KSPTE = KokkosSparse::PerfTest::Experimental;

enum {
CUSPARSE,
Expand Down Expand Up @@ -154,10 +150,10 @@ int test_sptrsv_perf(std::vector<int> tests, bool verbose,
cols_view_t entries("colmap_view", nnzL);
values_view_t values("values_view", nnzL);
// transpose L
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);
KokkosSparse::Impl::transpose_matrix<
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK - maybe just remove using KokkosSparse::Impl above or switch to KsI::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);
Expand Down Expand Up @@ -212,24 +208,24 @@ int test_sptrsv_perf(std::vector<int> 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,
true);
khU.create_sptrsv_handle(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(SPTRSVAlgorithm::SUPERNODAL_DAG, nrows,
true);
khU.create_sptrsv_handle(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(SPTRSVAlgorithm::SUPERNODAL_SPMV_DAG,
nrows, true);
khU.create_sptrsv_handle(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);
Expand All @@ -254,13 +250,13 @@ int test_sptrsv_perf(std::vector<int> 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
Expand All @@ -284,7 +280,7 @@ int test_sptrsv_perf(std::vector<int> 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;
Expand All @@ -296,7 +292,7 @@ int test_sptrsv_perf(std::vector<int> 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++;
}

Expand All @@ -308,7 +304,7 @@ int test_sptrsv_perf(std::vector<int> 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;
Expand Down
8 changes: 4 additions & 4 deletions src/graph/KokkosGraph_Distance2Color.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ 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<InRowmap, InEntries, TRowmap, TEntries,
TRowmap, execution_space>(
KokkosSparse::Impl::transpose_graph<InRowmap, InEntries, TRowmap, TEntries,
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));
Expand Down Expand Up @@ -235,8 +235,8 @@ 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<InRowmap, InEntries, TRowmap, TEntries,
TRowmap, execution_space>(
KokkosSparse::Impl::transpose_graph<InRowmap, InEntries, TRowmap, TEntries,
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));
Expand Down
2 changes: 1 addition & 1 deletion src/graph/impl/KokkosGraph_Distance2MIS_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<device_t, lno_t, rowmap_t>(
KokkosSparse::Impl::graph_min_max_degree<device_t, lno_t, rowmap_t>(
rowmap, minDegree, maxDegree);
// Compute row statuses
Kokkos::parallel_for(range_pol(0, numVerts),
Expand Down
Loading