DFT-EFE
 
Loading...
Searching...
No Matches
MPITypes.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 dftefeMPITypes_h
27#define dftefeMPITypes_h
28
29#ifdef DFTEFE_WITH_MPI
30# include <mpi.h>
31#endif // DFTEFE_WITH_MPI
32
33#include <complex>
34
35namespace dftefe
36{
37 namespace utils
38 {
39 namespace mpi
40 {
60 using ErrorCode = int;
61#ifdef DFTEFE_WITH_MPI
62 using MPIInfo = MPI_Info;
63 using MPIDatatype = MPI_Datatype;
64 using MPIComm = MPI_Comm;
65 using MPIRequest = MPI_Request;
66 using MPIStatus = MPI_Status;
67 using MPIGroup = MPI_Group;
68 using MPIOp = MPI_Op;
69 using MPIErrhandler = MPI_Errhandler;
70 using MPIUserFunction = MPI_User_function;
71#else // DFTEFE_WITH_MPI
72 using MPI_Status = struct
73 {
74 int count = 0;
75 int cancelled = 0;
76 int MPI_SOURCE = 0;
77 int MPI_TAG = 0;
78 int MPI_ERROR = 0;
79 };
80
81 using MPIInfo = int;
82 using MPIDatatype = int;
83 using MPIComm = int;
84 using MPIRequest = int;
85 using MPIStatus = int;
86 using MPIGroup = int;
87 using MPIOp = int;
88 using MPIErrhandler = int;
89 using MPIUserFunction = void(void *, void *, int *, MPIDatatype *);
90#endif // DFTEFE_WITH_MPI
99 extern int MPISuccess;
100 extern int MPIAnyTag;
101 extern int MPIAnySource;
104 extern int * MPIErrCodesIgnore;
105 extern void * MPIInPlace;
106
107 extern MPIDatatype MPIChar;
110 extern MPIDatatype MPIByte;
111 extern MPIDatatype MPIWChar;
112 extern MPIDatatype MPIShort;
114 extern MPIDatatype MPIInt;
116 extern MPIDatatype MPILong;
118 extern MPIDatatype MPIFloat;
119 extern MPIDatatype MPIDouble;
124 extern MPIDatatype MPIComplex;
126
127 extern MPIComm MPICommWorld;
128 extern MPIComm MPICommSelf;
129
130 extern MPIComm MPICommNull;
131 extern MPIGroup MPIGroupNull;
135 extern MPIOp MPIOpNull;
136 extern MPIOp MPIMax;
137 extern MPIOp MPIMin;
138 extern MPIOp MPISum;
139 extern MPIOp MPIProd;
140 extern MPIOp MPILAnd;
141 extern MPIOp MPIBAnd;
142 extern MPIOp MPILOr;
143 extern MPIOp MPIBOr;
144 extern MPIOp MPILXOr;
145 extern MPIOp MPIBXOr;
146 extern MPIOp MPIMinLoc;
147 extern MPIOp MPIMaxLoc;
148 extern MPIOp MPIReplace;
149
150 extern int MPIThreadSingle;
151 extern int MPIThreadFunneled;
152 extern int MPIThreadMultiple;
153 extern int MPIThreadSerialized;
154
170 template <typename T>
171 struct Types
172 {
173 static MPIDatatype
175 };
176
177
178 //
179 // various specialization of Types<T>
180 //
181 template <>
182 struct Types<char>
183 {
184 static MPIDatatype
186 };
187
188 template <>
189 struct Types<signed char>
190 {
191 static MPIDatatype
193 };
194
195 template <>
196 struct Types<unsigned char>
197 {
198 static MPIDatatype
200 };
201
202 template <>
203 struct Types<wchar_t>
204 {
205 static MPIDatatype
207 };
208
209 template <>
210 struct Types<short>
211 {
212 static MPIDatatype
214 };
215
216 template <>
217 struct Types<unsigned short>
218 {
219 static MPIDatatype
221 };
222
223 template <>
224 struct Types<int>
225 {
226 static MPIDatatype
228 };
229
230 template <>
231 struct Types<unsigned int>
232 {
233 static MPIDatatype
235 };
236
237 template <>
238 struct Types<long>
239 {
240 static MPIDatatype
242 };
243
244 template <>
245 struct Types<unsigned long>
246 {
247 static MPIDatatype
249 };
250
251 template <>
252 struct Types<float>
253 {
254 static MPIDatatype
256 };
257
258 template <>
259 struct Types<double>
260 {
261 static MPIDatatype
263 };
264
265 template <>
266 struct Types<long double>
267 {
268 static MPIDatatype
270 };
271
272 template <>
273 struct Types<long long int>
274 {
275 static MPIDatatype
277 };
278
279 template <>
280 struct Types<unsigned long long int>
281 {
282 static MPIDatatype
284 };
285
286 template <>
287 struct Types<std::complex<float>>
288 {
289 static MPIDatatype
291 };
292
293 template <>
294 struct Types<std::complex<double>>
295 {
296 static MPIDatatype
298 };
299
300 } // end of namespace mpi
301 } // end of namespace utils
302} // end of namespace dftefe
303#include <utils/MPITypes.t.cpp>
304#endif // dftefeMPITypes_h
int MPIThreadSerialized
Definition: MPITypes.cpp:177
int ErrorCode
The following provides a unified framework to use typedefs that will be valid both with and without t...
Definition: MPITypes.h:60
MPIDatatype MPIUnsignedChar
Definition: MPITypes.cpp:122
MPIDatatype MPIComplex
Definition: MPITypes.cpp:137
MPIDatatype MPILongLong
Definition: MPITypes.cpp:136
MPIDatatype MPIDoubleComplex
Definition: MPITypes.cpp:138
MPIOp MPIBAnd
Definition: MPITypes.cpp:165
MPIDatatype MPIUnsigned
Definition: MPITypes.cpp:128
int MPIErrhandler
Definition: MPITypes.h:88
int MPIThreadFunneled
Definition: MPITypes.cpp:175
MPIDatatype MPIFloat
Definition: MPITypes.cpp:131
MPIStatus * MPIStatusesIgnore
Definition: MPITypes.cpp:113
int MPI_TAG
Definition: MPITypes.h:77
MPIDatatype MPIDatatypeNull
Definition: MPITypes.cpp:146
MPIOp MPIBXOr
Definition: MPITypes.cpp:169
int * MPIErrCodesIgnore
Definition: MPITypes.cpp:114
MPIRequest MPIRequestNull
Definition: MPITypes.cpp:147
int MPIDatatype
Definition: MPITypes.h:82
int cancelled
Definition: MPITypes.h:75
void(void *, void *, int *, MPIDatatype *) MPIUserFunction
Definition: MPITypes.h:89
MPIDatatype MPISignedChar
Definition: MPITypes.cpp:121
MPIDatatype MPIByte
Definition: MPITypes.cpp:123
MPIDatatype MPIUnsignedLongLong
Definition: MPITypes.cpp:135
int MPIComm
Definition: MPITypes.h:83
MPIDatatype MPIUnsignedShort
Definition: MPITypes.cpp:126
int MPIAnySource
Definition: MPITypes.cpp:111
int MPIStatus
Definition: MPITypes.h:85
MPIDatatype MPIShort
Definition: MPITypes.cpp:125
MPIDatatype MPIDouble
Definition: MPITypes.cpp:132
MPIOp MPISum
Definition: MPITypes.cpp:162
MPIDatatype MPILong
Definition: MPITypes.cpp:129
int MPI_SOURCE
Definition: MPITypes.h:76
MPIOp MPIBOr
Definition: MPITypes.cpp:167
MPIOp MPILAnd
Definition: MPITypes.cpp:164
MPIComm MPICommSelf
Definition: MPITypes.cpp:155
MPIDatatype MPILongLongInt
Definition: MPITypes.cpp:134
int MPIOp
Definition: MPITypes.h:87
int MPIAnyTag
Definition: MPITypes.cpp:110
void * MPIInPlace
Definition: MPITypes.cpp:115
MPIErrhandler MPIErrHandlerNull
Definition: MPITypes.cpp:148
MPIStatus * MPIStatusIgnore
Definition: MPITypes.cpp:112
MPIOp MPIMaxLoc
Definition: MPITypes.cpp:171
struct { int count=0 MPI_Status
Definition: MPITypes.h:74
MPIDatatype MPIWChar
Definition: MPITypes.cpp:124
MPIOp MPIProd
Definition: MPITypes.cpp:163
MPIOp MPIMax
Definition: MPITypes.cpp:160
MPIOp MPILXOr
Definition: MPITypes.cpp:168
int MPIGroup
Definition: MPITypes.h:86
MPIComm MPICommWorld
Definition: MPITypes.cpp:154
int MPIThreadMultiple
Definition: MPITypes.cpp:176
MPIDatatype MPIInt
Definition: MPITypes.cpp:127
MPIOp MPIMinLoc
Definition: MPITypes.cpp:170
int MPIRequest
Definition: MPITypes.h:84
MPIOp MPIOpNull
Definition: MPITypes.cpp:144
MPIOp MPIReplace
Definition: MPITypes.cpp:172
MPIDatatype MPIChar
Definition: MPITypes.cpp:120
MPIGroup MPIGroupNull
Definition: MPITypes.cpp:145
int MPIInfo
Definition: MPITypes.h:81
MPIOp MPILOr
Definition: MPITypes.cpp:166
MPIDatatype MPILongDouble
Definition: MPITypes.cpp:133
MPIOp MPIMin
Definition: MPITypes.cpp:161
MPIDatatype MPIUnsignedLong
Definition: MPITypes.cpp:130
MPIComm MPICommNull
Definition: MPITypes.cpp:143
int MPIThreadSingle
Definition: MPITypes.cpp:174
int MPI_ERROR
Definition: MPITypes.h:78
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
A simple struct to return the MPIDatatype based on the user provided primitive data type (e....
Definition: MPITypes.h:172
static MPIDatatype getMPIDatatype()
Definition: MPITypes.cpp:191