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
sc_mpi.h
Go to the documentation of this file.
1 /*
2  This file is part of the SC Library.
3  The SC Library provides support for parallel scientific applications.
4 
5  Copyright (C) 2010 The University of Texas System
6  Additional copyright (C) 2011 individual authors
7 
8  The SC Library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  The SC Library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with the SC Library; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  02110-1301, USA.
22 */
23 
66 #ifndef SC_MPI_H
67 #define SC_MPI_H
68 
69 /* this works both standalone and when included from sc.h */
70 #include <sc_config.h>
71 #ifdef SC_ENABLE_MPI
72 #include <mpi.h>
73 #endif
74 
75 SC_EXTERN_C_BEGIN;
76 
80 int sc_mpi_is_enabled (void);
81 
85 int sc_mpi_is_shared (void);
86 
88 typedef enum
89 {
90  SC_TAG_FIRST = 's' + 'c',
111  SC_TAG_LAST
112 }
113 sc_tag_t;
114 
115 #ifdef SC_ENABLE_MPI
116 
117 /* constants */
118 #define sc_MPI_SUCCESS MPI_SUCCESS
119 #define sc_MPI_ERR_ARG MPI_ERR_ARG
120 #define sc_MPI_ERR_COUNT MPI_ERR_COUNT
121 #define sc_MPI_ERR_UNKNOWN MPI_ERR_UNKNOWN
122 #define sc_MPI_ERR_OTHER MPI_ERR_OTHER
123 #define sc_MPI_ERR_NO_MEM MPI_ERR_NO_MEM
124 #define sc_MPI_MAX_ERROR_STRING MPI_MAX_ERROR_STRING
125 
126 #ifdef SC_ENABLE_MPIIO
127 
128 #define sc_MPI_ERR_FILE MPI_ERR_FILE
129 #define sc_MPI_ERR_NOT_SAME MPI_ERR_NOT_SAME
130 #define sc_MPI_ERR_AMODE MPI_ERR_AMODE
131 #define sc_MPI_ERR_UNSUPPORTED_DATAREP MPI_ERR_UNSUPPORTED_DATAREP
132 #define sc_MPI_ERR_UNSUPPORTED_OPERATION MPI_ERR_UNSUPPORTED_OPERATION
133 #define sc_MPI_ERR_NO_SUCH_FILE MPI_ERR_NO_SUCH_FILE
134 #define sc_MPI_ERR_FILE_EXISTS MPI_ERR_FILE_EXISTS
135 #define sc_MPI_ERR_BAD_FILE MPI_ERR_BAD_FILE
136 #define sc_MPI_ERR_ACCESS MPI_ERR_ACCESS
137 #define sc_MPI_ERR_NO_SPACE MPI_ERR_NO_SPACE
138 #define sc_MPI_ERR_QUOTA MPI_ERR_QUOTA
139 #define sc_MPI_ERR_READ_ONLY MPI_ERR_READ_ONLY
140 #define sc_MPI_ERR_FILE_IN_USE MPI_ERR_FILE_IN_USE
141 #define sc_MPI_ERR_DUP_DATAREP MPI_ERR_DUP_DATAREP
142 #define sc_MPI_ERR_CONVERSION MPI_ERR_CONVERSION
143 #define sc_MPI_ERR_IO MPI_ERR_IO
144 
145 #define sc_MPI_ERR_LASTCODE MPI_ERR_LASTCODE
146 
147 /* MPI 2.0 type */
148 #define sc_MPI_Aint MPI_Aint
149 
150 #else /* !SC_ENABLE_MPIIO */
151 
152 typedef enum sc_MPI_IO_Errorcode
153 {
154  /* only MPI I/O error classes */
155  /* WARNING: This enum is only used in the deprecated case of activated MPI but
156  * deactivated MPI I/O.
157  */
158  sc_MPI_ERR_FILE = MPI_ERR_LASTCODE,
175 }
176 sc_MPI_IO_Errorcode_t;
177 
178 #define sc_MPI_Aint sc3_MPI_Aint_t
179 
180 #endif /* !SC_ENABLE_MPIIO */
181 
182 #define sc_MPI_COMM_NULL MPI_COMM_NULL
183 #define sc_MPI_COMM_WORLD MPI_COMM_WORLD
184 #define sc_MPI_COMM_SELF MPI_COMM_SELF
185 
186 #define sc_MPI_GROUP_NULL MPI_GROUP_NULL
187 #define sc_MPI_GROUP_EMPTY MPI_GROUP_EMPTY
188 
189 #define sc_MPI_IDENT MPI_IDENT
190 #define sc_MPI_CONGRUENT MPI_CONGRUENT
191 #define sc_MPI_SIMILAR MPI_SIMILAR
192 #define sc_MPI_UNEQUAL MPI_UNEQUAL
193 
194 #define sc_MPI_ANY_SOURCE MPI_ANY_SOURCE
195 #define sc_MPI_ANY_TAG MPI_ANY_TAG
196 #define sc_MPI_STATUS_IGNORE MPI_STATUS_IGNORE
197 #define sc_MPI_STATUSES_IGNORE MPI_STATUSES_IGNORE
198 
199 #define sc_MPI_REQUEST_NULL MPI_REQUEST_NULL
200 
201 #define sc_MPI_DATATYPE_NULL MPI_DATATYPE_NULL
202 #define sc_MPI_BYTE MPI_BYTE
203 #define sc_MPI_CHAR MPI_CHAR
204 #define sc_MPI_UNSIGNED_CHAR MPI_UNSIGNED_CHAR
205 #define sc_MPI_SHORT MPI_SHORT
206 #define sc_MPI_UNSIGNED_SHORT MPI_UNSIGNED_SHORT
207 #define sc_MPI_INT MPI_INT
208 #define sc_MPI_UNSIGNED MPI_UNSIGNED
209 #define sc_MPI_LONG MPI_LONG
210 #define sc_MPI_UNSIGNED_LONG MPI_UNSIGNED_LONG
211 /* Not an MPI 1.3 data type */
212 #ifdef SC_HAVE_MPI_UNSIGNED_LONG_LONG
213 #define sc_MPI_UNSIGNED_LONG_LONG MPI_UNSIGNED_LONG_LONG
214 #else
215 /* MPI data type is not supported */
216 #define sc_MPI_UNSIGNED_LONG_LONG MPI_DATATYPE_NULL
217 #endif
218 /* Not an MPI 1.3 data type */
219 #ifdef SC_HAVE_MPI_SIGNED_CHAR
220 #define sc_MPI_SIGNED_CHAR MPI_SIGNED_CHAR
221 #else
222 /* MPI data type is not supported */
223 #define sc_MPI_SIGNED_CHAR MPI_DATATYPE_NULL
224 #endif
225 /* Not an MPI 1.3 data type */
226 #ifdef SC_HAVE_MPI_INT8_T
227 #define sc_MPI_INT8_T MPI_INT8_T
228 #else
229 /* MPI data type is not supported */
230 #define sc_MPI_INT8_T MPI_DATATYPE_NULL
231 #endif
232 #define sc_MPI_LONG_LONG_INT MPI_LONG_LONG_INT
233 #define sc_MPI_FLOAT MPI_FLOAT
234 #define sc_MPI_DOUBLE MPI_DOUBLE
235 #define sc_MPI_LONG_DOUBLE MPI_LONG_DOUBLE
236 #define sc_MPI_2INT MPI_2INT
237 #define sc_MPI_DOUBLE_INT MPI_DOUBLE_INT
238 #define sc_MPI_PACKED MPI_PACKED
239 
240 #define sc_MPI_OP_NULL MPI_OP_NULL
241 #define sc_MPI_MAX MPI_MAX
242 #define sc_MPI_MIN MPI_MIN
243 #define sc_MPI_LAND MPI_LAND
244 #define sc_MPI_BAND MPI_BAND
245 #define sc_MPI_LOR MPI_LOR
246 #define sc_MPI_BOR MPI_BOR
247 #define sc_MPI_LXOR MPI_LXOR
248 #define sc_MPI_BXOR MPI_BXOR
249 #define sc_MPI_MINLOC MPI_MINLOC
250 #define sc_MPI_MAXLOC MPI_MAXLOC
251 #define sc_MPI_REPLACE MPI_REPLACE
252 #define sc_MPI_SUM MPI_SUM
253 #define sc_MPI_PROD MPI_PROD
254 
255 #define sc_MPI_UNDEFINED MPI_UNDEFINED
256 
257 #define sc_MPI_KEYVAL_INVALID MPI_KEYVAL_INVALID
258 
259 /* types */
260 
261 #define sc_MPI_Comm MPI_Comm
262 #define sc_MPI_Group MPI_Group
263 #define sc_MPI_Datatype MPI_Datatype
264 #define sc_MPI_Op MPI_Op
265 #define sc_MPI_Request MPI_Request
266 #define sc_MPI_Status MPI_Status
267 #define sc_MPI_Info MPI_Info
268 
269 /* MPI info arguments */
270 
271 #define sc_MPI_INFO_NULL MPI_INFO_NULL
272 
273 /* MPI functions */
274 
275 #define sc_MPI_Init MPI_Init
276 /* sc_MPI_Init_thread is handled below */
277 #define sc_MPI_Finalize MPI_Finalize
278 #define sc_MPI_Abort MPI_Abort
279 #define sc_MPI_Alloc_mem MPI_Alloc_mem
280 #define sc_MPI_Free_mem MPI_Free_mem
281 #define sc_MPI_Comm_set_attr MPI_Comm_set_attr
282 #define sc_MPI_Comm_get_attr MPI_Comm_get_attr
283 #define sc_MPI_Comm_delete_attr MPI_Comm_delete_attr
284 #define sc_MPI_Comm_create_keyval MPI_Comm_create_keyval
285 #define sc_MPI_Comm_dup MPI_Comm_dup
286 #define sc_MPI_Comm_create MPI_Comm_create
287 #define sc_MPI_Comm_split MPI_Comm_split
288 #define sc_MPI_Comm_free MPI_Comm_free
289 #define sc_MPI_Comm_size MPI_Comm_size
290 #define sc_MPI_Comm_rank MPI_Comm_rank
291 #define sc_MPI_Comm_compare MPI_Comm_compare
292 #define sc_MPI_Comm_group MPI_Comm_group
293 #define sc_MPI_Group_free MPI_Group_free
294 #define sc_MPI_Group_size MPI_Group_size
295 #define sc_MPI_Group_rank MPI_Group_rank
296 #define sc_MPI_Group_translate_ranks MPI_Group_translate_ranks
297 #define sc_MPI_Group_compare MPI_Group_compare
298 #define sc_MPI_Group_union MPI_Group_union
299 #define sc_MPI_Group_intersection MPI_Group_intersection
300 #define sc_MPI_Group_difference MPI_Group_difference
301 #define sc_MPI_Group_incl MPI_Group_incl
302 #define sc_MPI_Group_excl MPI_Group_excl
303 #define sc_MPI_Group_range_incl MPI_Group_range_incl
304 #define sc_MPI_Group_range_excl MPI_Group_range_excl
305 #define sc_MPI_Barrier MPI_Barrier
306 #define sc_MPI_Bcast MPI_Bcast
307 #define sc_MPI_Gather MPI_Gather
308 #define sc_MPI_Gatherv MPI_Gatherv
309 #define sc_MPI_Allgather MPI_Allgather
310 #define sc_MPI_Allgatherv MPI_Allgatherv
311 #define sc_MPI_Alltoall MPI_Alltoall
312 #define sc_MPI_Reduce MPI_Reduce
313 #define sc_MPI_Reduce_scatter_block MPI_Reduce_scatter_block
314 #define sc_MPI_Allreduce MPI_Allreduce
315 #define sc_MPI_Scan MPI_Scan
316 #define sc_MPI_Exscan MPI_Exscan
317 #define sc_MPI_Recv MPI_Recv
318 #define sc_MPI_Irecv MPI_Irecv
319 #define sc_MPI_Send MPI_Send
320 #define sc_MPI_Isend MPI_Isend
321 #define sc_MPI_Probe MPI_Probe
322 #define sc_MPI_Iprobe MPI_Iprobe
323 #define sc_MPI_Get_count MPI_Get_count
324 #define sc_MPI_Wtime MPI_Wtime
325 #define sc_MPI_Wait MPI_Wait
326 /* The MPI_Waitsome, MPI_Waitall and MPI_Testall functions are wrapped. */
327 #define sc_MPI_Type_size MPI_Type_size
328 #define sc_MPI_Pack MPI_Pack
329 #define sc_MPI_Unpack MPI_Unpack
330 #define sc_MPI_Pack_size MPI_Pack_size
331 #ifdef SC_HAVE_AINT_DIFF
332 /* MPI 3.0 function */
333 #define sc_MPI_Aint_diff MPI_Aint_diff
334 #else
335 /* Replacement by standard subtraction.
336  *
337  * MPI 2.0 supports MPI_Aint but does not support MPI_Aint_diff.
338  * In the MPI 2.0 standard document
339  * (https://www.mpi-forum.org/docs/mpi-2.0/mpi2-report.pdf) on page 283 is
340  * an example of calculating MPI_Aint displacements by standard subtraction.
341  * Therefore, we also use standard subtraction in the case MPI_Aint_diff is
342  * not available.
343  */
344 sc_MPI_Aint sc_MPI_Aint_diff (sc_MPI_Aint a, sc_MPI_Aint b);
345 #endif
346 
347 #else /* !SC_ENABLE_MPI */
348 #include <sc3_mpi_types.h>
349 
350 /* constants */
351 
352 #define sc_MPI_SUCCESS SC3_MPI_SUCCESS
353 #define sc_MPI_ERR_ARG SC3_MPI_ERR_ARG
354 #define sc_MPI_ERR_COUNT SC3_MPI_ERR_COUNT
355 #define sc_MPI_ERR_UNKNOWN SC3_MPI_ERR_UNKNOWN
356 #define sc_MPI_ERR_OTHER SC3_MPI_ERR_OTHER
357 #define sc_MPI_ERR_NO_MEM SC3_MPI_ERR_NO_MEM
358 #define sc_MPI_ERR_FILE SC3_MPI_ERR_FILE
359 #define sc_MPI_ERR_NOT_SAME SC3_MPI_ERR_NOT_SAME
360 #define sc_MPI_ERR_AMODE SC3_MPI_ERR_AMODE
362 #define sc_MPI_ERR_UNSUPPORTED_DATAREP SC3_MPI_ERR_UNSUPPORTED_DATAREP
364 #define sc_MPI_ERR_UNSUPPORTED_OPERATION SC3_MPI_ERR_UNSUPPORTED_OPERATION
366 #define sc_MPI_ERR_NO_SUCH_FILE SC3_MPI_ERR_NO_SUCH_FILE
367 #define sc_MPI_ERR_FILE_EXISTS SC3_MPI_ERR_FILE_EXISTS
368 #define sc_MPI_ERR_BAD_FILE SC3_MPI_ERR_BAD_FILE
369 #define sc_MPI_ERR_ACCESS SC3_MPI_ERR_ACCESS
370 #define sc_MPI_ERR_NO_SPACE SC3_MPI_ERR_NO_SPACE
371 #define sc_MPI_ERR_QUOTA SC3_MPI_ERR_QUOTA
372 #define sc_MPI_ERR_READ_ONLY SC3_MPI_ERR_READ_ONLY
373 #define sc_MPI_ERR_FILE_IN_USE SC3_MPI_ERR_FILE_IN_USE
374 #define sc_MPI_ERR_DUP_DATAREP SC3_MPI_ERR_DUP_DATAREP
375 #define sc_MPI_ERR_CONVERSION SC3_MPI_ERR_CONVERSION
376 #define sc_MPI_ERR_IO SC3_MPI_ERR_IO
377 #define sc_MPI_ERR_LASTCODE SC3_MPI_ERR_LASTCODE
380 #define sc_MPI_MAX_ERROR_STRING SC3_MPI_MAX_ERROR_STRING
381 
382 #define sc_MPI_COMM_NULL SC3_MPI_COMM_NULL
383 #define sc_MPI_COMM_WORLD SC3_MPI_COMM_WORLD
384 #define sc_MPI_COMM_SELF SC3_MPI_COMM_SELF
387 #define sc_MPI_GROUP_NULL ((sc_MPI_Group) 0x54000000) /* TODO change val */
389 #define sc_MPI_GROUP_EMPTY ((sc_MPI_Group) 0x54000001) /* TODO change val */
390 
392 #define sc_MPI_IDENT (1) /* TODO change val */
393 #define sc_MPI_CONGRUENT (2) /* TODO change val */
394 #define sc_MPI_SIMILAR (3) /* TODO change val */
395 #define sc_MPI_UNEQUAL (-1) /* TODO change val */
396 
397 #define sc_MPI_ANY_SOURCE (-2)
398 #define sc_MPI_ANY_TAG (-1)
399 #define sc_MPI_STATUS_IGNORE (sc_MPI_Status *) 1
400 #define sc_MPI_STATUSES_IGNORE (sc_MPI_Status *) 1
401 
402 #define sc_MPI_REQUEST_NULL ((sc_MPI_Request) 0x2c000000)
403 #define sc_MPI_DATATYPE_NULL SC3_MPI_DATATYPE_NULL
404 
405 #define sc_MPI_CHAR ((sc_MPI_Datatype) 0x4c000101)
406 #define sc_MPI_SIGNED_CHAR ((sc_MPI_Datatype) 0x4c000118)
407 #define sc_MPI_UNSIGNED_CHAR ((sc_MPI_Datatype) 0x4c000102)
408 #define sc_MPI_BYTE SC3_MPI_BYTE
409 #define sc_MPI_SHORT ((sc_MPI_Datatype) 0x4c000203)
410 #define sc_MPI_UNSIGNED_SHORT ((sc_MPI_Datatype) 0x4c000204)
411 #define sc_MPI_INT SC3_MPI_INT
412 #define sc_MPI_INT8_T ((sc_MPI_Datatype) 0x4c000205)
413 #define sc_MPI_2INT SC3_MPI_2INT
414 #define sc_MPI_UNSIGNED SC3_MPI_UNSIGNED
415 #define sc_MPI_LONG SC3_MPI_LONG
416 #define sc_MPI_UNSIGNED_LONG ((sc_MPI_Datatype) 0x4c000408)
417 #define sc_MPI_LONG_LONG_INT SC3_MPI_LONG_LONG
418 #define sc_MPI_UNSIGNED_LONG_LONG ((sc_MPI_Datatype) 0x4c000409)
419 #define sc_MPI_FLOAT SC3_MPI_FLOAT
420 #define sc_MPI_DOUBLE SC3_MPI_DOUBLE
421 #define sc_MPI_DOUBLE_INT SC3_MPI_DOUBLE_INT
422 #define sc_MPI_LONG_DOUBLE ((sc_MPI_Datatype) 0x4c000c0c)
423 #define sc_MPI_PACKED ((sc_MPI_Datatype) 0x4c001001)
424 #define sc_MPI_Aint sc3_MPI_Aint_t
425 
426 #define sc_MPI_OP_NULL SC3_MPI_OP_NULL
427 #define sc_MPI_MINLOC SC3_MPI_MINLOC
428 #define sc_MPI_MAXLOC SC3_MPI_MAXLOC
429 #define sc_MPI_LOR SC3_MPI_LOR
430 #define sc_MPI_LAND SC3_MPI_LAND
431 #define sc_MPI_LXOR SC3_MPI_LXOR
432 #define sc_MPI_BOR SC3_MPI_BOR
433 #define sc_MPI_BAND SC3_MPI_BAND
434 #define sc_MPI_BXOR SC3_MPI_BXOR
435 #define sc_MPI_REPLACE SC3_MPI_REPLACE
436 #define sc_MPI_PROD SC3_MPI_PROD
439 #define sc_MPI_MIN SC3_MPI_MIN
440 #define sc_MPI_MAX SC3_MPI_MAX
441 #define sc_MPI_SUM SC3_MPI_SUM
444 #define sc_MPI_UNDEFINED SC3_MPI_UNDEFINED
445 
446 /* types */
447 
448 typedef int sc_MPI_Group;
449 typedef int sc_MPI_Request;
456 typedef struct sc_MPI_Status
457 {
458  int count;
459  int cancelled;
461  int MPI_TAG;
462  int MPI_ERROR;
463 }
465 
466 /* MPI info arguments */
467 
468 #define sc_MPI_INFO_NULL NULL
470 /* These functions are valid and functional for a single process. */
471 
476 int sc_MPI_Init (int *argc, char ***argv);
477 
479 int sc_MPI_Finalize (void);
480 
485 int sc_MPI_Abort (sc_MPI_Comm mpicomm, int ecode)
486  __attribute__ ((noreturn));
487 
493  sc_MPI_Comm *dupcomm);
494 
499 
505 int sc_MPI_Type_size (sc_MPI_Datatype datatype, int *size);
506 
517 int sc_MPI_Pack (const void *inbuf, int incount,
518  sc_MPI_Datatype datatype, void *outbuf,
519  int outsize, int *position,
520  sc_MPI_Comm comm);
521 
532 int sc_MPI_Unpack (const void *inbuf, int insize,
533  int *position, void *outbuf, int outcount,
534  sc_MPI_Datatype datatype,
535  sc_MPI_Comm comm);
536 
545 int sc_MPI_Pack_size (int incount, sc_MPI_Datatype datatype,
546  sc_MPI_Comm comm, int *size);
547 
552 int sc_MPI_Comm_size (sc_MPI_Comm mpicomm, int *mpisize);
553 
558 int sc_MPI_Comm_rank (sc_MPI_Comm mpicomm, int *mpirank);
559 
564 int sc_MPI_Group_size (sc_MPI_Group mpigroup, int *size);
565 
570 int sc_MPI_Group_rank (sc_MPI_Group mpigroup, int *rank);
571 
576 
578 int sc_MPI_Bcast (void *, int, sc_MPI_Datatype, int,
579  sc_MPI_Comm);
580 
581 int sc_MPI_Gather (void *, int, sc_MPI_Datatype, void *, int,
583 int sc_MPI_Gatherv (void *, int, sc_MPI_Datatype, void *,
584  int *, int *, sc_MPI_Datatype, int,
585  sc_MPI_Comm);
586 
588 int sc_MPI_Allgather (void *, int, sc_MPI_Datatype, void *,
590 
592 int sc_MPI_Allgatherv (void *, int, sc_MPI_Datatype, void *,
593  int *, int *, sc_MPI_Datatype,
594  sc_MPI_Comm);
595 
597 int sc_MPI_Alltoall (void *, int, sc_MPI_Datatype, void *,
599 
601 int sc_MPI_Reduce (void *, void *, int, sc_MPI_Datatype,
602  sc_MPI_Op, int, sc_MPI_Comm);
603 
604 int sc_MPI_Reduce_scatter_block (void *, void *,
605  int, sc_MPI_Datatype,
607 
609 int sc_MPI_Allreduce (void *, void *, int, sc_MPI_Datatype,
611 
613 int sc_MPI_Scan (void *, void *, int, sc_MPI_Datatype,
615 
617 int sc_MPI_Exscan (void *, void *, int, sc_MPI_Datatype,
619 
620 /* Replacement by standard subtraction.
621  *
622  * MPI 2.0 supports MPI_Aint but does not support MPI_Aint_diff.
623  * In the MPI 2.0 standard document
624  * (https://www.mpi-forum.org/docs/mpi-2.0/mpi2-report.pdf) on page 283 is
625  * an example of calculating MPI_Aint displacements by standard subtraction.
626  * Therefore, we also use standard subtraction in the case MPI_Aint_diff is
627  * not available.
628  */
629 sc_MPI_Aint sc_MPI_Aint_diff (sc_MPI_Aint a, sc_MPI_Aint b);
630 
633 double sc_MPI_Wtime (void);
634 
639 
640 /* These functions will run but their results/actions are not defined. */
641 
642 int sc_MPI_Comm_create (sc_MPI_Comm, sc_MPI_Group,
643  sc_MPI_Comm *);
644 int sc_MPI_Comm_compare (sc_MPI_Comm, sc_MPI_Comm, int *);
645 int sc_MPI_Comm_group (sc_MPI_Comm, sc_MPI_Group *);
646 
647 int sc_MPI_Group_free (sc_MPI_Group *);
648 int sc_MPI_Group_translate_ranks (sc_MPI_Group, int, int *,
649  sc_MPI_Group, int *);
650 int sc_MPI_Group_compare (sc_MPI_Group, sc_MPI_Group, int *);
651 int sc_MPI_Group_union (sc_MPI_Group, sc_MPI_Group,
652  sc_MPI_Group *);
653 int sc_MPI_Group_intersection (sc_MPI_Group, sc_MPI_Group,
654  sc_MPI_Group *);
655 int sc_MPI_Group_difference (sc_MPI_Group, sc_MPI_Group,
656  sc_MPI_Group *);
657 int sc_MPI_Group_incl (sc_MPI_Group, int, int *,
658  sc_MPI_Group *);
659 int sc_MPI_Group_excl (sc_MPI_Group, int, int *,
660  sc_MPI_Group *);
661 int sc_MPI_Group_range_incl (sc_MPI_Group, int,
662  int ranges[][3], sc_MPI_Group *);
663 int sc_MPI_Group_range_excl (sc_MPI_Group, int,
664  int ranges[][3], sc_MPI_Group *);
665 
666 /* These functions will abort. */
667 
668 int sc_MPI_Recv (void *, int, sc_MPI_Datatype, int, int,
670 int sc_MPI_Irecv (void *, int, sc_MPI_Datatype, int, int,
672 int sc_MPI_Send (void *, int, sc_MPI_Datatype, int, int,
673  sc_MPI_Comm);
674 int sc_MPI_Isend (void *, int, sc_MPI_Datatype, int, int,
676 int sc_MPI_Probe (int, int, sc_MPI_Comm, sc_MPI_Status *);
677 int sc_MPI_Iprobe (int, int, sc_MPI_Comm, int *,
678  sc_MPI_Status *);
679 int sc_MPI_Get_count (sc_MPI_Status *, sc_MPI_Datatype,
680  int *);
681 
682 /* This function is only allowed to be called with NULL requests. */
683 
684 int sc_MPI_Wait (sc_MPI_Request *, sc_MPI_Status *);
685 
686 #endif /* !SC_ENABLE_MPI */
687 
688 /* Without SC_ENABLE_MPI, only allowed to be called with NULL requests. */
689 
690 int sc_MPI_Waitsome (int, sc_MPI_Request *,
691  int *, int *, sc_MPI_Status *);
692 int sc_MPI_Waitall (int, sc_MPI_Request *, sc_MPI_Status *);
693 int sc_MPI_Testall (int, sc_MPI_Request *, int *,
694  sc_MPI_Status *);
695 
696 /* This is based on configuration checks */
697 #if defined SC_ENABLE_MPI && defined SC_ENABLE_MPICOMMSHARED
698 #define sc_MPI_COMM_TYPE_SHARED MPI_COMM_TYPE_SHARED
699 #else
700 #define sc_MPI_COMM_TYPE_SHARED sc_MPI_UNDEFINED
701 #endif
702 
709  int split_type, int key,
710  sc_MPI_Info info,
711  sc_MPI_Comm *newcomm);
712 
713 #if defined SC_ENABLE_MPI && defined SC_ENABLE_MPITHREAD
714 
715 #define sc_MPI_THREAD_SINGLE MPI_THREAD_SINGLE
716 #define sc_MPI_THREAD_FUNNELED MPI_THREAD_FUNNELED
717 #define sc_MPI_THREAD_SERIALIZED MPI_THREAD_SERIALIZED
718 #define sc_MPI_THREAD_MULTIPLE MPI_THREAD_MULTIPLE
719 
720 #define sc_MPI_Init_thread MPI_Init_thread
721 
722 #else
723 
725 #define sc_MPI_THREAD_SINGLE 0
726 #define sc_MPI_THREAD_FUNNELED 1
727 #define sc_MPI_THREAD_SERIALIZED 2
728 #define sc_MPI_THREAD_MULTIPLE 3
731 int sc_MPI_Init_thread (int *argc, char ***argv,
732  int required, int *provided);
733 
734 #endif /* !(SC_ENABLE_MPI && SC_ENABLE_MPITHREAD) */
735 
736 #ifdef SC_ENABLE_MPIIO
737 
738 /* file access modes */
739 
740 #define sc_MPI_MODE_RDONLY MPI_MODE_RDONLY
741 #define sc_MPI_MODE_RDWR MPI_MODE_RDWR
742 #define sc_MPI_MODE_WRONLY MPI_MODE_WRONLY
743 #define sc_MPI_MODE_CREATE MPI_MODE_CREATE
744 #define sc_MPI_MODE_EXCL MPI_MODE_EXCL
745 #define sc_MPI_MODE_DELETE_ON_CLOSE MPI_MODE_DELETE_ON_CLOSE
746 #define sc_MPI_MODE_UNIQUE_OPEN MPI_MODE_UNIQUE_OPEN
747 #define sc_MPI_MODE_SEQUENTIAL MPI_MODE_SEQUENTIAL
748 #define sc_MPI_MODE_APPEND MPI_MODE_APPEND
749 
750 /* file seek parameters */
751 
752 #define sc_MPI_SEEK_SET MPI_SEEK_SET
753 #define sc_MPI_SEEK_CUR MPI_SEEK_CUR
754 #define sc_MPI_SEEK_END MPI_SEEK_END
755 
756 /* MPI I/O related types and functions */
757 
758 #define sc_MPI_Offset MPI_Offset
759 
760 #define sc_MPI_File MPI_File
761 #define sc_MPI_FILE_NULL MPI_FILE_NULL
762 
763 #define sc_MPI_File_open MPI_File_open
764 #define sc_MPI_File_close MPI_File_close
765 
766 #define sc_MPI_File_get_view MPI_File_get_view
767 #define sc_MPI_File_set_view MPI_File_set_view
768 
769 #define sc_MPI_File_write_all MPI_File_write_all
770 #define sc_MPI_File_read_all MPI_File_read_all
771 
772 #define sc_MPI_File_write_at_all MPI_File_write_at_all
773 #define sc_MPI_File_read_at_all MPI_File_read_at_all
774 
775 #define sc_MPI_File_get_size MPI_File_get_size
776 #define sc_MPI_File_set_size MPI_File_set_size
777 
778 #else
779 
780 typedef long sc_MPI_Offset;
786 {
788  const char *filename;
789  FILE *file;
790  int mpisize;
791  int mpirank;
792 };
793 
796 
797 #define sc_MPI_FILE_NULL NULL
799 #endif /* !SC_ENABLE_MPIIO */
800 
813 int sc_MPI_Error_class (int errorcode, int *errorclass);
814 
822 int sc_MPI_Error_string (int errorcode, char *string,
823  int *resultlen);
824 
830 
846 void sc_mpi_comm_attach_node_comms (sc_MPI_Comm comm,
847  int processes_per_node);
848 
857 void sc_mpi_comm_detach_node_comms (sc_MPI_Comm comm);
858 
866 void sc_mpi_comm_get_node_comms (sc_MPI_Comm comm,
867  sc_MPI_Comm * intranode,
868  sc_MPI_Comm * internode);
869 
876 int sc_mpi_comm_get_and_attach (sc_MPI_Comm comm);
877 
880 SC_EXTERN_C_END;
881 
882 #endif /* !SC_MPI_H */
We provide MPI replacement data types for configuring without MPI.
enum sc3_MPI_Op sc3_MPI_Op_t
We wrap the MPI operation types we use.
struct sc3_MPI_Info * sc3_MPI_Info_t
Wrapped MPI info object.
Definition: sc3_mpi_types.h:159
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
#define sc_MPI_ERR_NO_SUCH_FILE
Emulate SC_MPI_ERR_NO_SUCH_FILE.
Definition: sc_mpi.h:366
int sc_MPI_Comm_free(sc_MPI_Comm *freecomm)
Free a previously created MPI communicator.
int sc_MPI_Error_class(int errorcode, int *errorclass)
Turn an MPI error code into its error class.
#define sc_MPI_ERR_LASTCODE
Emulate SC_MPI_ERR_LASTCODE.
Definition: sc_mpi.h:377
size_t sc_mpi_sizeof(sc_MPI_Datatype t)
Return the size of MPI datatypes.
#define sc_MPI_ERR_CONVERSION
Emulate SC_MPI_ERR_CONVERSION.
Definition: sc_mpi.h:375
int sc_MPI_Group_size(sc_MPI_Group mpigroup, int *size)
Query size of an MPI group.
#define sc_MPI_ERR_BAD_FILE
Emulate SC_MPI_ERR_BAD_FILE.
Definition: sc_mpi.h:368
int sc_MPI_Unpack(const void *inbuf, int insize, int *position, void *outbuf, int outcount, sc_MPI_Datatype datatype, sc_MPI_Comm comm)
Unpack contiguous memory into several instances of the same datatype.
int sc_MPI_Allreduce(void *, void *, int, sc_MPI_Datatype, sc_MPI_Op, sc_MPI_Comm)
Execute the MPI_Allreduce algorithm.
#define sc_MPI_ERR_FILE
Emulate SC_MPI_ERR_FILE.
Definition: sc_mpi.h:358
sc3_MPI_Datatype_t sc_MPI_Datatype
Emulate MPI datatypes.
Definition: sc_mpi.h:452
int sc_MPI_Reduce(void *, void *, int, sc_MPI_Datatype, sc_MPI_Op, int, sc_MPI_Comm)
Execute the MPI_Reduce algorithm.
#define sc_MPI_ERR_READ_ONLY
Emulate SC_MPI_ERR_READ_ONLY.
Definition: sc_mpi.h:372
int sc_MPI_Bcast(void *, int, sc_MPI_Datatype, int, sc_MPI_Comm)
Execute the MPI_Bcast algorithm.
int sc_MPI_Type_size(sc_MPI_Datatype datatype, int *size)
Return size of an MPI datatype.
struct sc_no_mpiio_file * sc_MPI_File
Replacement object for an MPI file.
Definition: sc_mpi.h:795
int sc_MPI_Exscan(void *, void *, int, sc_MPI_Datatype, sc_MPI_Op, sc_MPI_Comm)
Execute the MPI_Exscan algorithm.
#define sc_MPI_ERR_DUP_DATAREP
Emulate SC_MPI_ERR_DUP_DATAREP.
Definition: sc_mpi.h:374
int sc_MPI_Alltoall(void *, int, sc_MPI_Datatype, void *, int, sc_MPI_Datatype, sc_MPI_Comm)
Execute the MPI_Alltoall algorithm.
int sc_MPI_Finalize(void)
MPI finalization.
#define sc_MPI_ERR_UNSUPPORTED_DATAREP
Emulate SC_MPI_ERR_UNSUPPORTED_DATAREP.
Definition: sc_mpi.h:362
int sc_mpi_is_shared(void)
Return whether MPI supports type split and shared windows.
#define sc_MPI_ERR_QUOTA
Emulate SC_MPI_ERR_QUOTA.
Definition: sc_mpi.h:371
int sc_MPI_Group_rank(sc_MPI_Group mpigroup, int *rank)
Query rank of an MPI process within a group.
sc_tag_t
Enumerate all MPI tags used internally to the sc library.
Definition: sc_mpi.h:89
@ SC_TAG_AG_ALLTOALL
Used in MPI alltoall replacement.
Definition: sc_mpi.h:91
@ SC_TAG_REDUCE
Used in MPI reduce replacement.
Definition: sc_mpi.h:108
@ SC_TAG_AG_RECURSIVE_C
Internal tag; do not use.
Definition: sc_mpi.h:94
@ SC_TAG_LAST
End marker of tag enumeration.
Definition: sc_mpi.h:111
@ SC_TAG_NOTIFY_RANGES
Internal tag to sc_notify.
Definition: sc_mpi.h:101
@ SC_TAG_PSORT_LO
Internal tag to sc_psort.
Definition: sc_mpi.h:109
@ SC_TAG_AG_RECURSIVE_A
Internal tag; do not use.
Definition: sc_mpi.h:92
@ SC_TAG_NOTIFY_CENSUSV
Internal tag to sc_notify.
Definition: sc_mpi.h:96
@ SC_TAG_NOTIFY_WRAPPERV
Internal tag to sc_notify.
Definition: sc_mpi.h:100
@ SC_TAG_NOTIFY_RECURSIVE
Internal tag to sc_notify.
Definition: sc_mpi.h:105
@ SC_TAG_NOTIFY_NBXV
Internal tag to sc_notify.
Definition: sc_mpi.h:98
@ SC_TAG_NOTIFY_WRAPPER
Internal tag to sc_notify.
Definition: sc_mpi.h:99
@ SC_TAG_NOTIFY_NBX
Internal tag to sc_notify.
Definition: sc_mpi.h:97
@ SC_TAG_NOTIFY_CENSUS
Internal tag to sc_notify.
Definition: sc_mpi.h:95
@ SC_TAG_NOTIFY_SUPER_EXTRA
Internal tag to sc_notify.
Definition: sc_mpi.h:104
@ SC_TAG_NOTIFY_SUPER_TRUE
Internal tag to sc_notify.
Definition: sc_mpi.h:103
@ SC_TAG_FIRST
Anything really.
Definition: sc_mpi.h:90
@ SC_TAG_NOTIFY_NARY
Internal tag to sc_notify.
Definition: sc_mpi.h:107
@ SC_TAG_AG_RECURSIVE_B
Internal tag; do not use.
Definition: sc_mpi.h:93
@ SC_TAG_NOTIFY_PAYLOAD
Internal tag to sc_notify.
Definition: sc_mpi.h:102
@ SC_TAG_PSORT_HI
Internal tag to sc_psort.
Definition: sc_mpi.h:110
int sc_MPI_Group
Emulate an MPI group.
Definition: sc_mpi.h:448
int sc_MPI_Barrier(sc_MPI_Comm mpicomm)
Execute a parallel barrier.
sc3_MPI_Comm_t sc_MPI_Comm
Emulate an MPI communicator.
Definition: sc_mpi.h:450
int sc_MPI_Abort(sc_MPI_Comm mpicomm, int ecode)
Abort an MPI program.
#define sc_MPI_ERR_FILE_IN_USE
Emulate SC_MPI_ERR_FILE_IN_USE.
Definition: sc_mpi.h:373
int sc_MPI_Comm_rank(sc_MPI_Comm mpicomm, int *mpirank)
Query rank of an MPI process within a communicator.
double sc_MPI_Wtime(void)
Execute the MPI_Wtime function.
int sc_MPI_Allgatherv(void *, int, sc_MPI_Datatype, void *, int *, int *, sc_MPI_Datatype, sc_MPI_Comm)
Execute the MPI_Allgatherv algorithm.
sc3_MPI_Info_t sc_MPI_Info
Emulate an MPI Info object.
Definition: sc_mpi.h:451
#define sc_MPI_ERR_AMODE
Emulate SC_MPI_ERR_AMODE .
Definition: sc_mpi.h:360
#define sc_MPI_ERR_IO
Emulate SC_MPI_ERR_IO.
Definition: sc_mpi.h:376
int sc_MPI_Allgather(void *, int, sc_MPI_Datatype, void *, int, sc_MPI_Datatype, sc_MPI_Comm)
Execute the MPI_Allgather algorithm.
int sc_MPI_Init(int *argc, char ***argv)
MPI initialization.
#define sc_MPI_ERR_FILE_EXISTS
Emulate SC_MPI_ERR_FILE_EXISTS.
Definition: sc_mpi.h:367
int sc_MPI_Request
Emulate an MPI request.
Definition: sc_mpi.h:449
int sc_MPI_Scan(void *, void *, int, sc_MPI_Datatype, sc_MPI_Op, sc_MPI_Comm)
Execute the MPI_Scan algorithm.
int sc_MPI_Pack(const void *inbuf, int incount, sc_MPI_Datatype datatype, void *outbuf, int outsize, int *position, sc_MPI_Comm comm)
Pack several instances of the same datatype into contiguous memory.
#define sc_MPI_ERR_ACCESS
Emulate SC_MPI_ERR_ACCESS.
Definition: sc_mpi.h:369
int sc_mpi_is_enabled(void)
Return whether MPI is configured.
long sc_MPI_Offset
Emulate the MPI offset type.
Definition: sc_mpi.h:780
int sc_MPI_Pack_size(int incount, sc_MPI_Datatype datatype, sc_MPI_Comm comm, int *size)
Determine space needed to pack several instances of the same datatype.
sc3_MPI_Op_t sc_MPI_Op
Emulate MPI operations.
Definition: sc_mpi.h:453
#define sc_MPI_ERR_NOT_SAME
Emulate SC_MPI_ERR_NOT_SAME.
Definition: sc_mpi.h:359
int sc_MPI_Comm_split(sc_MPI_Comm, int, int, sc_MPI_Comm *)
Return the input communicator in lieu of splitting.
struct sc_MPI_Status sc_MPI_Status
Replacement of MPI_Status for non-MPI configuration.
int sc_MPI_Comm_size(sc_MPI_Comm mpicomm, int *mpisize)
Query size of an MPI communicator.
int sc_MPI_Comm_split_type(sc_MPI_Comm mpicomm, int split_type, int key, sc_MPI_Info info, sc_MPI_Comm *newcomm)
Wrapper to split an MPI communicator by shared node type.
#define sc_MPI_ERR_UNSUPPORTED_OPERATION
Emulate SC_MPI_ERR_UNSUPPORTED_OPERATION.
Definition: sc_mpi.h:364
#define sc_MPI_ERR_NO_SPACE
Emulate SC_MPI_ERR_NO_SPACE.
Definition: sc_mpi.h:370
int sc_MPI_Error_string(int errorcode, char *string, int *resultlen)
Turn MPI error code into a string.
int sc_MPI_Comm_dup(sc_MPI_Comm mpicomm, sc_MPI_Comm *dupcomm)
Duplicate an MPI communicator.
Replacement of MPI_Status for non-MPI configuration.
Definition: sc_mpi.h:457
int MPI_ERROR
Error occurred.
Definition: sc_mpi.h:462
int MPI_TAG
Tag of the message.
Definition: sc_mpi.h:461
int cancelled
Cancellation occurred.
Definition: sc_mpi.h:459
int count
Bytes sent/received.
Definition: sc_mpi.h:458
int MPI_SOURCE
Rank of the source.
Definition: sc_mpi.h:460
Replacement structure for MPI_File.
Definition: sc_mpi.h:786
FILE * file
Underlying file object.
Definition: sc_mpi.h:789
const char * filename
Name of the file.
Definition: sc_mpi.h:788
int mpirank
Rank of this process.
Definition: sc_mpi.h:791
int mpisize
Ranks in communicator.
Definition: sc_mpi.h:790
sc_MPI_Comm mpicomm
The MPI communicator.
Definition: sc_mpi.h:787