eckit::mpi::Comm class

Derived classes

class Parallel
class Serial

Public static functions

static auto comm(std::string_view name = {}) -> Comm&

Public functions

auto name() const -> std::string
auto processorName() const -> std::string pure virtual
Returns name of processor according to MPI.
auto rank() const -> size_t
MPI rank of process in this communicator.
auto size() const -> size_t
MPI size of this communicator.
auto remoteSize() const -> size_t pure virtual
void barrier() const pure virtual
MPI barrier for this communicator.
auto iBarrier() const -> Request pure virtual
MPI non-blocking barrier for this communicator.
void abort(int errorcode = -1) const pure virtual
MPI abort for this communicator.
auto wait(Request&) const -> Status pure virtual
Wait for Request to be completed, ignoring the return status.
auto waitAny(std::vector<Request>& requests, int& index) const -> Status pure virtual
Wait for one request out of a vector of requests to finish.
auto waitAll(std::vector<Request>&) const -> std::vector<Status> pure virtual
Wait for all given requests to finish.
auto probe(int source, int tag) const -> Status pure virtual
Probe for incoming messages (blocking)
auto iProbe(int source, int tag) const -> Status pure virtual
Probe for incoming messages (non-blocking) Use status.error() to check if there is an incoming message status.error() == 0 if there is an incoming message.
auto procNull() const -> int pure virtual
auto undefined() const -> int pure virtual
auto anySource() const -> int pure virtual
auto anyTag() const -> int pure virtual
auto status() const -> Status pure virtual
auto request(int) const -> Request pure virtual
auto group(int) const -> Group pure virtual
auto group() const -> Group pure virtual
auto remoteGroup() const -> Group pure virtual
auto create(const Group&, const std::string& name) const -> Comm& pure virtual
auto create(const Group&, int tag, const std::string& name) const -> Comm& pure virtual
template<typename T>
auto getCount(Status& status) const -> size_t
template<typename T>
void broadcast(T& value, size_t root) const
template<typename T>
void broadcast(T* first, T* last, size_t root) const
template<typename T>
void broadcast(T buffer[], size_t count, size_t root) const
template<typename T>
void broadcast(typename std::vector<T>& v, size_t root) const
template<class Iter>
void broadcast(Iter first, Iter last, size_t root) const
template<class CIter, class Iter>
void gather(CIter first, CIter last, Iter rfirst, Iter rlast, size_t root) const
template<typename T>
void gather(const T send, std::vector<T>& recv, size_t root) const
template<typename T>
void gather(const std::vector<T>& send, std::vector<T>& recv, size_t root) const
template<typename Value>
void gatherv(const Value* sendbuf, size_t sendcount, Value* recvbuf, const int recvcounts[], const int displs[], size_t root) const
template<class CIter, class Iter>
void gatherv(CIter first, CIter last, Iter rfirst, Iter rlast, const int recvcounts[], const int displs[], size_t root) const
template<class CIter, class Iter>
void gatherv(CIter first, CIter last, Iter rfirst, Iter rlast, const std::vector<int>& recvcounts, const std::vector<int>& displs, size_t root) const
template<typename T>
void gatherv(const std::vector<T>& send, std::vector<T>& recv, const std::vector<int>& recvcounts, const std::vector<int>& displs, size_t root) const
template<typename T>
void scatter(const std::vector<T>& send, T& recv, size_t root) const
template<typename T>
void scatter(const std::vector<T>& send, std::vector<T>& recv, size_t root) const
template<typename Value>
void scatterv(const Value* sendbuf, const int sendcounts[], const int displs[], Value* recvbuf, int recvcount, size_t root) const
template<class CIter, class Iter>
void scatterv(CIter first, CIter last, const int sendcounts[], const int displs[], Iter rfirst, Iter rlast, size_t root) const
template<class CIter, class Iter>
void scatterv(CIter first, CIter last, const std::vector<int>& sendcounts, const std::vector<int>& displs, Iter rfirst, Iter rlast, size_t root) const
template<typename T>
void reduce(const T send, T& recv, Operation::Code op, size_t root) const
template<typename T>
void reduce(const T* send, T* recv, size_t count, Operation::Code op, size_t root) const
template<typename T>
void reduce(const std::vector<T>& send, std::vector<T>& recv, Operation::Code op, size_t root) const
template<typename T>
void reduceInPlace(T* sendrecvbuf, size_t count, Operation::Code op, size_t root) const
template<typename T>
void reduceInPlace(T& sendrecvbuf, Operation::Code op, size_t root) const
template<class Iter>
void reduceInPlace(Iter first, Iter last, Operation::Code op, size_t root) const
template<typename T>
void allReduce(const T send, T& recv, Operation::Code op) const
template<typename T>
void allReduce(const T* send, T* recv, size_t count, Operation::Code op) const
template<typename T>
void allReduce(const std::vector<T>& send, std::vector<T>& recv, Operation::Code op) const
template<typename T>
void allReduceInPlace(T* sendrecvbuf, size_t count, Operation::Code op) const
template<typename T>
void allReduceInPlace(T& sendrecvbuf, Operation::Code op) const
template<class Iter>
void allReduceInPlace(Iter first, Iter last, Operation::Code op) const
template<typename T, typename Iter>
void allGather(const T sendval, Iter rfirst, Iter rlast) const
template<typename CIter, typename Iter>
void allGatherv(CIter first, CIter last, Iter recvbuf, const int recvcounts[], const int displs[]) const
template<typename T, typename CIter>
void allGatherv(CIter first, CIter last, mpi::Buffer<T>& recv) const
template<typename T>
void allToAll(const std::vector<T>& send, std::vector<T>& recv) const
template<typename T>
void allToAllv(const T* sendbuf, const int sendcounts[], const int sdispls[], T* recvbuf, const int recvcounts[], const int rdispls[]) const
template<typename T>
auto iReceive(T* recv, size_t count, int source, int tag) const -> Request
template<typename T>
auto iReceive(T& recv, int source, int tag) const -> Request
template<typename T>
auto receive(T* recv, size_t count, int source, int tag) const -> Status
template<typename T>
auto receive(T& recv, int source, int tag) const -> Status
template<typename T>
void send(const T* sendbuf, size_t count, int dest, int tag) const
template<typename T>
void send(const T& sendbuf, int dest, int tag) const
template<typename T>
void synchronisedSend(const T* sendbuf, size_t count, int dest, int tag) const
template<typename T>
void synchronisedSend(const T& sendbuf, int dest, int tag) const
template<typename T>
auto iSend(const T* sendbuf, size_t count, int dest, int tag) const -> Request
template<typename T>
auto iSend(const T& sendbuf, int dest, int tag) const -> Request
template<typename T>
auto sendReceiveReplace(T* sendrecv, size_t count, int dest, int sendtag, int source, int recvtag) const -> Status
template<typename T>
auto sendReceiveReplace(T& sendrecv, int dest, int sendtag, int source, int recvtag) const -> Status
template<typename T>
void allToAll(const std::vector<std::vector<T>>& sendvec, std::vector<std::vector<T>>& recvvec) const
auto broadcastFile(const eckit::PathName& filepath, size_t root) const -> eckit::SharedBuffer pure virtual
auto split(int color, const std::string& name) const -> Comm& pure virtual
Split the communicator based on color & give the new communicator a name.
auto communicator() const -> int pure virtual
The communicator.
template<typename T>
auto iReceive(T* recv, size_t count, int source, int tag) const -> eckit::mpi::Request
template<typename T>
auto iReceive(T& recv, int source, int tag) const -> eckit::mpi::Request
template<typename T>
auto receive(T* recv, size_t count, int source, int tag) const -> eckit::mpi::Status
template<typename T>
auto receive(T& recv, int source, int tag) const -> eckit::mpi::Status
template<typename T>
auto sendReceiveReplace(T* sendrecv, size_t count, int dest, int sendtag, int source, int recvtag) const -> eckit::mpi::Status
template<typename T>
auto sendReceiveReplace(T& sendrecv, int dest, int sendtag, int source, int recvtag) const -> eckit::mpi::Status
template<typename T>
auto iSend(const T* sendbuf, size_t count, int dest, int tag) const -> eckit::mpi::Request
template<typename T>
auto iSend(const T& sendbuf, int dest, int tag) const -> eckit::mpi::Request

