Skip to content

Commit

Permalink
Merge pull request #1720 from dalg24/drop_pre_kokkos_36_workaround
Browse files Browse the repository at this point in the history
Drop obsolete workaround `#ifdef KOKKOS_IF_ON_HOST`
  • Loading branch information
lucbv authored Mar 7, 2023
2 parents f41ff47 + d9df4fd commit 0481552
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,42 +388,10 @@ struct SerialEigendecompositionInternal {
const int ers, RealType* ei, const int eis, RealType* UL, const int uls0,
const int uls1, RealType* UR, const int urs0, const int urs1, RealType* w,
const int wlen) {
#if defined(KOKKOS_IF_ON_HOST)
KOKKOS_IF_ON_HOST((host_invoke(m, A, as0, as1, er, ers, ei, eis, UL, uls0,
uls1, UR, urs0, urs1, w, wlen);))
KOKKOS_IF_ON_DEVICE((device_invoke(m, A, as0, as1, er, ers, ei, eis, UL,
uls0, uls1, UR, urs0, urs1, w, wlen);))
#elif defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST) // FIXME remove when
// requiring minimum
// version of
// Kokkos 3.6
// if (as0 == 1 || as1 == 1) {
/// column major or row major and it runs on host
/// potentially it can run tpls internally
// NOTE BMK: If LAPACK not enabled, this will static_assert.
// If neither stride is unit, will runtime assert.
// Otherwise will succeed using LAPACK.
host_invoke(m, A, as0, as1, er, ers, ei, eis, UL, uls0, uls1, UR, urs0,
urs1, w, wlen);
/*
} else {
/// arbitrary strides should be handled by native implementation
device_invoke(m,
A, as0, as1,
er, ers,
ei, eis,
UL, uls0, uls1,
UR, urs0, urs1,
w, wlen);
throw std::runtime_error("Serial eigendecomposition without unit stride
implemented yet.");
}
*/
#else
/// device code runs
device_invoke(m, A, as0, as1, er, ers, ei, eis, UL, uls0, uls1, UR, urs0,
urs1, w, wlen);
#endif
return 0;
}
};
Expand Down
22 changes: 2 additions & 20 deletions sparse/impl/KokkosSparse_spmv_struct_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ struct SPMV_Struct_Functor {
const size_type rowOffset = m_A.graph.row_map(rowIdx);

y_value_type sum(0.0);
#if defined(KOKKOS_IF_ON_HOST)

// clang-format off
KOKKOS_IF_ON_HOST((
for (ordinal_type idx = 0; idx < 27; ++idx) {
Expand All @@ -540,25 +540,7 @@ struct SPMV_Struct_Functor {
},
sum);
))
// clang-format on
#elif defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST) // FIXME remove when
// requiring minimum
// version of
// Kokkos 3.6
for (ordinal_type idx = 0; idx < 27; ++idx) {
sum +=
m_A.values(rowOffset + idx) * m_x(rowIdx + columnOffsets(idx));
}
#else
Kokkos::parallel_reduce(
Kokkos::ThreadVectorRange(dev, 27),
[&](const ordinal_type& idx, y_value_type& lclSum) {
lclSum += (conjugate ? ATV::conj(m_A.values(rowOffset + idx))
: m_A.values(rowOffset + idx)) *
m_x(rowIdx + columnOffsets(idx));
},
sum);
#endif
// clang-format on

Kokkos::single(Kokkos::PerThread(dev), [&]() {
m_y(rowIdx) = beta * m_y(rowIdx) + alpha * sum;
Expand Down

0 comments on commit 0481552

Please sign in to comment.