queso-0.57.1
|
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... | |
const Epetra_Comm & | epetraMpiComm () const |
Extract MPI Communicator from a Epetra_MpiComm object. 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 |
Epetra_Comm * | m_epetraComm |
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 38 of file MpiComm.C.
References m_myPid, m_numProc, m_worldRank, and QUESO::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 65 of file MpiComm.C.
QUESO::MpiComm::MpiComm | ( | const MpiComm & | src | ) |
Copy Constructor.
Makes an exact copy of an existing MpiComm instance.
QUESO::MpiComm::~MpiComm | ( | ) |
Destructor.
|
private |
Default Constructor.
It should not be used by user.
Definition at line 91 of file MpiComm.C.
References m_epetraComm.
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 143 of file MpiComm.C.
References m_rawComm, NumProc(), and QUESO::queso_require_equal_to_msg.
Referenced by QUESO::MiscCheckForSameValueInAllNodes(), QUESO::GslVector::mpiAllReduce(), QUESO::TeuchosVector::mpiAllReduce(), QUESO::GslVector::mpiBcast(), QUESO::TeuchosVector::mpiBcast(), QUESO::MHRawChainInfoStruct::mpiSum(), QUESO::TeuchosMatrix::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 156 of file MpiComm.C.
References m_rawComm, NumProc(), and QUESO::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 174 of file MpiComm.C.
References m_epetraComm, m_rawComm, NumProc(), and QUESO::queso_require_equal_to_msg.
Referenced by QUESO::VectorFunctionSynchronizer< P_V, P_M, Q_V, Q_M >::callFunction(), QUESO::ComputeCovCorrMatricesBetweenVectorSequences(), QUESO::MiscCheckForSameValueInAllNodes(), QUESO::GslVector::mpiBcast(), QUESO::TeuchosVector::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 191 of file MpiComm.C.
References m_rawComm, NumProc(), and QUESO::queso_require_equal_to_msg.
Referenced by QUESO::MiscCheckForSameValueInAllNodes(), QUESO::GslVector::mpiAllQuantile(), QUESO::TeuchosVector::mpiAllQuantile(), QUESO::GslVector::mpiBcast(), QUESO::TeuchosVector::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 111 of file MpiComm.C.
References m_epetraComm, and m_rawComm.
Referenced by QUESO::GPMSAEmulator< V, M >::lnValue(), and QUESO::GPMSAFactory< V, M >::setUpHyperpriors().
|
private |
Copies from an existing MpiComm instance.
Definition at line 368 of file MpiComm.C.
References m_epetraComm, m_myPid, m_numProc, m_rawComm, and m_worldRank.
Referenced by operator=().
const Epetra_Comm & QUESO::MpiComm::epetraMpiComm | ( | ) | const |
Extract MPI Communicator from a Epetra_MpiComm object.
Definition at line 360 of file MpiComm.C.
References m_epetraComm.
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 202 of file MpiComm.C.
References m_rawComm, NumProc(), and QUESO::queso_require_equal_to_msg.
Referenced by QUESO::GslVector::mpiAllQuantile(), and QUESO::TeuchosVector::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 224 of file MpiComm.C.
References m_rawComm, NumProc(), and QUESO::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 254 of file MpiComm.C.
References m_rawComm, NumProc(), and QUESO::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 276 of file MpiComm.C.
References m_rawComm, NumProc(), and QUESO::queso_require_equal_to_msg.
int QUESO::MpiComm::MyPID | ( | ) | const |
Return my process ID.
Definition at line 124 of file MpiComm.C.
References m_epetraComm, and m_myPid.
Referenced by QUESO::MiscCheckForSameValueInAllNodes(), QUESO::GslVector::mpiAllQuantile(), QUESO::TeuchosVector::mpiAllQuantile(), QUESO::GslVector::mpiAllReduce(), QUESO::TeuchosVector::mpiAllReduce(), QUESO::GslVector::mpiBcast(), QUESO::TeuchosVector::mpiBcast(), and syncPrintDebugMsg().
int QUESO::MpiComm::NumProc | ( | ) | const |
Returns total number of processes.
Definition at line 133 of file MpiComm.C.
References m_epetraComm, and m_numProc.
Referenced by Allreduce(), Barrier(), Bcast(), Gather(), Gatherv(), QUESO::EnvironmentOptions::getMyOptionValues(), QUESO::MiscCheckForSameValueInAllNodes(), QUESO::MiscCheckTheParallelEnvironment(), QUESO::GslVector::mpiAllQuantile(), QUESO::TeuchosVector::mpiAllQuantile(), QUESO::GslVector::mpiBcast(), QUESO::TeuchosVector::mpiBcast(), QUESO::Matrix::numOfProcsForStorage(), QUESO::Vector::numOfProcsForStorage(), Recv(), Send(), and syncPrintDebugMsg().
Assignment operator.
Definition at line 102 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 307 of file MpiComm.C.
References m_rawComm, NumProc(), and QUESO::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 320 of file MpiComm.C.
References m_rawComm, NumProc(), and QUESO::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 333 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 395 of file MpiComm.h.
Referenced by syncPrintDebugMsg().
|
private |
|
private |
|
private |
|
private |
|
private |