28 #include <queso/Defines.h>
34 #ifdef QUESO_HAS_TRILINOS
47 #define RawValue_MPI_COMM_SELF MPI_COMM_SELF
48 #define RawValue_MPI_ANY_SOURCE MPI_ANY_SOURCE
49 #define RawValue_MPI_CHAR MPI_CHAR
50 #define RawValue_MPI_INT MPI_INT
51 #define RawValue_MPI_DOUBLE MPI_DOUBLE
52 #define RawValue_MPI_UNSIGNED MPI_UNSIGNED
53 #define RawValue_MPI_MIN MPI_MIN
54 #define RawValue_MPI_MAX MPI_MAX
55 #define RawValue_MPI_SUM MPI_SUM
63 #define RawValue_MPI_COMM_SELF 0
64 #define RawValue_MPI_ANY_SOURCE -1
65 #define RawValue_MPI_CHAR 0
66 #define RawValue_MPI_INT 1
67 #define RawValue_MPI_DOUBLE 2
68 #define RawValue_MPI_UNSIGNED 3
69 #define RawValue_MPI_MIN 0
70 #define RawValue_MPI_MAX 1
71 #define RawValue_MPI_SUM 2
141 template <
typename T>
144 #ifdef QUESO_HAS_CXX11 // This macro isn't defined (yet)
146 static_assert(dependent_false<T>::value,
147 "Only specializations of StandardType may be used, did you forget to include a header file (e.g. parallel_algebra.h)?");
162 #define QUESO_STANDARD_TYPE(cxxtype,mpitype) \
164 class StandardType<cxxtype> : public DataType \
168 StandardType(const cxxtype* = NULL) : DataType(mpitype) {} \
173 #define QUESO_STANDARD_TYPE(cxxtype,mpitype) \
175 class StandardType<cxxtype> : public DataType \
179 StandardType(const cxxtype* = NULL) : DataType() {} \
248 #endif // QUESO_HAS_MPI
269 RawType_MPI_Op op,
const char* whereMsg,
const char* whatMsg)
const;
278 template <
typename T>
280 const char* whereMsg,
const char* whatMsg)
const;
294 const char* whereMsg,
const char* whatMsg)
const;
310 const char* whereMsg,
const char* whatMsg)
const;
320 template <
typename T>
321 void Gather(
const T * sendbuf,
int sendcnt, T * recvbuf,
int recvcount,
int root,
322 const char * whereMsg,
const char * whatMsg)
const;
337 const char* whereMsg,
const char* whatMsg)
const;
350 template <
typename T>
351 void Gatherv(
const T * sendbuf,
int sendcnt, T * recvbuf,
int * recvcnts,
352 int * displs,
int root,
const char * whereMsg,
353 const char * whatMsg)
const;
363 const char* whereMsg,
const char* whatMsg)
const;
372 const char* whereMsg,
const char* whatMsg)
const;
377 void syncPrintDebugMsg(
const char* msg,
unsigned int msgVerbosity,
unsigned int numUSecs)
const;
380 #ifdef QUESO_HAS_TRILINOS
397 #ifdef QUESO_HAS_TRILINOS
417 #endif // UQ_MPI_COMM_H
MPI_Comm RawType_MPI_Comm
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.
MpiComm & operator=(const MpiComm &rhs)
Assignment operator.
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
StandardType(const T *example=NULL)
Epetra_Comm * m_epetraComm
const BaseEnvironment & m_env
RawType_MPI_Datatype _datatype
int m_myPid
Process ID of this process.
void syncPrintDebugMsg(const char *msg, unsigned int msgVerbosity, unsigned int numUSecs) const
Synchronizes all the processes and print debug message.
int MyPID() const
Return my process ID.
int m_worldRank
World rank.
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 copy(const MpiComm &src)
Copies from an existing MpiComm instance.
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.
DataType(const DataType &, unsigned int)
QUESO_STANDARD_TYPE(char, MPI_CHAR)
DataType(const DataType &other)
DataType(const DataType &other, unsigned int count)
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.
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.
MPI_Group RawType_MPI_Group
MPI_Datatype RawType_MPI_Datatype
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.
MpiComm()
Default Constructor.
const Epetra_Comm & epetraMpiComm() const
Extract MPI Communicator from a Epetra_MpiComm object.
The QUESO MPI Communicator Class.
int NumProc() const
Returns total number of processes.
DataType & operator=(const DataType &other)
MPI_Status RawType_MPI_Status
RawType_MPI_Comm Comm() const
Extract MPI Communicator from a MpiComm object.
DataType(const RawType_MPI_Datatype &type)
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.