Skip to content

Commit

Permalink
KokkosKernels: temp. fix for #11655
Browse files Browse the repository at this point in the history
(Temporary) In SpGEMM, disable the check that the input matrices are
sorted if the KokkosKernels (non-TPL) implementation is going to be
called. This impl does not actually require sorted inputs, and Tpetra's
MatrixMatrix logic needs some nontrivial changes to have a sorted B.
  • Loading branch information
brian-kelley committed Mar 11, 2023
1 parent 2bd52d2 commit e7994a7
Showing 1 changed file with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,26 @@ void spgemm_symbolic(KernelHandle *handle,
// Verify that graphs A and B are sorted.
// This test is designed to be as efficient as possible, but still skip
// it in a release build.
//
// Temporary fix for Trilinos issue #11655: Only perform this check if a TPL
// is to be called. The KokkosKernels (non-TPL) implementation does not
// actually require sorted indices yet. And Tpetra uses size_type = size_t, so
// it will (currently) not be calling a TPL path.
#ifndef NDEBUG
if (!KokkosSparse::Impl::isCrsGraphSorted(const_a_r, const_a_l))
throw std::runtime_error(
"KokkosSparse::spgemm_symbolic: entries of A are not sorted within "
"rows. May use KokkosSparse::sort_crs_matrix to sort it.");
if (!KokkosSparse::Impl::isCrsGraphSorted(const_b_r, const_b_l))
throw std::runtime_error(
"KokkosSparse::spgemm_symbolic: entries of B are not sorted within "
"rows. May use KokkosSparse::sort_crs_matrix to sort it.");
if constexpr (KokkosSparse::Impl::spgemm_symbolic_tpl_spec_avail<
const_handle_type, Internal_alno_row_view_t_,
Internal_alno_nnz_view_t_, Internal_blno_row_view_t_,
Internal_blno_nnz_view_t_,
Internal_clno_row_view_t_>::value) {
if (!KokkosSparse::Impl::isCrsGraphSorted(const_a_r, const_a_l))
throw std::runtime_error(
"KokkosSparse::spgemm_symbolic: entries of A are not sorted within "
"rows. May use KokkosSparse::sort_crs_matrix to sort it.");
if (!KokkosSparse::Impl::isCrsGraphSorted(const_b_r, const_b_l))
throw std::runtime_error(
"KokkosSparse::spgemm_symbolic: entries of B are not sorted within "
"rows. May use KokkosSparse::sort_crs_matrix to sort it.");
}
#endif

auto algo = tmp_handle.get_spgemm_handle()->get_algorithm_type();
Expand Down

0 comments on commit e7994a7

Please sign in to comment.