Private functions

auto getCount(Status& status, Data::Code datatype) const -> size_t pure virtual
void broadcast(void* buffer, size_t count, Data::Code datatype, size_t root) const pure virtual
void gather(const void* sendbuf, size_t sendcount, void* recvbuf, size_t recvcount, Data::Code datatype, size_t root) const pure virtual
void scatter(const void* sendbuf, size_t sendcount, void* recvbuf, size_t recvcount, Data::Code datatype, size_t root) const pure virtual
void gatherv(const void* sendbuf, size_t sendcount, void* recvbuf, const int recvcounts[], const int displs[], Data::Code datatype, size_t root) const pure virtual
void scatterv(const void* sendbuf, const int sendcounts[], const int displs[], void* recvbuf, size_t recvcount, Data::Code datatype, size_t root) const pure virtual
void reduce(const void* sendbuf, void* recvbuf, size_t count, Data::Code datatype, Operation::Code op, size_t root) const pure virtual
void reduceInPlace(void* sendrecvbuf, size_t count, Data::Code datatype, Operation::Code op, size_t root) const pure virtual
void allReduce(const void* sendbuf, void* recvbuf, size_t count, Data::Code datatype, Operation::Code op) const pure virtual
void allReduceInPlace(void* sendrecvbuf, size_t count, Data::Code datatype, Operation::Code op) const pure virtual
void allGather(const void* sendbuf, size_t sendcount, void* recvbuf, size_t recvcount, Data::Code datatype) const pure virtual
void allGatherv(const void* sendbuf, size_t sendcount, void* recvbuf, const int recvcounts[], const int displs[], Data::Code datatype) const pure virtual
void allToAll(const void* sendbuf, size_t sendcount, void* recvbuf, size_t recvcount, Data::Code datatype) const pure virtual
void allToAllv(const void* sendbuf, const int sendcounts[], const int sdispls[], void* recvbuf, const int recvcounts[], const int rdispls[], Data::Code datatype) const pure virtual
auto receive(void* recv, size_t count, Data::Code datatype, int source, int tag) const -> Status pure virtual
void send(const void* send, size_t count, Data::Code datatype, int dest, int tag) const pure virtual
void synchronisedSend(const void* send, size_t count, Data::Code datatype, int dest, int tag) const pure virtual
auto iReceive(void* recv, size_t count, Data::Code datatype, int source, int tag) const -> Request pure virtual
auto iSend(const void* send, size_t count, Data::Code datatype, int dest, int tag) const -> Request pure virtual
auto sendReceiveReplace(void* sendrecv, size_t count, Data::Code datatype, int dest, int sendtag, int source, int recvtag) const -> Status pure virtual
void free() pure virtual
Call free on this communicator After calling this method, the communicator should not be used again This is protected so only Environment can call it, typically via the deleteComm() method.
auto self() const -> eckit::mpi::Comm* pure virtual
Creates a communicator to self.
void print(std::ostream&) const pure virtual
~Comm() private virtual

