Skip to content

Commit

Permalink
stokhos: attempted compatibility update of spmv usage
Browse files Browse the repository at this point in the history
Compatibility update corresponding to kokkos/kokkos-kernels#2126
  • Loading branch information
ndellingwood authored and github-actions[bot] committed Mar 14, 2024
1 parent f3bb2df commit b62c372
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1481,20 +1481,33 @@ 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
// TODO what is an alternative compile-time option to determine the rank?
// Is rank appropriate here, or is additional checking based on specialize trait needed?
&& (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
KokkosSparse::SPMVHandle<ExecutionSpace, MatrixType, Kokkos::View< InputType, InputP... >, Kokkos::View< OutputType, OutputP... >>* 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
)
{
std::cout << " STOKHOS UQPCE SPMV R1" << std::endl;
typedef Kokkos::View< OutputType, OutputP... > OutputVectorType;
typedef Kokkos::View< InputType, InputP... > InputVectorType;
typedef Stokhos::Multiply<MatrixType, typename InputVectorType::const_type,
Expand Down Expand Up @@ -1542,20 +1555,33 @@ 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
// TODO what is an alternative compile-time option to determine the rank?
// Is rank appropriate here, or is additional checking based on specialize trait needed?
&& (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
KokkosSparse::SPMVHandle<ExecutionSpace, MatrixType, Kokkos::View< InputType, InputP... >, Kokkos::View< OutputType, OutputP... >>* 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
)
{
std::cout << " STOKHOS UQPCE SPMV R2" << std::endl;
#if KOKKOSKERNELS_VERSION >= 40199
if(space != ExecutionSpace()) {
Kokkos::Impl::raise_error(
Expand All @@ -1569,7 +1595,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 @@ -543,20 +543,33 @@ 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
// TODO what is an alternative compile-time option to determine the rank?
// Is rank appropriate here, or is additional checking based on specialize trait needed?
&& (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
KokkosSparse::SPMVHandle<ExecutionSpace, MatrixType, Kokkos::View< InputType, InputP... >, Kokkos::View< OutputType, OutputP... >>* 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
)
{
std::cout << " STOKHOS MPVEC SPMV R1" << std::endl;
typedef Kokkos::View< OutputType, OutputP... > OutputVectorType;
typedef Kokkos::View< InputType, InputP... > InputVectorType;
using input_vector_type = const_type_t<InputVectorType>;
Expand Down Expand Up @@ -640,20 +653,33 @@ 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
// TODO what is an alternative compile-time option to determine the rank?
// Is rank appropriate here, or is additional checking based on specialize trait needed?
&& (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
KokkosSparse::SPMVHandle<ExecutionSpace, MatrixType, Kokkos::View< InputType, InputP... >, Kokkos::View< OutputType, OutputP... >>* 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
)
{
std::cout << " STOKHOS MPVEC SPMV R2" << std::endl;
#if KOKKOSKERNELS_VERSION >= 40199
if(space != ExecutionSpace()) {
Kokkos::Impl::raise_error(
Expand All @@ -667,7 +693,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 b62c372

Please sign in to comment.