12 communicator(MPI_Comm comm = MPI_COMM_WORLD,
bool owner =
false);
27 owner_(other.owner_) { other.owner_ =
false; }
30 operator=(
const communicator& other) { comm_ = other.comm_; rank_ = other.rank_; size_ = other.size_; owner_ =
false;
return *
this; }
32 operator=(
communicator&& other) { comm_ = other.comm_; rank_ = other.rank_; size_ = other.size_; owner_ = other.owner_; other.owner_ =
false;
return *
this; }
34 int rank()
const {
return rank_; }
35 int size()
const {
return size_; }
39 void send(
int dest,
int tag,
const T& x)
const { detail::send<T>()(comm_, dest, tag, x); }
44 status recv(
int source,
int tag, T& x)
const {
return detail::recv<T>()(comm_, source, tag, x); }
48 request isend(
int dest,
int tag,
const T& x)
const {
return detail::isend<T>()(comm_, dest, tag, x); }
53 request irecv(
int source,
int tag, T& x)
const {
return detail::irecv<T>()(comm_, source, tag, x); }
62 iprobe(
int source,
int tag)
const;
68 operator MPI_Comm()
const {
return comm_; }
74 split(
int color,
int key = 0)
const;
85 diy::mpi::communicator::
86 communicator(MPI_Comm comm,
bool owner):
87 comm_(comm), rank_(0), size_(1), owner_(owner)
90 if (comm != MPI_COMM_NULL)
92 MPI_Comm_rank(comm_, &rank_);
93 MPI_Comm_size(comm_, &size_);
98 diy::mpi::communicator::
103 MPI_Comm_free(&comm_);
116 MPI_Probe(source, tag, comm_, &s.s);
119 DIY_UNSUPPORTED_MPI_CALL(MPI_Probe);
132 MPI_Iprobe(source, tag, comm_, &flag, &s.s);
154 MPI_Comm_split(comm_, color, key, &newcomm);
communicator split(int color, int key=0) const
split When keys are the same, the ties are broken by the rank in the original comm.
Definition: communicator.hpp:150
request isend(int dest, int tag, const T &x) const
Non-blocking version of send().
Definition: communicator.hpp:48
status probe(int source, int tag) const
probe
Definition: communicator.hpp:109
Simple wrapper around MPI_Comm.
Definition: communicator.hpp:8
request irecv(int source, int tag, T &x) const
Non-blocking version of recv(). If T is an std::vector<...>, its size must be big enough to accommoda...
Definition: communicator.hpp:53
void barrier() const
barrier
Definition: communicator.hpp:141
status recv(int source, int tag, T &x) const
Receive x from dest using tag (blocking). If T is an std::vector<...>, recv will resize it to fit exa...
Definition: communicator.hpp:44
optional< status > iprobe(int source, int tag) const
iprobe
Definition: communicator.hpp:125
Definition: optional.hpp:6
Definition: request.hpp:5
void send(int dest, int tag, const T &x) const
Send x to processor dest using tag (blocking).
Definition: communicator.hpp:39