Friends

auto operator<<(std::ostream& s, const Comm& o) -> std::ostream&

Function documentation

Status eckit::mpi::Comm::waitAny(std::vector<Request>& requests, int& index) const pure virtual

Wait for one request out of a vector of requests to finish.

Parameters
requests in The requests that one will be waited for.
index out The request index in requests that has been waited for.

template<typename T>
void eckit::mpi::Comm::broadcast(T& value, size_t root) const

Broadcast, pointer to data (also covers scalars)

template<class CIter, class Iter>
void eckit::mpi::Comm::gather(CIter first, CIter last, Iter rfirst, Iter rlast, size_t root) const

Gather methods to one root, equal data sizes per rank

template<typename Value>
void eckit::mpi::Comm::gatherv(const Value* sendbuf, size_t sendcount, Value* recvbuf, const int recvcounts[], const int displs[], size_t root) const

Gather methods to one root, variable data sizes per rank

template<typename T>
void eckit::mpi::Comm::scatter(const std::vector<T>& send, T& recv, size_t root) const

Scatter methods from one root

template<typename Value>
void eckit::mpi::Comm::scatterv(const Value* sendbuf, const int sendcounts[], const int displs[], Value* recvbuf, int recvcount, size_t root) const

Scatter methods from one root, variable data sizes per rank, pointer to data (also covers scalar case)

