libsc  2.8.3.341-30a7-dirty
The SC library provides support for parallel scientific applications.
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 
78 typedef enum
79 {
80  SC_TAG_FIRST = 's' + 'c',
101  SC_TAG_LAST
102 }
103 sc_tag_t;
104 
105 #ifdef SC_ENABLE_MPI
106 
107 /* constants */
108 #define sc_MPI_SUCCESS MPI_SUCCESS
109 #define sc_MPI_ERR_ARG MPI_ERR_ARG
110 #define sc_MPI_ERR_UNKNOWN MPI_ERR_UNKNOWN
111 #define sc_MPI_ERR_OTHER MPI_ERR_OTHER
112 #define sc_MPI_ERR_NO_MEM MPI_ERR_NO_MEM
113 #define sc_MPI_MAX_ERROR_STRING MPI_MAX_ERROR_STRING
114 
115 #ifdef SC_ENABLE_MPIIO
116 
117 #define sc_MPI_ERR_FILE MPI_ERR_FILE
118 #define sc_MPI_ERR_NOT_SAME MPI_ERR_NOT_SAME
119 #define sc_MPI_ERR_AMODE MPI_ERR_AMODE
120 #define sc_MPI_ERR_UNSUPPORTED_DATAREP MPI_ERR_UNSUPPORTED_DATAREP
121 #define sc_MPI_ERR_UNSUPPORTED_OPERATION MPI_ERR_UNSUPPORTED_OPERATION
122 #define sc_MPI_ERR_NO_SUCH_FILE MPI_ERR_NO_SUCH_FILE
123 #define sc_MPI_ERR_FILE_EXISTS MPI_ERR_FILE_EXISTS
124 #define sc_MPI_ERR_BAD_FILE MPI_ERR_BAD_FILE
125 #define sc_MPI_ERR_ACCESS MPI_ERR_ACCESS
126 #define sc_MPI_ERR_NO_SPACE MPI_ERR_NO_SPACE
127 #define sc_MPI_ERR_QUOTA MPI_ERR_QUOTA
128 #define sc_MPI_ERR_READ_ONLY MPI_ERR_READ_ONLY
129 #define sc_MPI_ERR_FILE_IN_USE MPI_ERR_FILE_IN_USE
130 #define sc_MPI_ERR_DUP_DATAREP MPI_ERR_DUP_DATAREP
131 #define sc_MPI_ERR_CONVERSION MPI_ERR_CONVERSION
132 #define sc_MPI_ERR_IO MPI_ERR_IO
133 
134 #define sc_MPI_ERR_LASTCODE MPI_ERR_LASTCODE
135 
136 #else /* !SC_ENABLE_MPIIO */
137 
138 typedef enum sc_MPI_IO_Errorcode
139 {
140  /* only MPI I/O error classes */
141  sc_MPI_ERR_FILE = MPI_ERR_LASTCODE,
156  sc_MPI_ERR_COUNT,
159 }
160 sc_MPI_IO_Errorcode_t;
161 
162 #endif /* !SC_ENABLE_MPIIO */
163 
164 #define sc_MPI_COMM_NULL MPI_COMM_NULL
165 #define sc_MPI_COMM_WORLD MPI_COMM_WORLD
166 #define sc_MPI_COMM_SELF MPI_COMM_SELF
167 #define sc_MPI_COMM_TYPE_SHARED MPI_COMM_TYPE_SHARED
168 
169 #define sc_MPI_GROUP_NULL MPI_GROUP_NULL
170 #define sc_MPI_GROUP_EMPTY MPI_GROUP_EMPTY
171 
172 #define sc_MPI_IDENT MPI_IDENT
173 #define sc_MPI_CONGRUENT MPI_CONGRUENT
174 #define sc_MPI_SIMILAR MPI_SIMILAR
175 #define sc_MPI_UNEQUAL MPI_UNEQUAL
176 
177 #define sc_MPI_ANY_SOURCE MPI_ANY_SOURCE
178 #define sc_MPI_ANY_TAG MPI_ANY_TAG
179 #define sc_MPI_STATUS_IGNORE MPI_STATUS_IGNORE
180 #define sc_MPI_STATUSES_IGNORE MPI_STATUSES_IGNORE
181 
182 #define sc_MPI_REQUEST_NULL MPI_REQUEST_NULL
183 #define sc_MPI_INFO_NULL MPI_INFO_NULL
184 
185 #define sc_MPI_DATATYPE_NULL MPI_DATATYPE_NULL
186 #define sc_MPI_CHAR MPI_CHAR
187 #define sc_MPI_SIGNED_CHAR MPI_SIGNED_CHAR
188 #define sc_MPI_UNSIGNED_CHAR MPI_UNSIGNED_CHAR
189 #define sc_MPI_BYTE MPI_BYTE
190 #define sc_MPI_SHORT MPI_SHORT
191 #define sc_MPI_UNSIGNED_SHORT MPI_UNSIGNED_SHORT
192 #define sc_MPI_INT MPI_INT
193 #define sc_MPI_2INT MPI_2INT
194 #define sc_MPI_UNSIGNED MPI_UNSIGNED
195 #define sc_MPI_LONG MPI_LONG
196 #define sc_MPI_UNSIGNED_LONG MPI_UNSIGNED_LONG
197 #define sc_MPI_LONG_LONG_INT MPI_LONG_LONG_INT
198 #define sc_MPI_UNSIGNED_LONG_LONG MPI_UNSIGNED_LONG_LONG
199 #define sc_MPI_FLOAT MPI_FLOAT
200 #define sc_MPI_DOUBLE MPI_DOUBLE
201 #define sc_MPI_LONG_DOUBLE MPI_LONG_DOUBLE
202 
203 #define sc_MPI_OP_NULL MPI_OP_NULL
204 #define sc_MPI_MAX MPI_MAX
205 #define sc_MPI_MIN MPI_MIN
206 #define sc_MPI_LAND MPI_LAND
207 #define sc_MPI_BAND MPI_BAND
208 #define sc_MPI_LOR MPI_LOR
209 #define sc_MPI_BOR MPI_BOR
210 #define sc_MPI_LXOR MPI_LXOR
211 #define sc_MPI_BXOR MPI_BXOR
212 #define sc_MPI_MINLOC MPI_MINLOC
213 #define sc_MPI_MAXLOC MPI_MAXLOC
214 #define sc_MPI_REPLACE MPI_REPLACE
215 #define sc_MPI_SUM MPI_SUM
216 #define sc_MPI_PROD MPI_PROD
217 
218 #define sc_MPI_UNDEFINED MPI_UNDEFINED
219 
220 #define sc_MPI_KEYVAL_INVALID MPI_KEYVAL_INVALID
221 
222 /* types */
223 
224 #define sc_MPI_Comm MPI_Comm
225 #define sc_MPI_Group MPI_Group
226 #define sc_MPI_Datatype MPI_Datatype
227 #define sc_MPI_Op MPI_Op
228 #define sc_MPI_Request MPI_Request
229 #define sc_MPI_Status MPI_Status
230 #define sc_MPI_Info MPI_Info
231 
232 /* MPI info arguments */
233 
234 #define sc_MPI_INFO_NULL MPI_INFO_NULL
235 
236 /* MPI functions */
237 
238 #define sc_MPI_Init MPI_Init
239 /* sc_MPI_Init_thread is handled below */
240 #define sc_MPI_Finalize MPI_Finalize
241 #define sc_MPI_Abort MPI_Abort
242 #define sc_MPI_Alloc_mem MPI_Alloc_mem
243 #define sc_MPI_Free_mem MPI_Free_mem
244 #define sc_MPI_Comm_set_attr MPI_Comm_set_attr
245 #define sc_MPI_Comm_get_attr MPI_Comm_get_attr
246 #define sc_MPI_Comm_delete_attr MPI_Comm_delete_attr
247 #define sc_MPI_Comm_create_keyval MPI_Comm_create_keyval
248 #define sc_MPI_Comm_dup MPI_Comm_dup
249 #define sc_MPI_Comm_create MPI_Comm_create
250 #define sc_MPI_Comm_split MPI_Comm_split
251 #define sc_MPI_Comm_split_type MPI_Comm_split_type
252 #define sc_MPI_Comm_free MPI_Comm_free
253 #define sc_MPI_Comm_size MPI_Comm_size
254 #define sc_MPI_Comm_rank MPI_Comm_rank
255 #define sc_MPI_Comm_compare MPI_Comm_compare
256 #define sc_MPI_Comm_group MPI_Comm_group
257 #define sc_MPI_Group_free MPI_Group_free
258 #define sc_MPI_Group_size MPI_Group_size
259 #define sc_MPI_Group_rank MPI_Group_rank
260 #define sc_MPI_Group_translate_ranks MPI_Group_translate_ranks
261 #define sc_MPI_Group_compare MPI_Group_compare
262 #define sc_MPI_Group_union MPI_Group_union
263 #define sc_MPI_Group_intersection MPI_Group_intersection
264 #define sc_MPI_Group_difference MPI_Group_difference
265 #define sc_MPI_Group_incl MPI_Group_incl
266 #define sc_MPI_Group_excl MPI_Group_excl
267 #define sc_MPI_Group_range_incl MPI_Group_range_incl
268 #define sc_MPI_Group_range_excl MPI_Group_range_excl
269 #define sc_MPI_Barrier MPI_Barrier
270 #define sc_MPI_Bcast MPI_Bcast
271 #define sc_MPI_Gather MPI_Gather
272 #define sc_MPI_Gatherv MPI_Gatherv
273 #define sc_MPI_Allgather MPI_Allgather
274 #define sc_MPI_Allgatherv MPI_Allgatherv
275 #define sc_MPI_Alltoall MPI_Alltoall
276 #define sc_MPI_Reduce MPI_Reduce
277 #define sc_MPI_Reduce_scatter_block MPI_Reduce_scatter_block
278 #define sc_MPI_Allreduce MPI_Allreduce
279 #define sc_MPI_Scan MPI_Scan
280 #define sc_MPI_Exscan MPI_Exscan
281 #define sc_MPI_Recv MPI_Recv
282 #define sc_MPI_Irecv MPI_Irecv
283 #define sc_MPI_Send MPI_Send
284 #define sc_MPI_Isend MPI_Isend
285 #define sc_MPI_Probe MPI_Probe
286 #define sc_MPI_Iprobe MPI_Iprobe
287 #define sc_MPI_Get_count MPI_Get_count
288 #define sc_MPI_Wtime MPI_Wtime
289 #define sc_MPI_Wait MPI_Wait
290 /* The MPI_Waitsome, MPI_Waitall and MPI_Testall functions are wrapped. */
291 #define sc_MPI_Type_size MPI_Type_size
292 
293 #else /* !SC_ENABLE_MPI */
294 #include <sc3_mpi_types.h>
295 
296 /* constants */
297 
298 #define sc_MPI_SUCCESS SC3_MPI_SUCCESS
299 #define sc_MPI_ERR_ARG SC3_MPI_ERR_ARG
300 #define sc_MPI_ERR_UNKNOWN SC3_MPI_ERR_UNKNOWN
301 #define sc_MPI_ERR_OTHER SC3_MPI_ERR_OTHER
302 #define sc_MPI_ERR_NO_MEM SC3_MPI_ERR_NO_MEM
303 #define sc_MPI_ERR_FILE SC3_MPI_ERR_FILE
304 #define sc_MPI_ERR_NOT_SAME SC3_MPI_ERR_NOT_SAME
305 #define sc_MPI_ERR_AMODE SC3_MPI_ERR_AMODE
307 #define sc_MPI_ERR_UNSUPPORTED_DATAREP SC3_MPI_ERR_UNSUPPORTED_DATAREP
309 #define sc_MPI_ERR_UNSUPPORTED_OPERATION SC3_MPI_ERR_UNSUPPORTED_OPERATION
311 #define sc_MPI_ERR_NO_SUCH_FILE SC3_MPI_ERR_NO_SUCH_FILE
312 #define sc_MPI_ERR_FILE_EXISTS SC3_MPI_ERR_FILE_EXISTS
313 #define sc_MPI_ERR_BAD_FILE SC3_MPI_ERR_BAD_FILE
314 #define sc_MPI_ERR_ACCESS SC3_MPI_ERR_ACCESS
315 #define sc_MPI_ERR_NO_SPACE SC3_MPI_ERR_NO_SPACE
316 #define sc_MPI_ERR_QUOTA SC3_MPI_ERR_QUOTA
317 #define sc_MPI_ERR_READ_ONLY SC3_MPI_ERR_READ_ONLY
318 #define sc_MPI_ERR_FILE_IN_USE SC3_MPI_ERR_FILE_IN_USE
319 #define sc_MPI_ERR_DUP_DATAREP SC3_MPI_ERR_DUP_DATAREP
320 #define sc_MPI_ERR_CONVERSION SC3_MPI_ERR_CONVERSION
321 #define sc_MPI_ERR_IO SC3_MPI_ERR_IO
322 #define sc_MPI_ERR_LASTCODE SC3_MPI_ERR_LASTCODE
325 #define sc_MPI_MAX_ERROR_STRING SC3_MPI_MAX_ERROR_STRING
326 
327 #define sc_MPI_COMM_NULL SC3_MPI_COMM_NULL
328 #define sc_MPI_COMM_WORLD SC3_MPI_COMM_WORLD
329 #define sc_MPI_COMM_SELF SC3_MPI_COMM_SELF
332 #define sc_MPI_GROUP_NULL ((sc_MPI_Group) 0x54000000) /* TODO change val */
334 #define sc_MPI_GROUP_EMPTY ((sc_MPI_Group) 0x54000001) /* TODO change val */
335 
337 #define sc_MPI_IDENT (1) /* TODO change val */
338 #define sc_MPI_CONGRUENT (2) /* TODO change val */
339 #define sc_MPI_SIMILAR (3) /* TODO change val */
340 #define sc_MPI_UNEQUAL (-1) /* TODO change val */
341 
342 #define sc_MPI_ANY_SOURCE (-2)
343 #define sc_MPI_ANY_TAG (-1)
344 #define sc_MPI_STATUS_IGNORE (sc_MPI_Status *) 1
345 #define sc_MPI_STATUSES_IGNORE (sc_MPI_Status *) 1
346 
347 #define sc_MPI_REQUEST_NULL ((sc_MPI_Request) 0x2c000000)
348 #define sc_MPI_DATATYPE_NULL SC3_MPI_DATATYPE_NULL
349 
350 #define sc_MPI_CHAR ((sc_MPI_Datatype) 0x4c000101)
351 #define sc_MPI_SIGNED_CHAR ((sc_MPI_Datatype) 0x4c000118)
352 #define sc_MPI_UNSIGNED_CHAR ((sc_MPI_Datatype) 0x4c000102)
353 #define sc_MPI_BYTE SC3_MPI_BYTE
354 #define sc_MPI_SHORT ((sc_MPI_Datatype) 0x4c000203)
355 #define sc_MPI_UNSIGNED_SHORT ((sc_MPI_Datatype) 0x4c000204)
356 #define sc_MPI_INT SC3_MPI_INT
357 #define sc_MPI_2INT SC3_MPI_2INT
358 #define sc_MPI_UNSIGNED SC3_MPI_UNSIGNED
359 #define sc_MPI_LONG SC3_MPI_LONG
360 #define sc_MPI_UNSIGNED_LONG ((sc_MPI_Datatype) 0x4c000408)
361 #define sc_MPI_LONG_LONG_INT SC3_MPI_LONG_LONG
362 #define sc_MPI_UNSIGNED_LONG_LONG ((sc_MPI_Datatype) 0x4c000409)
363 #define sc_MPI_FLOAT SC3_MPI_FLOAT
364 #define sc_MPI_DOUBLE SC3_MPI_DOUBLE
365 #define sc_MPI_DOUBLE_INT SC3_MPI_DOUBLE_INT
366 #define sc_MPI_LONG_DOUBLE ((sc_MPI_Datatype) 0x4c000c0c)
367 
368 #define sc_MPI_OP_NULL SC3_MPI_OP_NULL
369 #define sc_MPI_MINLOC SC3_MPI_MINLOC
370 #define sc_MPI_MAXLOC SC3_MPI_MAXLOC
371 #define sc_MPI_LOR SC3_MPI_LOR
372 #define sc_MPI_LAND SC3_MPI_LAND
373 #define sc_MPI_LXOR SC3_MPI_LXOR
374 #define sc_MPI_BOR SC3_MPI_BOR
375 #define sc_MPI_BAND SC3_MPI_BAND
376 #define sc_MPI_BXOR SC3_MPI_BXOR
377 #define sc_MPI_REPLACE SC3_MPI_REPLACE
378 #define sc_MPI_PROD SC3_MPI_PROD
381 #define sc_MPI_MIN SC3_MPI_MIN
382 #define sc_MPI_MAX SC3_MPI_MAX
383 #define sc_MPI_SUM SC3_MPI_SUM
386 #define sc_MPI_UNDEFINED SC3_MPI_UNDEFINED
387 
388 /* types */
389 
390 typedef int sc_MPI_Group;
391 typedef int sc_MPI_Request;
398 typedef struct sc_MPI_Status
399 {
400  int count;
401  int cancelled;
403  int MPI_TAG;
404  int MPI_ERROR;
405 }
407 
408 /* MPI info arguments */
409 
410 #define sc_MPI_INFO_NULL NULL
412 /* These functions are valid and functional for a single process. */
413 
418 int sc_MPI_Init (int *argc, char ***argv);
419 
421 int sc_MPI_Finalize (void);
422 
427 int sc_MPI_Abort (sc_MPI_Comm mpicomm, int ecode)
428  __attribute__ ((noreturn));
429 
435  sc_MPI_Comm *dupcomm);
436 
441 
447 int sc_MPI_Type_size (sc_MPI_Datatype datatype, int *size);
448 
453 int sc_MPI_Comm_size (sc_MPI_Comm mpicomm, int *mpisize);
454 
459 int sc_MPI_Comm_rank (sc_MPI_Comm mpicomm, int *mpirank);
460 
465 int sc_MPI_Group_size (sc_MPI_Group mpigroup, int *size);
466 
471 int sc_MPI_Group_rank (sc_MPI_Group mpigroup, int *rank);
472 
477 
479 int sc_MPI_Bcast (void *, int, sc_MPI_Datatype, int,
480  sc_MPI_Comm);
481 
482 int sc_MPI_Gather (void *, int, sc_MPI_Datatype, void *, int,
484 int sc_MPI_Gatherv (void *, int, sc_MPI_Datatype, void *,
485  int *, int *, sc_MPI_Datatype, int,
486  sc_MPI_Comm);
487 
489 int sc_MPI_Allgather (void *, int, sc_MPI_Datatype, void *,
491 
493 int sc_MPI_Allgatherv (void *, int, sc_MPI_Datatype, void *,
494  int *, int *, sc_MPI_Datatype,
495  sc_MPI_Comm);
496 
498 int sc_MPI_Alltoall (void *, int, sc_MPI_Datatype, void *,
500 
502 int sc_MPI_Reduce (void *, void *, int, sc_MPI_Datatype,
503  sc_MPI_Op, int, sc_MPI_Comm);
504 
505 int sc_MPI_Reduce_scatter_block (void *, void *,
506  int, sc_MPI_Datatype,
508 
510 int sc_MPI_Allreduce (void *, void *, int, sc_MPI_Datatype,
512 
514 int sc_MPI_Scan (void *, void *, int, sc_MPI_Datatype,
516 
518 int sc_MPI_Exscan (void *, void *, int, sc_MPI_Datatype,
520 
523 double sc_MPI_Wtime (void);
524 
525 /* These functions will run but their results/actions are not defined. */
526 
527 int sc_MPI_Comm_create (sc_MPI_Comm, sc_MPI_Group,
528  sc_MPI_Comm *);
529 int sc_MPI_Comm_split (sc_MPI_Comm, int, int, sc_MPI_Comm *);
530 int sc_MPI_Comm_compare (sc_MPI_Comm, sc_MPI_Comm, int *);
531 int sc_MPI_Comm_group (sc_MPI_Comm, sc_MPI_Group *);
532 
533 int sc_MPI_Group_free (sc_MPI_Group *);
534 int sc_MPI_Group_translate_ranks (sc_MPI_Group, int, int *,
535  sc_MPI_Group, int *);
536 int sc_MPI_Group_compare (sc_MPI_Group, sc_MPI_Group, int *);
537 int sc_MPI_Group_union (sc_MPI_Group, sc_MPI_Group,
538  sc_MPI_Group *);
539 int sc_MPI_Group_intersection (sc_MPI_Group, sc_MPI_Group,
540  sc_MPI_Group *);
541 int sc_MPI_Group_difference (sc_MPI_Group, sc_MPI_Group,
542  sc_MPI_Group *);
543 int sc_MPI_Group_incl (sc_MPI_Group, int, int *,
544  sc_MPI_Group *);
545 int sc_MPI_Group_excl (sc_MPI_Group, int, int *,
546  sc_MPI_Group *);
547 int sc_MPI_Group_range_incl (sc_MPI_Group, int,
548  int ranges[][3], sc_MPI_Group *);
549 int sc_MPI_Group_range_excl (sc_MPI_Group, int,
550  int ranges[][3], sc_MPI_Group *);
551 
552 /* These functions will abort. */
553 
554 int sc_MPI_Recv (void *, int, sc_MPI_Datatype, int, int,
556 int sc_MPI_Irecv (void *, int, sc_MPI_Datatype, int, int,
558 int sc_MPI_Send (void *, int, sc_MPI_Datatype, int, int,
559  sc_MPI_Comm);
560 int sc_MPI_Isend (void *, int, sc_MPI_Datatype, int, int,
562 int sc_MPI_Probe (int, int, sc_MPI_Comm, sc_MPI_Status *);
563 int sc_MPI_Iprobe (int, int, sc_MPI_Comm, int *,
564  sc_MPI_Status *);
565 int sc_MPI_Get_count (sc_MPI_Status *, sc_MPI_Datatype,
566  int *);
567 
568 /* This function is only allowed to be called with NULL requests. */
569 
570 int sc_MPI_Wait (sc_MPI_Request *, sc_MPI_Status *);
571 
572 #endif /* !SC_ENABLE_MPI */
573 
574 /* Without SC_ENABLE_MPI, only allowed to be called with NULL requests. */
575 
576 int sc_MPI_Waitsome (int, sc_MPI_Request *,
577  int *, int *, sc_MPI_Status *);
578 int sc_MPI_Waitall (int, sc_MPI_Request *, sc_MPI_Status *);
579 int sc_MPI_Testall (int, sc_MPI_Request *, int *,
580  sc_MPI_Status *);
581 
582 #if defined SC_ENABLE_MPI && defined SC_ENABLE_MPITHREAD
583 
584 #define sc_MPI_THREAD_SINGLE MPI_THREAD_SINGLE
585 #define sc_MPI_THREAD_FUNNELED MPI_THREAD_FUNNELED
586 #define sc_MPI_THREAD_SERIALIZED MPI_THREAD_SERIALIZED
587 #define sc_MPI_THREAD_MULTIPLE MPI_THREAD_MULTIPLE
588 
589 #define sc_MPI_Init_thread MPI_Init_thread
590 
591 #else
592 
594 #define sc_MPI_THREAD_SINGLE 0
595 #define sc_MPI_THREAD_FUNNELED 1
596 #define sc_MPI_THREAD_SERIALIZED 2
597 #define sc_MPI_THREAD_MULTIPLE 3
600 int sc_MPI_Init_thread (int *argc, char ***argv,
601  int required, int *provided);
602 
603 #endif /* !(SC_ENABLE_MPI && SC_ENABLE_MPITHREAD) */
604 
605 #ifdef SC_ENABLE_MPIIO
606 
607 /* file access modes */
608 
609 #define sc_MPI_MODE_RDONLY MPI_MODE_RDONLY
610 #define sc_MPI_MODE_RDWR MPI_MODE_RDWR
611 #define sc_MPI_MODE_WRONLY MPI_MODE_WRONLY
612 #define sc_MPI_MODE_CREATE MPI_MODE_CREATE
613 #define sc_MPI_MODE_EXCL MPI_MODE_EXCL
614 #define sc_MPI_MODE_DELETE_ON_CLOSE MPI_MODE_DELETE_ON_CLOSE
615 #define sc_MPI_MODE_UNIQUE_OPEN MPI_MODE_UNIQUE_OPEN
616 #define sc_MPI_MODE_SEQUENTIAL MPI_MODE_SEQUENTIAL
617 #define sc_MPI_MODE_APPEND MPI_MODE_APPEND
618 
619 /* file seek parameters */
620 
621 #define sc_MPI_SEEK_SET MPI_SEEK_SET
622 #define sc_MPI_SEEK_CUR MPI_SEEK_CUR
623 #define sc_MPI_SEEK_END MPI_SEEK_END
624 
625 /* MPI I/O related types and functions */
626 
627 #define sc_MPI_Offset MPI_Offset
628 
629 #define sc_MPI_File MPI_File
630 #define sc_MPI_FILE_NULL MPI_FILE_NULL
631 
632 #define sc_MPI_File_open MPI_File_open
633 #define sc_MPI_File_close MPI_File_close
634 
635 #else
636 
637 typedef long sc_MPI_Offset;
643 {
644  const char *filename;
645  FILE *file;
646 #ifdef SC_ENABLE_MPI
647  sc_MPI_Comm mpicomm;
648 #endif
649 };
650 
653 
654 #define sc_MPI_FILE_NULL NULL
656 #endif /* !SC_ENABLE_MPIIO */
657 
670 int sc_MPI_Error_class (int errorcode, int *errorclass);
671 
679 int sc_MPI_Error_string (int errorcode, char *string,
680  int *resultlen);
681 
687 
703 void sc_mpi_comm_attach_node_comms (sc_MPI_Comm comm,
704  int processes_per_node);
705 
714 void sc_mpi_comm_detach_node_comms (sc_MPI_Comm comm);
715 
723 void sc_mpi_comm_get_node_comms (sc_MPI_Comm comm,
724  sc_MPI_Comm * intranode,
725  sc_MPI_Comm * internode);
726 
733 int sc_mpi_comm_get_and_attach (sc_MPI_Comm comm);
734 
737 SC_EXTERN_C_END;
738 
739 #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:155
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:151
#define sc_MPI_ERR_NO_SUCH_FILE
Emulate SC_MPI_ERR_NO_SUCH_FILE.
Definition: sc_mpi.h:311
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:322
size_t sc_mpi_sizeof(sc_MPI_Datatype t)
Return the size of MPI data types.
#define sc_MPI_ERR_CONVERSION
Emulate SC_MPI_ERR_CONVERSION.
Definition: sc_mpi.h:320
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:313
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:303
sc3_MPI_Datatype_t sc_MPI_Datatype
Emulate MPI datatypes.
Definition: sc_mpi.h:394
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:317
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:652
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:319
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:307
#define sc_MPI_ERR_QUOTA
Emulate SC_MPI_ERR_QUOTA.
Definition: sc_mpi.h:316
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:79
@ SC_TAG_AG_ALLTOALL
Used in MPI alltoall replacement.
Definition: sc_mpi.h:81
@ SC_TAG_REDUCE
Used in MPI reduce replacement.
Definition: sc_mpi.h:98
@ SC_TAG_AG_RECURSIVE_C
Internal tag; do not use.
Definition: sc_mpi.h:84
@ SC_TAG_LAST
End marker of tag enumeration.
Definition: sc_mpi.h:101
@ SC_TAG_NOTIFY_RANGES
Internal tag to sc_notify.
Definition: sc_mpi.h:91
@ SC_TAG_PSORT_LO
Internal tag to sc_psort.
Definition: sc_mpi.h:99
@ SC_TAG_AG_RECURSIVE_A
Internal tag; do not use.
Definition: sc_mpi.h:82
@ SC_TAG_NOTIFY_CENSUSV
Internal tag to sc_notify.
Definition: sc_mpi.h:86
@ SC_TAG_NOTIFY_WRAPPERV
Internal tag to sc_notify.
Definition: sc_mpi.h:90
@ SC_TAG_NOTIFY_RECURSIVE
Internal tag to sc_notify.
Definition: sc_mpi.h:95
@ SC_TAG_NOTIFY_NBXV
Internal tag to sc_notify.
Definition: sc_mpi.h:88
@ SC_TAG_NOTIFY_WRAPPER
Internal tag to sc_notify.
Definition: sc_mpi.h:89
@ SC_TAG_NOTIFY_NBX
Internal tag to sc_notify.
Definition: sc_mpi.h:87
@ SC_TAG_NOTIFY_CENSUS
Internal tag to sc_notify.
Definition: sc_mpi.h:85
@ SC_TAG_NOTIFY_SUPER_EXTRA
Internal tag to sc_notify.
Definition: sc_mpi.h:94
@ SC_TAG_NOTIFY_SUPER_TRUE
Internal tag to sc_notify.
Definition: sc_mpi.h:93
@ SC_TAG_FIRST
Anything really.
Definition: sc_mpi.h:80
@ SC_TAG_NOTIFY_NARY
Internal tag to sc_notify.
Definition: sc_mpi.h:97
@ SC_TAG_AG_RECURSIVE_B
Internal tag; do not use.
Definition: sc_mpi.h:83
@ SC_TAG_NOTIFY_PAYLOAD
Internal tag to sc_notify.
Definition: sc_mpi.h:92
@ SC_TAG_PSORT_HI
Internal tag to sc_psort.
Definition: sc_mpi.h:100
int sc_MPI_Group
Emulate an MPI group.
Definition: sc_mpi.h:390
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:392
#define sc_MPI_ERR_FILE_IN_USE
Emulate SC_MPI_ERR_FILE_IN_USE.
Definition: sc_mpi.h:318
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:393
#define sc_MPI_ERR_AMODE
Emulate SC_MPI_ERR_AMODE .
Definition: sc_mpi.h:305
#define sc_MPI_ERR_IO
Emulate SC_MPI_ERR_IO.
Definition: sc_mpi.h:321
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:312
int sc_MPI_Request
Emulate an MPI request.
Definition: sc_mpi.h:391
int sc_MPI_Scan(void *, void *, int, sc_MPI_Datatype, sc_MPI_Op, sc_MPI_Comm)
Execute the MPI_Scan algorithm.
#define sc_MPI_ERR_ACCESS
Emulate SC_MPI_ERR_ACCESS.
Definition: sc_mpi.h:314
long sc_MPI_Offset
Emulate the MPI offset type.
Definition: sc_mpi.h:637
sc3_MPI_Op_t sc_MPI_Op
Emulate MPI operations.
Definition: sc_mpi.h:395
#define sc_MPI_ERR_NOT_SAME
Emulate SC_MPI_ERR_NOT_SAME.
Definition: sc_mpi.h:304
struct sc_MPI_Status sc_MPI_Status
Replacement of MPI_Status for non-MPI configuration.
int sc_MPI_Abort(sc_MPI_Comm mpicomm, int ecode) __attribute__((noreturn))
Abort an MPI program.
int sc_MPI_Comm_size(sc_MPI_Comm mpicomm, int *mpisize)
Query size of an MPI communicator.
#define sc_MPI_ERR_UNSUPPORTED_OPERATION
Emulate SC_MPI_ERR_UNSUPPORTED_OPERATION.
Definition: sc_mpi.h:309
#define sc_MPI_ERR_NO_SPACE
Emulate SC_MPI_ERR_NO_SPACE.
Definition: sc_mpi.h:315
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:399
int MPI_ERROR
Error occurred.
Definition: sc_mpi.h:404
int MPI_TAG
Tag of the message.
Definition: sc_mpi.h:403
int cancelled
Cancellation occurred.
Definition: sc_mpi.h:401
int count
Bytes sent/received.
Definition: sc_mpi.h:400
int MPI_SOURCE
Rank of the source.
Definition: sc_mpi.h:402
Replacement structure for MPI_File.
Definition: sc_mpi.h:643
FILE * file
Underlying file object.
Definition: sc_mpi.h:645
const char * filename
Name of the file.
Definition: sc_mpi.h:644