28 #include <queso/Defines.h>
30 #ifdef QUESO_HAS_TRILINOS
31 #include <Epetra_MpiComm.h>
44 typedef MPI_Datatype data_type ;
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 STANDARD_TYPE(cxxtype,mpitype) \
164 class StandardType<cxxtype> : public DataType \
168 StandardType(const cxxtype* = NULL) : DataType(mpitype) {} \
173 #define STANDARD_TYPE(cxxtype,mpitype) \
175 class StandardType<cxxtype> : public DataType \
179 StandardType(const cxxtype* = NULL) : DataType() {} \
189 class BaseEnvironment;
267 RawType_MPI_Op op,
const char* whereMsg,
const char* whatMsg)
const;
276 template <
typename T>
278 const char* whereMsg,
const char* whatMsg)
const;
292 const char* whereMsg,
const char* whatMsg)
const;
308 const char* whereMsg,
const char* whatMsg)
const;
318 template <
typename T>
319 void Gather(
const T * sendbuf,
int sendcnt, T * recvbuf,
int recvcount,
int root,
320 const char * whereMsg,
const char * whatMsg)
const;
335 const char* whereMsg,
const char* whatMsg)
const;
348 template <
typename T>
349 void Gatherv(
const T * sendbuf,
int sendcnt, T * recvbuf,
int * recvcnts,
350 int * displs,
int root,
const char * whereMsg,
351 const char * whatMsg)
const;
361 const char* whereMsg,
const char* whatMsg)
const;
370 const char* whereMsg,
const char* whatMsg)
const;
375 void syncPrintDebugMsg(
const char* msg,
unsigned int msgVerbosity,
unsigned int numUSecs)
const;
378 #ifdef QUESO_HAS_TRILINOS
379 const Epetra_MpiComm& epetraMpiComm()
const;
394 #ifdef QUESO_HAS_TRILINOS
397 Epetra_MpiComm* m_epetraMpiComm;
414 #endif // UQ_MPI_COMM_H
DataType(const RawType_MPI_Datatype &type)
MpiComm()
Default Constructor.
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.
RawType_MPI_Comm Comm() const
Extract MPI Communicator from a MpiComm object.
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.
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.
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.
RawType_MPI_Datatype _datatype
int m_myPid
Process ID of this process.
void Barrier() const
Pause every process in *this communicator until all the processes reach this point.
DataType(const DataType &, unsigned int)
and that you are informed that you can do these things To protect your we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it For example
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
int MyPID() const
Return my process ID.
int NumProc() const
Returns total number of processes.
RawType_MPI_Comm m_rawComm
Embedded wrapped opaque MPI_Comm object.
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.
DataType(const DataType &other)
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.
DataType & operator=(const DataType &other)
MpiComm & operator=(const MpiComm &rhs)
Assignment operator.
The QUESO MPI Communicator Class.
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.
STANDARD_TYPE(char, MPI_CHAR)
StandardType(const T *example=NULL)