DFT-EFE
 
Loading...
Searching...
No Matches
MPIWrapper.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) 2021. *
3 * The Regents of the University of Michigan and DFT-EFE developers. *
4 * *
5 * This file is part of the DFT-EFE code. *
6 * *
7 * DFT-EFE is free software: you can redistribute it and/or modify *
8 * it under the terms of the Lesser GNU General Public License as *
9 * published by the Free Software Foundation, either version 3 of *
10 * the License, or (at your option) any later version. *
11 * *
12 * DFT-EFE is distributed in the hope that it will be useful, but *
13 * WITHOUT ANY WARRANTY; without even the implied warranty *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
15 * See the Lesser GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU Lesser General Public *
18 * License at the top level of DFT-EFE distribution. If not, see *
19 * <https://www.gnu.org/licenses/>. *
20 ******************************************************************************/
21
22/*
23 * @author Bikash Kanungo
24 */
25
26#ifndef dftefeMPIWrapper_h
27#define dftefeMPIWrapper_h
28
29#include <utils/MPITypes.h>
30#include <utils/TypeConfig.h>
32#include <string>
33#include <utility>
34namespace dftefe
35{
36 namespace utils
37 {
38 namespace mpi
39 {
40 template <typename MPIDatatype>
41 struct MinMaxAvg
42 {
46 };
47
48 int
49 MPITypeContiguous(int count, MPIDatatype oldtype, MPIDatatype *newtype);
50
51 template <MemorySpace memorySpace>
52 int
53 MPIAllreduce(const void *sendbuf,
54 void * recvbuf,
55 int count,
56 MPIDatatype datatype,
57 MPIOp op,
58 MPIComm comm);
59
60 template <MemorySpace memorySpace>
61 int
62 MPIAllgather(const void *sendbuf,
63 int sendcount,
64 MPIDatatype sendtype,
65 void * recvbuf,
66 int recvcount,
67 MPIDatatype recvtype,
68 MPIComm comm);
69
70 template <MemorySpace memorySpace>
71 int
72 MPIAllgatherv(const void *sendbuf,
73 int sendcount,
74 MPIDatatype sendtype,
75 void * recvbuf,
76 const int * recvcounts,
77 const int * displs,
78 MPIDatatype recvtype,
79 MPIComm comm);
80
81 int
82 MPIBarrier(MPIComm comm);
83 int
84 MPIIbarrier(MPIComm comm, MPIRequest *request);
85
86 template <MemorySpace memorySpace>
87 int
88 MPIBcast(void * buffer,
89 int count,
90 MPIDatatype datatype,
91 int root,
92 MPIComm comm);
93
94 int
96 MPIGroup group,
97 int tag,
98 MPIComm *newcomm);
99
100 int
101 MPICommFree(MPIComm *comm);
102 int
103 MPICommGroup(MPIComm comm, MPIGroup *group);
104 int
105 MPICommRank(MPIComm comm, int *rank);
106 int
107 MPICommSize(MPIComm comm, int *size);
108
109 int
110 MPIGroupFree(MPIGroup *group);
111
112 int
114 int n,
115 const int ranks[],
116 MPIGroup *newgroup);
117
118 int
120 int n,
121 const int ranks1[],
122 MPIGroup group2,
123 int ranks2[]);
124
125 int
126 MPIGroupUnion(MPIGroup group1, MPIGroup group2, MPIGroup *newgroup);
127
128 int
129 MPIInit(int *argc, char ***argv);
130
131 int
132 MPIInitThread(int *argc, char ***argv, int required, int *provided);
133
134 int
135 MPIInitialized(int *flag);
136
137 int
138 MPIIprobe(int source,
139 int tag,
140 MPIComm comm,
141 int * flag,
142 MPIStatus *status);
143
144 int
145 MPITest(MPIRequest *request, int *flag, MPIStatus *status);
146 int
147 MPITestall(int count,
148 MPIRequest *requests,
149 int * flag,
150 MPIStatus * statuses);
151
152 template <MemorySpace memorySpace>
153 int
154 MPIIrecv(void * buf,
155 int count,
156 MPIDatatype datatype,
157 int source,
158 int tag,
159 MPIComm comm,
160 MPIRequest *request);
161
162 template <MemorySpace memorySpace>
163 int
164 MPIIsend(const void *buf,
165 int count,
166 MPIDatatype datatype,
167 int dest,
168 int tag,
169 MPIComm comm,
170 MPIRequest *request);
171
172 template <MemorySpace memorySpace>
173 int
174 MPIRecv(void * buf,
175 int count,
176 MPIDatatype datatype,
177 int source,
178 int tag,
179 MPIComm comm,
180 MPIStatus * status);
181
182 int
183 MPIOpCreate(MPIUserFunction *userfn, int commute, MPIOp *op);
184
185 int
186 MPIOpFree(MPIOp *op);
187
188 template <MemorySpace memorySpace>
189 int
190 MPIReduce(void * sendbuf,
191 void * recvbuf,
192 int count,
193 MPIDatatype datatype,
194 MPIOp op,
195 int root,
196 MPIComm comm);
197
198 int
199 MPIRequestFree(MPIRequest *request);
200
201 template <MemorySpace memorySpace>
202 int
203 MPISend(const void *buf,
204 int count,
205 MPIDatatype datatype,
206 int dest,
207 int tag,
208 MPIComm comm);
209
210 template <MemorySpace memorySpace>
211 int
212 MPISendrecv(const void *sendbuf,
213 int sendcount,
214 MPIDatatype sendtype,
215 int dest,
216 int sendtag,
217 void * recvbuf,
218 int recvcount,
219 MPIDatatype recvtype,
220 int source,
221 int recvtag,
222 MPIComm comm,
223 MPIStatus * status);
224
225 template <MemorySpace memorySpace>
226 int
227 MPIIssend(const void *buf,
228 int count,
229 MPIDatatype datatype,
230 int dest,
231 int tag,
232 MPIComm comm,
233 MPIRequest *request);
234
235 template <MemorySpace memorySpace>
236 int
237 MPISsend(const void *buf,
238 int count,
239 MPIDatatype datatype,
240 int dest,
241 int tag,
242 MPIComm comm);
243
244 int
245 MPITypeCommit(MPIDatatype *datatype);
246
247 int
248 MPITypeFree(MPIDatatype *datatype);
249
250 int
251 MPITypeVector(int count,
252 int blocklength,
253 int stride,
254 MPIDatatype oldtype,
255 MPIDatatype *newtype);
256
257 int
258 MPIWait(MPIRequest *request, MPIStatus *status);
259
260 int
261 MPIWaitall(int count, MPIRequest requests[], MPIStatus statuses[]);
262
263 int
264 MPIErrorString(int errorcode, char *string, int *resultlen);
265
266 int
267 MPIFinalize(void);
268
269 double
270 MPIWtime(void);
271
272 int
273 MPIFinalized(int *flag);
274
275 // template <typename T>
276 // MPIDatatype
277 // MPIGetDatatype();
278
279 bool
280 MPIErrIsSuccess(int errCode);
281
282 std::string
283 MPIErrMsg(int errCode);
284
285 std::pair<bool, std::string>
286 MPIErrIsSuccessAndMsg(int errCode);
287
288 template <typename T, MemorySpace memorySpace>
290 MPIAllreduceMinMaxAvg(const T &data, MPIComm comm);
291
292 unsigned int
293 numMPIProcesses(const MPIComm comm);
294
295 unsigned int
296 thisMPIProcess(const MPIComm comm);
297
298 } // end of namespace mpi
299 } // end of namespace utils
300} // end of namespace dftefe
301#include "MPIWrapper.t.cpp"
302#endif // dftefeMPIWrapper_h
int MPISendrecv(const void *sendbuf, int sendcount, MPIDatatype sendtype, int dest, int sendtag, void *recvbuf, int recvcount, MPIDatatype recvtype, int source, int recvtag, MPIComm comm, MPIStatus *status)
Definition: MPIWrapper.t.cpp:536
int MPIGroupTranslateRanks(MPIGroup group1, int n, const int ranks1[], MPIGroup group2, int ranks2[])
Definition: MPIWrapper.cpp:343
int MPIErrorString(int errorcode, char *string, int *resultlen)
Definition: MPIWrapper.cpp:479
int MPISsend(const void *buf, int count, MPIDatatype datatype, int dest, int tag, MPIComm comm)
Definition: MPIWrapper.t.cpp:573
int MPIRecv(void *buf, int count, MPIDatatype datatype, int source, int tag, MPIComm comm, MPIStatus *status)
Definition: MPIWrapper.t.cpp:486
int MPITypeContiguous(int count, MPIDatatype oldtype, MPIDatatype *newtype)
Definition: MPIWrapper.cpp:259
int MPIAllgatherv(const void *sendbuf, int sendcount, MPIDatatype sendtype, void *recvbuf, const int *recvcounts, const int *displs, MPIDatatype recvtype, MPIComm comm)
Definition: MPIWrapper.t.cpp:438
int MPIFinalized(int *flag)
Definition: MPIWrapper.cpp:494
int MPITest(MPIRequest *request, int *flag, MPIStatus *status)
Definition: MPIWrapper.cpp:376
int MPITypeVector(int count, int blocklength, int stride, MPIDatatype oldtype, MPIDatatype *newtype)
Definition: MPIWrapper.cpp:448
int MPICommRank(MPIComm comm, int *rank)
Definition: MPIWrapper.cpp:302
int MPITypeCommit(MPIDatatype *datatype)
Definition: MPIWrapper.cpp:430
int MPIGroupUnion(MPIGroup group1, MPIGroup group2, MPIGroup *newgroup)
int MPIDatatype
Definition: MPITypes.h:83
int MPIAllreduce(const void *sendbuf, void *recvbuf, int count, MPIDatatype datatype, MPIOp op, MPIComm comm)
Definition: MPIWrapper.t.cpp:401
void(void *, void *, int *, MPIDatatype *) MPIUserFunction
Definition: MPITypes.h:90
int MPITestall(int count, MPIRequest *requests, int *flag, MPIStatus *statuses)
Definition: MPIWrapper.cpp:383
std::pair< bool, std::string > MPIErrIsSuccessAndMsg(int errCode)
Definition: MPIWrapper.cpp:521
int MPIComm
Definition: MPITypes.h:84
int MPIBcast(void *buffer, int count, MPIDatatype datatype, int root, MPIComm comm)
Definition: MPIWrapper.t.cpp:459
int MPIGroupFree(MPIGroup *group)
Definition: MPIWrapper.cpp:316
int MPIIsend(const void *buf, int count, MPIDatatype datatype, int dest, int tag, MPIComm comm, MPIRequest *request)
Definition: MPIWrapper.t.cpp:557
int MPIIprobe(int source, int tag, MPIComm comm, int *flag, MPIStatus *status)
Definition: MPIWrapper.cpp:369
int MPIStatus
Definition: MPITypes.h:86
int MPICommSize(MPIComm comm, int *size)
Definition: MPIWrapper.cpp:309
int MPIWait(MPIRequest *request, MPIStatus *status)
Definition: MPIWrapper.cpp:461
int MPICommGroup(MPIComm comm, MPIGroup *group)
Definition: MPIWrapper.cpp:296
int MPIFinalize(void)
Definition: MPIWrapper.cpp:488
int MPIGroupIncl(MPIGroup group, int n, const int ranks[], MPIGroup *newgroup)
Definition: MPIWrapper.cpp:325
int MPIWaitall(int count, MPIRequest requests[], MPIStatus statuses[])
Definition: MPIWrapper.cpp:470
int MPIInit(int *argc, char ***argv)
Definition: MPIWrapper.cpp:356
int MPIOp
Definition: MPITypes.h:88
bool MPIErrIsSuccess(int errCode)
Definition: MPIWrapper.cpp:507
int MPICommCreateGroup(MPIComm comm, MPIGroup group, int tag, MPIComm *newcomm)
Definition: MPIWrapper.cpp:281
int MPIInitThread(int *argc, char ***argv, int required, int *provided)
Definition: MPIWrapper.cpp:393
int MPIOpCreate(MPIUserFunction *user_fn, int commute, MPIOp *op)
Definition: MPIWrapper.cpp:401
int MPIGroup
Definition: MPITypes.h:87
MinMaxAvg< T > MPIAllreduceMinMaxAvg(const T &data, MPIComm comm)
Definition: MPIWrapper.t.cpp:604
int MPIAllgather(const void *sendbuf, int sendcount, MPIDatatype sendtype, void *recvbuf, int recvcount, MPIDatatype recvtype, MPIComm comm)
Definition: MPIWrapper.t.cpp:418
int MPIRequest
Definition: MPITypes.h:85
int MPITypeFree(MPIDatatype *datatype)
Definition: MPIWrapper.cpp:439
unsigned int thisMPIProcess(const MPIComm mpi_communicator)
Definition: MPIWrapper.cpp:541
int MPISend(const void *buf, int count, MPIDatatype datatype, int dest, int tag, MPIComm comm)
Definition: MPIWrapper.t.cpp:521
unsigned int numMPIProcesses(const MPIComm mpi_communicator)
Definition: MPIWrapper.cpp:529
int MPIInitialized(int *flag)
Definition: MPIWrapper.cpp:362
int MPIOpFree(MPIOp *op)
Definition: MPIWrapper.cpp:410
int MPIIssend(const void *buf, int count, MPIDatatype datatype, int dest, int tag, MPIComm comm, MPIRequest *request)
Definition: MPIWrapper.t.cpp:588
int MPIIbarrier(MPIComm comm, MPIRequest *request)
Definition: MPIWrapper.cpp:274
std::string MPIErrMsg(int errCode)
Definition: MPIWrapper.cpp:513
int MPIIrecv(void *buf, int count, MPIDatatype datatype, int source, int tag, MPIComm comm, MPIRequest *request)
Definition: MPIWrapper.t.cpp:470
int MPIBarrier(MPIComm comm)
Definition: MPIWrapper.cpp:268
int MPICommFree(MPIComm *comm)
Definition: MPIWrapper.cpp:290
int MPIRequestFree(MPIRequest *request)
Definition: MPIWrapper.cpp:420
int MPIReduce(void *sendbuf, void *recvbuf, int count, MPIDatatype datatype, MPIOp op, int root, MPIComm comm)
Definition: MPIWrapper.t.cpp:503
double MPIWtime(void)
Definition: MPIWrapper.cpp:501
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
Definition: MPIWrapper.h:42
MPIDatatype max
Definition: MPIWrapper.h:44
MPIDatatype avg
Definition: MPIWrapper.h:45
MPIDatatype min
Definition: MPIWrapper.h:43