diff --git a/src/impl/KokkosComm_alltoall.hpp b/src/impl/KokkosComm_alltoall.hpp index 8b0b4edb..1bc6aa93 100644 --- a/src/impl/KokkosComm_alltoall.hpp +++ b/src/impl/KokkosComm_alltoall.hpp @@ -55,6 +55,9 @@ void alltoall(const ExecSpace &space, const SendView &sv, const size_t sendCount static_assert(KokkosComm::rank() <= 1, "alltoall for SendView::rank > 1 not supported"); static_assert(KokkosComm::rank() <= 1, "alltoall for RecvView::rank > 1 not supported"); + // Make sure views are ready + space.fence("KokkosComm::Impl::alltoall"); + if (KokkosComm::PackTraits::needs_pack(sv) || KokkosComm::PackTraits::needs_pack(rv)) { throw std::runtime_error("alltoall for non-contiguous views not implemented"); } else { @@ -90,6 +93,9 @@ void alltoall(const ExecSpace &space, const RecvView &rv, const size_t recvCount static_assert(RecvView::rank <= 1, "alltoall for RecvView::rank > 1 not supported"); + // Make sure views are ready + space.fence("KokkosComm::Impl::alltoall"); + if (KokkosComm::PackTraits::needs_pack(rv)) { throw std::runtime_error("alltoall for non-contiguous views not implemented"); } else {