OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

ompi_datatype_internal.h
1 /* -*- Mode: C; c-basic-offset:4 ; -*- */
2 /*
3 * Copyright (c) 2009-2010 The University of Tennessee and The University
4 * of Tennessee Research Foundation. All rights
5 * reserved.
6 * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
7 * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
8 * $COPYRIGHT$
9 *
10 * Additional copyrights may follow
11 *
12 * $HEADER$
13 */
14
15 /**
16 * ompi_datatype_t interface for OMPI internal data type representation
17 *
18 * ompi_datatype_t is a class which represents contiguous or
19 * non-contiguous data together with constituent type-related
20 * information.
21 */
22
23 #ifndef OMPI_DATATYPE_INTERNAL_H
24 #define OMPI_DATATYPE_INTERNAL_H
25
26 #include "opal/datatype/opal_datatype_internal.h"
27 #include "ompi/class/ompi_free_list.h"
28
29 /*
30 * This is the OMPI-layered numbering of ALL supported MPI types
31 * (derived from the old DT_ names).
32 * NOTE: These numbers have to match the d_f_to_c_index.
33 */
34 #define OMPI_DATATYPE_MPI_EMPTY 0x00
35 #define OMPI_DATATYPE_MPI_INT8_T 0x01
36 #define OMPI_DATATYPE_MPI_UINT8_T 0x02
37 #define OMPI_DATATYPE_MPI_INT16_T 0x03
38 #define OMPI_DATATYPE_MPI_UINT16_T 0x04
39 #define OMPI_DATATYPE_MPI_INT32_T 0x05
40 #define OMPI_DATATYPE_MPI_UINT32_T 0x06
41 #define OMPI_DATATYPE_MPI_INT64_T 0x07
42 #define OMPI_DATATYPE_MPI_UINT64_T 0x08
43 #define OMPI_DATATYPE_MPI_FLOAT 0x09
44 #define OMPI_DATATYPE_MPI_DOUBLE 0x0A
45 #define OMPI_DATATYPE_MPI_LONG_DOUBLE 0x0B
46 #define OMPI_DATATYPE_MPI_COMPLEX8 0x0C
47 #define OMPI_DATATYPE_MPI_COMPLEX16 0x0D
48 #define OMPI_DATATYPE_MPI_COMPLEX32 0x0E
49 #define OMPI_DATATYPE_MPI_WCHAR 0x0F
50 #define OMPI_DATATYPE_MPI_PACKED 0x10
51
52 #define OMPI_DATATYPE_MPI_BOOL 0x11
53
54 #define OMPI_DATATYPE_MPI_LOGICAL 0x12
55 #define OMPI_DATATYPE_MPI_CHARACTER 0x13
56 #define OMPI_DATATYPE_MPI_INTEGER 0x14
57 #define OMPI_DATATYPE_MPI_REAL 0x15
58 #define OMPI_DATATYPE_MPI_DOUBLE_PRECISION 0x16
59
60 /*
61 * Derived datatypes supposely contiguous
62 */
63 #define OMPI_DATATYPE_MPI_COMPLEX 0x17 /* Was COMPLEX_FLOAT */
64 #define OMPI_DATATYPE_MPI_DOUBLE_COMPLEX 0x18 /* Was COMPLEX_DOUBLE */
65 #define OMPI_DATATYPE_MPI_LONG_DOUBLE_COMPLEX 0x19 /* Was COMPLEX_LONG_DOUBLE */
66 #define OMPI_DATATYPE_MPI_2INT 0x1A
67 #define OMPI_DATATYPE_MPI_2INTEGER 0x1B
68 #define OMPI_DATATYPE_MPI_2REAL 0x1C
69 #define OMPI_DATATYPE_MPI_2DBLPREC 0x1D
70 #define OMPI_DATATYPE_MPI_2COMPLEX 0x1E
71 #define OMPI_DATATYPE_MPI_2DOUBLE_COMPLEX 0x1F
72 /*
73 * Derived datatypes which will definitively be non contiguous on some architectures.
74 */
75 #define OMPI_DATATYPE_MPI_FLOAT_INT 0x20
76 #define OMPI_DATATYPE_MPI_DOUBLE_INT 0x21
77 #define OMPI_DATATYPE_MPI_LONG_DOUBLE_INT 0x22
78 #define OMPI_DATATYPE_MPI_LONG_INT 0x23
79 #define OMPI_DATATYPE_MPI_SHORT_INT 0x24
80 /*
81 * Datatypes from the MPI 2.2 standard
82 */
83 #define OMPI_DATATYPE_MPI_AINT 0x25
84 #define OMPI_DATATYPE_MPI_OFFSET 0x26
85 #define OMPI_DATATYPE_MPI_C_BOOL 0x27
86 #define OMPI_DATATYPE_MPI_C_COMPLEX 0x28
87 #define OMPI_DATATYPE_MPI_C_FLOAT_COMPLEX 0x29
88 #define OMPI_DATATYPE_MPI_C_DOUBLE_COMPLEX 0x2A
89 #define OMPI_DATATYPE_MPI_C_LONG_DOUBLE_COMPLEX 0x2B
90
91 #define OMPI_DATATYPE_MPI_LB 0x2C
92 #define OMPI_DATATYPE_MPI_UB 0x2D
93 /* This should __ALWAYS__ stay last */
94 #define OMPI_DATATYPE_MPI_UNAVAILABLE 0x2E
95
96 #define OMPI_DATATYPE_MPI_MAX_PREDEFINED (OMPI_DATATYPE_MPI_UNAVAILABLE+1)
97
98 /*
99 * Mapped types. The following types have basic equivalents in OPAL. Instead
100 * of being redefined as independent types, they will be made synonyms to
101 * the most basic type.
102 */
103 #if SIZEOF_CHAR == 1
104 #define OMPI_DATATYPE_MPI_CHAR OMPI_DATATYPE_MPI_INT8_T
105 #define OMPI_DATATYPE_MPI_SIGNED_CHAR OMPI_DATATYPE_MPI_INT8_T
106 #define OMPI_DATATYPE_MPI_UNSIGNED_CHAR OMPI_DATATYPE_MPI_UINT8_T
107 #define OMPI_DATATYPE_MPI_BYTE OMPI_DATATYPE_MPI_UINT8_T
108 #elif SIZEOF_CHAR == 2
109 #define OMPI_DATATYPE_MPI_CHAR OMPI_DATATYPE_MPI_INT16_T
110 #define OMPI_DATATYPE_MPI_SIGNED_CHAR OMPI_DATATYPE_MPI_INT16_T
111 #define OMPI_DATATYPE_MPI_UNSIGNED_CHAR OMPI_DATATYPE_MPI_UINT16_T
112 #define OMPI_DATATYPE_MPI_BYTE OMPI_DATATYPE_MPI_UINT16_T
113 #elif SIZEOF_CHAR == 4
114 #define OMPI_DATATYPE_MPI_CHAR OMPI_DATATYPE_MPI_INT32_T
115 #define OMPI_DATATYPE_MPI_SIGNED_CHAR OMPI_DATATYPE_MPI_INT32_T
116 #define OMPI_DATATYPE_MPI_UNSIGNED_CHAR OMPI_DATATYPE_MPI_UINT32_T
117 #define OMPI_DATATYPE_MPI_BYTE OMPI_DATATYPE_MPI_UINT32_T
118 #elif SIZEOF_CHAR == 8
119 #define OMPI_DATATYPE_MPI_CHAR OMPI_DATATYPE_MPI_INT64_T
120 #define OMPI_DATATYPE_MPI_SIGNED_CHAR OMPI_DATATYPE_MPI_INT64_T
121 #define OMPI_DATATYPE_MPI_UNSIGNED_CHAR OMPI_DATATYPE_MPI_UINT64_T
122 #define OMPI_DATATYPE_MPI_BYTE OMPI_DATATYPE_MPI_UINT64_T
123 #endif
124
125 #if SIZEOF_SHORT == 1
126 #define OMPI_DATATYPE_MPI_SHORT OMPI_DATATYPE_MPI_INT8_T
127 #define OMPI_DATATYPE_MPI_UNSIGNED_SHORT OMPI_DATATYPE_MPI_UINT8_T
128 #elif SIZEOF_SHORT == 2
129 #define OMPI_DATATYPE_MPI_SHORT OMPI_DATATYPE_MPI_INT16_T
130 #define OMPI_DATATYPE_MPI_UNSIGNED_SHORT OMPI_DATATYPE_MPI_UINT16_T
131 #elif SIZEOF_SHORT == 4
132 #define OMPI_DATATYPE_MPI_SHORT OMPI_DATATYPE_MPI_INT32_T
133 #define OMPI_DATATYPE_MPI_UNSIGNED_SHORT OMPI_DATATYPE_MPI_UINT32_T
134 #elif SIZEOF_SHORT == 8
135 #define OMPI_DATATYPE_MPI_SHORT OMPI_DATATYPE_MPI_INT64_T
136 #define OMPI_DATATYPE_MPI_UNSIGNED_SHORT OMPI_DATATYPE_MPI_UINT64_T
137 #endif
138
139 #if SIZEOF_INT == 1
140 #define OMPI_DATATYPE_MPI_INT OMPI_DATATYPE_MPI_INT8_T
141 #define OMPI_DATATYPE_MPI_UNSIGNED_INT OMPI_DATATYPE_MPI_UINT8_T
142 #elif SIZEOF_INT == 2
143 #define OMPI_DATATYPE_MPI_INT OMPI_DATATYPE_MPI_INT16_T
144 #define OMPI_DATATYPE_MPI_UNSIGNED_INT OMPI_DATATYPE_MPI_UINT16_T
145 #elif SIZEOF_INT == 4
146 #define OMPI_DATATYPE_MPI_INT OMPI_DATATYPE_MPI_INT32_T
147 #define OMPI_DATATYPE_MPI_UNSIGNED_INT OMPI_DATATYPE_MPI_UINT32_T
148 #elif SIZEOF_INT == 8
149 #define OMPI_DATATYPE_MPI_INT OMPI_DATATYPE_MPI_INT64_T
150 #define OMPI_DATATYPE_MPI_UNSIGNED_INT OMPI_DATATYPE_MPI_UINT64_T
151 #endif
152
153 #if SIZEOF_LONG == 1
154 #define OMPI_DATATYPE_MPI_LONG OMPI_DATATYPE_MPI_INT8_T
155 #define OMPI_DATATYPE_MPI_UNSIGNED_LONG OMPI_DATATYPE_MPI_UINT8_T
156 #elif SIZEOF_LONG == 2
157 #define OMPI_DATATYPE_MPI_LONG OMPI_DATATYPE_MPI_INT16_T
158 #define OMPI_DATATYPE_MPI_UNSIGNED_LONG OMPI_DATATYPE_MPI_UINT16_T
159 #elif SIZEOF_LONG == 4
160 #define OMPI_DATATYPE_MPI_LONG OMPI_DATATYPE_MPI_INT32_T
161 #define OMPI_DATATYPE_MPI_UNSIGNED_LONG OMPI_DATATYPE_MPI_UINT32_T
162 #elif SIZEOF_LONG == 8
163 #define OMPI_DATATYPE_MPI_LONG OMPI_DATATYPE_MPI_INT64_T
164 #define OMPI_DATATYPE_MPI_UNSIGNED_LONG OMPI_DATATYPE_MPI_UINT64_T
165 #endif
166
167 #if SIZEOF_LONG_LONG == 1
168 #define OMPI_DATATYPE_MPI_LONG_LONG OMPI_DATATYPE_MPI_INT8_T
169 #define OMPI_DATATYPE_MPI_UNSIGNED_LONG_LONG OMPI_DATATYPE_MPI_UINT8_T
170 #elif SIZEOF_LONG_LONG == 2
171 #define OMPI_DATATYPE_MPI_LONG_LONG OMPI_DATATYPE_MPI_INT16_T
172 #define OMPI_DATATYPE_MPI_UNSIGNED_LONG_LONG OMPI_DATATYPE_MPI_UINT16_T
173 #elif SIZEOF_LONG_LONG == 4
174 #define OMPI_DATATYPE_MPI_LONG_LONG OMPI_DATATYPE_MPI_INT32_T
175 #define OMPI_DATATYPE_MPI_UNSIGNED_LONG_LONG OMPI_DATATYPE_MPI_UINT32_T
176 #elif SIZEOF_LONG_LONG == 8
177 #define OMPI_DATATYPE_MPI_LONG_LONG OMPI_DATATYPE_MPI_INT64_T
178 #define OMPI_DATATYPE_MPI_UNSIGNED_LONG_LONG OMPI_DATATYPE_MPI_UINT64_T
179 #endif
180
181 /*
182 * Optional Fortran datatypes, these map to representable types
183 * in the lower layer, aka as other Fortran types have to map to C types,
184 * additionally, if the type has the same size as the mandatory
185 * Fortran type, map to this one.
186 */
187 /* LOGICAL */
188 #if OMPI_SIZEOF_FORTRAN_LOGICAL1 == OMPI_SIZEOF_FORTRAN_LOGICAL
189 # define OMPI_DATATYPE_MPI_LOGICAL1 OMPI_DATATYPE_MPI_LOGICAL
190 #elif OMPI_SIZEOF_FORTRAN_LOGICAL1 == 1
191 # define OMPI_DATATYPE_MPI_LOGICAL1 OMPI_DATATYPE_MPI_INT8_T
192 #elif OMPI_SIZEOF_FORTRAN_LOGICAL1 == 2
193 # define OMPI_DATATYPE_MPI_LOGICAL1 OMPI_DATATYPE_MPI_INT16_T
194 #elif OMPI_SIZEOF_FORTRAN_LOGICAL1 == 4
195 # define OMPI_DATATYPE_MPI_LOGICAL1 OMPI_DATATYPE_MPI_INT32_T
196 #elif OMPI_SIZEOF_FORTRAN_LOGICAL1 == 8
197 # define OMPI_DATATYPE_MPI_LOGICAL1 OMPI_DATATYPE_MPI_INT64_T
198 #else
199 # define OMPI_DATATYPE_MPI_LOGICAL1 OMPI_DATATYPE_MPI_UNAVAILABLE
200 #endif
201
202 #if OMPI_SIZEOF_FORTRAN_LOGICAL2 == OMPI_SIZEOF_FORTRAN_LOGICAL
203 # define OMPI_DATATYPE_MPI_LOGICAL2 OMPI_DATATYPE_MPI_LOGICAL
204 #elif OMPI_SIZEOF_FORTRAN_LOGICAL2 == 1
205 # define OMPI_DATATYPE_MPI_LOGICAL2 OMPI_DATATYPE_MPI_INT8_T
206 #elif OMPI_SIZEOF_FORTRAN_LOGICAL2 == 2
207 # define OMPI_DATATYPE_MPI_LOGICAL2 OMPI_DATATYPE_MPI_INT16_T
208 #elif OMPI_SIZEOF_FORTRAN_LOGICAL2 == 4
209 # define OMPI_DATATYPE_MPI_LOGICAL2 OMPI_DATATYPE_MPI_INT32_T
210 #elif OMPI_SIZEOF_FORTRAN_LOGICAL2 == 8
211 # define OMPI_DATATYPE_MPI_LOGICAL2 OMPI_DATATYPE_MPI_INT64_T
212 #else
213 # define OMPI_DATATYPE_MPI_LOGICAL2 OMPI_DATATYPE_MPI_UNAVAILABLE
214 #endif
215
216 #if OMPI_SIZEOF_FORTRAN_LOGICAL4 == OMPI_SIZEOF_FORTRAN_LOGICAL
217 # define OMPI_DATATYPE_MPI_LOGICAL4 OMPI_DATATYPE_MPI_LOGICAL
218 #elif OMPI_SIZEOF_FORTRAN_LOGICAL4 == 1
219 # define OMPI_DATATYPE_MPI_LOGICAL4 OMPI_DATATYPE_MPI_INT8_T
220 #elif OMPI_SIZEOF_FORTRAN_LOGICAL4 == 2
221 # define OMPI_DATATYPE_MPI_LOGICAL4 OMPI_DATATYPE_MPI_INT16_T
222 #elif OMPI_SIZEOF_FORTRAN_LOGICAL4 == 4
223 # define OMPI_DATATYPE_MPI_LOGICAL4 OMPI_DATATYPE_MPI_INT32_T
224 #elif OMPI_SIZEOF_FORTRAN_LOGICAL4 == 8
225 # define OMPI_DATATYPE_MPI_LOGICAL4 OMPI_DATATYPE_MPI_INT64_T
226 #else
227 # define OMPI_DATATYPE_MPI_LOGICAL4 OMPI_DATATYPE_MPI_UNAVAILABLE
228 #endif
229
230 #if OMPI_SIZEOF_FORTRAN_LOGICAL8 == OMPI_SIZEOF_FORTRAN_LOGICAL
231 # define OMPI_DATATYPE_MPI_LOGICAL8 OMPI_DATATYPE_MPI_LOGICAL
232 #elif OMPI_SIZEOF_FORTRAN_LOGICAL8 == 1
233 # define OMPI_DATATYPE_MPI_LOGICAL8 OMPI_DATATYPE_MPI_INT8_T
234 #elif OMPI_SIZEOF_FORTRAN_LOGICAL8 == 2
235 # define OMPI_DATATYPE_MPI_LOGICAL8 OMPI_DATATYPE_MPI_INT16_T
236 #elif OMPI_SIZEOF_FORTRAN_LOGICAL8 == 4
237 # define OMPI_DATATYPE_MPI_LOGICAL8 OMPI_DATATYPE_MPI_INT32_T
238 #elif OMPI_SIZEOF_FORTRAN_LOGICAL8 == 8
239 # define OMPI_DATATYPE_MPI_LOGICAL8 OMPI_DATATYPE_MPI_INT64_T
240 #else
241 # define OMPI_DATATYPE_MPI_LOGICAL8 OMPI_DATATYPE_MPI_UNAVAILABLE
242 #endif
243
244 /* INTEGER */
245 #if OMPI_SIZEOF_FORTRAN_INTEGER1 == OMPI_SIZEOF_FORTRAN_INTEGER
246 # define OMPI_DATATYPE_MPI_INTEGER1 OMPI_DATATYPE_MPI_INTEGER
247 #elif OMPI_SIZEOF_FORTRAN_INTEGER1 == 1
248 # define OMPI_DATATYPE_MPI_INTEGER1 OMPI_DATATYPE_MPI_INT8_T
249 #elif OMPI_SIZEOF_FORTRAN_INTEGER1 == 2
250 # define OMPI_DATATYPE_MPI_INTEGER1 OMPI_DATATYPE_MPI_INT16_T
251 #elif OMPI_SIZEOF_FORTRAN_INTEGER1 == 4
252 # define OMPI_DATATYPE_MPI_INTEGER1 OMPI_DATATYPE_MPI_INT32_T
253 #elif OMPI_SIZEOF_FORTRAN_INTEGER1 == 8
254 # define OMPI_DATATYPE_MPI_INTEGER1 OMPI_DATATYPE_MPI_INT64_T
255 #else
256 # define OMPI_DATATYPE_MPI_INTEGER1 OMPI_DATATYPE_MPI_UNAVAILABLE
257 #endif
258
259 #if OMPI_SIZEOF_FORTRAN_INTEGER2 == OMPI_SIZEOF_FORTRAN_INTEGER
260 # define OMPI_DATATYPE_MPI_INTEGER2 OMPI_DATATYPE_MPI_INTEGER
261 #elif OMPI_SIZEOF_FORTRAN_INTEGER2 == 1
262 # define OMPI_DATATYPE_MPI_INTEGER2 OMPI_DATATYPE_MPI_INT8_T
263 #elif OMPI_SIZEOF_FORTRAN_INTEGER2 == 2
264 # define OMPI_DATATYPE_MPI_INTEGER2 OMPI_DATATYPE_MPI_INT16_T
265 #elif OMPI_SIZEOF_FORTRAN_INTEGER2 == 4
266 # define OMPI_DATATYPE_MPI_INTEGER2 OMPI_DATATYPE_MPI_INT32_T
267 #elif OMPI_SIZEOF_FORTRAN_INTEGER2 == 8
268 # define OMPI_DATATYPE_MPI_INTEGER2 OMPI_DATATYPE_MPI_INT64_T
269 #else
270 # define OMPI_DATATYPE_MPI_INTEGER2 OMPI_DATATYPE_MPI_UNAVAILABLE
271 #endif
272
273 #if OMPI_SIZEOF_FORTRAN_INTEGER4 == OMPI_SIZEOF_FORTRAN_INTEGER
274 # define OMPI_DATATYPE_MPI_INTEGER4 OMPI_DATATYPE_MPI_INTEGER
275 #elif OMPI_SIZEOF_FORTRAN_INTEGER4 == 1
276 # define OMPI_DATATYPE_MPI_INTEGER4 OMPI_DATATYPE_MPI_INT8_T
277 #elif OMPI_SIZEOF_FORTRAN_INTEGER4 == 2
278 # define OMPI_DATATYPE_MPI_INTEGER4 OMPI_DATATYPE_MPI_INT16_T
279 #elif OMPI_SIZEOF_FORTRAN_INTEGER4 == 4
280 # define OMPI_DATATYPE_MPI_INTEGER4 OMPI_DATATYPE_MPI_INT32_T
281 #elif OMPI_SIZEOF_FORTRAN_INTEGER4 == 8
282 # define OMPI_DATATYPE_MPI_INTEGER4 OMPI_DATATYPE_MPI_INT64_T
283 #else
284 # define OMPI_DATATYPE_MPI_INTEGER4 OMPI_DATATYPE_MPI_UNAVAILABLE
285 #endif
286
287 #if OMPI_SIZEOF_FORTRAN_INTEGER8 == OMPI_SIZEOF_FORTRAN_INTEGER
288 # define OMPI_DATATYPE_MPI_INTEGER8 OMPI_DATATYPE_MPI_INTEGER
289 #elif OMPI_SIZEOF_FORTRAN_INTEGER8 == 1
290 # define OMPI_DATATYPE_MPI_INTEGER8 OMPI_DATATYPE_MPI_INT8_T
291 #elif OMPI_SIZEOF_FORTRAN_INTEGER8 == 2
292 # define OMPI_DATATYPE_MPI_INTEGER8 OMPI_DATATYPE_MPI_INT16_T
293 #elif OMPI_SIZEOF_FORTRAN_INTEGER8 == 4
294 # define OMPI_DATATYPE_MPI_INTEGER8 OMPI_DATATYPE_MPI_INT32_T
295 #elif OMPI_SIZEOF_FORTRAN_INTEGER8 == 8
296 # define OMPI_DATATYPE_MPI_INTEGER8 OMPI_DATATYPE_MPI_INT64_T
297 #else
298 # define OMPI_DATATYPE_MPI_INTEGER8 OMPI_DATATYPE_MPI_UNAVAILABLE
299 #endif
300
301 #if OMPI_SIZEOF_FORTRAN_INTEGER16 == OMPI_SIZEOF_FORTRAN_INTEGER
302 # define OMPI_DATATYPE_MPI_INTEGER16 OMPI_DATATYPE_MPI_INTEGER
303 #elif OMPI_SIZEOF_FORTRAN_INTEGER16 == 1
304 # define OMPI_DATATYPE_MPI_INTEGER16 OMPI_DATATYPE_MPI_INT8_T
305 #elif OMPI_SIZEOF_FORTRAN_INTEGER16 == 2
306 # define OMPI_DATATYPE_MPI_INTEGER16 OMPI_DATATYPE_MPI_INT16_T
307 #elif OMPI_SIZEOF_FORTRAN_INTEGER16 == 4
308 # define OMPI_DATATYPE_MPI_INTEGER16 OMPI_DATATYPE_MPI_INT32_T
309 #elif OMPI_SIZEOF_FORTRAN_INTEGER16 == 8
310 # define OMPI_DATATYPE_MPI_INTEGER16 OMPI_DATATYPE_MPI_INT64_T
311 #else
312 # define OMPI_DATATYPE_MPI_INTEGER16 OMPI_DATATYPE_MPI_UNAVAILABLE
313 #endif
314
315 /* REAL */
316 #if OMPI_SIZEOF_FORTRAN_REAL2 == OMPI_SIZEOF_FORTRAN_REAL
317 # define OMPI_DATATYPE_MPI_REAL2 OMPI_DATATYPE_MPI_REAL
318 #elif OMPI_SIZEOF_FORTRAN_REAL2 == SIZEOF_FLOAT
319 # define OMPI_DATATYPE_MPI_REAL2 OMPI_DATATYPE_MPI_FLOAT
320 #elif OMPI_SIZEOF_FORTRAN_REAL2 == SIZEOF_DOUBLE
321 # define OMPI_DATATYPE_MPI_REAL2 OMPI_DATATYPE_MPI_DOUBLE
322 #elif OMPI_SIZEOF_FORTRAN_REAL2 == SIZEOF_LONG_DOUBLE
323 # define OMPI_DATATYPE_MPI_REAL2 OMPI_DATATYPE_MPI_LONG_DOUBLE
324 #else
325 # define OMPI_DATATYPE_MPI_REAL2 OMPI_DATATYPE_MPI_UNAVAILABLE
326 #endif
327
328 #if OMPI_SIZEOF_FORTRAN_REAL4 == OMPI_SIZEOF_FORTRAN_REAL
329 # define OMPI_DATATYPE_MPI_REAL4 OMPI_DATATYPE_MPI_REAL
330 #elif OMPI_SIZEOF_FORTRAN_REAL4 == SIZEOF_FLOAT
331 # define OMPI_DATATYPE_MPI_REAL4 OMPI_DATATYPE_MPI_FLOAT
332 #elif OMPI_SIZEOF_FORTRAN_REAL4 == SIZEOF_DOUBLE
333 # define OMPI_DATATYPE_MPI_REAL4 OMPI_DATATYPE_MPI_DOUBLE
334 #elif OMPI_SIZEOF_FORTRAN_REAL4 == SIZEOF_LONG_DOUBLE
335 # define OMPI_DATATYPE_MPI_REAL4 OMPI_DATATYPE_MPI_LONG_DOUBLE
336 #else
337 # define OMPI_DATATYPE_MPI_REAL4 OMPI_DATATYPE_MPI_UNAVAILABLE
338 #endif
339
340 #if OMPI_SIZEOF_FORTRAN_REAL8 == OMPI_SIZEOF_FORTRAN_REAL
341 # define OMPI_DATATYPE_MPI_REAL8 OMPI_DATATYPE_MPI_REAL
342 #elif OMPI_SIZEOF_FORTRAN_REAL8 == SIZEOF_FLOAT
343 # define OMPI_DATATYPE_MPI_REAL8 OMPI_DATATYPE_MPI_FLOAT
344 #elif OMPI_SIZEOF_FORTRAN_REAL8 == SIZEOF_DOUBLE
345 # define OMPI_DATATYPE_MPI_REAL8 OMPI_DATATYPE_MPI_DOUBLE
346 #elif OMPI_SIZEOF_FORTRAN_REAL8 == SIZEOF_LONG_DOUBLE
347 # define OMPI_DATATYPE_MPI_REAL8 OMPI_DATATYPE_MPI_LONG_DOUBLE
348 #else
349 # define OMPI_DATATYPE_MPI_REAL8 OMPI_DATATYPE_MPI_UNAVAILABLE
350 #endif
351
352 #if OMPI_SIZEOF_FORTRAN_REAL16 == OMPI_SIZEOF_FORTRAN_REAL
353 # define OMPI_DATATYPE_MPI_REAL16 OMPI_DATATYPE_MPI_REAL
354 #elif OMPI_SIZEOF_FORTRAN_REAL16 == SIZEOF_FLOAT
355 # define OMPI_DATATYPE_MPI_REAL16 OMPI_DATATYPE_MPI_FLOAT
356 #elif OMPI_SIZEOF_FORTRAN_REAL16 == SIZEOF_DOUBLE
357 # define OMPI_DATATYPE_MPI_REAL16 OMPI_DATATYPE_MPI_DOUBLE
358 #elif OMPI_SIZEOF_FORTRAN_REAL16 == SIZEOF_LONG_DOUBLE
359 # define OMPI_DATATYPE_MPI_REAL16 OMPI_DATATYPE_MPI_LONG_DOUBLE
360 #else
361 # define OMPI_DATATYPE_MPI_REAL16 OMPI_DATATYPE_MPI_UNAVAILABLE
362 #endif
363
364
365 OMPI_DECLSPEC extern union dt_elem_desc ompi_datatype_predefined_elem_desc[2 * OMPI_DATATYPE_MPI_MAX_PREDEFINED];
366 extern const ompi_datatype_t* ompi_datatype_basicDatatypes[OMPI_DATATYPE_MPI_MAX_PREDEFINED];
367
368 /* There 3 types of predefined data types.
369 * - the basic one composed by just one basic datatype which are
370 * definitively contiguous
371 * - the derived ones where the same basic type is used multiple times.
372 * They should be most of the time contiguous.
373 * - and finally the derived one where multiple basic types are used.
374 * Depending on the architecture they can be contiguous or not.
375 *
376 * At this level we do not care from which language the datatype came from
377 * (C, C++ or FORTRAN), we only focus on their internal representation in
378 * the host memory.
379 */
380
381 #define OMPI_DATATYPE_EMPTY_DATA(NAME) \
382 OMPI_DATATYPE_MPI_ ## NAME /*id*/, \
383 0 /*d_f_to_c_index*/, \
384 NULL /*d_keyhash*/, \
385 NULL /*args*/, \
386 NULL /*packed_description*/, \
387 "MPI_" # NAME /*name*/
388
389 #define OMPI_DATATYPE_INITIALIZER_UNAVAILABLE(FLAGS) \
390 OPAL_DATATYPE_INITIALIZER_UNAVAILABLE(FLAGS)
391
392 #define OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE( TYPE, NAME, FLAGS ) \
393 { /*ompi_predefined_datatype_t*/ \
394 { /* ompi_datatype_t */ \
395 OMPI_DATATYPE_INITIALIZER_ ## TYPE (OMPI_DATATYPE_FLAG_PREDEFINED | \
396 (FLAGS)) /*super*/, \
397 OMPI_DATATYPE_EMPTY_DATA(NAME) /*id,d_f_to_c_index,d_keyhash,args,packed_description,name*/ \
398 }, \
399 {0, } /* padding */ \
400 }
401 /*
402 * Two macros for convenience
403 */
404 #define OMPI_DATATYPE_INIT_PREDEFINED( NAME, FLAGS ) \
405 OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE( NAME, NAME, FLAGS )
406 #define OMPI_DATATYPE_INIT_UNAVAILABLE( NAME, FLAGS ) \
407 OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE( UNAVAILABLE, NAME, FLAGS )
408
409 /*
410 * Initilization for these types is deferred until runtime.
411 *
412 * Using this macro implies that at this point not all informations needed
413 * to fill up the datatype are known. We fill them with zeros and then later
414 * when the datatype engine will be initialized we complete with the
415 * correct information. This macro should be used for all composed types.
416 */
417 #define OMPI_DATATYPE_INIT_DEFER(NAME, FLAGS) \
418 OMPI_DATATYPE_INIT_UNAVAILABLE(NAME, FLAGS)
419
420
421 #if OMPI_WANT_F77_BINDINGS
422 /*
423 * For Fortran, we need to pass information, such as ALIGNMENT and SIZE as well
424 * Therefore, for initialization at compile-time, pass this data as well.
425 *
426 * However, there is no underlying OPAL-TYPE, therefore we just pass NAME, SIZE,
427 * ALIGN and the FLAGS. Additionally, ONLY for Fortran we need the
428 * ompi_datatype_predefined_elem_desc for the additional types.
429 */
430 #define OMPI_DATATYPE_INIT_DESC_PREDEFINED(TYPE, SIZE) \
431 { \
432 1 /*length*/, 1 /*used*/, \
433 &(ompi_datatype_predefined_elem_desc[2 * OPAL_DATATYPE_ ## TYPE ## SIZE]) /*desc*/ \
434 }
435
436 /*
437 * Fortran types are based on the underlying OPAL types: They share the ID -- however,
438 * the alignment is overwritten.
439 */
440 #define OMPI_DATATYPE_INITIALIZER_FORTRAN( TYPE, NAME, SIZE, ALIGN, FLAGS ) \
441 { \
442 OPAL_OBJ_STATIC_INIT(opal_datatype_t), \
443 OPAL_DATATYPE_FLAG_BASIC | \
444 OMPI_DATATYPE_FLAG_PREDEFINED | \
445 OMPI_DATATYPE_FLAG_DATA_FORTRAN | (FLAGS) /*flag*/, \
446 OPAL_DATATYPE_ ## TYPE ## SIZE /*id*/, \
447 (((uint32_t)1)<<(OPAL_DATATYPE_ ## TYPE ## SIZE)) /*bdt_used*/, \
448 SIZE /*size*/, \
449 0 /*true_lb*/, SIZE /*true_ub*/, 0 /*lb*/, SIZE /*ub*/, \
450 (ALIGN) /*align*/, \
451 1 /*nbElems*/, \
452 OPAL_DATATYPE_INIT_NAME(TYPE ## SIZE) /*name*/, \
453 OMPI_DATATYPE_INIT_DESC_PREDEFINED(TYPE, SIZE) /*desc*/, \
454 OMPI_DATATYPE_INIT_DESC_PREDEFINED(TYPE, SIZE) /*opt_desc*/, \
455 OPAL_DATATYPE_INIT_BTYPES_ARRAY_ ## TYPE ## SIZE /*btypes*/ \
456 }
457
458 #define OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN( TYPE, NAME, SIZE, ALIGN, FLAGS ) \
459 { /*ompi_predefined_datatype_t*/ \
460 { /*ompi_datatype_t*/ \
461 OMPI_DATATYPE_INITIALIZER_FORTRAN( TYPE, NAME, SIZE, ALIGN, FLAGS) /*super*/, \
462 OMPI_DATATYPE_EMPTY_DATA(NAME) /*id,d_f_to_c_index,d_keyhash,args,packed_description,name*/ \
463 }, \
464 {0, } /* padding */ \
465 }
466 #else
467 #define OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN( TYPE, NAME, SIZE, ALIGN, FLAGS ) \
468 OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE( UNAVAILABLE, NAME, FLAGS )
469 #endif
470
471
472 /*
473 * OMPI-Versions of Initializer mapped onto OPAL-Types
474 */
475
476 #define OMPI_DATATYPE_INITIALIZER_LB OPAL_DATATYPE_INITIALIZER_LB
477 #define OMPI_DATATYPE_INITIALIZER_UB OPAL_DATATYPE_INITIALIZER_UB
478
479 #define OMPI_DATATYPE_INITIALIZER_INT8_T OPAL_DATATYPE_INITIALIZER_INT1
480 #define OMPI_DATATYPE_INITIALIZER_UINT8_T OPAL_DATATYPE_INITIALIZER_UINT1
481 #define OMPI_DATATYPE_INITIALIZER_INT16_T OPAL_DATATYPE_INITIALIZER_INT2
482 #define OMPI_DATATYPE_INITIALIZER_UINT16_T OPAL_DATATYPE_INITIALIZER_UINT2
483 #define OMPI_DATATYPE_INITIALIZER_INT32_T OPAL_DATATYPE_INITIALIZER_INT4
484 #define OMPI_DATATYPE_INITIALIZER_UINT32_T OPAL_DATATYPE_INITIALIZER_UINT4
485 #define OMPI_DATATYPE_INITIALIZER_INT64_T OPAL_DATATYPE_INITIALIZER_INT8
486 #define OMPI_DATATYPE_INITIALIZER_UINT64_T OPAL_DATATYPE_INITIALIZER_UINT8
487
488 #if SIZEOF_CHAR == 1
489 #define OMPI_DATATYPE_INITIALIZER_CHAR OPAL_DATATYPE_INITIALIZER_INT1
490 #define OMPI_DATATYPE_INITIALIZER_UNSIGNED_CHAR OPAL_DATATYPE_INITIALIZER_UINT1
491 #define OMPI_DATATYPE_INITIALIZER_SIGNED_CHAR OPAL_DATATYPE_INITIALIZER_INT1
492 #define OMPI_DATATYPE_INITIALIZER_BYTE OPAL_DATATYPE_INITIALIZER_UINT1
493 #elif SIZEOF_CHAR == 2
494 #define OMPI_DATATYPE_INITIALIZER_CHAR OPAL_DATATYPE_INITIALIZER_INT2
495 #define OMPI_DATATYPE_INITIALIZER_UNSIGNED_CHAR OPAL_DATATYPE_INITIALIZER_UINT2
496 #define OMPI_DATATYPE_INITIALIZER_SIGNED_CHAR OPAL_DATATYPE_INITIALIZER_INT2
497 #define OMPI_DATATYPE_INITIALIZER_BYTE OPAL_DATATYPE_INITIALIZER_UINT2
498 #elif SIZEOF_CHAR == 4
499 #define OMPI_DATATYPE_INITIALIZER_CHAR OPAL_DATATYPE_INITIALIZER_INT4
500 #define OMPI_DATATYPE_INITIALIZER_UNSIGNED_CHAR OPAL_DATATYPE_INITIALIZER_UINT4
501 #define OMPI_DATATYPE_INITIALIZER_SIGNED_CHAR OPAL_DATATYPE_INITIALIZER_INT4
502 #define OMPI_DATATYPE_INITIALIZER_BYTE OPAL_DATATYPE_INITIALIZER_UINT4
503 #elif SIZEOF_CHAR == 8
504 #define OMPI_DATATYPE_INITIALIZER_CHAR OPAL_DATATYPE_INITIALIZER_INT8
505 #define OMPI_DATATYPE_INITIALIZER_UNSIGNED_CHAR OPAL_DATATYPE_INITIALIZER_UINT8
506 #define OMPI_DATATYPE_INITIALIZER_SIGNED_CHAR OPAL_DATATYPE_INITIALIZER_INT8
507 #define OMPI_DATATYPE_INITIALIZER_BYTE OPAL_DATATYPE_INITIALIZER_UINT8
508 #endif
509
510 #if SIZEOF_SHORT == 2
511 #define OMPI_DATATYPE_INITIALIZER_SHORT OPAL_DATATYPE_INITIALIZER_INT2
512 #define OMPI_DATATYPE_INITIALIZER_UNSIGNED_SHORT OPAL_DATATYPE_INITIALIZER_UINT2
513 #elif SIZEOF_SHORT == 4
514 #define OMPI_DATATYPE_INITIALIZER_SHORT OPAL_DATATYPE_INITIALIZER_INT4
515 #define OMPI_DATATYPE_INITIALIZER_UNSIGNED_SHORT OPAL_DATATYPE_INITIALIZER_UINT4
516 #elif SIZEOF_SHORT == 8
517 #define OMPI_DATATYPE_INITIALIZER_SHORT OPAL_DATATYPE_INITIALIZER_INT8
518 #define OMPI_DATATYPE_INITIALIZER_UNSIGNED_SHORT OPAL_DATATYPE_INITIALIZER_UINT8
519 #endif
520
521 #if SIZEOF_INT == 2
522 #define OMPI_DATATYPE_INITIALIZER_INT OPAL_DATATYPE_INITIALIZER_INT2
523 #define OMPI_DATATYPE_INITIALIZER_UNSIGNED_INT OPAL_DATATYPE_INITIALIZER_UINT2
524 #elif SIZEOF_INT == 4
525 #define OMPI_DATATYPE_INITIALIZER_INT OPAL_DATATYPE_INITIALIZER_INT4
526 #define OMPI_DATATYPE_INITIALIZER_UNSIGNED_INT OPAL_DATATYPE_INITIALIZER_UINT4
527 #elif SIZEOF_INT == 8
528 #define OMPI_DATATYPE_INITIALIZER_INT OPAL_DATATYPE_INITIALIZER_INT8
529 #define OMPI_DATATYPE_INITIALIZER_UNSIGNED_INT OPAL_DATATYPE_INITIALIZER_UINT8
530 #endif
531
532 #if SIZEOF_LONG == 4
533 #define OMPI_DATATYPE_INITIALIZER_LONG OPAL_DATATYPE_INITIALIZER_INT4
534 #define OMPI_DATATYPE_INITIALIZER_UNSIGNED_LONG OPAL_DATATYPE_INITIALIZER_UINT4
535 #elif SIZEOF_LONG == 8
536 #define OMPI_DATATYPE_INITIALIZER_LONG OPAL_DATATYPE_INITIALIZER_INT8
537 #define OMPI_DATATYPE_INITIALIZER_UNSIGNED_LONG OPAL_DATATYPE_INITIALIZER_UINT8
538 #elif SIZEOF_LONG == 16
539 #define OMPI_DATATYPE_INITIALIZER_LONG OPAL_DATATYPE_INITIALIZER_INT16
540 #define OMPI_DATATYPE_INITIALIZER_UNSIGNED_LONG OPAL_DATATYPE_INITIALIZER_UINT16
541 #endif
542
543
544 #ifdef HAVE_LONG_LONG
545 #if SIZEOF_LONG_LONG == 4
546 #define OMPI_DATATYPE_INITIALIZER_LONG_LONG OPAL_DATATYPE_INITIALIZER_INT4
547 #define OMPI_DATATYPE_INITIALIZER_UNSIGNED_LONG_LONG OPAL_DATATYPE_INITIALIZER_UINT4
548 #elif SIZEOF_LONG_LONG == 8
549 #define OMPI_DATATYPE_INITIALIZER_LONG_LONG OPAL_DATATYPE_INITIALIZER_INT8
550 #define OMPI_DATATYPE_INITIALIZER_UNSIGNED_LONG_LONG OPAL_DATATYPE_INITIALIZER_UINT8
551 #elif SIZEOF_LONG_LONG == 16
552 #define OMPI_DATATYPE_INITIALIZER_LONG_LONG OPAL_DATATYPE_INITIALIZER_INT16
553 #define OMPI_DATATYPE_INITIALIZER_UNSIGNED_LONG_LONG OPAL_DATATYPE_INITIALIZER_UINT16
554 #endif
555
556 #else /* HAVE_LONG_LONG */
557
558 #define OMPI_DATATYPE_INITIALIZER_LONG_LONG OPAL_DATATYPE_INIT_UNAVAILABLE (LONG_LONG, OMPI_DATATYPE_FLAG_DATA_C)
559 #define OMPI_DATATYPE_INITIALIZER_UNSIGNED_LONG_LONG OPAL_DATATYPE_INIT_UNAVAILABLE (UNSIGNED_LONG_LONG, OMPI_DATATYPE_FLAG_DATA_C)
560
561 #endif /* HAVE_LONG_LONG */
562
563 #if SIZEOF_FLOAT == 2
564 #define OMPI_DATATYPE_INITIALIZER_FLOAT OPAL_DATATYPE_INITIALIZER_FLOAT2
565 #elif SIZEOF_FLOAT == 4
566 #define OMPI_DATATYPE_INITIALIZER_FLOAT OPAL_DATATYPE_INITIALIZER_FLOAT4
567 #elif SIZEOF_FLOAT == 8
568 #define OMPI_DATATYPE_INITIALIZER_FLOAT OPAL_DATATYPE_INITIALIZER_FLOAT8
569 #endif
570
571
572 #if SIZEOF_DOUBLE == 4
573 #define OMPI_DATATYPE_INITIALIZER_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT4
574 #elif SIZEOF_DOUBLE == 8
575 #define OMPI_DATATYPE_INITIALIZER_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT8
576 #elif SIZEOF_DOUBLE == 12
577 #define OMPI_DATATYPE_INITIALIZER_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT12
578 #elif SIZEOF_DOUBLE == 16
579 #define OMPI_DATATYPE_INITIALIZER_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT16
580 #endif
581
582
583 #ifdef HAVE_LONG_DOUBLE
584 #if SIZEOF_LONG_DOUBLE == 4
585 #define OMPI_DATATYPE_INITIALIZER_LONG_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT4
586 #elif SIZEOF_LONG_DOUBLE == 8
587 #define OMPI_DATATYPE_INITIALIZER_LONG_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT8
588 #elif SIZEOF_LONG_DOUBLE == 12
589 #define OMPI_DATATYPE_INITIALIZER_LONG_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT12
590 #elif SIZEOF_LONG_DOUBLE == 16
591 #define OMPI_DATATYPE_INITIALIZER_LONG_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT16
592 #endif
593
594 #else /* HAVE_LONG_DOUBLE */
595
596 #define OMPI_DATATYPE_INITIALIZER_LONG_DOUBLE OMPI_DATATYPE_INIT_UNAVAILABLE(LONG_DOUBLE, OMPI_DATATYPE_FLAG_DATA_C)
597
598 #endif /* HAVE_LONG_DOUBLE */
599
600 #define OMPI_DATATYPE_INITIALIZER_PACKED OPAL_DATATYPE_INITIALIZER_UINT1
601
602 #define OMPI_DATATYPE_INITIALIZER_BOOL OPAL_DATATYPE_INITIALIZER_BOOL
603
604 #define OMPI_DATATYPE_INITIALIZER_WCHAR OPAL_DATATYPE_INITIALIZER_WCHAR
605
606 /*
607 * Following are the structured types, that cannot be represented
608 * by one single OPAL basic type
609 */
610 #define OMPI_DATATYPE_FIRST_TYPE OPAL_DATATYPE_MAX_PREDEFINED
611 #define OMPI_DATATYPE_COMPLEX (OMPI_DATATYPE_FIRST_TYPE+0) /* Equal to OMPI_DATATYPE_FIRST_TYPE */
612 #define OMPI_DATATYPE_DOUBLE_COMPLEX (OMPI_DATATYPE_FIRST_TYPE+1)
613 #define OMPI_DATATYPE_LONG_DOUBLE_COMPLEX (OMPI_DATATYPE_FIRST_TYPE+2)
614
615 #define OMPI_DATATYPE_COMPLEX8 (OMPI_DATATYPE_FIRST_TYPE+3)
616 #define OMPI_DATATYPE_COMPLEX16 (OMPI_DATATYPE_FIRST_TYPE+4)
617 #define OMPI_DATATYPE_COMPLEX32 (OMPI_DATATYPE_FIRST_TYPE+5)
618
619 /*
620 * Derived datatypes supposely contiguous
621 */
622 #define OMPI_DATATYPE_2INT (OMPI_DATATYPE_FIRST_TYPE+6)
623 #define OMPI_DATATYPE_2INTEGER (OMPI_DATATYPE_FIRST_TYPE+7)
624 #define OMPI_DATATYPE_2REAL (OMPI_DATATYPE_FIRST_TYPE+8)
625 #define OMPI_DATATYPE_2DBLPREC (OMPI_DATATYPE_FIRST_TYPE+9)
626 #define OMPI_DATATYPE_2COMPLEX (OMPI_DATATYPE_FIRST_TYPE+10)
627 #define OMPI_DATATYPE_2DOUBLE_COMPLEX (OMPI_DATATYPE_FIRST_TYPE+11)
628 /*
629 * Derived datatypes which will definitively be non contiguous on some architectures.
630 */
631 #define OMPI_DATATYPE_FLOAT_INT (OMPI_DATATYPE_FIRST_TYPE+12)
632 #define OMPI_DATATYPE_DOUBLE_INT (OMPI_DATATYPE_FIRST_TYPE+13)
633 #define OMPI_DATATYPE_LONG_DOUBLE_INT (OMPI_DATATYPE_FIRST_TYPE+14)
634 #define OMPI_DATATYPE_SHORT_INT (OMPI_DATATYPE_FIRST_TYPE+15)
635 #define OMPI_DATATYPE_LONG_INT (OMPI_DATATYPE_FIRST_TYPE+16)
636
637 /* Used locally as a nice marker */
638 #define OMPI_DATATYPE_UNAVAILABLE (OMPI_DATATYPE_FIRST_TYPE+17)
639
640 /* If the number of basic datatype should change update OMPI_DATATYPE_MAX_PREDEFINED in ompi_datatype.h */
641 #if OMPI_DATATYPE_MAX_PREDEFINED <= OMPI_DATATYPE_UNAVAILABLE
642 #error OMPI_DATATYPE_MAX_PREDEFINED should be updated to the next value after the OMPI_DATATYPE_UNAVAILABLE define
643 #endif /* safe check for max predefined datatypes. */
644
645 #endif /* OMPI_DATATYPE_INTERNAL_H */
dt_elem_desc
Definition: opal_datatype_internal.h:184
ompi_datatype_t
Definition: ompi_datatype.h:68