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#include "MPITags.h"
35
36namespace dftefe
37{
38 namespace utils
39 {
40 namespace mpi
41 {
61 using ErrorCode = int;
62#ifdef DFTEFE_WITH_MPI
63 using MPIInfo = MPI_Info;
64 using MPIDatatype = MPI_Datatype;
65 using MPIComm = MPI_Comm;
66 using MPIRequest = MPI_Request;
67 using MPIStatus = MPI_Status;
68 using MPIGroup = MPI_Group;
69 using MPIOp = MPI_Op;
70 using MPIErrhandler = MPI_Errhandler;
71 using MPIUserFunction = MPI_User_function;
72#else // DFTEFE_WITH_MPI
73 using MPI_Status = struct
74 {
75 int count = 0;
76 int cancelled = 0;
77 int MPI_SOURCE = 0;
78 int MPI_TAG = 0;
79 int MPI_ERROR = 0;
80 };
81
82 using MPIInfo = int;
83 using MPIDatatype = int;
84 using MPIComm = int;
85 using MPIRequest = int;
86 using MPIStatus = int;
87 using MPIGroup = int;
88 using MPIOp = int;
89 using MPIErrhandler = int;
90 using MPIUserFunction = void(void *, void *, int *, MPIDatatype *);
91#endif // DFTEFE_WITH_MPI
100 extern int MPISuccess;
101 extern int MPIAnyTag;
102 extern int MPIAnySource;
105 extern int * MPIErrCodesIgnore;
106 extern void * MPIInPlace;
107
108 extern MPIDatatype MPIChar;
111 extern MPIDatatype MPIByte;
112 extern MPIDatatype MPIWChar;
113 extern MPIDatatype MPIShort;
115 extern MPIDatatype MPIInt;
117 extern MPIDatatype MPILong;
119 extern MPIDatatype MPIFloat;
120 extern MPIDatatype MPIDouble;
125 extern MPIDatatype MPIComplex;
127
128 extern MPIComm MPICommWorld;
129 extern MPIComm MPICommSelf;
130
131 extern MPIComm MPICommNull;
132 extern MPIGroup MPIGroupNull;
136 extern MPIOp MPIOpNull;
137 extern MPIOp MPIMax;
138 extern MPIOp MPIMin;
139 extern MPIOp MPISum;
140 extern MPIOp MPIProd;
141 extern MPIOp MPILAnd;
142 extern MPIOp MPIBAnd;
143 extern MPIOp MPILOr;
144 extern MPIOp MPIBOr;
145 extern MPIOp MPILXOr;
146 extern MPIOp MPIBXOr;
147 extern MPIOp MPIMinLoc;
148 extern MPIOp MPIMaxLoc;
149 extern MPIOp MPIReplace;
150
151 extern int MPIThreadSingle;
152 extern int MPIThreadFunneled;
153 extern int MPIThreadMultiple;
154 extern int MPIThreadSerialized;
155
171 template <typename T>
172 struct Types
173 {
174 static MPIDatatype
176 };
177
178
179 //
180 // various specialization of Types<T>
181 //
182 template <>
183 struct Types<char>
184 {
185 static MPIDatatype
187 };
188
189 template <>
190 struct Types<signed char>
191 {
192 static MPIDatatype
194 };
195
196 template <>
197 struct Types<unsigned char>
198 {
199 static MPIDatatype
201 };
202
203 template <>
204 struct Types<wchar_t>
205 {
206 static MPIDatatype
208 };
209
210 template <>
211 struct Types<short>
212 {
213 static MPIDatatype
215 };
216
217 template <>
218 struct Types<unsigned short>
219 {
220 static MPIDatatype
222 };
223
224 template <>
225 struct Types<int>
226 {
227 static MPIDatatype
229 };
230
231 template <>
232 struct Types<unsigned int>
233 {
234 static MPIDatatype
236 };
237
238 template <>
239 struct Types<long>
240 {
241 static MPIDatatype
243 };
244
245 template <>
246 struct Types<unsigned long>
247 {
248 static MPIDatatype
250 };
251
252 template <>
253 struct Types<float>
254 {
255 static MPIDatatype
257 };
258
259 template <>
260 struct Types<double>
261 {
262 static MPIDatatype
264 };
265
266 template <>
267 struct Types<long double>
268 {
269 static MPIDatatype
271 };
272
273 template <>
274 struct Types<long long int>
275 {
276 static MPIDatatype
278 };
279
280 template <>
281 struct Types<unsigned long long int>
282 {
283 static MPIDatatype
285 };
286
287 template <>
288 struct Types<std::complex<float>>
289 {
290 static MPIDatatype
292 };
293
294 template <>
295 struct Types<std::complex<double>>
296 {
297 static MPIDatatype
299 };
300
301 } // end of namespace mpi
302 } // end of namespace utils
303} // end of namespace dftefe
304#include <utils/MPITypes.t.cpp>
305#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:61
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:89
int MPIThreadFunneled
Definition: MPITypes.cpp:175
MPIDatatype MPIFloat
Definition: MPITypes.cpp:131
MPIStatus * MPIStatusesIgnore
Definition: MPITypes.cpp:113
int MPI_TAG
Definition: MPITypes.h:78
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:83
int cancelled
Definition: MPITypes.h:76
void(void *, void *, int *, MPIDatatype *) MPIUserFunction
Definition: MPITypes.h:90
MPIDatatype MPISignedChar
Definition: MPITypes.cpp:121
MPIDatatype MPIByte
Definition: MPITypes.cpp:123
MPIDatatype MPIUnsignedLongLong
Definition: MPITypes.cpp:135
int MPIComm
Definition: MPITypes.h:84
MPIDatatype MPIUnsignedShort
Definition: MPITypes.cpp:126
int MPIAnySource
Definition: MPITypes.cpp:111
int MPIStatus
Definition: MPITypes.h:86
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:77
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:88
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:75
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:87
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:85
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:82
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:79
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:173
static MPIDatatype getMPIDatatype()
Definition: MPITypes.cpp:191