Skip to content

Commit

Permalink
Merge pull request #2021 from cwpearson/fix/issue-2010
Browse files Browse the repository at this point in the history
hide native merge-path SpMV behind "native-merge"
  • Loading branch information
lucbv authored Oct 27, 2023
2 parents 33255c8 + 8ba47b9 commit 89df0f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sparse/impl/KokkosSparse_spmv_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
namespace KokkosSparse {
namespace Impl {

constexpr const char* KOKKOSSPARSE_ALG_MERGE = "merge";
constexpr const char* KOKKOSSPARSE_ALG_NATIVE_MERGE = "native-merge";

// This TransposeFunctor is functional, but not necessarily performant.
template <class execution_space, class AMatrix, class XVector, class YVector,
Expand Down Expand Up @@ -632,15 +632,15 @@ static void spmv_beta(const execution_space& exec,
typename YVector::const_value_type& beta,
const YVector& y) {
if (mode[0] == NoTranspose[0]) {
if (controls.getParameter("algorithm") == KOKKOSSPARSE_ALG_MERGE) {
if (controls.getParameter("algorithm") == KOKKOSSPARSE_ALG_NATIVE_MERGE) {
SpmvMergeHierarchical<execution_space, AMatrix, XVector, YVector>::spmv(
exec, mode, alpha, A, x, beta, y);
} else {
spmv_beta_no_transpose<execution_space, AMatrix, XVector, YVector, dobeta,
false>(exec, controls, alpha, A, x, beta, y);
}
} else if (mode[0] == Conjugate[0]) {
if (controls.getParameter("algorithm") == KOKKOSSPARSE_ALG_MERGE) {
if (controls.getParameter("algorithm") == KOKKOSSPARSE_ALG_NATIVE_MERGE) {
SpmvMergeHierarchical<execution_space, AMatrix, XVector, YVector>::spmv(
exec, mode, alpha, A, x, beta, y);
} else {
Expand Down
6 changes: 6 additions & 0 deletions sparse/unit_test/Test_Sparse_spmv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,12 @@ void test_spmv_algorithms(lno_t numRows, size_type nnz, lno_t bandwidth,
test_spmv<scalar_t, lno_t, size_type, Device>(
controls, numRows, nnz, bandwidth, row_size_variance, heavy);
}
{
KokkosKernels::Experimental::Controls controls;
controls.setParameter("algorithm", "native-merge");
test_spmv<scalar_t, lno_t, size_type, Device>(
controls, numRows, nnz, bandwidth, row_size_variance, heavy);
}
}

template <typename scalar_t, typename lno_t, typename size_type,
Expand Down

0 comments on commit 89df0f9

Please sign in to comment.