libsc  2.8.7
The SC library provides support for parallel scientific applications.
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sc3_mpi_types.h
Go to the documentation of this file.
1 /*
2  This file is part of the SC Library, version 3.
3  The SC Library provides support for parallel scientific applications.
4 
5  Copyright (C) 2019 individual authors
6 
7  Redistribution and use in source and binary forms, with or without
8  modification, are permitted provided that the following conditions are met:
9 
10  1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13  2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  POSSIBILITY OF SUCH DAMAGE.
28 */
29 
41 #ifndef SC3_MPI_TYPES_H
42 #define SC3_MPI_TYPES_H
43 
44 /* this works both standalone and when included from sc.h */
45 #include <sc_config.h>
46 #ifdef SC_ENABLE_MPI
47 #include <mpi.h>
48 
49 typedef MPI_Errhandler sc3_MPI_Errhandler_t;
50 typedef MPI_Comm sc3_MPI_Comm_t;
51 typedef MPI_Info sc3_MPI_Info_t;
52 typedef MPI_Datatype sc3_MPI_Datatype_t;
53 typedef MPI_Op sc3_MPI_Op_t;
54 
55 #define SC3_MPI_UNDEFINED MPI_UNDEFINED
56 
57 #define SC3_MPI_DATATYPE_NULL MPI_DATATYPE_NULL
58 #define SC3_MPI_BYTE MPI_BYTE
59 #define SC3_MPI_INT MPI_INT
60 #define SC3_MPI_2INT MPI_2INT
61 #define SC3_MPI_UNSIGNED MPI_UNSIGNED
62 #define SC3_MPI_LONG MPI_LONG
63 #define SC3_MPI_LONG_LONG MPI_LONG_LONG_INT
64 #define SC3_MPI_FLOAT MPI_FLOAT
65 #define SC3_MPI_DOUBLE MPI_DOUBLE
66 #define SC3_MPI_DOUBLE_INT MPI_DOUBLE_INT
67 
68 #define SC3_MPI_OP_NULL MPI_OP_NULL
69 #define SC3_MPI_MIN MPI_MIN
70 #define SC3_MPI_MAX MPI_MAX
71 #define SC3_MPI_MINLOC MPI_MINLOC
72 #define SC3_MPI_MAXLOC MPI_MAXLOC
73 #define SC3_MPI_LOR MPI_LOR
74 #define SC3_MPI_LAND MPI_LAND
75 #define SC3_MPI_LXOR MPI_LXOR
76 #define SC3_MPI_BOR MPI_BOR
77 #define SC3_MPI_BAND MPI_BAND
78 #define SC3_MPI_BXOR MPI_BXOR
79 #define SC3_MPI_REPLACE MPI_REPLACE
80 #define SC3_MPI_SUM MPI_SUM
81 #define SC3_MPI_PROD MPI_PROD
82 
83 #define SC3_MPI_ERRORS_RETURN MPI_ERRORS_RETURN
84 #define SC3_MPI_COMM_WORLD MPI_COMM_WORLD
85 #define SC3_MPI_COMM_SELF MPI_COMM_SELF
86 #define SC3_MPI_COMM_NULL MPI_COMM_NULL
87 #define SC3_MPI_INFO_NULL MPI_INFO_NULL
88 
89 #define SC3_MPI_MAX_ERROR_STRING MPI_MAX_ERROR_STRING
90 #define SC3_MPI_SUCCESS MPI_SUCCESS
91 #define SC3_MPI_ERR_ARG MPI_ERR_ARG
92 #define SC3_MPI_ERR_COUNT MPI_ERR_COUNT
93 #define SC3_MPI_ERR_UNKNOWN MPI_ERR_UNKNOWN
94 #define SC3_MPI_ERR_OTHER MPI_ERR_OTHER
95 #define SC3_MPI_ERR_NO_MEM MPI_ERR_NO_MEM
96 
97 #ifdef SC_ENABLE_MPIIO
98 
99 #define SC_MPI_ERR_FILE MPI_ERR_FILE
100 #define SC_MPI_ERR_NOT_SAME MPI_ERR_NOT_SAME
101 #define SC_MPI_ERR_AMODE MPI_ERR_AMODE
102 #define SC_MPI_ERR_UNSUPPORTED_DATAREP MPI_ERR_UNSUPPORTED_DATAREP
103 #define SC_MPI_ERR_UNSUPPORTED_OPERATION MPI_ERR_UNSUPPORTED_OPERATION
104 #define SC_MPI_ERR_NO_SUCH_FILE MPI_ERR_NO_SUCH_FILE
105 #define SC_MPI_ERR_FILE_EXISTS MPI_ERR_FILE_EXISTS
106 #define SC_MPI_ERR_BAD_FILE MPI_ERR_BAD_FILE
107 #define SC_MPI_ERR_ACCESS MPI_ERR_ACCESS
108 #define SC_MPI_ERR_NO_SPACE MPI_ERR_NO_SPACE
109 #define SC_MPI_ERR_QUOTA MPI_ERR_QUOTA
110 #define SC_MPI_ERR_READ_ONLY MPI_ERR_READ_ONLY
111 #define SC_MPI_ERR_FILE_IN_USE MPI_ERR_FILE_IN_USE
112 #define SC_MPI_ERR_DUP_DATAREP MPI_ERR_DUP_DATAREP
113 #define SC_MPI_ERR_CONVERSION MPI_ERR_CONVERSION
114 #define SC_MPI_ERR_IO MPI_ERR_IO
115 
116 #define SC3_MPI_ERR_LASTCODE MPI_ERR_LASTCODE
117 
118 #else
119 
120 typedef enum sc3_MPI_IO_Errorcode
121 {
122  /* only MPI I/O error classes */
123  /* WARNING: This enum is only used in the deprecated case of activated MPI but
124  * deactivated MPI I/O.
125  */
126  SC3_MPI_ERR_FILE = MPI_ERR_LASTCODE,
127  SC3_MPI_ERR_NOT_SAME,
128  SC3_MPI_ERR_AMODE,
129  SC3_MPI_ERR_UNSUPPORTED_DATAREP,
130  SC3_MPI_ERR_UNSUPPORTED_OPERATION,
131  SC3_MPI_ERR_NO_SUCH_FILE,
132  SC3_MPI_ERR_FILE_EXISTS,
133  SC3_MPI_ERR_BAD_FILE,
134  SC3_MPI_ERR_ACCESS,
135  SC3_MPI_ERR_NO_SPACE,
136  SC3_MPI_ERR_QUOTA,
137  SC3_MPI_ERR_READ_ONLY,
138  SC3_MPI_ERR_FILE_IN_USE,
139  SC3_MPI_ERR_DUP_DATAREP,
140  SC3_MPI_ERR_CONVERSION,
141  SC3_MPI_ERR_IO,
142  SC3_MPI_ERR_LASTCODE
143 }
144 sc3_MPI_IO_Errorcode_t;
145 
146 #endif /* !SC_ENABLE_MPIIO */
147 
148 #else /* !SC_ENABLE_MPI */
149 
151 typedef struct sc3_MPI_Errhandler *sc3_MPI_Errhandler_t;
152 
155 typedef struct sc3_MPI_Comm *sc3_MPI_Comm_t;
156 
159 typedef struct sc3_MPI_Info *sc3_MPI_Info_t;
160 
162 typedef enum sc3_MPI_Datatype
163 {
165  SC3_MPI_BYTE,
176 }
178 
180 typedef enum sc3_MPI_Op
181 {
195  SC3_MPI_PROD
196 }
198 
200 typedef enum sc3_MPI_Errorcode
201 {
203  SC3_MPI_ERR_ARG = 14000,
209  /* add MPI I/O error classes */
210  SC3_MPI_ERR_FILE,
211  SC3_MPI_ERR_NOT_SAME,
212  SC3_MPI_ERR_AMODE,
213  SC3_MPI_ERR_UNSUPPORTED_DATAREP,
214  SC3_MPI_ERR_UNSUPPORTED_OPERATION,
215  SC3_MPI_ERR_NO_SUCH_FILE,
216  SC3_MPI_ERR_FILE_EXISTS,
217  SC3_MPI_ERR_BAD_FILE,
218  SC3_MPI_ERR_ACCESS,
219  SC3_MPI_ERR_NO_SPACE,
220  SC3_MPI_ERR_QUOTA,
221  SC3_MPI_ERR_READ_ONLY,
222  SC3_MPI_ERR_FILE_IN_USE,
223  SC3_MPI_ERR_DUP_DATAREP,
224  SC3_MPI_ERR_CONVERSION,
225  SC3_MPI_ERR_IO,
226  SC3_MPI_ERR_LASTCODE
227 }
229 
231 typedef enum sc3_MPI_Enum
232 {
233  SC3_MPI_UNDEFINED = 0x11
234 }
236 
238 #define SC3_MPI_ERRORS_RETURN NULL
239 
241 #define SC3_MPI_MAX_ERROR_STRING BUFSIZ
242 
244 #define SC3_MPI_COMM_NULL ((sc3_MPI_Comm_t) NULL)
245 
247 #define SC3_MPI_COMM_WORLD ((sc3_MPI_Comm_t) 0x40)
248 
250 #define SC3_MPI_COMM_SELF ((sc3_MPI_Comm_t) 0x80)
251 
253 #define SC3_MPI_INFO_NULL ((sc3_MPI_Info_t) NULL)
254 
255 #endif /* !SC_ENABLE_MPI */
256 
257 #ifndef SC_ENABLE_MPICOMMSHARED
258 /* It is possible that MPI exists but the shared communicators do not. */
259 
262 typedef enum sc3_MPI_Comm_type
263 {
265 }
267 
268 #else
269 /* We know that MPI is generally available. */
270 
271 #define SC3_MPI_COMM_TYPE_SHARED MPI_COMM_TYPE_SHARED
272 
273 #endif /* SC_ENABLE_MPICOMMSHARED */
274 
285 typedef struct sc3_MPI_Win *sc3_MPI_Win_t;
286 
288 #define SC3_MPI_WIN_NULL ((sc3_MPI_Win_t) NULL)
289 
290 #ifndef SC_ENABLE_MPIWINSHARED
291 /* It is possible that MPI exists but the shared windows do not. */
292 
294 typedef long sc3_MPI_Aint_t;
295 
297 typedef enum sc3_MPI_Win_mode
298 {
301  SC3_MPI_MODE_NOCHECK = 0x15
302 }
304 
305 #else
306 /* We know that MPI is generally available. */
307 
308 typedef MPI_Aint sc3_MPI_Aint_t;
309 
310 #define SC3_MPI_LOCK_SHARED MPI_LOCK_SHARED
311 #define SC3_MPI_LOCK_EXCLUSIVE MPI_LOCK_EXCLUSIVE
312 #define SC3_MPI_MODE_NOCHECK MPI_MODE_NOCHECK
313 
314 #endif /* SC_ENABLE_MPIWINSHARED */
315 
316 #endif /* !SC3_MPI_TYPES_H */
sc3_MPI_Op
We wrap the MPI operation types we use.
Definition: sc3_mpi_types.h:181
@ SC3_MPI_LXOR
Logical XOR.
Definition: sc3_mpi_types.h:189
@ SC3_MPI_MAX
The usual maximum reduction operation.
Definition: sc3_mpi_types.h:184
@ SC3_MPI_MAXLOC
Find maximum value and its rank.
Definition: sc3_mpi_types.h:186
@ SC3_MPI_PROD
The usual product reduction operation.
Definition: sc3_mpi_types.h:195
@ SC3_MPI_LAND
Logical AND.
Definition: sc3_mpi_types.h:188
@ SC3_MPI_OP_NULL
The invalid operation.
Definition: sc3_mpi_types.h:182
@ SC3_MPI_REPLACE
The MPI replace operation.
Definition: sc3_mpi_types.h:193
@ SC3_MPI_BOR
Bitwise OR.
Definition: sc3_mpi_types.h:190
@ SC3_MPI_LOR
Logical OR.
Definition: sc3_mpi_types.h:187
@ SC3_MPI_BXOR
Bitwise XOR.
Definition: sc3_mpi_types.h:192
@ SC3_MPI_SUM
The usual sum reduction operation.
Definition: sc3_mpi_types.h:194
@ SC3_MPI_BAND
Bitwise AND.
Definition: sc3_mpi_types.h:191
@ SC3_MPI_MINLOC
Find minimum value and its rank.
Definition: sc3_mpi_types.h:185
@ SC3_MPI_MIN
The usual minimum reduction operation.
Definition: sc3_mpi_types.h:183
enum sc3_MPI_Errorcode sc3_MPI_Errorcode_t
We wrap some MPI error codes and the I/O error classes.
struct sc3_MPI_Win * sc3_MPI_Win_t
We wrap the MPI 3 window object.
Definition: sc3_mpi_types.h:285
enum sc3_MPI_Op sc3_MPI_Op_t
We wrap the MPI operation types we use.
enum sc3_MPI_Comm_type sc3_MPI_Comm_type_t
We wrap MPI 3 shared memory communicators.
struct sc3_MPI_Info * sc3_MPI_Info_t
Wrapped MPI info object.
Definition: sc3_mpi_types.h:159
sc3_MPI_Win_mode
Wrap MPI 3 window lock modes.
Definition: sc3_mpi_types.h:298
@ SC3_MPI_LOCK_EXCLUSIVE
Exclusive (usually reader) lock.
Definition: sc3_mpi_types.h:300
@ SC3_MPI_MODE_NOCHECK
Option to MPI_Win_lock.
Definition: sc3_mpi_types.h:301
@ SC3_MPI_LOCK_SHARED
Shared (multiple readers) lock.
Definition: sc3_mpi_types.h:299
enum sc3_MPI_Enum sc3_MPI_Enum_t
We need several parameters to MPI functions.
sc3_MPI_Comm_type
We wrap MPI 3 shared memory communicators.
Definition: sc3_mpi_types.h:263
@ SC3_MPI_COMM_TYPE_SHARED
MPI 3 shared window communicator.
Definition: sc3_mpi_types.h:264
sc3_MPI_Datatype
We wrap the MPI datatypes we use.
Definition: sc3_mpi_types.h:163
@ SC3_MPI_DOUBLE
Same as in original MPI.
Definition: sc3_mpi_types.h:174
@ SC3_MPI_2INT
Same as in original MPI.
Definition: sc3_mpi_types.h:169
@ SC3_MPI_FLOAT
Same as in original MPI.
Definition: sc3_mpi_types.h:173
@ SC3_MPI_LONG
Same as in original MPI.
Definition: sc3_mpi_types.h:171
@ SC3_MPI_LONG_LONG
Same as in original MPI.
Definition: sc3_mpi_types.h:172
@ SC3_MPI_DATATYPE_NULL
The invalid data type.
Definition: sc3_mpi_types.h:164
@ SC3_MPI_BYTE
Same as in original MPI.
Definition: sc3_mpi_types.h:165
@ SC3_MPI_UNSIGNED
Same as in original MPI.
Definition: sc3_mpi_types.h:170
@ SC3_MPI_INT
Same as in original MPI.
Definition: sc3_mpi_types.h:168
@ SC3_MPI_DOUBLE_INT
Same as in original MPI.
Definition: sc3_mpi_types.h:175
sc3_MPI_Enum
We need several parameters to MPI functions.
Definition: sc3_mpi_types.h:232
@ SC3_MPI_UNDEFINED
An input parameter with undefined value.
Definition: sc3_mpi_types.h:233
struct sc3_MPI_Errhandler * sc3_MPI_Errhandler_t
Wrapped MPI error handler object.
Definition: sc3_mpi_types.h:151
enum sc3_MPI_Win_mode sc3_MPI_Win_mode_t
Wrap MPI 3 window lock modes.
sc3_MPI_Errorcode
We wrap some MPI error codes and the I/O error classes.
Definition: sc3_mpi_types.h:201
@ SC3_MPI_ERR_OTHER
An MPI function has produced some known error.
Definition: sc3_mpi_types.h:206
@ SC3_MPI_ERR_UNKNOWN
An MPI function has produced an unknown error.
Definition: sc3_mpi_types.h:205
@ SC3_MPI_ERR_COUNT
An MPI function encountered an invalid count argument.
Definition: sc3_mpi_types.h:204
@ SC3_MPI_ERR_NO_MEM
An MPI function ran out of memory.
Definition: sc3_mpi_types.h:207
@ SC3_MPI_SUCCESS
An MPI function has exited successfully.
Definition: sc3_mpi_types.h:202
@ SC3_MPI_ERR_ARG
An MPI function encountered invalid arguments.
Definition: sc3_mpi_types.h:203
long sc3_MPI_Aint_t
We wrap the MPI address integer type.
Definition: sc3_mpi_types.h:294
enum sc3_MPI_Datatype sc3_MPI_Datatype_t
We wrap the MPI datatypes we use.
struct sc3_MPI_Comm * sc3_MPI_Comm_t
Wrapped MPI communicator.
Definition: sc3_mpi_types.h:155