12#include <kernel/util/binary_stream.hpp>
13#include <kernel/util/type_traits.hpp>
76#if defined(FEAT_HAVE_MPI) || defined(DOXYGEN)
91 explicit Datatype(MPI_Datatype dt_, std::size_t bytes_) :
dt(dt_),
bytes(bytes_) {}
98 explicit Datatype(
int dt_, std::size_t bytes_) :
dt(dt_),
bytes(bytes_) {}
105 return this->dt == other.dt;
111 return this->dt != other.dt;
172#if defined(FEAT_HAVE_QUADMATH) || defined(DOXYGEN)
177#if defined(FEAT_HAVE_HALFMATH) || defined(DOXYGEN)
197 template<>
inline const Datatype& autotype<wchar_t>() {
return dt_wchar;}
198 template<>
inline const Datatype& autotype<signed char>() {
return dt_signed_char;}
199 template<>
inline const Datatype& autotype<signed short>() {
return dt_signed_short;}
200 template<>
inline const Datatype& autotype<signed int>() {
return dt_signed_int;}
201 template<>
inline const Datatype& autotype<signed long>() {
return dt_signed_long;}
202 template<>
inline const Datatype& autotype<signed long long>() {
return dt_signed_long_long;}
203 template<>
inline const Datatype& autotype<unsigned char>() {
return dt_unsigned_char;}
204 template<>
inline const Datatype& autotype<unsigned short>() {
return dt_unsigned_short;}
205 template<>
inline const Datatype& autotype<unsigned int>() {
return dt_unsigned_int;}
206 template<>
inline const Datatype& autotype<unsigned long>() {
return dt_unsigned_long;}
208 template<>
inline const Datatype& autotype<float>() {
return dt_float;}
209 template<>
inline const Datatype& autotype<double>() {
return dt_double;}
210 template<>
inline const Datatype& autotype<long double>() {
return dt_long_double;}
212#if defined(FEAT_HAVE_QUADMATH) || defined(DOXYGEN)
213 template<>
inline const Datatype& autotype<__float128>() {
return dt__float128;}
216#if defined(FEAT_HAVE_HALFMATH) || defined(DOXYGEN)
217 template<>
inline const Datatype& autotype<__half>() {
return dt__half;}
238#if defined(FEAT_HAVE_MPI) || defined(DOXYGEN)
260 return this->op == other.op;
266 return this->op != other.op;
296#if defined(FEAT_HAVE_MPI) || defined(DOXYGEN)
305 status.MPI_SOURCE = MPI_PROC_NULL;
326 return status.MPI_SOURCE == MPI_PROC_NULL;
367 MPI_Get_count(&
status, datatype.
dt, &c);
368 return std::size_t(c);
375 MPI_Get_count(&
status, MPI_BYTE, &c);
376 return std::size_t(c);
393 static_assert(
sizeof(Status) ==
sizeof(MPI_Status),
"invalid Status class size; class Status must be a POD");
424#if defined(FEAT_HAVE_MPI) || defined(DOXYGEN)
443#if defined(FEAT_HAVE_MPI) || defined(DOXYGEN)
445 explicit Request(MPI_Request req_);
598 static_assert(
sizeof(Request) ==
sizeof(MPI_Request),
"invalid Request class size; class Request must be a POD");
647#if defined(FEAT_HAVE_MPI)
650 return int(
_reqs.size());
653 MPI_Request* _reqs_array()
655 return reinterpret_cast<MPI_Request*
>(
_reqs.data());
658 MPI_Status* _stats_array()
660 return reinterpret_cast<MPI_Status*
>(
_stats.data());
733 _reqs = std::forward<std::vector<Request>>(other._reqs);
734 _stats = std::forward<std::vector<Status>>(other._stats);
743 XASSERTM(
is_null(),
"You are trying to destroy an active request vector!");
815 if(size_ <=
_reqs.size())
817 _reqs.reserve(size_);
837 for(std::size_t i(size_); i <
_reqs.size(); ++i)
860 std::size_t i(0), j(0), n =
_reqs.size();
888 _reqs.emplace_back(std::forward<Request>(request));
917 std::size_t count(0);
918 for(
const auto& r :
_reqs)
939 return _reqs.empty();
956 for(
const auto& r :
_reqs)
1350#if defined(FEAT_HAVE_MPI) || defined(DOXYGEN)
1362#if !defined(FEAT_HAVE_MPI) && !defined(DOXYGEN)
1374#if defined(FEAT_HAVE_MPI) || defined(DOXYGEN)
1387 explicit Comm(MPI_Comm comm_);
1437#if defined(FEAT_HAVE_MPI) || defined(DOXYGEN)
1643 void send(
const void* buffer, std::size_t count,
const Datatype& datatype,
int dest,
int tag = 0)
const;
1664 template<
typename T_>
1665 void send(
const T_* buffer, std::size_t count,
int dest,
int tag = 0)
const
1667 send(buffer, count, autotype<T_>(), dest, tag);
1693 void recv(
void* buffer, std::size_t count,
const Datatype& datatype,
int source,
int tag,
Status& status)
const;
1717 void recv(
void* buffer, std::size_t count,
const Datatype& datatype,
int source,
int tag = 0)
const
1720 recv(buffer, count, datatype, source, tag, status);
1745 template<
typename T_>
1746 void recv(T_* buffer, std::size_t count,
int source,
int tag,
Status& status)
const
1748 recv(buffer, count, autotype<T_>(), source, tag, status);
1771 template<
typename T_>
1772 void recv(T_* buffer, std::size_t count,
int source,
int tag = 0)
const
1775 recv(buffer, count, autotype<T_>(), source, tag, status);
1809 Request isend(
const void* buffer, std::size_t count,
const Datatype& datatype,
int dest,
int tag = 0)
const;
1833 template<
typename T_>
1834 Request isend(
const T_* buffer, std::size_t count,
int dest,
int tag = 0)
const
1836 return isend(buffer, count, autotype<T_>(), dest, tag);
1862 Request irecv(
void* buffer, std::size_t count,
const Datatype& datatype,
int source,
int tag = 0)
const;
1886 template<
typename T_>
1887 Request irecv(T_* buffer, std::size_t count,
int source,
int tag = 0)
const
1889 return irecv(buffer, count, autotype<T_>(), source, tag);
1917 void bcast(
void* buffer, std::size_t count,
const Datatype& datatype,
int root)
const;
1935 template<
typename T_>
1936 void bcast(T_* buffer, std::size_t count,
int root)
const
1938 bcast(buffer, count, autotype<T_>(), root);
1982 template<
typename T_>
1985 return ibcast(buffer, count, autotype<T_>(), root);
2026 void gather(
const void* sendbuf, std::size_t sendcount,
const Datatype& sendtype,
void* recvbuf, std::size_t recvcount,
const Datatype& recvtype,
int root)
const;
2054 template<
typename ST_,
typename RT_>
2055 void gather(
const ST_* sendbuf, std::size_t sendcount, RT_* recvbuf, std::size_t recvcount,
int root)
const
2057 gather(sendbuf, sendcount, autotype<ST_>(), recvbuf, recvcount, autotype<RT_>(), root);
2094 Request igather(
const void* sendbuf, std::size_t sendcount,
const Datatype& sendtype,
void* recvbuf, std::size_t recvcount,
const Datatype& recvtype,
int root)
const;
2126 template<
typename ST_,
typename RT_>
2127 Request igather(
const ST_* sendbuf, std::size_t sendcount, RT_* recvbuf, std::size_t recvcount,
int root)
const
2129 return igather(sendbuf, sendcount, autotype<ST_>(), recvbuf, recvcount, autotype<RT_>(), root);
2162 void scatter(
const void* sendbuf, std::size_t sendcount,
const Datatype& sendtype,
void* recvbuf, std::size_t recvcount,
const Datatype& recvtype,
int root)
const;
2190 template<
typename ST_,
typename RT_>
2191 void scatter(
const ST_* sendbuf, std::size_t sendcount, RT_* recvbuf, std::size_t recvcount,
int root)
const
2193 scatter(sendbuf, sendcount, autotype<ST_>(), recvbuf, recvcount, autotype<RT_>(), root);
2230 Request iscatter(
const void* sendbuf, std::size_t sendcount,
const Datatype& sendtype,
void* recvbuf, std::size_t recvcount,
const Datatype& recvtype,
int root)
const;
2262 template<
typename ST_,
typename RT_>
2263 Request iscatter(
const ST_* sendbuf, std::size_t sendcount, RT_* recvbuf, std::size_t recvcount,
int root)
const
2265 return iscatter(sendbuf, sendcount, autotype<ST_>(), recvbuf, recvcount, autotype<RT_>(), root);
2295 void allgather(
const void* sendbuf, std::size_t sendcount,
const Datatype& sendtype,
void* recvbuf, std::size_t recvcount,
const Datatype& recvtype)
const;
2320 template<
typename ST_,
typename RT_>
2321 void allgather(
const ST_* sendbuf, std::size_t sendcount, RT_* recvbuf, std::size_t recvcount)
const
2323 allgather(sendbuf, sendcount, autotype<ST_>(), recvbuf, recvcount, autotype<RT_>());
2386 template<
typename ST_,
typename RT_>
2387 Request iallgather(
const ST_* sendbuf, std::size_t sendcount, RT_* recvbuf, std::size_t recvcount)
const
2389 return iallgather(sendbuf, sendcount, autotype<ST_>(), recvbuf, recvcount, autotype<RT_>());
2426 void allgatherv(
const void* sendbuf, std::size_t sendcount,
const Datatype& sendtype,
void* recvbuf,
const int* recvcounts,
const int* displs,
const Datatype& recvtype)
const;
2458 template<
typename ST_,
typename RT_>
2459 void allgatherv(
const ST_* sendbuf, std::size_t sendcount, RT_* recvbuf,
const int* recvcounts,
const int* displs)
const
2461 allgatherv(sendbuf, sendcount, autotype<ST_>(), recvbuf, recvcounts, displs, autotype<RT_>());
2491 void alltoall(
const void* sendbuf, std::size_t sendcount,
const Datatype& sendtype,
void* recvbuf, std::size_t recvcount,
const Datatype& recvtype)
const;
2516 template<
typename ST_,
typename RT_>
2517 void alltoall(
const ST_* sendbuf, std::size_t sendcount, RT_* recvbuf, std::size_t recvcount)
const
2519 alltoall(sendbuf, sendcount, autotype<ST_>(), recvbuf, recvcount, autotype<RT_>());
2553 Request ialltoall(
const void* sendbuf, std::size_t sendcount,
const Datatype& sendtype,
void* recvbuf, std::size_t recvcount,
const Datatype& recvtype)
const;
2582 template<
typename ST_,
typename RT_>
2583 Request ialltoall(
const ST_* sendbuf, std::size_t sendcount, RT_* recvbuf, std::size_t recvcount)
const
2585 return ialltoall(sendbuf, sendcount, autotype<ST_>(), recvbuf, recvcount, autotype<RT_>());
2625 void alltoallv(
const void* sendbuf,
const int* sendcounts,
const int* sdispls,
const Datatype& sendtype,
void* recvbuf,
const int* recvcounts,
const int* rdispls,
const Datatype& recvtype)
const;
2660 template<
typename ST_,
typename RT_>
2661 void alltoallv(
const ST_* sendbuf,
const int* sendcounts,
const int* sdispls, RT_* recvbuf,
const int* recvcounts,
const int* rdispls)
const
2663 alltoallv(sendbuf, sendcounts, sdispls, autotype<ST_>(), recvbuf, recvcounts, rdispls, autotype<RT_>());
2701 void reduce(
const void* sendbuf,
void* recvbuf, std::size_t count,
const Datatype& datatype,
const Operation& op,
int root)
const;
2729 template<
typename T_>
2730 void reduce(
const T_* sendbuf, T_* recvbuf, std::size_t count,
const Operation& op,
int root)
const
2732 reduce(sendbuf, recvbuf, count, autotype<T_>(), op, root);
2798 template<
typename T_>
2801 return ireduce(sendbuf, recvbuf, count, autotype<T_>(), op, root);
2853 template<
typename T_>
2856 allreduce(sendbuf, recvbuf, count, autotype<T_>(), op);
2916 template<
typename T_>
2919 return iallreduce(sendbuf, recvbuf, count, autotype<T_>(), op);
2946 void scan(
const void* sendbuf,
void* recvbuf, std::size_t count,
const Datatype& datatype,
const Operation& op)
const;
2971 template<
typename T_>
2972 void scan(
const T_* sendbuf, T_* recvbuf, std::size_t count,
const Operation& op)
const
2974 scan(sendbuf, recvbuf, count, autotype<T_>(), op);
3009 void exscan(
const void* sendbuf,
void* recvbuf, std::size_t count,
const Datatype& datatype,
const Operation& op)
const;
3034 template<
typename T_>
3037 exscan(sendbuf, recvbuf, count, autotype<T_>(), op);
3094 void print(std::ostream& os,
const String& msg,
int root = 0)
const;
3108 print(std::cout, msg, root);
3125 void allprint(std::ostream& os,
const String& msg,
int root = 0)
const;
3152 void print_flush(std::ostream& os,
int root = 0)
const;
#define XASSERT(expr)
Assertion macro definition.
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
void scatter(const void *sendbuf, std::size_t sendcount, const Datatype &sendtype, void *recvbuf, std::size_t recvcount, const Datatype &recvtype, int root) const
Blocking scatter.
Comm & operator=(const Comm &)=delete
communicators are non-copyable
void bcast(void *buffer, std::size_t count, const Datatype &datatype, int root) const
Blocking broadcast.
void reduce(const void *sendbuf, void *recvbuf, std::size_t count, const Datatype &datatype, const Operation &op, int root) const
Blocking Reduce.
Request iallgather(const void *sendbuf, std::size_t sendcount, const Datatype &sendtype, void *recvbuf, std::size_t recvcount, const Datatype &recvtype) const
Nonblocking gather-to-all.
Comm comm_create_range_incl(int count, int first=0, int stride=1) const
Creates a new sub-communicator from a strided range of ranks.
void allreduce(const void *sendbuf, void *recvbuf, std::size_t count, const Datatype &datatype, const Operation &op) const
Blocking All-Reduce.
void barrier() const
Blocking barrier.
Request ibcast(void *buffer, std::size_t count, const Datatype &datatype, int root) const
Nonblocking broadcast.
int size() const
Returns the size of this communicator.
void exscan(const void *sendbuf, void *recvbuf, std::size_t count, const Datatype &datatype, const Operation &op) const
Blocking Exclusive Scan.
Comm comm_create_incl(int n, const int *ranks) const
Creates a new sub-communicator for a given set of ranks.
void recv(void *buffer, std::size_t count, const Datatype &datatype, int source, int tag=0) const
Blocking Receive.
Request igather(const void *sendbuf, std::size_t sendcount, const Datatype &sendtype, void *recvbuf, std::size_t recvcount, const Datatype &recvtype, int root) const
Nonblocking gather.
Request isend(const T_ *buffer, std::size_t count, int dest, int tag=0) const
Nonblocking Send.
static Comm null()
Returns a null communicator.
Request ibarrier() const
Nonblocking barrier.
void print(const String &msg, int root=0) const
Prints a message line to the standard output stream cout.
void allreduce(const T_ *sendbuf, T_ *recvbuf, std::size_t count, const Operation &op) const
Blocking All-Reduce.
Request igather(const ST_ *sendbuf, std::size_t sendcount, RT_ *recvbuf, std::size_t recvcount, int root) const
Nonblocking gather.
virtual ~Comm()
virtual destructor
void exscan(const T_ *sendbuf, T_ *recvbuf, std::size_t count, const Operation &op) const
Blocking Exclusive Scan.
void gather(const ST_ *sendbuf, std::size_t sendcount, RT_ *recvbuf, std::size_t recvcount, int root) const
Blocking gather.
Request iallreduce(const void *sendbuf, void *recvbuf, std::size_t count, const Datatype &datatype, const Operation &op) const
Nonblocking All-Reduce.
Request irecv(void *buffer, std::size_t count, const Datatype &datatype, int source, int tag=0) const
Nonblocking Receive.
Comm()
Standard constructor.
void print_flush(int root=0) const
Explicitly flushes cout.
Comm comm_split(int color, int key) const
Creates a new sub-communicator by splitting this communicator.
void recv(T_ *buffer, std::size_t count, int source, int tag=0) const
Blocking Receive.
bool is_world() const
Checks whether this communicator is the world communicator.
void recv(T_ *buffer, std::size_t count, int source, int tag, Status &status) const
Blocking Receive.
void bcast_binarystream(BinaryStream &stream, int root=0) const
Blocking broadcast of a BinaryStream.
void recv(void *buffer, std::size_t count, const Datatype &datatype, int source, int tag, Status &status) const
Blocking Receive.
void bcast(T_ *buffer, std::size_t count, int root) const
Blocking broadcast.
Request isend(const void *buffer, std::size_t count, const Datatype &datatype, int dest, int tag=0) const
Nonblocking Send.
int _size
the communicator size
MPI_Comm comm
our MPI communicator handle
Request iscatter(const void *sendbuf, std::size_t sendcount, const Datatype &sendtype, void *recvbuf, std::size_t recvcount, const Datatype &recvtype, int root) const
Nonblocking scatter.
void scatter(const ST_ *sendbuf, std::size_t sendcount, RT_ *recvbuf, std::size_t recvcount, int root) const
Blocking scatter.
Comm(const Comm &)=delete
communicators are non-copyable
void gather(const void *sendbuf, std::size_t sendcount, const Datatype &sendtype, void *recvbuf, std::size_t recvcount, const Datatype &recvtype, int root) const
Blocking gather.
static Comm self()
Returns a copy of the self communicator.
Request iallgather(const ST_ *sendbuf, std::size_t sendcount, RT_ *recvbuf, std::size_t recvcount) const
Nonblocking gather-to-all.
bool is_self() const
Checks whether this communicator is the self communicator.
const MPI_Comm & mpi_comm() const
void allgatherv(const ST_ *sendbuf, std::size_t sendcount, RT_ *recvbuf, const int *recvcounts, const int *displs) const
Blocking gather-to-all.
void alltoallv(const void *sendbuf, const int *sendcounts, const int *sdispls, const Datatype &sendtype, void *recvbuf, const int *recvcounts, const int *rdispls, const Datatype &recvtype) const
Blocking All-to-All Scatter/Gather.
void allgather(const ST_ *sendbuf, std::size_t sendcount, RT_ *recvbuf, std::size_t recvcount) const
Blocking gather-to-all.
Request iscatter(const ST_ *sendbuf, std::size_t sendcount, RT_ *recvbuf, std::size_t recvcount, int root) const
Nonblocking scatter.
void alltoall(const void *sendbuf, std::size_t sendcount, const Datatype &sendtype, void *recvbuf, std::size_t recvcount, const Datatype &recvtype) const
Blocking All-to-All Scatter/Gather.
void alltoallv(const ST_ *sendbuf, const int *sendcounts, const int *sdispls, RT_ *recvbuf, const int *recvcounts, const int *rdispls) const
Blocking All-to-All Scatter/Gather.
void send(const void *buffer, std::size_t count, const Datatype &datatype, int dest, int tag=0) const
Blocking Send.
void print_flush(std::ostream &os, int root=0) const
Explicitly flushes the output stream.
Request ibcast(T_ *buffer, std::size_t count, int root) const
Nonblocking broadcast.
void reduce(const T_ *sendbuf, T_ *recvbuf, std::size_t count, const Operation &op, int root) const
Blocking Reduce.
void send(const T_ *buffer, std::size_t count, int dest, int tag=0) const
Blocking Send.
Comm comm_dup() const
Creates a copy of this communicator.
void allprint(std::ostream &os, const String &msg, int root=0) const
Prints the ordered messages of all processes to an output stream.
Request ireduce(const void *sendbuf, void *recvbuf, std::size_t count, const Datatype &datatype, const Operation &op, int root) const
Nonblocking Reduce.
Request ireduce(const T_ *sendbuf, T_ *recvbuf, std::size_t count, const Operation &op, int root) const
Nonblocking Reduce.
void scan(const T_ *sendbuf, T_ *recvbuf, std::size_t count, const Operation &op) const
Blocking Inclusive Scan.
void allgatherv(const void *sendbuf, std::size_t sendcount, const Datatype &sendtype, void *recvbuf, const int *recvcounts, const int *displs, const Datatype &recvtype) const
Blocking gather-to-all.
void allprint(const String &msg, int root=0) const
Prints the ordered messages of all processes to the standard output stream cout.
Request ialltoall(const void *sendbuf, std::size_t sendcount, const Datatype &sendtype, void *recvbuf, std::size_t recvcount, const Datatype &recvtype) const
Nonblocking All-to-All Scatter/Gather.
int rank() const
Returns the rank of this process in this communicator.
Request iallreduce(const T_ *sendbuf, T_ *recvbuf, std::size_t count, const Operation &op) const
Nonblocking All-Reduce.
Request irecv(T_ *buffer, std::size_t count, int source, int tag=0) const
Nonblocking Receive.
void alltoall(const ST_ *sendbuf, std::size_t sendcount, RT_ *recvbuf, std::size_t recvcount) const
Blocking All-to-All Scatter/Gather.
void allgather(const void *sendbuf, std::size_t sendcount, const Datatype &sendtype, void *recvbuf, std::size_t recvcount, const Datatype &recvtype) const
Blocking gather-to-all.
bool is_null() const
Checks whether this communicator is a null communicator.
Request ialltoall(const ST_ *sendbuf, std::size_t sendcount, RT_ *recvbuf, std::size_t recvcount) const
Nonblocking All-to-All Scatter/Gather.
static Comm world()
Returns a copy of the world communicator.
void print(std::ostream &os, const String &msg, int root=0) const
Prints a message line to an output stream.
void scan(const void *sendbuf, void *recvbuf, std::size_t count, const Datatype &datatype, const Operation &op) const
Blocking Inclusive Scan.
void bcast_stringstream(std::stringstream &stream, int root=0) const
Blocking broadcast of a std::stringstream.
Communication Request class.
MPI_Request request
our internal MPI request handle
bool test(Status &status)
Tests whether the request is fulfilled (or null) without blocking.
Request(const Request &)=delete
Request objects are non-copyable.
~Request()
non-virtual destructor
Request()
Standard constructor.
bool wait(Status &status)
Blocks until the request is fulfilled (or null).
bool wait()
Blocks until the request is fulfilled (or null).
bool test()
Tests whether the request is fulfilled (or null).
void free()
Frees the request.
MPI_Request * mpi_request()
void cancel()
Cancels the request.
Request & operator=(const Request &)=delete
Request objects are non-copyable.
bool is_null() const
Checks whether this request is null.
Communication Request vector class.
Status & get_status(std::size_t idx)
Returns a (const) reference to a single status in the vector.
void resize(std::size_t size_)
Resizes the request vector.
RequestVector(const RequestVector &)=delete
request vectors are non-copyable
void push_back(Request &&request)
Inserts a new request at the end of the request vector.
RequestVector()
Standard constructor.
void reserve(std::size_t size_)
Reserves sufficient space for a specified number of requests.
bool test_for(std::size_t idx)
Tests whether a specific request is fulfilled (or null).
std::size_t active_count() const
Returns the number of active requests in the vector.
void cancel()
Cancels all remaining active requests.
const Request & get_request(std::size_t idx) const
Returns a (const) reference to a single request in the vector.
Request & get_request(std::size_t idx)
Returns a (const) reference to a single request in the vector.
Request & operator[](std::size_t idx)
Returns a (const) reference to a single request in the vector.
bool wait_for(std::size_t idx, Status &status)
Blocks until a specific request is fulfilled (or null).
bool wait_for(std::size_t idx)
Blocks until a specific request is fulfilled (or null).
bool test_all()
Tests whether all active requests are fulfilled (or null).
bool wait_any(Status &status)
Blocks until one of the active requests has been fulfilled.
RequestVector & operator=(RequestVector &&other)
Move-assignment operator.
bool empty() const
Checks whether the request vector is empty.
bool test_any(std::size_t &idx, Status &status)
Tests whether one of the active requests has been fulfilled.
bool is_null() const
Checks whether all requests are null requests.
std::vector< Request > _reqs
internal vector of Request objects
RequestVector(RequestVector &&other)
Move constructor.
const Request & operator[](std::size_t idx) const
Returns a (const) reference to a single request in the vector.
bool wait_any(std::size_t &idx)
Blocks until one of the active requests has been fulfilled.
void free()
Frees all remaining active requests.
bool test_any(Status &status)
Tests whether one of the active requests has been fulfilled.
std::size_t size() const
Returns the total number of (both active and null) requests in the vector.
std::vector< Status > _stats
internal vector of Status objects
std::size_t compress()
Compresses the request vector.
void clear()
Clears the request vector.
bool wait_any(std::size_t &idx, Status &status)
Blocks until one of the active requests has been fulfilled.
const Status & get_status(std::size_t idx) const
Returns a (const) reference to a single status in the vector.
bool test_any(std::size_t &idx)
Tests whether one of the active requests has been fulfilled.
virtual ~RequestVector()
virtual destructor
RequestVector & operator=(const RequestVector &)=delete
request vectors are non-copyable
RequestVector(std::size_t size_)
Sized constructor.
void wait_all()
Blocks until all active requests are fulfilled.
bool test_for(std::size_t idx, Status &status)
Tests whether a specific request is fulfilled (or null).
Communication Status class.
std::size_t get_size() const
Status()
standard constructor
std::size_t get_count(const Datatype &datatype) const
Returns the size of the message.
Status & operator=(const Status &)=default
status objects are copyable
bool is_null() const
Checks whether the source rank is MPI_PROC_NULL.
MPI_Status status
the MPI status structure
MPI_Status * mpi_status()
Status(const Status &)=default
status objects are copyable
String class implementation.
bool initialize(int &argc, char **&argv)
Initializes the distributed communication system.
const Datatype dt_byte(MPI_BYTE, sizeof(char))
Datatype wrapper for MPI_BYTE.
const Datatype dt_wchar(MPI_WCHAR, sizeof(wchar_t))
Datatype wrapper for MPI_WCHAR.
const Datatype dt_signed_long(MPI_LONG, sizeof(long))
Datatype wrapper for MPI_LONG.
const Datatype dt_float(MPI_FLOAT, sizeof(float))
Datatype wrapper for MPI_FLOAT.
const Datatype dt_signed_char(MPI_SIGNED_CHAR, sizeof(signed char))
Datatype wrapper for MPI_SIGNED_CHAR.
const Datatype dt_signed_short(MPI_SHORT, sizeof(short))
Datatype wrapper for MPI_SHORT.
const Datatype dt_unsigned_long_long(MPI_UNSIGNED_LONG_LONG, sizeof(unsigned long long))
Datatype wrapper for MPI_UNSIGNED_LONG_LONG.
const Datatype dt_signed_int32(MPI_INT32_T, sizeof(std::int32_t))
Datatype wrapper for MPI_INT32_T.
const Datatype & autotype()
Automatic Datatype deduction function template.
const Datatype dt_unsigned_int32(MPI_UINT32_T, sizeof(std::uint32_t))
Datatype wrapper for MPI_UINT32_T.
void finalize()
Finalizes the distributed communication system.
const Datatype dt_signed_int8(MPI_INT8_T, sizeof(std::int8_t))
Datatype wrapper for MPI_INT8_T.
const Datatype dt_char(MPI_CHAR, sizeof(char))
Datatype wrapper for MPI_CHAR.
const Operation op_min(MPI_MIN)
Operation wrapper for MPI_MIN.
const Datatype dt_unsigned_int(MPI_UNSIGNED, sizeof(unsigned int))
Datatype wrapper for MPI_UNSIGNED.
const Datatype dt_unsigned_int16(MPI_UINT16_T, sizeof(std::uint16_t))
Datatype wrapper for MPI_UINT16_T.
const Datatype dt_unsigned_int8(MPI_UINT8_T, sizeof(std::uint8_t))
Datatype wrapper for MPI_UINT8_T.
const Datatype dt__half
custom Datatype for __half
const Datatype dt_signed_int(MPI_INT, sizeof(int))
Datatype wrapper for MPI_INT.
const Datatype dt_signed_long_long(MPI_LONG_LONG, sizeof(long long))
Datatype wrapper for MPI_LONG_LONG.
const Operation op_max(MPI_MAX)
Operation wrapper for MPI_MAX.
const Datatype dt_double(MPI_DOUBLE, sizeof(double))
Datatype wrapper for MPI_DOUBLE.
const Datatype dt_unsigned_char(MPI_UNSIGNED_CHAR, sizeof(unsigned char))
Datatype wrapper for MPI_UNSIGNED_CHAR.
const Datatype dt_signed_int16(MPI_INT16_T, sizeof(std::int16_t))
Datatype wrapper for MPI_INT16_T.
const Datatype dt_unsigned_short(MPI_UNSIGNED_SHORT, sizeof(unsigned short))
Datatype wrapper for MPI_UNSIGNED_SHORT.
const Datatype dt_unsigned_int64(MPI_UINT64_T, sizeof(std::uint64_t))
Datatype wrapper for MPI_UINT64_T.
const Datatype dt_long_double(MPI_LONG_DOUBLE, sizeof(long double))
Datatype wrapper for MPI_LONG_DOUBLE.
const Operation op_sum(MPI_SUM)
Operation wrapper for MPI_SUM.
const Datatype dt__float128
custom Datatype for __float128
const Datatype dt_unsigned_long(MPI_UNSIGNED_LONG, sizeof(unsigned long))
Datatype wrapper for MPI_UNSIGNED_LONG.
const Datatype dt_signed_int64(MPI_INT64_T, sizeof(std::int64_t))
Datatype wrapper for MPI_INT64_T.
Communication Datatype class.
MPI_Datatype dt
the MPI datatype handle
Datatype(MPI_Datatype dt_, std::size_t bytes_)
MPI_Datatype handle constructor
bool operator!=(const Datatype &other) const
inequality comparison operator
bool operator==(const Datatype &other) const
equality comparison operator
std::size_t size() const
Returns the size of the datatype in bytes, as given in the constructor.
std::size_t bytes
the size of the datatype in bytes
Communication Operation class.
bool operator==(const Operation &other) const
equality comparison operator
Operation(MPI_Op op_)
MPI_Op handle constructor
bool operator!=(const Operation &other) const
inequality comparison operator
MPI_Op op
the MPI operation handle