template<typename T>
void eckit::mpi::Comm::reduce(const T send, T& recv, Operation::Code op, size_t root) const

Reduce operations, separate buffers

template<typename T>
void eckit::mpi::Comm::reduceInPlace(T* sendrecvbuf, size_t count, Operation::Code op, size_t root) const

Reduce operations, in place buffer

template<typename T>
void eckit::mpi::Comm::allReduce(const T send, T& recv, Operation::Code op) const

All reduce operations, separate buffers

template<typename T>
void eckit::mpi::Comm::allReduceInPlace(T* sendrecvbuf, size_t count, Operation::Code op) const

All reduce operations, in place buffer

template<typename T, typename Iter>
void eckit::mpi::Comm::allGather(const T sendval, Iter rfirst, Iter rlast) const

Gather methods from all, equal data sizes per rank

template<typename CIter, typename Iter>
void eckit::mpi::Comm::allGatherv(CIter first, CIter last, Iter recvbuf, const int recvcounts[], const int displs[]) const

Gather methods from all, variable data sizes per rank

template<typename T>
void eckit::mpi::Comm::allToAll(const std::vector<T>& send, std::vector<T>& recv) const

All to all methods, fixed data size

template<typename T>
void eckit::mpi::Comm::allToAllv(const T* sendbuf, const int sendcounts[], const int sdispls[], T* recvbuf, const int recvcounts[], const int rdispls[]) const

All to All, variable data size

template<typename T>
Request eckit::mpi::Comm::iReceive(T* recv, size_t count, int source, int tag) const

Non-blocking receive

template<typename T>
Status eckit::mpi::Comm::receive(T* recv, size_t count, int source, int tag) const

Blocking receive

template<typename T>
void eckit::mpi::Comm::send(const T* sendbuf, size_t count, int dest, int tag) const

Blocking send

template<typename T>
void eckit::mpi::Comm::synchronisedSend(const T* sendbuf, size_t count, int dest, int tag) const

Blocking send, until message received

template<typename T>
Request eckit::mpi::Comm::iSend(const T* sendbuf, size_t count, int dest, int tag) const

Non-blocking send

template<typename T>
Status eckit::mpi::Comm::sendReceiveReplace(T* sendrecv, size_t count, int dest, int sendtag, int source, int recvtag) const

In place simultaneous send and receive

template<typename T>
void eckit::mpi::Comm::allToAll(const std::vector<std::vector<T>>& sendvec, std::vector<std::vector<T>>& recvvec) const

All to all of vector< vector<> >

eckit::SharedBuffer eckit::mpi::Comm::broadcastFile(const eckit::PathName& filepath, size_t root) const pure virtual

Read file on one rank, and broadcast

template<typename T>
eckit::mpi::Request eckit::mpi::Comm::iReceive(T* recv, size_t count, int source, int tag) const

Non-blocking receive

template<typename T>
eckit::mpi::Status eckit::mpi::Comm::receive(T* recv, size_t count, int source, int tag) const

Blocking receive

template<typename T>
eckit::mpi::Status eckit::mpi::Comm::sendReceiveReplace(T* sendrecv, size_t count, int dest, int sendtag, int source, int recvtag) const

In place simultaneous send and receive

template<typename T>
eckit::mpi::Request eckit::mpi::Comm::iSend(const T* sendbuf, size_t count, int dest, int tag) const

Non-blocking send