eckit::mpi::Serial class

Base classes

class Comm

Public types

struct Constants

Public static functions

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

Public functions

auto name() const -> std::string
auto rank() const -> size_t
MPI rank of process in this communicator.
auto size() const -> size_t
MPI size of this communicator.
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 allToAll(const std::vector<std::vector<T>>& sendvec, std::vector<std::vector<T>>& recvvec) 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

Private functions

auto self() const -> eckit::mpi::Comm* override
Creates a communicator to self.
auto processorName() const -> std::string override
Returns name of processor according to MPI.
auto remoteSize() const -> size_t override
void barrier() const override
MPI barrier for this communicator.
auto iBarrier() const -> Request override
MPI non-blocking barrier for this communicator.
void abort(int errorcode = -1) const override
MPI abort for this communicator.
auto wait(Request&) const -> Status override
Wait for Request to be completed, ignoring the return status.
auto waitAny(std::vector<Request>& requests, int& index) const -> Status override
Wait for one request out of a vector of requests to finish.
auto waitAll(std::vector<Request>&) const -> std::vector<Status> override
Wait for all given requests to finish.
auto probe(int source, int tag) const -> Status override
Probe for incoming messages (blocking)
auto iProbe(int source, int tag) const -> Status override
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 anySource() const -> int override
auto anyTag() const -> int override
auto undefined() const -> int override
auto procNull() const -> int override
auto getCount(Status& st, Data::Code type) const -> size_t override
void broadcast(void* buffer, size_t count, Data::Code type, size_t root) const override
void gather(const void* sendbuf, size_t sendcount, void* recvbuf, size_t recvcount, Data::Code type, size_t root) const override
void scatter(const void* sendbuf, size_t sendcount, void* recvbuf, size_t recvcount, Data::Code type, size_t root) const override
void gatherv(const void* sendbuf, size_t sendcount, void* recvbuf, const int recvcounts[], const int displs[], Data::Code type, size_t root) const override
void scatterv(const void* sendbuf, const int sendcounts[], const int displs[], void* recvbuf, size_t recvcount, Data::Code type, size_t root) const override
void reduce(const void* sendbuf, void* recvbuf, size_t count, Data::Code type, Operation::Code op, size_t root) const override
void reduceInPlace(void* sendrecvbuf, size_t count, Data::Code type, Operation::Code op, size_t root) const override
void allReduce(const void* sendbuf, void* recvbuf, size_t count, Data::Code type, Operation::Code op) const override
void allReduceInPlace(void* sendrecvbuf, size_t count, Data::Code type, Operation::Code op) const override
void allGather(const void* sendbuf, size_t sendcount, void* recvbuf, size_t recvcount, Data::Code type) const override
void allGatherv(const void* sendbuf, size_t sendcount, void* recvbuf, const int recvcounts[], const int displs[], Data::Code type) const override
void allToAll(const void* sendbuf, size_t sendcount, void* recvbuf, size_t recvcount, Data::Code type) const override
void allToAllv(const void* sendbuf, const int sendcounts[], const int sdispls[], void* recvbuf, const int recvcounts[], const int rdispls[], Data::Code type) const override
auto receive(void* recv, size_t count, Data::Code type, int source, int tag) const -> Status override
void send(const void* send, size_t count, Data::Code type, int dest, int tag) const override
void synchronisedSend(const void* send, size_t count, Data::Code type, int dest, int tag) const override
auto iReceive(void* recv, size_t count, Data::Code type, int source, int tag) const -> Request override
auto iSend(const void* send, size_t count, Data::Code type, int dest, int tag) const -> Request override
auto sendReceiveReplace(void* sendrecv, size_t count, Data::Code type, int dest, int sendtag, int source, int recvtag) const -> Status override
auto split(int color, const std::string& name) const -> Comm& override
Split the communicator based on color & give the new communicator a name.
void free() override
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 broadcastFile(const eckit::PathName& filepath, size_t root) const -> eckit::SharedBuffer override
void print(std::ostream&) const override
auto status() const -> Status override
auto request(int tag) const -> Request override
auto group(int) const -> Group override
auto group() const -> Group override
auto remoteGroup() const -> Group override
auto create(const Group&, const std::string& name) const -> Comm& override
auto create(const Group&, int tag, const std::string& name) const -> Comm& override
auto communicator() const -> int override
The communicator.

