WARPXM v1.10.0
Loading...
Searching...
No Matches
wxmpimsg.h
Go to the documentation of this file.
1#ifndef wxmpimsg_h
2#define wxmpimsg_h
3
4#ifndef _DONT_USE_MPI_
5#include <mpi.h>
6#endif
7
8// WarpX includes
9#include "wxmsgbase.h"
10#include "wxmpimsgtmpl.h"
11#include "wxdatatypes.h"
12
13// std includes
14
22class WxMpiMsg : public WxMsgBase
23{
24public:
32
38 int rank() const override
39 {
40 int r;
41 MPI_Comm_rank(_comm, &r);
42 return r;
43 }
44
50 unsigned numProcs() const override
51 {
52 int np;
53 MPI_Comm_size(_comm, &np);
54 return np;
55 }
56
64 WxMsgBase* createSubComm(const std::vector<int>& ranks) override;
65
69 WxMsgBase* splitComm(int color, int order) override;
70
74 void barrier() const override
75 {
76 MPI_Barrier(_comm);
77 }
78
86 void* finishRecv(WxMsgStatus ms) const override;
87
93 void finishSend(WxMsgStatus ms) const override;
94
103 bool checkRecv(WxMsgStatus ms) const override;
104
110 MPI_Comm getMpiComm() const
111 {
112 return _comm;
113 }
114
115private:
119 WxMpiMsg(WxMpiMsg* parent, MPI_Comm comm);
120
121 MPI_Comm _comm;
122};
123
125#endif // wxmpimsg_h
MPI Messenger.
Definition: wxmpimsg.h:23
void barrier() const override
Block till all processes hit this barrier.
Definition: wxmpimsg.h:74
void * finishRecv(WxMsgStatus ms) const override
Finish the receive started by startRecv and return a pointer to the data recieved.
unsigned numProcs() const override
Number of processes taking part in messaging.
Definition: wxmpimsg.h:50
WxMsgBase * createSubComm(const std::vector< int > &ranks) override
Split communicator into a child communicator.
int rank() const override
Rank of process.
Definition: wxmpimsg.h:38
void finishSend(WxMsgStatus ms) const override
Finish the send started by startSend.
bool checkRecv(WxMsgStatus ms) const override
Check status of recieve started by a startRecv.
MPI_Comm getMpiComm() const
Get MPI communicator for this class.
Definition: wxmpimsg.h:110
WxMpiMsg()
Construct a new MPI messenger give a set of communicating processors.
WxMsgBase * splitComm(int color, int order) override
See MPI_Comm_split.
Provides an abstract interface for message based communication between different processes.
Definition: wxmsgbase.h:22
WxMsgBase * parent() const
Get parent communicating processor group.
Definition: wxmsgbase.h:50
Provides a means for derived messengers to return implimentation specific message status flags and da...
Definition: wxmsgtmpl.h:19