Class MPIManager¶
Defined in File MPIManager.hpp
Class Documentation¶
-
class MPIManager¶
MPI operation class. Maintains MPI related operations.
Public Functions
-
inline MPIManager()¶
-
inline MPIManager(MPI_Comm communicator)¶
-
inline MPIManager(int argc, char **argv)¶
-
inline MPIManager(const MPIManager &other)¶
-
inline ~MPIManager()¶
-
inline auto getRank() const -> std::size_t¶
Get the process rank in the communicator.
-
inline auto getSize() const -> std::size_t¶
Get the process number in the communicator.
-
inline auto getSizeNode() const -> std::size_t¶
Get the number of processes per node in the communicator.
-
inline MPI_Comm getComm()¶
Get the communicator.
-
inline double getTime()¶
Get an elapsed time.
-
inline auto getVendor() const -> const std::string&¶
Get the MPI vendor.
-
inline auto getVersion() const -> std::tuple<std::size_t, std::size_t>¶
Get the MPI version.
-
template<typename T>
inline void Allgather(T &sendBuf, std::vector<T> &recvBuf, std::size_t sendCount = 1)¶ MPI_Allgather wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer.
recvBuf – Receive buffer vector.
sendCount – Number of elements received from any process.
-
template<typename T>
inline auto allgather(T &sendBuf) -> std::vector<T>¶ MPI_Allgather wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer.
sendCount – Number of elements received from any process.
- Returns
recvBuf Vector of receive buffer.
-
template<typename T>
inline void Allgather(std::vector<T> &sendBuf, std::vector<T> &recvBuf)¶ MPI_Allgather wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer vector.
recvBuf – Receive buffer vector.
-
template<typename T>
inline auto allgather(std::vector<T> &sendBuf) -> std::vector<T>¶ MPI_Allgather wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer vector.
- Returns
recvBuf Vector of receive buffer.
-
template<typename T>
inline void Allreduce(T &sendBuf, T &recvBuf, const std::string &op_str)¶ MPI_Allreduce wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer.
recvBuf – Receive buffer.
op_str – String of MPI_Op.
-
template<typename T>
inline auto allreduce(T &sendBuf, const std::string &op_str) -> T¶ MPI_Allreduce wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer.
op_str – String of MPI_Op.
- Returns
recvBuf Receive buffer.
-
template<typename T>
inline void Allreduce(std::vector<T> &sendBuf, std::vector<T> &recvBuf, const std::string &op_str)¶ MPI_Allreduce wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer vector.
recvBuf – Receive buffer vector.
op_str – String of MPI_Op.
-
template<typename T>
inline auto allreduce(std::vector<T> &sendBuf, const std::string &op_str) -> std::vector<T>¶ MPI_Allreduce wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer vector.
op_str – String of MPI_Op.
- Returns
recvBuf Receive buffer.
-
template<typename T>
inline void Reduce(T &sendBuf, T &recvBuf, std::size_t root, const std::string &op_str)¶ MPI_Reduce wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer.
recvBuf – Receive buffer.
root – Rank of root process.
op_str – String of MPI_Op.
-
template<typename T>
inline void Reduce(std::vector<T> &sendBuf, std::vector<T> &recvBuf, std::size_t root, const std::string &op_str)¶ MPI_Reduce wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer vector.
recvBuf – Receive buffer vector.
root – Rank of root process.
op_str – String of MPI_Op.
-
template<typename T>
inline void Reduce(DataBuffer<T> &sendBuf, DataBuffer<T> &recvBuf, std::size_t length, std::size_t root, const std::string &op_str)¶ MPI_Reduce wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer (DataBuffer type).
recvBuf – Receive buffer (DataBuffer type).
root – Rank of root process.
op_str – String of MPI_Op.
-
template<typename T>
inline void Reduce(T *sendBuf, T *recvBuf, std::size_t length, std::size_t root, const std::string &op_str)¶ MPI_Reduce wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer.
recvBuf – Receive buffer vector.
root – Rank of root process.
-
template<typename T>
inline void Gather(std::vector<T> &sendBuf, std::vector<T> &recvBuf, std::size_t root)¶ MPI_Reduce wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer vector.
recvBuf – Receive buffer vector.
root – Rank of root process.
-
inline void Barrier()¶
MPI_Barrier wrapper.
-
template<typename T>
inline void Bcast(T &sendBuf, std::size_t root)¶ MPI_Bcast wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer.
root – Rank of broadcast root.
-
template<typename T>
inline void Bcast(std::vector<T> &sendBuf, std::size_t root)¶ MPI_Bcast wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer vector.
root – Rank of broadcast root.
-
template<typename T>
inline void Scatter(T *sendBuf, T *recvBuf, std::size_t dataSize, std::size_t root)¶ MPI_Scatter wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer.
recvBuf – Receive buffer.
root – Rank of scatter root.
-
template<typename T>
inline void Scatter(std::vector<T> &sendBuf, std::vector<T> &recvBuf, std::size_t root)¶ MPI_Scatter wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer vector.
recvBuf – Receive buffer vector.
root – Rank of scatter root.
-
template<typename T>
inline auto scatter(std::vector<T> &sendBuf, std::size_t root) -> std::vector<T>¶ MPI_Scatter wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer vector.
root – Rank of scatter root.
- Returns
recvBuf Receive buffer vector.
-
template<typename T>
inline void Send(std::vector<T> &sendBuf, std::size_t dest)¶ MPI_Send wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer vector.
dest – Rank of send dest.
-
template<typename T>
inline void Recv(std::vector<T> &recvBuf, std::size_t source)¶ MPI_Recv wrapper.
- Template Parameters
T – C++ data type.
- Parameters
recvBuf – Recv buffer vector.
source – Rank of data source.
-
template<typename T>
inline void Sendrecv(T &sendBuf, std::size_t dest, T &recvBuf, std::size_t source)¶ MPI_Sendrecv wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer.
dest – Rank of destination.
recvBuf – Receive buffer.
source – Rank of source.
-
template<typename T>
inline void Sendrecv(std::vector<T> &sendBuf, std::size_t dest, std::vector<T> &recvBuf, std::size_t source)¶ MPI_Sendrecv wrapper.
- Template Parameters
T – C++ data type.
- Parameters
sendBuf – Send buffer vector.
dest – Rank of destination.
recvBuf – Receive buffer vector.
source – Rank of source.
-
inline auto split(std::size_t color, std::size_t key) -> MPIManager¶
Creates new MPIManager based on colors and keys.
- Parameters
color – Processes with the same color are in the same new communicator.
key – Rank assignment control.
- Returns
new MPIManager object.
-
inline MPIManager()¶