Skip to content

Commit

Permalink
Merge pull request #56 from cwpearson/mpi/send-low
Browse files Browse the repository at this point in the history
mpi: contiguous send wrapper
  • Loading branch information
cwpearson authored May 17, 2024
2 parents 96d8105 + 4b35d33 commit 4c68ad6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/impl/KokkosComm_send.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@

namespace KokkosComm::Impl {

template <KokkosView SendView>
void send(const SendView &sv, int dest, int tag, MPI_Comm comm) {
Kokkos::Tools::pushRegion("KokkosComm::Impl::send");
using KCT = typename KokkosComm::Traits<SendView>;

if (KCT::is_contiguous(sv)) {
using SendScalar = typename SendView::non_const_value_type;
MPI_Send(KCT::data_handle(sv), KCT::span(sv), mpi_type_v<SendScalar>, dest, tag, comm);
} else {
throw std::runtime_error("only contiguous views supported for low-level send");
}
Kokkos::Tools::popRegion();
}

template <CommMode SendMode = CommMode::Default, KokkosExecutionSpace ExecSpace, KokkosView SendView>
void send(const ExecSpace &space, const SendView &sv, int dest, int tag, MPI_Comm comm) {
Kokkos::Tools::pushRegion("KokkosComm::Impl::send");
Expand Down

0 comments on commit 4c68ad6

Please sign in to comment.