Function documentation

static Comm& eckit::mpi::Serial::comm(std::string_view name = {})

std::string eckit::mpi::Serial::name() const

size_t eckit::mpi::Serial::rank() const

MPI rank of process in this communicator.

size_t eckit::mpi::Serial::size() const

MPI size of this communicator.

template<typename T>
size_t eckit::mpi::Serial::getCount(Status& status) const

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

Broadcast, pointer to data (also covers scalars)

template<typename T>
void eckit::mpi::Serial::broadcast(T* first, T* last, size_t root) const

template<typename T>
void eckit::mpi::Serial::broadcast(T buffer[], size_t count, size_t root) const

template<typename T>
void eckit::mpi::Serial::broadcast(typename std::vector<T>& v, size_t root) const

template<class Iter>
void eckit::mpi::Serial::broadcast(Iter first, Iter last, size_t root) const

template<class CIter, class Iter>
void eckit::mpi::Serial::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 T>
void eckit::mpi::Serial::gather(const T send, std::vector<T>& recv, size_t root) const

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

template<typename Value>
void eckit::mpi::Serial::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<class CIter, class Iter>
void eckit::mpi::Serial::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 eckit::mpi::Serial::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 eckit::mpi::Serial::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 eckit::mpi::Serial::scatter(const std::vector<T>& send, T& recv, size_t root) const

Scatter methods from one root

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

template<typename Value>
void eckit::mpi::Serial::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<class CIter, class Iter>
void eckit::mpi::Serial::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 eckit::mpi::Serial::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 eckit::mpi::Serial::reduce(const T send, T& recv, Operation::Code op, size_t root) const

Reduce operations, separate buffers

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

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

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

Reduce operations, in place buffer

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

template<class Iter>
void eckit::mpi::Serial::reduceInPlace(Iter first, Iter last, Operation::Code op, size_t root) const

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

All reduce operations, separate buffers

template<typename T>
void eckit::mpi::Serial::allReduce(const T* send, T* recv, size_t count, Operation::Code op) const

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

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

All reduce operations, in place buffer

template<typename T>
void eckit::mpi::Serial::allReduceInPlace(T& sendrecvbuf, Operation::Code op) const

template<class Iter>
void eckit::mpi::Serial::allReduceInPlace(Iter first, Iter last, Operation::Code op) const

template<typename T, typename Iter>
void eckit::mpi::Serial::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::Serial::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, typename CIter>
void eckit::mpi::Serial::allGatherv(CIter first, CIter last, mpi::Buffer<T>& recv) const

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

All to all methods, fixed data size

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

All to all of vector< vector<> >

template<typename T>
void eckit::mpi::Serial::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::Serial::iReceive(T* recv, size_t count, int source, int tag) const

Non-blocking receive

template<typename T>
Request eckit::mpi::Serial::iReceive(T& recv, int source, int tag) const

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

Blocking receive

template<typename T>
Status eckit::mpi::Serial::receive(T& recv, int source, int tag) const

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

Blocking send

template<typename T>
void eckit::mpi::Serial::send(const T& sendbuf, int dest, int tag) const

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

Blocking send, until message received

template<typename T>
void eckit::mpi::Serial::synchronisedSend(const T& sendbuf, int dest, int tag) const

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

Non-blocking send

template<typename T>
Request eckit::mpi::Serial::iSend(const T& sendbuf, int dest, int tag) const

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

In place simultaneous send and receive

template<typename T>
Status eckit::mpi::Serial::sendReceiveReplace(T& sendrecv, int dest, int sendtag, int source, int recvtag) const

Status eckit::mpi::Serial::waitAny(std::vector<Request>& requests, int& index) const override private

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.

eckit::SharedBuffer eckit::mpi::Serial::broadcastFile(const eckit::PathName& filepath, size_t root) const override private

Read file on one rank, and broadcast