6 #ifndef communicators_hh
7 #define communicators_hh
38 virtual ~Communicator() {};
40 virtual int rank()
const = 0;
41 virtual int nrank()
const = 0;
44 virtual int receive(
void *rbuf, uint cnt, uint src) = 0;
45 virtual int receive(uint *rbuf, uint cnt, uint src) = 0;
46 virtual int receive(
Real *rbuf, uint cnt, uint src) = 0;
49 virtual int nbsend(
void *sbuf, uint cnt, uint* dest, uint ndest) = 0;
50 virtual int nbsend(uint *sbuf, uint cnt, uint* dest, uint ndest) = 0;
51 virtual int nbsend(
Real *sbuf, uint cnt, uint* dest, uint ndest) = 0;
52 virtual int waitall() = 0;
55 virtual int allgather(
void *sbuf, uint cnt,
void *rbuf) = 0;
56 virtual int allgather(uint *sbuf, uint cnt, uint *rbuf) = 0;
57 virtual int allgather(
Real *sbuf, uint cnt,
Real *rbuf) = 0;
60 virtual int alltoallV(
void *sbuf,
int *nsdata,
int *sdataoffset,
61 void *rbuf,
int *nrdata,
int *rdataoffset) = 0;
62 virtual int alltoallV(uint *sbuf,
int *nsdata,
int *sdataoffset,
63 uint *rbuf,
int *nrdata,
int *rdataoffset) = 0;
66 virtual int barrier() = 0;
74 class ComMPI :
public Communicator {
82 Request(Request *lnk, uint nreq);
87 inline uint nrequest()
const {
return nreq_;};
88 inline Request* link()
const {
return lnk_;};
98 std::ostream& info(std::ostream& os)
const {
99 return os <<
"ComMPI(rank=" << rnk_ <<
", nrank=" << nrnk_ <<
")";
103 ComMPI(
int *argc,
char ***argv);
106 int rank()
const {
return rnk_;};
107 int nrank()
const {
return nrnk_;};
110 int receive(
void *rbuf, uint cnt, uint src);
111 int receive(uint *rbuf, uint cnt, uint src);
112 int receive(
Real *rbuf, uint cnt, uint src);
115 int nbsend(
void *sbuf, uint cnt, uint* dest, uint ndest);
116 int nbsend(uint *sbuf, uint cnt, uint* dest, uint ndest);
117 int nbsend(
Real *sbuf, uint cnt, uint* dest, uint ndest);
121 int allgather(
void *sbuf, uint cnt,
void *rbuf);
122 int allgather(uint *sbuf, uint cnt, uint *rbuf);
123 int allgather(
Real *sbuf, uint cnt,
Real *rbuf);
126 int alltoallV(
void *sndbuf,
int *sndcounts,
int *sdispls,
127 void *recvbuf,
int *recvcounts,
int *rdispls);
128 int alltoallV(uint *sndbuf,
int *sndcounts,
int *sdispls,
129 uint *recvbuf,
int *recvcounts,
int *rdispls);
138 #endif // communicators_hh