Skip to content

Commit

Permalink
Amesos2: fix host/device access issue in vector gather/scatter
Browse files Browse the repository at this point in the history
Signed-off-by: iyamazaki <[email protected]>
  • Loading branch information
iyamazaki committed Feb 26, 2025
1 parent b1b5160 commit 6823b2a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/amesos2/src/Amesos2_TpetraMultiVecAdapter_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,8 @@ namespace Amesos2 {
}
{
auto nRows_l = this->mv_->getLocalLength();
auto lclMV = this->mv_->getLocalViewHost(Tpetra::Access::ReadOnly);
auto lclMV_d = this->mv_->getLocalViewDevice(Tpetra::Access::ReadOnly);
auto lclMV = Kokkos::create_mirror_view(lclMV_d);
for (size_t j=0; j<nCols; j++) {
// lclMV with ReadOnly = const sendbuf
const Scalar * sendbuf = reinterpret_cast<const Scalar*> (nRows_l > 0 ? &lclMV(0,j) : lclMV.data());
Expand Down Expand Up @@ -642,7 +643,8 @@ namespace Amesos2 {
auto comm = this->mv_->getMap()->getComm();
auto myRank = comm->getRank();
{
auto lclMV = this->mv_->getLocalViewHost(Tpetra::Access::OverwriteAll);
auto lclMV_d = this->mv_->getLocalViewDevice(Tpetra::Access::OverwriteAll);
auto lclMV = Kokkos::create_mirror_view(lclMV_d);
for (size_t j=0; j<nCols; j++) {
if (myRank == 0 && this->buf_.extent(0) > 0) {
for (global_size_t i=0; i<nRows; i++) this->buf_(i, 0) = kokkos_new_view(perm_g2l(i),j);
Expand Down

0 comments on commit 6823b2a

Please sign in to comment.