26 #include <queso/MpiComm.h>
27 #include <queso/Environment.h>
35 #ifdef QUESO_HAS_TRILINOS
36 m_epetraMpiComm( new Epetra_MpiComm(inputRawComm) ),
38 m_rawComm (inputRawComm),
43 int mpiRC = MPI_Comm_rank(inputRawComm,&
m_worldRank);
46 mpiRC = MPI_Comm_rank(inputRawComm,&
m_myPid);
49 mpiRC = MPI_Comm_size(inputRawComm,&
m_numProc);
57 #ifdef QUESO_HAS_TRILINOS
68 #ifdef QUESO_HAS_TRILINOS
69 delete m_epetraMpiComm;
70 m_epetraMpiComm = NULL;
87 #ifdef QUESO_HAS_TRILINOS
88 return m_epetraMpiComm->Comm();
96 #ifdef QUESO_HAS_TRILINOS
97 return m_epetraMpiComm->MyPID();
105 #ifdef QUESO_HAS_TRILINOS
106 return m_epetraMpiComm->NumProc();
115 int mpiRC = MPI_Allreduce(sendbuf, recvbuf, count, datatype, op,
m_rawComm);
124 #ifdef QUESO_HAS_TRILINOS
125 return m_epetraMpiComm->Barrier();
135 int mpiRC = MPI_Bcast(buffer, count, datatype, root,
m_rawComm);
145 const char* whereMsg,
const char* whatMsg)
const
150 int mpiRC = MPI_Gather(sendbuf, sendcnt, sendtype,
151 recvbuf, recvcount, recvtype,
162 const char* whereMsg,
const char* whatMsg)
const
167 int mpiRC = MPI_Gatherv(sendbuf, sendcnt, sendtype,
168 recvbuf, recvcnts, displs, recvtype,
177 const char* whereMsg,
const char* whatMsg)
const
179 int mpiRC = MPI_Recv(buf, count, datatype, source, tag,
m_rawComm, status);
187 const char* whereMsg,
const char* whatMsg)
const
189 int mpiRC = MPI_Send(buf, count, datatype, dest, tag,
m_rawComm);
199 for (
int i = 0; i < this->
NumProc(); ++i) {
200 if (i == this->
MyPID()) {
220 #ifdef QUESO_HAS_TRILINOS
221 const Epetra_MpiComm&
222 MpiComm::epetraMpiComm()
const
224 return *m_epetraMpiComm;
232 #ifdef QUESO_HAS_TRILINOS
233 delete m_epetraMpiComm;
234 m_epetraMpiComm =
new Epetra_MpiComm(*src.m_epetraMpiComm);
MPI_Comm RawType_MPI_Comm
int subRank() const
Access function for sub-rank.
int MyPID() const
Return my process ID.
MPI_Status RawType_MPI_Status
RawType_MPI_Comm m_rawComm
Embedded wrapped opaque MPI_Comm object.
void Barrier() const
Pause every process in *this communicator until all the processes reach this point.
int NumProc() const
Returns total number of processes.
int fullRank() const
Returns the process full rank.
const BaseEnvironment & m_env
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.
MPI_Datatype RawType_MPI_Datatype
unsigned int syncVerbosity() const
Access function to private attribute m_syncVerbosity.
int inter0Rank() const
Returns the process inter0 rank.
The QUESO MPI Communicator Class.
#define queso_require_equal_to_msg(expr1, expr2, msg)
int m_worldRank
World rank.
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.
RawType_MPI_Comm Comm() const
Extract MPI Communicator from a MpiComm object.
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
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.
MpiComm & operator=(const MpiComm &rhs)
Assignment operator.
MpiComm()
Default Constructor.
unsigned int subId() const
Access function to the number of each sub-environment Id: m_subId.
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.
int m_myPid
Process ID of this process.
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.
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.
void syncPrintDebugMsg(const char *msg, unsigned int msgVerbosity, unsigned int numUSecs) const
Synchronizes all the processes and print debug message.
void copy(const MpiComm &src)
Copies from an existing MpiComm instance.