From 0f17f7d7a58ae6492034737ee2985bf7a10f032f Mon Sep 17 00:00:00 2001 From: Brian Kelley Date: Tue, 28 Mar 2023 11:18:03 -0600 Subject: [PATCH] Patch Trilinos #11663 This was intended to be a temporary patch, but it will need to stay until 4.1. This means it has to be included in 4.0.1. --- sparse/src/KokkosSparse_spgemm_symbolic.hpp | 27 +++++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/sparse/src/KokkosSparse_spgemm_symbolic.hpp b/sparse/src/KokkosSparse_spgemm_symbolic.hpp index ff37199699..486d999e41 100644 --- a/sparse/src/KokkosSparse_spgemm_symbolic.hpp +++ b/sparse/src/KokkosSparse_spgemm_symbolic.hpp @@ -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();