20#ifndef UTILS_MPI_SENDRECV_HPP
21#define UTILS_MPI_SENDRECV_HPP
23#include <boost/mpi/communicator.hpp>
24#include <boost/mpi/datatype.hpp>
25#include <boost/mpi/exception.hpp>
26#include <boost/mpi/nonblocking.hpp>
36std::array<mpi::request, 2> isendrecv_impl(mpi::communicator
const &comm,
37 int dest,
int stag,
const T &sval,
38 int src,
int rtag, T &rval) {
39 return {{comm.isend(dest, stag, sval), comm.irecv(src, rtag, rval)}};
43mpi::status sendrecv_impl(mpi::communicator
const &comm,
int dest,
int stag,
44 const T &sval,
int src,
int rtag, T &rval,
47 BOOST_MPI_CHECK_RESULT(
48 MPI_Sendrecv, (
const_cast<T *
>(&sval), 1, mpi::get_mpi_datatype<T>(sval),
49 dest, stag, &rval, 1, mpi::get_mpi_datatype<T>(rval), src,
50 rtag, comm, &stat.m_status));
55mpi::status sendrecv_impl(mpi::communicator
const &comm,
int dest,
int stag,
56 const T &sval,
int src,
int rtag, T &rval,
58 auto srrequests = isendrecv_impl(comm, dest, stag, sval, src, rtag, rval);
59 mpi::status srstatuses[2];
60 wait_all(srrequests.begin(), srrequests.end(), srstatuses);
66mpi::status
sendrecv(mpi::communicator
const &comm,
int dest,
int stag,
67 const T &sval,
int src,
int rtag, T &rval) {
68 return detail::sendrecv_impl(comm, dest, stag, sval, src, rtag, rval,
73std::array<mpi::request, 2>
isendrecv(mpi::communicator
const &comm,
int dest,
74 int stag,
const T &sval,
int src,
76 return detail::isendrecv_impl(comm, dest, stag, sval, src, rtag, rval);
std::array< mpi::request, 2 > isendrecv(mpi::communicator const &comm, int dest, int stag, const T &sval, int src, int rtag, T &rval)
mpi::status sendrecv(mpi::communicator const &comm, int dest, int stag, const T &sval, int src, int rtag, T &rval)