queso-0.54.0
|
The QUESO MPI Communicator Class. More...
#include <MpiComm.h>
Public Member Functions | |
Constructor/Destructor methods | |
MpiComm (const BaseEnvironment &env, RawType_MPI_Comm inputRawComm) | |
QUESO MpiComm MPI parallel constructor. More... | |
MpiComm (const BaseEnvironment &env) | |
QUESO MpiComm MPI serial constructor. More... | |
MpiComm (const MpiComm &src) | |
Copy Constructor. More... | |
~MpiComm () | |
Destructor. More... | |
Set methods | |
MpiComm & | operator= (const MpiComm &rhs) |
Assignment operator. More... | |
Attribute Accessor Methods | |
RawType_MPI_Comm | Comm () const |
Extract MPI Communicator from a MpiComm object. More... | |
int | MyPID () const |
Return my process ID. More... | |
int | NumProc () const |
Returns total number of processes. More... | |
Methods Overridden from Comm | |
void | Allreduce (void *sendbuf, void *recvbuf, int count, RawType_MPI_Datatype datatype, RawType_MPI_Op op, const char *whereMsg, const char *whatMsg) const |
Combines values from all processes and distributes the result back to all processes. More... | |
template<typename T > | |
void | Allreduce (const T *sendbuf, T *recvbuf, int count, RawType_MPI_Op op, const char *whereMsg, const char *whatMsg) const |
Combines values from all processes and distributes the result back to all processes. More... | |
void | Barrier () const |
Pause every process in *this communicator until all the processes reach this point. More... | |
void | Bcast (void *buffer, int count, RawType_MPI_Datatype datatype, int root, const char *whereMsg, const char *whatMsg) const |
Broadcast values from the root process to the slave processes. More... | |
void | Gather (void *sendbuf, int sendcnt, RawType_MPI_Datatype sendtype, void *recvbuf, int recvcount, RawType_MPI_Datatype recvtype, int root, const char *whereMsg, const char *whatMsg) const |
Gather values from each process to collect on all processes. More... | |
template<typename T > | |
void | Gather (const T *sendbuf, int sendcnt, T *recvbuf, int recvcount, int root, const char *whereMsg, const char *whatMsg) const |
Gather values from each process to collect on all processes. More... | |
void | Gatherv (void *sendbuf, int sendcnt, RawType_MPI_Datatype sendtype, void *recvbuf, int *recvcnts, int *displs, RawType_MPI_Datatype recvtype, int root, const char *whereMsg, const char *whatMsg) const |
Gathers into specified locations from all processes in a group. More... | |
template<typename T > | |
void | Gatherv (const T *sendbuf, int sendcnt, T *recvbuf, int *recvcnts, int *displs, int root, const char *whereMsg, const char *whatMsg) const |
Gathers into specified locations from all processes in a group. More... | |
void | Recv (void *buf, int count, RawType_MPI_Datatype datatype, int source, int tag, RawType_MPI_Status *status, const char *whereMsg, const char *whatMsg) const |
Blocking receive of data from this process to another process. More... | |
void | Send (void *buf, int count, RawType_MPI_Datatype datatype, int dest, int tag, const char *whereMsg, const char *whatMsg) const |
Possibly blocking send of data from this process to another process. More... | |
Miscellaneous Methods | |
void | syncPrintDebugMsg (const char *msg, unsigned int msgVerbosity, unsigned int numUSecs) const |
Synchronizes all the processes and print debug message. More... | |
Private Member Functions | |
MpiComm () | |
Default Constructor. More... | |
void | copy (const MpiComm &src) |
Copies from an existing MpiComm instance. More... | |
Private Attributes | |
const BaseEnvironment & | m_env |
RawType_MPI_Comm | m_rawComm |
Embedded wrapped opaque MPI_Comm object. More... | |
int | m_worldRank |
World rank. More... | |
int | m_myPid |
Process ID of this process. More... | |
int | m_numProc |
The QUESO MPI Communicator Class.
This class uses MPI (the Message Passing Interface) for distributed-memory communication between one or more parallel processes. It is meant to insulate the user from the specifics of communication that are not required for normal manipulation of linear algebra objects.
QUESO::MpiComm::MpiComm | ( | const BaseEnvironment & | env, |
RawType_MPI_Comm | inputRawComm | ||
) |
QUESO MpiComm MPI parallel constructor.
This constructs an MpiComm that uses the given "raw" MPI communicator underneath. MPI_Init must have been called before instantiating an object of this type.
The MPI_Comm must be valid for the lifetime of this MpiComm.
Definition at line 33 of file MpiComm.C.
References m_myPid, m_numProc, m_worldRank, and queso_require_equal_to_msg.
QUESO::MpiComm::MpiComm | ( | const BaseEnvironment & | env | ) |
QUESO MpiComm MPI serial constructor.
This constructs an MpiComm that defaults to MPI_COMM_SELF underneath. MPI_Init need not be called before using this constructor.
The MPI_Comm must be valid for the lifetime of this MpiComm.
Definition at line 60 of file MpiComm.C.
QUESO::MpiComm::MpiComm | ( | const MpiComm & | src | ) |
Copy Constructor.
Makes an exact copy of an existing MpiComm instance.
Definition at line 74 of file MpiComm.C.
References copy().
QUESO::MpiComm::~MpiComm | ( | ) |
|
private |
Default Constructor.
It should not be used by user.
void QUESO::MpiComm::Allreduce | ( | void * | sendbuf, |
void * | recvbuf, | ||
int | count, | ||
RawType_MPI_Datatype | datatype, | ||
RawType_MPI_Op | op, | ||
const char * | whereMsg, | ||
const char * | whatMsg | ||
) | const |
Combines values from all processes and distributes the result back to all processes.
sendbuf | starting address of send buffer |
count | number of elements in send buffer |
datatype | data type of elements of send buffer |
op | operation |
recvbuf | (output) starting address of receive buffer |
This method is deprecated. Use the templated Allreduce method instead.
Definition at line 133 of file MpiComm.C.
References m_rawComm, NumProc(), queso_deprecated, and queso_require_equal_to_msg.
Referenced by QUESO::MiscCheckForSameValueInAllNodes(), QUESO::GslVector::mpiAllReduce(), QUESO::GslVector::mpiBcast(), QUESO::MHRawChainInfoStruct::mpiSum(), and QUESO::GslMatrix::mpiSum().
void QUESO::MpiComm::Allreduce | ( | const T * | sendbuf, |
T * | recvbuf, | ||
int | count, | ||
RawType_MPI_Op | op, | ||
const char * | whereMsg, | ||
const char * | whatMsg | ||
) | const |
Combines values from all processes and distributes the result back to all processes.
sendbuf | starting address of send buffer containing elements of type T |
count | number of elements in send buffer |
op | operation |
recvbuf | (output) starting address of receive buffer containing elements of type T |
Definition at line 146 of file MpiComm.C.
References m_rawComm, NumProc(), and queso_require_equal_to_msg.
void QUESO::MpiComm::Barrier | ( | ) | const |
Pause every process in *this communicator until all the processes reach this point.
Blocks the caller until all processes in the communicator have called it; that is, the call returns at any process only after all members of the communicator have entered the call.
Definition at line 164 of file MpiComm.C.
References m_rawComm, NumProc(), and queso_require_equal_to_msg.
Referenced by QUESO::ComputeCovCorrMatricesBetweenVectorSequences(), QUESO::FullEnvironment::FullEnvironment(), QUESO::MiscCheckForSameValueInAllNodes(), QUESO::GslVector::mpiBcast(), and syncPrintDebugMsg().
void QUESO::MpiComm::Bcast | ( | void * | buffer, |
int | count, | ||
RawType_MPI_Datatype | datatype, | ||
int | root, | ||
const char * | whereMsg, | ||
const char * | whatMsg | ||
) | const |
Broadcast values from the root process to the slave processes.
Broadcasts a message from the process with rank "root" to all other processes of the communicator.
buffer | (input/output) starting address of buffer |
count | number of entries in buffer |
datatype | data type of buffer |
root | rank of broadcast root |
Definition at line 181 of file MpiComm.C.
References m_rawComm, NumProc(), and queso_require_equal_to_msg.
Referenced by QUESO::MiscCheckForSameValueInAllNodes(), QUESO::GslVector::mpiAllQuantile(), QUESO::GslVector::mpiBcast(), QUESO::InterpolationSurrogateIOASCII< V, M >::read(), and QUESO::InterpolationSurrogateData< V, M >::sync_values().
RawType_MPI_Comm QUESO::MpiComm::Comm | ( | ) | const |
Extract MPI Communicator from a MpiComm object.
Definition at line 105 of file MpiComm.C.
References m_rawComm.
Copies from an existing MpiComm instance.
Definition at line 358 of file MpiComm.C.
References m_myPid, m_numProc, m_rawComm, and m_worldRank.
Referenced by MpiComm(), and operator=().
void QUESO::MpiComm::Gather | ( | void * | sendbuf, |
int | sendcnt, | ||
RawType_MPI_Datatype | sendtype, | ||
void * | recvbuf, | ||
int | recvcount, | ||
RawType_MPI_Datatype | recvtype, | ||
int | root, | ||
const char * | whereMsg, | ||
const char * | whatMsg | ||
) | const |
Gather values from each process to collect on all processes.
sendbuf | starting address of send buffer |
sendcnt | number of elements in send buffer |
sendtype | data type of send buffer elements |
recvcount | number of elements for any single receive |
recvtype | data type of recv buffer elements |
root | rank of receiving process |
recvbuf | (output) address of receive buffer |
This method is deprecated. Use the templated Gather method instead.
Definition at line 192 of file MpiComm.C.
References m_rawComm, NumProc(), queso_deprecated, and queso_require_equal_to_msg.
Referenced by QUESO::GslVector::mpiAllQuantile().
void QUESO::MpiComm::Gather | ( | const T * | sendbuf, |
int | sendcnt, | ||
T * | recvbuf, | ||
int | recvcount, | ||
int | root, | ||
const char * | whereMsg, | ||
const char * | whatMsg | ||
) | const |
Gather values from each process to collect on all processes.
sendbuf | starting address of send buffer containing elements of type T |
sendcnt | number of elements in send buffer |
recvcount | number of elements for any single receive |
root | rank of receiving process |
recvbuf | (output) address of receive buffer containing elements of type T |
Definition at line 214 of file MpiComm.C.
References m_rawComm, NumProc(), and queso_require_equal_to_msg.
void QUESO::MpiComm::Gatherv | ( | void * | sendbuf, |
int | sendcnt, | ||
RawType_MPI_Datatype | sendtype, | ||
void * | recvbuf, | ||
int * | recvcnts, | ||
int * | displs, | ||
RawType_MPI_Datatype | recvtype, | ||
int | root, | ||
const char * | whereMsg, | ||
const char * | whatMsg | ||
) | const |
Gathers into specified locations from all processes in a group.
sendbuf | starting address of send buffer |
sendcount | number of elements in send buffer |
sendtype | data type of send buffer elements |
recvcounts | integer array (of length group size) containing the number of elements that are received from each process |
displs | integer array (of length group size). Entry i specifies the displacement relative to recvbuf at which to place the incoming data from process i |
recvtype | data type of recv buffer elements |
root | rank of receiving process |
Definition at line 244 of file MpiComm.C.
References m_rawComm, NumProc(), queso_deprecated, and queso_require_equal_to_msg.
void QUESO::MpiComm::Gatherv | ( | const T * | sendbuf, |
int | sendcnt, | ||
T * | recvbuf, | ||
int * | recvcnts, | ||
int * | displs, | ||
int | root, | ||
const char * | whereMsg, | ||
const char * | whatMsg | ||
) | const |
Gathers into specified locations from all processes in a group.
sendbuf | starting address of send buffer containing elements of type T |
sendcnt | number of elements in send buffer |
recvcnts | integer array (of length group size) containing the number of elements that are received from each process |
displs | integer array (of length group size). Entry i specifies the displacement relative to recvbuf at which to place the incoming data from process i |
root | rank of receiving process |
Definition at line 266 of file MpiComm.C.
References m_rawComm, NumProc(), and queso_require_equal_to_msg.
int QUESO::MpiComm::MyPID | ( | ) | const |
Return my process ID.
Definition at line 114 of file MpiComm.C.
References m_myPid.
Referenced by QUESO::MiscCheckForSameValueInAllNodes(), QUESO::GslVector::mpiAllQuantile(), QUESO::GslVector::mpiAllReduce(), QUESO::GslVector::mpiBcast(), and syncPrintDebugMsg().
int QUESO::MpiComm::NumProc | ( | ) | const |
Returns total number of processes.
Definition at line 123 of file MpiComm.C.
References m_numProc.
Referenced by Allreduce(), Barrier(), Bcast(), Gather(), Gatherv(), QUESO::EnvironmentOptions::getMyOptionValues(), QUESO::MiscCheckForSameValueInAllNodes(), QUESO::MiscCheckTheParallelEnvironment(), QUESO::GslVector::mpiAllQuantile(), QUESO::GslVector::mpiBcast(), QUESO::Matrix::numOfProcsForStorage(), QUESO::Vector::numOfProcsForStorage(), Recv(), Send(), and syncPrintDebugMsg().
Assignment operator.
Definition at line 97 of file MpiComm.C.
References copy().
void QUESO::MpiComm::Recv | ( | void * | buf, |
int | count, | ||
RawType_MPI_Datatype | datatype, | ||
int | source, | ||
int | tag, | ||
RawType_MPI_Status * | status, | ||
const char * | whereMsg, | ||
const char * | whatMsg | ||
) | const |
Blocking receive of data from this process to another process.
buf | (output) initial address of receive buffer |
status | (output) status object |
count | maximum number of elements in receive buffer |
datatype | datatype of each receive buffer element |
source | rank of source |
tag | message tag |
Definition at line 297 of file MpiComm.C.
References m_rawComm, NumProc(), and queso_require_equal_to_msg.
void QUESO::MpiComm::Send | ( | void * | buf, |
int | count, | ||
RawType_MPI_Datatype | datatype, | ||
int | dest, | ||
int | tag, | ||
const char * | whereMsg, | ||
const char * | whatMsg | ||
) | const |
Possibly blocking send of data from this process to another process.
buf | initial address of send buffer |
count | number of elements in send buffer |
datatype | datatype of each send buffer element |
dest | rank of destination |
tag | message tag |
Definition at line 310 of file MpiComm.C.
References m_rawComm, NumProc(), and queso_require_equal_to_msg.
void QUESO::MpiComm::syncPrintDebugMsg | ( | const char * | msg, |
unsigned int | msgVerbosity, | ||
unsigned int | numUSecs | ||
) | const |
Synchronizes all the processes and print debug message.
Definition at line 323 of file MpiComm.C.
References Barrier(), QUESO::BaseEnvironment::fullRank(), QUESO::BaseEnvironment::inter0Rank(), m_env, MyPID(), NumProc(), QUESO::BaseEnvironment::subId(), QUESO::BaseEnvironment::subRank(), and QUESO::BaseEnvironment::syncVerbosity().
|
private |
Definition at line 393 of file MpiComm.h.
Referenced by syncPrintDebugMsg().
|
private |
|
private |
|
private |
|
private |