9#include <kernel/util/dist.hpp>
10#include <kernel/util/time_stamp.hpp>
11#include <kernel/util/statistics.hpp>
12#include <kernel/lafem/dense_vector.hpp>
25 template <
typename VT_,
typename VMT_>
36#if defined(FEAT_HAVE_MPI) || defined(DOXYGEN)
52#if defined(FEAT_HAVE_MPI) || defined(DOXYGEN)
82#if defined(FEAT_HAVE_MPI) || defined(DOXYGEN)
90 const std::size_t n = ranks.size();
97 for(std::size_t i(0); i < n; ++i)
103 _recv_reqs.
push_back(
_comm->
irecv(_recv_bufs.at(i).elements(), _recv_bufs.at(i).size(), ranks.at(i)));
109 for(std::size_t i(0); i < n; ++i)
121 Statistics::add_time_mpi_execute_blas2(ts_start.
elapsed_now());
131 SynchVectorTicket(const SynchVectorTicket &) = delete;
137#if defined(FEAT_HAVE_MPI) || defined(DOXYGEN)
143 _recv_reqs(std::forward<Dist::RequestVector>(other._recv_reqs)),
145 _recv_bufs(std::forward<std::vector<
BufferType>>(other._recv_bufs))
147 other._finished =
true;
148 other._comm =
nullptr;
149 other._target =
nullptr;
150 other._mirrors =
nullptr;
155 other._finished =
true;
165#if defined(FEAT_HAVE_MPI) || defined(DOXYGEN)
170 _send_reqs = std::forward<Dist::RequestVector>(other._send_reqs);
171 _recv_reqs = std::forward<Dist::RequestVector>(other._recv_reqs);
172 _send_bufs = std::forward<std::vector<BufferType>>(other._send_bufs);
173 _recv_bufs = std::forward<std::vector<BufferType>>(other._recv_bufs);
175 other._finished =
true;
176 other._comm =
nullptr;
177 other._target =
nullptr;
178 other._mirrors =
nullptr;
181 other._finished =
true;
201 for(std::size_t idx(0u); _recv_reqs.
wait_any(idx); )
210 Statistics::add_time_mpi_wait_blas2(ts_start.
elapsed_now());
#define XASSERT(expr)
Assertion macro definition.
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Request irecv(void *buffer, std::size_t count, const Datatype &datatype, int source, int tag=0) const
Nonblocking Receive.
Request isend(const void *buffer, std::size_t count, const Datatype &datatype, int dest, int tag=0) const
Nonblocking Send.
Communication Request vector class.
void push_back(Request &&request)
Inserts a new request at the end of the request vector.
void reserve(std::size_t size_)
Reserves sufficient space for a specified number of requests.
bool wait_any(std::size_t &idx, Status &status)
Blocks until one of the active requests has been fulfilled.
void wait_all()
Blocks until all active requests are fulfilled.
Ticket class for asynchronous global operations on vectors.
SynchVectorTicket()
default constructor
const std::vector< VMT_ > * _mirrors
the vector mirrors
SynchVectorTicket(VT_ &target, const Dist::Comm &comm, const std::vector< int > &ranks, const std::vector< VMT_ > &mirrors)
Constructor.
VT_ * _target
the vector to be synchronized
SynchVectorTicket & operator=(SynchVectorTicket &&other)
move-assign operator
SynchVectorTicket(SynchVectorTicket &&other)
move constructor
~SynchVectorTicket()
Destructor.
const Dist::Comm * _comm
our communicator
LAFEM::DenseVector< typename VT_::DataType, typename VT_::IndexType > BufferType
the buffer vector type
Dist::RequestVector _send_reqs
send and receive request vectors
SynchVectorTicket & operator=(const SynchVectorTicket &)=delete
Unwanted copy assignment operator: Do not implement!
std::vector< BufferType > _send_bufs
send and receive buffers
bool _finished
signals, whether wait was already called
Dense data vector class template.
double elapsed_now() const
Calculates the time elapsed between the time stamp and now.