Skip to content

Commit

Permalink
Merge Pull Request trilinos#12818 from brian-kelley/Trilinos/stokhosS…
Browse files Browse the repository at this point in the history
…pmvRefactor

Automatically Merged using Trilinos Pull Request AutoTester
PR Title: b'Stokhos: prepare for KokkosKernels 4.3 spmv refactor'
PR Author: brian-kelley
  • Loading branch information
trilinos-autotester authored Mar 13, 2024
2 parents f3bb2df + 3904ea8 commit 38999ab
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,9 @@ namespace KokkosSparse {
template <
#if KOKKOSKERNELS_VERSION >= 40199
typename ExecutionSpace,
#endif
#if KOKKOSKERNELS_VERSION >= 40299
typename Handle,
#endif
typename AlphaType,
typename BetaType,
Expand All @@ -1481,19 +1484,30 @@ template <
typename std::enable_if<
Kokkos::is_view_uq_pce< Kokkos::View< InputType, InputP... > >::value &&
Kokkos::is_view_uq_pce< Kokkos::View< OutputType, OutputP... > >::value
#if KOKKOSKERNELS_VERSION >= 40299
&& KokkosSparse::is_crs_matrix_v<MatrixType>
&& (Kokkos::View< OutputType, OutputP... >::rank() == 1)
#endif
>::type
spmv(
#if KOKKOSKERNELS_VERSION >= 40199
const ExecutionSpace& space,
#endif
#if KOKKOSKERNELS_VERSION < 40299
KokkosKernels::Experimental::Controls,
#else
Handle* handle,
#endif
const char mode[],
const AlphaType& a,
const MatrixType& A,
const Kokkos::View< InputType, InputP... >& x,
const BetaType& b,
const Kokkos::View< OutputType, OutputP... >& y,
const RANK_ONE)
const Kokkos::View< OutputType, OutputP... >& y
#if KOKKOSKERNELS_VERSION < 40299
, const RANK_ONE
#endif
)
{
typedef Kokkos::View< OutputType, OutputP... > OutputVectorType;
typedef Kokkos::View< InputType, InputP... > InputVectorType;
Expand Down Expand Up @@ -1531,6 +1545,9 @@ spmv(
template <
#if KOKKOSKERNELS_VERSION >= 40199
typename ExecutionSpace,
#endif
#if KOKKOSKERNELS_VERSION >= 40299
typename Handle,
#endif
typename AlphaType,
typename BetaType,
Expand All @@ -1542,19 +1559,30 @@ template <
typename std::enable_if<
Kokkos::is_view_uq_pce< Kokkos::View< InputType, InputP... > >::value &&
Kokkos::is_view_uq_pce< Kokkos::View< OutputType, OutputP... > >::value
#if KOKKOSKERNELS_VERSION >= 40299
&& KokkosSparse::is_crs_matrix_v<MatrixType>
&& (Kokkos::View< OutputType, OutputP... >::rank() == 2)
#endif
>::type
spmv(
#if KOKKOSKERNELS_VERSION >= 40199
const ExecutionSpace& space,
#endif
#if KOKKOSKERNELS_VERSION < 40299
KokkosKernels::Experimental::Controls,
#else
Handle* handle,
#endif
const char mode[],
const AlphaType& a,
const MatrixType& A,
const Kokkos::View< InputType, InputP... >& x,
const BetaType& b,
const Kokkos::View< OutputType, OutputP... >& y,
const RANK_TWO)
const Kokkos::View< OutputType, OutputP... >& y
#if KOKKOSKERNELS_VERSION < 40299
, const RANK_TWO
#endif
)
{
#if KOKKOSKERNELS_VERSION >= 40199
if(space != ExecutionSpace()) {
Expand All @@ -1569,7 +1597,9 @@ spmv(
if (y.extent(1) == 1) {
auto y_1D = subview(y, Kokkos::ALL(), 0);
auto x_1D = subview(x, Kokkos::ALL(), 0);
#if KOKKOSKERNELS_VERSION >= 40199
#if KOKKOSKERNELS_VERSION >= 40299
spmv(space, handle, mode, a, A, x_1D, b, y_1D);
#elif (KOKKOSKERNELS_VERSION < 40299) && (KOKKOSKERNELS_VERSION >= 40199)
spmv(space, KokkosKernels::Experimental::Controls(), mode, a, A, x_1D, b, y_1D, RANK_ONE());
#else
spmv(KokkosKernels::Experimental::Controls(), mode, a, A, x_1D, b, y_1D, RANK_ONE());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,9 @@ namespace KokkosSparse {
template <
#if KOKKOSKERNELS_VERSION >= 40199
typename ExecutionSpace,
#endif
#if KOKKOSKERNELS_VERSION >= 40299
typename Handle,
#endif
typename AlphaType,
typename BetaType,
Expand All @@ -543,19 +546,30 @@ template <
typename std::enable_if<
Kokkos::is_view_mp_vector< Kokkos::View< InputType, InputP... > >::value &&
Kokkos::is_view_mp_vector< Kokkos::View< OutputType, OutputP... > >::value
#if KOKKOSKERNELS_VERSION >= 40299
&& KokkosSparse::is_crs_matrix_v<MatrixType>
&& (Kokkos::View< OutputType, OutputP... >::rank() == 1)
#endif
>::type
spmv(
#if KOKKOSKERNELS_VERSION >= 40199
const ExecutionSpace& space,
#endif
#if KOKKOSKERNELS_VERSION < 40299
KokkosKernels::Experimental::Controls,
#else
Handle* handle,
#endif
const char mode[],
const AlphaType& a,
const MatrixType& A,
const Kokkos::View< InputType, InputP... >& x,
const BetaType& b,
const Kokkos::View< OutputType, OutputP... >& y,
const RANK_ONE)
const Kokkos::View< OutputType, OutputP... >& y
#if KOKKOSKERNELS_VERSION < 40299
, const RANK_ONE
#endif
)
{
typedef Kokkos::View< OutputType, OutputP... > OutputVectorType;
typedef Kokkos::View< InputType, InputP... > InputVectorType;
Expand Down Expand Up @@ -629,6 +643,9 @@ spmv(
template <
#if KOKKOSKERNELS_VERSION >= 40199
typename ExecutionSpace,
#endif
#if KOKKOSKERNELS_VERSION >= 40299
typename Handle,
#endif
typename AlphaType,
typename BetaType,
Expand All @@ -640,19 +657,30 @@ template <
typename std::enable_if<
Kokkos::is_view_mp_vector< Kokkos::View< InputType, InputP... > >::value &&
Kokkos::is_view_mp_vector< Kokkos::View< OutputType, OutputP... > >::value
#if KOKKOSKERNELS_VERSION >= 40299
&& KokkosSparse::is_crs_matrix_v<MatrixType>
&& (Kokkos::View< OutputType, OutputP... >::rank() == 2)
#endif
>::type
spmv(
#if KOKKOSKERNELS_VERSION >= 40199
const ExecutionSpace& space,
#endif
#if KOKKOSKERNELS_VERSION < 40299
KokkosKernels::Experimental::Controls,
#else
Handle* handle,
#endif
const char mode[],
const AlphaType& a,
const MatrixType& A,
const Kokkos::View< InputType, InputP... >& x,
const BetaType& b,
const Kokkos::View< OutputType, OutputP... >& y,
const RANK_TWO)
const Kokkos::View< OutputType, OutputP... >& y
#if KOKKOSKERNELS_VERSION < 40299
, const RANK_TWO
#endif
)
{
#if KOKKOSKERNELS_VERSION >= 40199
if(space != ExecutionSpace()) {
Expand All @@ -667,7 +695,9 @@ spmv(
if (y.extent(1) == 1) {
auto y_1D = subview(y, Kokkos::ALL(), 0);
auto x_1D = subview(x, Kokkos::ALL(), 0);
#if KOKKOSKERNELS_VERSION >= 40199
#if KOKKOSKERNELS_VERSION >= 40299
spmv(space, handle, mode, a, A, x_1D, b, y_1D);
#elif (KOKKOSKERNELS_VERSION < 40299) && (KOKKOSKERNELS_VERSION >= 40199)
spmv(space, KokkosKernels::Experimental::Controls(), mode, a, A, x_1D, b, y_1D, RANK_ONE());
#else
spmv(KokkosKernels::Experimental::Controls(), mode, a, A, x_1D, b, y_1D, RANK_ONE());
Expand Down

0 comments on commit 38999ab

Please sign in to comment.