Actual source code: mpi.h

petsc-3.12.4 2020-02-04
Report Typos and Errors
  1: /*
  2:    This is a special set of bindings for uni-processor use of MPI by the PETSc library.

  4:    NOT ALL THE MPI CALLS ARE IMPLEMENTED CORRECTLY! Only those needed in PETSc.

  6:    For example,
  7:    * Does not implement send to self.
  8:    * Does not implement attributes correctly.
  9: */

 11: /*
 12:   The following info is a response to one of the petsc-maint questions
 13:   regarding MPIUNI.

 15:   MPIUNI was developed with the aim of getting PETSc compiled, and
 16:   usable in the absence of a full MPI implementation. With this, we
 17:   were able to provide PETSc on Windows, Windows64 even before any MPI
 18:   implementation was available on these platforms. [Or with certain
 19:   compilers - like borland, that do not have a usable MPI
 20:   implementation]

 22:   However - providing a seqential, standards compliant MPI
 23:   implementation is *not* the goal of MPIUNI. The development strategy
 24:   was - to make enough changes to it so that PETSc sources, examples
 25:   compile without errors, and runs in the uni-processor mode. This is
 26:   the reason each function is not documented.

 28:   PETSc usage of MPIUNI is primarily from C. However a minimal fortran
 29:   interface is also provided - to get PETSc fortran examples with a
 30:   few MPI calls working.

 32:   One of the optimzation with MPIUNI, is to avoid the function call
 33:   overhead, when possible. Hence most of the C functions are
 34:   implemented as macros. However the function calls cannot be avoided
 35:   with fortran usage.

 37:   Most PETSc objects have both sequential and parallel
 38:   implementations, which are separate. For eg: We have two types of
 39:   sparse matrix storage formats - SeqAIJ, and MPIAIJ. Some MPI
 40:   routines are used in the Seq part, but most of them are used in the
 41:   MPI part. The send/receive calls can be found mostly in the MPI
 42:   part.

 44:   When MPIUNI is used, only the Seq version of the PETSc objects are
 45:   used, even though the MPI variant of the objects are compiled. Since
 46:   there are no send/receive calls in the Seq variant, PETSc works fine
 47:   with MPIUNI in seq mode.

 49:   The reason some send/receive functions are defined to abort(), is to
 50:   detect sections of code that use send/receive functions, and gets
 51:   executed in the sequential mode. (which shouldn't happen in case of
 52:   PETSc).

 54:   Proper implementation of send/receive would involve writing a
 55:   function for each of them. Inside each of these functions, we have
 56:   to check if the send is to self or receive is from self, and then
 57:   doing the buffering accordingly (until the receive is called) - or
 58:   what if a nonblocking receive is called, do a copy etc.. Handling
 59:   the buffering aspects might be complicated enough, that in this
 60:   case, a proper implementation of MPI might as well be used. This is
 61:   the reason the send to self is not implemented in MPIUNI, and never
 62:   will be.

 64:   Proper implementations of MPI [for eg: MPICH & OpenMPI] are
 65:   available for most machines. When these packages are available, Its
 66:   generally preferable to use one of them instead of MPIUNI - even if
 67:   the user is using PETSc sequentially.

 69:     - MPIUNI does not support all MPI functions [or functionality].
 70:     Hence it might not work with external packages or user code that
 71:     might have MPI calls in it.

 73:     - MPIUNI is not a standards compliant implementation for np=1.
 74:     For eg: if the user code has send/recv to self, then it will
 75:     abort. [Similar issues with a number of other MPI functionality]
 76:     However MPICH & OpenMPI are the correct implementations of MPI
 77:     standard for np=1.

 79:     - When user code uses multiple MPI based packages that have their
 80:     own *internal* stubs equivalent to MPIUNI - in sequential mode,
 81:     invariably these multiple implementations of MPI for np=1 conflict
 82:     with each other. The correct thing to do is: make all such
 83:     packages use the *same* MPI implementation for np=1. MPICH/OpenMPI
 84:     satisfy this requirement correctly [and hence the correct choice].

 86:     - Using MPICH/OpenMPI sequentially should have minimal
 87:     disadvantages. [for eg: these binaries can be run without
 88:     mpirun/mpiexec as ./executable, without requiring any extra
 89:     configurations for ssh/rsh/daemons etc..]. This should not be a
 90:     reason to avoid these packages for sequential use.

 92: */

 94: #if !defined(MPIUNI_H)
 95: #define MPIUNI_H

 97: /* Required by abort() in mpi.c & for win64 */
 98: #include <petscconf.h>
 99: #include <stddef.h>

101: /*  This is reproduced from petscsys.h so that mpi.h can be used standalone without first including petscsys.h */
102: #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
103: #  define MPIUni_ __declspec(dllexport)
104: #  define MPIUni_PETSC_DLLIMPORT __declspec(dllimport)
105: #elif defined(PETSC_USE_VISIBILITY_CXX) && defined(__cplusplus)
106: #  define MPIUni_ __attribute__((visibility ("default")))
107: #  define MPIUni_PETSC_DLLIMPORT __attribute__((visibility ("default")))
108: #elif defined(PETSC_USE_VISIBILITY_C) && !defined(__cplusplus)
109: #  define MPIUni_ __attribute__((visibility ("default")))
110: #  define MPIUni_PETSC_DLLIMPORT __attribute__((visibility ("default")))
111: #else
112: #  define MPIUni_
113: #  define MPIUni_PETSC_DLLIMPORT
114: #endif

116: #if defined(petsc_EXPORTS)
117: #  define MPIUni_PETSC_VISIBILITY_PUBLIC MPIUni_
118: #else  /* Win32 users need this to import symbols from petsc.dll */
119: #  define MPIUni_PETSC_VISIBILITY_PUBLIC MPIUni_PETSC_DLLIMPORT
120: #endif

122: #if defined(__cplusplus)
123: #define MPIUni_PETSC_EXTERN extern "C" MPIUni_PETSC_VISIBILITY_PUBLIC
124: #else
125: #define MPIUni_PETSC_EXTERN extern MPIUni_PETSC_VISIBILITY_PUBLIC
126: #endif

128: #if defined(__cplusplus)
129: extern "C" {
130: #endif

132: /* MPI_Aint has to be a signed integral type large enough to hold a pointer */
133: typedef ptrdiff_t MPI_Aint;

135: /* old 32bit MS compiler does not support long long */
136: #if defined(PETSC_SIZEOF_LONG_LONG)
137: typedef long long MPIUNI_INT64;
138: typedef unsigned long long MPIUNI_UINT64;
139: #elif defined(PETSC_HAVE___INT64)
140: typedef _int64 MPIUNI_INT64;
141: typedef unsigned _int64 MPIUNI_UINT64;
142: #else
143: #error "cannot determine MPIUNI_INT64, MPIUNI_UINT64 types"
144: #endif

146: /*

148:  MPIUNI_ARG is used in the macros below only to stop various C/C++ compilers
149:  from generating warning messages about unused variables while compiling PETSc.
150: */
151: MPIUni_PETSC_EXTERN void *MPIUNI_TMP;
152: #define MPIUNI_ARG(arg) (MPIUNI_TMP = (void *)(MPI_Aint) (arg))

154: #define MPI_IDENT            0
155: #define MPI_CONGRUENT        1
156: #define MPI_SIMILAR          2
157: #define MPI_UNEQUAL          3

159: #define MPI_BOTTOM   ((void *) 0)
160: #define MPI_IN_PLACE ((void *)-1)

162: #define MPI_PROC_NULL      (-1)
163: #define MPI_ANY_SOURCE     (-2)
164: #define MPI_ANY_TAG        (-1)
165: #define MPI_UNDEFINED  (-32766)

167: #define MPI_SUCCESS          0
168: #define MPI_ERR_OTHER       17
169: #define MPI_ERR_UNKNOWN     18
170: #define MPI_ERR_INTERN      21

172: #define MPI_KEYVAL_INVALID   0
173: #define MPI_TAG_UB           0

175: #define MPI_MAX_PROCESSOR_NAME 1024
176: #define MPI_MAX_ERROR_STRING   2056

178: typedef int MPI_Comm;
179: #define MPI_COMM_NULL  0
180: #define MPI_COMM_SELF  1
181: #define MPI_COMM_WORLD 2
182: #define MPI_COMM_TYPE_SHARED 1

184: typedef int MPI_Info;
185: #define MPI_INFO_NULL 0

187: typedef struct {int MPI_SOURCE,MPI_TAG,MPI_ERROR;} MPI_Status;
188: #define MPI_STATUS_IGNORE   (MPI_Status *)0
189: #define MPI_STATUSES_IGNORE (MPI_Status *)0

191: /* 32-bit packing scheme: [combiner:4 | type-index:8 | count:12 | base-bytes:8] */
192: /* Any changes here must also be reflected in mpif.h */
193: typedef int MPI_Datatype;
194: #define MPI_DATATYPE_NULL      0
195: #define MPI_PACKED             0

197: #define MPI_FLOAT              (1 << 20 | 1 << 8 | (int)sizeof(float))
198: #define MPI_DOUBLE             (1 << 20 | 1 << 8 | (int)sizeof(double))
199: #define MPI_LONG_DOUBLE        (1 << 20 | 1 << 8 | (int)sizeof(long double))

201: #define MPI_COMPLEX            (2 << 20 | 1 << 8 | 2*(int)sizeof(float))
202: #define MPI_C_COMPLEX          (2 << 20 | 1 << 8 | 2*(int)sizeof(float))
203: #define MPI_C_FLOAT_COMPLEX    (2 << 20 | 1 << 8 | 2*(int)sizeof(float))
204: #define MPI_DOUBLE_COMPLEX     (2 << 20 | 1 << 8 | 2*(int)sizeof(double))
205: #define MPI_C_DOUBLE_COMPLEX   (2 << 20 | 1 << 8 | 2*(int)sizeof(double))

207: #define MPI_CHAR               (3 << 20 | 1 << 8 | (int)sizeof(char))
208: #define MPI_BYTE               (3 << 20 | 1 << 8 | (int)sizeof(char))
209: #define MPI_SIGNED_CHAR        (3 << 20 | 1 << 8 | (int)sizeof(signed char))
210: #define MPI_UNSIGNED_CHAR      (3 << 20 | 1 << 8 | (int)sizeof(unsigned char))

212: #define MPI_SHORT              (4 << 20 | 1 << 8 | (int)sizeof(short))
213: #define MPI_INT                (4 << 20 | 1 << 8 | (int)sizeof(int))
214: #define MPI_LONG               (4 << 20 | 1 << 8 | (int)sizeof(long))
215: #define MPI_LONG_LONG          (4 << 20 | 1 << 8 | (int)sizeof(MPIUNI_INT64))
216: #define MPI_LONG_LONG_INT      MPI_LONG_LONG
217: #define MPI_INTEGER8           MPI_LONG_LONG

219: #define MPI_UNSIGNED_SHORT     (5 << 20 | 1 << 8 | (int)sizeof(unsigned short))
220: #define MPI_UNSIGNED           (5 << 20 | 1 << 8 | (int)sizeof(unsigned))
221: #define MPI_UNSIGNED_LONG      (5 << 20 | 1 << 8 | (int)sizeof(unsigned long))
222: #define MPI_UNSIGNED_LONG_LONG (5 << 20 | 1 << 8 | (int)sizeof(MPIUNI_UINT64))

224: #define MPI_FLOAT_INT          (10 << 20 | 1 << 8 | (int)(sizeof(float) + sizeof(int)))
225: #define MPI_DOUBLE_INT         (11 << 20 | 1 << 8 | (int)(sizeof(double) + sizeof(int)))
226: #define MPI_LONG_INT           (12 << 20 | 1 << 8 | (int)(sizeof(long) + sizeof(int)))
227: #define MPI_SHORT_INT          (13 << 20 | 1 << 8 | (int)(sizeof(short) + sizeof(int)))
228: #define MPI_2INT               (14 << 20 | 1 << 8 | (int)(2*sizeof(int)))
229: #define MPI_2DOUBLE            (15 << 20 | 1 << 8 | (int)(2*sizeof(double)))

231: /* Fortran datatypes; Jed Brown says they should be defined here */
232: #define MPI_INTEGER MPI_INT
233: #define MPI_DOUBLE_PRECISION MPI_DOUBLE
234: #define MPI_COMPLEX16 MPI_C_DOUBLE_COMPLEX
235: #define MPI_2DOUBLE_PRECISION MPI_2DOUBLE

237: #define MPI_ORDER_C            0
238: #define MPI_ORDER_FORTRAN      1

240: #define MPI_sizeof_default(datatype) ((((datatype) >> 8) & 0xfff) * ((datatype) & 0xff))
241: #if defined(PETSC_USE_REAL___FP16)
242: MPIUni_PETSC_EXTERN MPI_Datatype MPIU___FP16;
243: #define MPI_sizeof(datatype) ((datatype == MPIU___FP16) ? (int)(2*sizeof(char)) : MPI_sizeof_default(datatype))
244: #elif defined(PETSC_USE_REAL___FLOAT128)
245: MPIUni_PETSC_EXTERN MPI_Datatype MPIU___FLOAT128;
246: #define MPI_sizeof(datatype) ((datatype == MPIU___FLOAT128) ? (int)(2*sizeof(double)) : MPI_sizeof_default(datatype))
247: #else
248: #define MPI_sizeof(datatype) (MPI_sizeof_default(datatype))
249: #endif

251: MPIUni_PETSC_EXTERN int MPIUNI_Memcpy(void*,const void*,int);

253: typedef int MPI_Request;
254: #define MPI_REQUEST_NULL 0

256: typedef int MPI_Group;
257: #define MPI_GROUP_NULL  0
258: #define MPI_GROUP_EMPTY 0

260: typedef int MPI_Op;
261: #define MPI_OP_NULL    0
262: #define MPI_SUM        1
263: #define MPI_MAX        2
264: #define MPI_MIN        3
265: #define MPI_REPLACE    4
266: #define MPI_PROD       5
267: #define MPI_LAND       6
268: #define MPI_BAND       7
269: #define MPI_LOR        8
270: #define MPI_BOR        9
271: #define MPI_LXOR       10
272: #define MPI_BXOR       11
273: #define MPI_MAXLOC     12
274: #define MPI_MINLOC     13

276: typedef void (MPI_User_function)(void*, void *, int *, MPI_Datatype *);

278: typedef int MPI_Errhandler;
279: #define MPI_ERRHANDLER_NULL  0
280: #define MPI_ERRORS_RETURN    0
281: #define MPI_ERRORS_ARE_FATAL 0
282: typedef void (MPI_Handler_function)(MPI_Comm *, int *, ...);

284: /*
285:   Prototypes of some functions which are implemented in mpi.c
286: */
287: typedef int (MPI_Copy_function)(MPI_Comm,int,void *,void *,void *,int *);
288: typedef int (MPI_Delete_function)(MPI_Comm,int,void *,void *);
289: #define MPI_NULL_COPY_FN   (MPI_Copy_function*)0
290: #define MPI_NULL_DELETE_FN (MPI_Delete_function*)0

292: /*
293:   To enable linking PETSc+MPIUNI with any other package that might have its
294:   own MPIUNI (equivalent implementation) we need to avoid using 'MPI'
295:   namespace for MPIUNI functions that go into the petsc library.

297:   For C functions below (that get compiled into petsc library) - we map
298:   the 'MPI' functions to use 'Petsc_MPI' namespace.

300:   With fortran we use similar mapping - thus requiring the use of
301:   c-preprocessor with mpif.h
302: */
303: #define MPI_Abort         Petsc_MPI_Abort
304: #define MPIUni_Abort      Petsc_MPIUni_Abort
305: #define MPI_Attr_get      Petsc_MPI_Attr_get
306: #define MPI_Keyval_free   Petsc_MPI_Keyval_free
307: #define MPI_Attr_put      Petsc_MPI_Attr_put
308: #define MPI_Attr_delete   Petsc_MPI_Attr_delete
309: #define MPI_Keyval_create Petsc_MPI_Keyval_create
310: #define MPI_Comm_free     Petsc_MPI_Comm_free
311: #define MPI_Comm_dup      Petsc_MPI_Comm_dup
312: #define MPI_Comm_create   Petsc_MPI_Comm_create
313: #define MPI_Init          Petsc_MPI_Init
314: #define MPI_Finalize      Petsc_MPI_Finalize
315: #define MPI_Initialized   Petsc_MPI_Initialized
316: #define MPI_Finalized     Petsc_MPI_Finalized
317: #define MPI_Comm_size     Petsc_MPI_Comm_size
318: #define MPI_Comm_rank     Petsc_MPI_Comm_rank
319: #define MPI_Wtime         Petsc_MPI_Wtime
320: #define MPI_Type_get_envelope Petsc_MPI_Type_get_envelope
321: #define MPI_Type_get_contents Petsc_MPI_Type_get_contents
322: #define MPI_Add_error_class   Petsc_MPI_Add_error_class
323: #define MPI_Add_error_code    Petsc_MPI_Add_error_code

325: /* identical C bindings */
326: #define MPI_Comm_copy_attr_function   MPI_Copy_function
327: #define MPI_Comm_delete_attr_function MPI_Delete_function
328: #define MPI_COMM_NULL_COPY_FN         MPI_NULL_COPY_FN
329: #define MPI_COMM_NULL_DELETE_FN       MPI_NULL_DELETE_FN
330: #define MPI_Comm_create_keyval        Petsc_MPI_Keyval_create
331: #define MPI_Comm_free_keyval          Petsc_MPI_Keyval_free
332: #define MPI_Comm_get_attr             Petsc_MPI_Attr_get
333: #define MPI_Comm_set_attr             Petsc_MPI_Attr_put
334: #define MPI_Comm_delete_attr          Petsc_MPI_Attr_delete

336: MPIUni_PETSC_EXTERN int    MPIUni_Abort(MPI_Comm,int);
337: MPIUni_PETSC_EXTERN int    MPI_Abort(MPI_Comm,int);
338: MPIUni_PETSC_EXTERN int    MPI_Attr_get(MPI_Comm comm,int keyval,void *attribute_val,int *flag);
339: MPIUni_PETSC_EXTERN int    MPI_Keyval_free(int*);
340: MPIUni_PETSC_EXTERN int    MPI_Attr_put(MPI_Comm,int,void *);
341: MPIUni_PETSC_EXTERN int    MPI_Attr_delete(MPI_Comm,int);
342: MPIUni_PETSC_EXTERN int    MPI_Keyval_create(MPI_Copy_function *,MPI_Delete_function *,int *,void *);
343: MPIUni_PETSC_EXTERN int    MPI_Comm_free(MPI_Comm*);
344: MPIUni_PETSC_EXTERN int    MPI_Comm_dup(MPI_Comm,MPI_Comm *);
345: MPIUni_PETSC_EXTERN int    MPI_Comm_create(MPI_Comm,MPI_Group,MPI_Comm *);
346: MPIUni_PETSC_EXTERN int    MPI_Init(int *, char ***);
347: MPIUni_PETSC_EXTERN int    MPI_Finalize(void);
348: MPIUni_PETSC_EXTERN int    MPI_Initialized(int*);
349: MPIUni_PETSC_EXTERN int    MPI_Finalized(int*);
350: MPIUni_PETSC_EXTERN int    MPI_Comm_size(MPI_Comm,int*);
351: MPIUni_PETSC_EXTERN int    MPI_Comm_rank(MPI_Comm,int*);
352: MPIUni_PETSC_EXTERN double MPI_Wtime(void);

354: MPIUni_PETSC_EXTERN int MPI_Type_get_envelope(MPI_Datatype,int*,int*,int*,int*);
355: MPIUni_PETSC_EXTERN int MPI_Type_get_contents(MPI_Datatype,int,int,int,int*,MPI_Aint*,MPI_Datatype*);
356: MPIUni_PETSC_EXTERN int MPI_Add_error_class(int*);
357: MPIUni_PETSC_EXTERN int MPI_Add_error_code(int,int*);

359: /*
360:     Routines we have replace with macros that do nothing
361:     Some return error codes others return success
362: */

364: typedef int MPI_Fint;
365: #define MPI_Comm_f2c(comm) (MPI_Comm)(comm)
366: #define MPI_Comm_c2f(comm) (MPI_Fint)(comm)
367: #define MPI_Type_f2c(type) (MPI_Datatype)(type)
368: #define MPI_Type_c2f(type) (MPI_Fint)(type)
369: #define MPI_Op_f2c(op)     (MPI_Op)(op)
370: #define MPI_Op_c2f(op)     (MPI_Fint)(op)

372: #define MPI_Send(buf,count,datatype,dest,tag,comm)  \
373:      (MPIUNI_ARG(buf),\
374:       MPIUNI_ARG(count),\
375:       MPIUNI_ARG(datatype),\
376:       MPIUNI_ARG(dest),\
377:       MPIUNI_ARG(tag),\
378:       MPIUNI_ARG(comm),\
379:       MPIUni_Abort(MPI_COMM_WORLD,0))
380: #define MPI_Recv(buf,count,datatype,source,tag,comm,status) \
381:      (MPIUNI_ARG(buf),\
382:       MPIUNI_ARG(count),\
383:       MPIUNI_ARG(datatype),\
384:       MPIUNI_ARG(source),\
385:       MPIUNI_ARG(tag),\
386:       MPIUNI_ARG(comm),\
387:       MPIUNI_ARG(status),\
388:       MPIUni_Abort(MPI_COMM_WORLD,0))
389: #define MPI_Get_count(status,datatype,count) \
390:      (MPIUNI_ARG(status),\
391:       MPIUNI_ARG(datatype),\
392:       MPIUNI_ARG(count),\
393:       MPIUni_Abort(MPI_COMM_WORLD,0))
394: #define MPI_Bsend(buf,count,datatype,dest,tag,comm)  \
395:      (MPIUNI_ARG(buf),\
396:       MPIUNI_ARG(count),\
397:       MPIUNI_ARG(datatype),\
398:       MPIUNI_ARG(dest),\
399:       MPIUNI_ARG(tag),\
400:       MPIUNI_ARG(comm),\
401:       MPIUni_Abort(MPI_COMM_WORLD,0))
402: #define MPI_Ssend(buf,count,datatype,dest,tag,comm) \
403:      (MPIUNI_ARG(buf),\
404:       MPIUNI_ARG(count),\
405:       MPIUNI_ARG(datatype),\
406:       MPIUNI_ARG(dest),\
407:       MPIUNI_ARG(tag),\
408:       MPIUNI_ARG(comm),\
409:       MPIUni_Abort(MPI_COMM_WORLD,0))
410: #define MPI_Rsend(buf,count,datatype,dest,tag,comm) \
411:      (MPIUNI_ARG(buf),\
412:       MPIUNI_ARG(count),\
413:       MPIUNI_ARG(datatype),\
414:       MPIUNI_ARG(dest),\
415:       MPIUNI_ARG(tag),\
416:       MPIUNI_ARG(comm),\
417:       MPIUni_Abort(MPI_COMM_WORLD,0))
418: #define MPI_Buffer_attach(buffer,size) \
419:      (MPIUNI_ARG(buffer),\
420:       MPIUNI_ARG(size),\
421:       MPI_SUCCESS)
422: #define MPI_Buffer_detach(buffer,size)\
423:      (MPIUNI_ARG(buffer),\
424:       MPIUNI_ARG(size),\
425:       MPI_SUCCESS)
426: #define MPI_Ibsend(buf,count,datatype,dest,tag,comm,request) \
427:      (MPIUNI_ARG(buf),\
428:       MPIUNI_ARG(count),\
429:       MPIUNI_ARG(datatype),\
430:       MPIUNI_ARG(dest),\
431:       MPIUNI_ARG(tag),\
432:       MPIUNI_ARG(comm),\
433:       MPIUNI_ARG(request),\
434:       MPIUni_Abort(MPI_COMM_WORLD,0))
435: #define MPI_Issend(buf,count,datatype,dest,tag,comm,request) \
436:      (MPIUNI_ARG(buf),\
437:       MPIUNI_ARG(count),\
438:       MPIUNI_ARG(datatype),\
439:       MPIUNI_ARG(dest),\
440:       MPIUNI_ARG(tag),\
441:       MPIUNI_ARG(comm),\
442:       MPIUNI_ARG(request),\
443:       MPIUni_Abort(MPI_COMM_WORLD,0))
444: #define MPI_Irsend(buf,count,datatype,dest,tag,comm,request) \
445:      (MPIUNI_ARG(buf),\
446:       MPIUNI_ARG(count),\
447:       MPIUNI_ARG(datatype),\
448:       MPIUNI_ARG(dest),\
449:       MPIUNI_ARG(tag),\
450:       MPIUNI_ARG(comm),\
451:       MPIUNI_ARG(request),\
452:       MPIUni_Abort(MPI_COMM_WORLD,0))
453: #define MPI_Irecv(buf,count,datatype,source,tag,comm,request) \
454:      (MPIUNI_ARG(buf),\
455:       MPIUNI_ARG(count),\
456:       MPIUNI_ARG(datatype),\
457:       MPIUNI_ARG(source),\
458:       MPIUNI_ARG(tag),\
459:       MPIUNI_ARG(comm),\
460:       MPIUNI_ARG(request),\
461:       MPIUni_Abort(MPI_COMM_WORLD,0))
462: #define MPI_Isend(buf,count,datatype,dest,tag,comm,request) \
463:      (MPIUNI_ARG(buf),\
464:       MPIUNI_ARG(count),\
465:       MPIUNI_ARG(datatype),\
466:       MPIUNI_ARG(dest),\
467:       MPIUNI_ARG(tag),\
468:       MPIUNI_ARG(comm),\
469:       MPIUNI_ARG(request),\
470:       MPIUni_Abort(MPI_COMM_WORLD,0))
471: #define MPI_Wait(request,status) \
472:      (MPIUNI_ARG(request),\
473:       MPIUNI_ARG(status),\
474:       MPI_SUCCESS)
475: #define MPI_Test(request,flag,status) \
476:      (MPIUNI_ARG(request),\
477:       MPIUNI_ARG(status),\
478:       *(flag) = 0,\
479:       MPI_SUCCESS)
480: #define MPI_Request_free(request) \
481:      (MPIUNI_ARG(request),\
482:       MPI_SUCCESS)
483: #define MPI_Waitany(count,array_of_requests,index,status) \
484:      (MPIUNI_ARG(count),\
485:       MPIUNI_ARG(array_of_requests),\
486:       MPIUNI_ARG(status),\
487:       (*(status)).MPI_SOURCE = 0,               \
488:       *(index) = 0,\
489:       MPI_SUCCESS)
490: #define MPI_Testany(a,b,c,d,e) \
491:      (MPIUNI_ARG(a),\
492:       MPIUNI_ARG(b),\
493:       MPIUNI_ARG(c),\
494:       MPIUNI_ARG(d),\
495:       MPIUNI_ARG(e),\
496:       MPI_SUCCESS)
497: #define MPI_Waitall(count,array_of_requests,array_of_statuses) \
498:      (MPIUNI_ARG(count),\
499:       MPIUNI_ARG(array_of_requests),\
500:       MPIUNI_ARG(array_of_statuses),\
501:       MPI_SUCCESS)
502: #define MPI_Testall(count,array_of_requests,flag,array_of_statuses) \
503:      (MPIUNI_ARG(count),\
504:       MPIUNI_ARG(array_of_requests),\
505:       MPIUNI_ARG(flag),\
506:       MPIUNI_ARG(array_of_statuses),\
507:       MPI_SUCCESS)
508: #define MPI_Waitsome(incount,array_of_requests,outcount,\
509:                      array_of_indices,array_of_statuses)        \
510:      (MPIUNI_ARG(incount),\
511:       MPIUNI_ARG(array_of_requests),\
512:       MPIUNI_ARG(outcount),\
513:       MPIUNI_ARG(array_of_indices),\
514:       MPIUNI_ARG(array_of_statuses),\
515:       MPI_SUCCESS)
516: #define MPI_Comm_group(comm,group) \
517:      (MPIUNI_ARG(comm),\
518:       *group = 1,\
519:       MPI_SUCCESS)
520: #define MPI_Group_incl(group,n,ranks,newgroup) \
521:      (MPIUNI_ARG(group),\
522:       MPIUNI_ARG(n),\
523:       MPIUNI_ARG(ranks),\
524:       MPIUNI_ARG(newgroup),\
525:       MPI_SUCCESS)
526: #define MPI_Testsome(incount,array_of_requests,outcount,\
527:                      array_of_indices,array_of_statuses) \
528:      (MPIUNI_ARG(incount),\
529:       MPIUNI_ARG(array_of_requests),\
530:       MPIUNI_ARG(outcount),\
531:       MPIUNI_ARG(array_of_indices),\
532:       MPIUNI_ARG(array_of_statuses),\
533:       MPI_SUCCESS)
534: #define MPI_Iprobe(source,tag,comm,flag,status) \
535:      (MPIUNI_ARG(source),\
536:       MPIUNI_ARG(tag),\
537:       MPIUNI_ARG(comm),\
538:       *(flag)=0,\
539:       MPIUNI_ARG(status),\
540:       MPI_SUCCESS)
541: #define MPI_Probe(source,tag,comm,status) \
542:      (MPIUNI_ARG(source),\
543:       MPIUNI_ARG(tag),\
544:       MPIUNI_ARG(comm),\
545:       MPIUNI_ARG(status),\
546:       MPI_SUCCESS)
547: #define MPI_Cancel(request) \
548:      (MPIUNI_ARG(request),\
549:       MPI_SUCCESS)
550: #define MPI_Test_cancelled(status,flag) \
551:      (MPIUNI_ARG(status),\
552:       *(flag)=0,\
553:       MPI_SUCCESS)
554: #define MPI_Send_init(buf,count,datatype,dest,tag,comm,request) \
555:      (MPIUNI_ARG(buf),\
556:       MPIUNI_ARG(count),\
557:       MPIUNI_ARG(datatype),\
558:       MPIUNI_ARG(dest),\
559:       MPIUNI_ARG(tag),\
560:       MPIUNI_ARG(comm),\
561:       MPIUNI_ARG(request),\
562:       MPI_SUCCESS)
563: #define MPI_Bsend_init(buf,count,datatype,dest,tag,comm,request) \
564:      (MPIUNI_ARG(buf),\
565:       MPIUNI_ARG(count),\
566:       MPIUNI_ARG(datatype),\
567:       MPIUNI_ARG(dest),\
568:       MPIUNI_ARG(tag),\
569:       MPIUNI_ARG(comm),\
570:       MPIUNI_ARG(request),\
571:       MPI_SUCCESS)
572: #define MPI_Ssend_init(buf,count,datatype,dest,tag,comm,request) \
573:      (MPIUNI_ARG(buf),\
574:       MPIUNI_ARG(count),\
575:       MPIUNI_ARG(datatype),\
576:       MPIUNI_ARG(dest),\
577:       MPIUNI_ARG(tag),\
578:       MPIUNI_ARG(comm),\
579:       MPIUNI_ARG(request),\
580:       MPI_SUCCESS)
581: #define MPI_Bsend_init(buf,count,datatype,dest,tag,comm,request) \
582:      (MPIUNI_ARG(buf),\
583:       MPIUNI_ARG(count),\
584:       MPIUNI_ARG(datatype),\
585:       MPIUNI_ARG(dest),\
586:       MPIUNI_ARG(tag),\
587:       MPIUNI_ARG(comm),\
588:       MPIUNI_ARG(request),\
589:       MPI_SUCCESS)
590: #define MPI_Rsend_init(buf,count,datatype,dest,tag,comm,request) \
591:      (MPIUNI_ARG(buf),\
592:       MPIUNI_ARG(count),\
593:       MPIUNI_ARG(datatype),\
594:       MPIUNI_ARG(dest),\
595:       MPIUNI_ARG(tag),\
596:       MPIUNI_ARG(comm),\
597:       MPIUNI_ARG(request),\
598:       MPI_SUCCESS)
599: #define MPI_Recv_init(buf,count,datatype,source,tag,comm,request) \
600:      (MPIUNI_ARG(buf),\
601:       MPIUNI_ARG(count),\
602:       MPIUNI_ARG(datatype),\
603:       MPIUNI_ARG(source),\
604:       MPIUNI_ARG(tag),\
605:       MPIUNI_ARG(comm),\
606:       MPIUNI_ARG(request),\
607:       MPI_SUCCESS)
608: #define MPI_Start(request) \
609:      (MPIUNI_ARG(request),\
610:       MPI_SUCCESS)
611: #define MPI_Startall(count,array_of_requests) \
612:      (MPIUNI_ARG(count),\
613:       MPIUNI_ARG(array_of_requests),\
614:       MPI_SUCCESS)
615: #define MPI_Sendrecv(sendbuf,sendcount,sendtype,\
616:                      dest,sendtag,recvbuf,recvcount,\
617:                      recvtype,source,recvtag,\
618:                      comm,status) \
619:      (MPIUNI_ARG(dest),\
620:       MPIUNI_ARG(sendtag),\
621:       MPIUNI_ARG(recvcount),\
622:       MPIUNI_ARG(recvtype),\
623:       MPIUNI_ARG(source),\
624:       MPIUNI_ARG(recvtag),\
625:       MPIUNI_ARG(comm),\
626:       MPIUNI_ARG(status),\
627:       MPIUNI_Memcpy(recvbuf,sendbuf,(sendcount)*MPI_sizeof(sendtype)))
628: #define MPI_Sendrecv_replace(buf,count,datatype,dest,sendtag,\
629:                              source,recvtag,comm,status) \
630:      (MPIUNI_ARG(buf),\
631:       MPIUNI_ARG(count),\
632:       MPIUNI_ARG(datatype),\
633:       MPIUNI_ARG(dest),\
634:       MPIUNI_ARG(sendtag),\
635:       MPIUNI_ARG(source),\
636:       MPIUNI_ARG(recvtag),\
637:       MPIUNI_ARG(comm),\
638:       MPIUNI_ARG(status),\
639:       MPI_SUCCESS)

641: #define MPI_COMBINER_NAMED      0
642: #define MPI_COMBINER_DUP        1
643: #define MPI_COMBINER_CONTIGUOUS 2
644:   /* 32-bit packing scheme: [combiner:4 | type-index:8 | count:12 | base-bytes:8] */
645: #define MPI_Type_dup(oldtype,newtype) \
646:      (*(newtype) = oldtype, MPI_SUCCESS)
647: #define MPI_Type_contiguous(count,oldtype,newtype) \
648:      (*(newtype) = (MPI_COMBINER_CONTIGUOUS<<28)|((oldtype)&0x0ff00000)|(((oldtype)>>8&0xfff)*(count))<<8|((oldtype)&0xff), MPI_SUCCESS)
649: #define MPI_Type_vector(count,blocklength,stride,oldtype,newtype) \
650:      (MPIUNI_ARG(count),\
651:       MPIUNI_ARG(blocklength),\
652:       MPIUNI_ARG(stride),\
653:       MPIUNI_ARG(oldtype),\
654:       MPIUNI_ARG(newtype),\
655:       MPIUni_Abort(MPI_COMM_WORLD,0))
656: #define MPI_Type_hvector(count,blocklength,stride,oldtype,newtype) \
657:      (MPIUNI_ARG(count),\
658:       MPIUNI_ARG(blocklength),\
659:       MPIUNI_ARG(stride),\
660:       MPIUNI_ARG(oldtype),\
661:       MPIUNI_ARG(newtype),\
662:       MPIUni_Abort(MPI_COMM_WORLD,0))
663: #define MPI_Type_indexed(count,array_of_blocklengths,array_of_displacements,oldtype,newtype) \
664:      (MPIUNI_ARG(count),\
665:       MPIUNI_ARG(array_of_blocklengths),\
666:       MPIUNI_ARG(array_of_displacements),\
667:       MPIUNI_ARG(oldtype),\
668:       MPIUNI_ARG(newtype),\
669:       MPIUni_Abort(MPI_COMM_WORLD,0))
670: #define MPI_Type_hindexed(count,array_of_blocklengths,array_of_displacements,oldtype,newtype) \
671:      (MPIUNI_ARG(count),\
672:       MPIUNI_ARG(array_of_blocklengths),\
673:       MPIUNI_ARG(array_of_displacements),\
674:       MPIUNI_ARG(oldtype),\
675:       MPIUNI_ARG(newtype),\
676:       MPIUni_Abort(MPI_COMM_WORLD,0))
677: #define MPI_Type_struct(count,array_of_blocklengths,array_of_displacements,array_of_types,newtype) \
678:      (MPIUNI_ARG(count),\
679:       MPIUNI_ARG(array_of_blocklengths),\
680:       MPIUNI_ARG(array_of_displacements),\
681:       MPIUNI_ARG(array_of_types),\
682:       MPIUNI_ARG(newtype),\
683:       MPIUni_Abort(MPI_COMM_WORLD,0))
684: #define MPI_Address(location,address) \
685:      (*(address) = (MPI_Aint)((char *)(location)), MPI_SUCCESS)
686: #define MPI_Type_size(datatype,size) (*(size) = MPI_sizeof((datatype)), MPI_SUCCESS)
687: #define MPI_Type_lb(datatype,lb) (MPIUNI_ARG(datatype), *(lb) = 0, MPI_SUCCESS)
688: #define MPI_Type_ub(datatype,ub) (*(ub) = MPI_sizeof((datatype)), MPI_SUCCESS)
689: #define MPI_Type_extent(datatype,extent) \
690:      (*(extent) = MPI_sizeof((datatype)), MPI_SUCCESS)
691: #define MPI_Type_get_extent(datatype,lb,extent) \
692:      (*(lb) = 0, *(extent) = MPI_sizeof((datatype)), MPI_SUCCESS)
693: #define MPI_Type_commit(datatype) (MPIUNI_ARG(datatype), MPI_SUCCESS)
694: #define MPI_Type_free(datatype) (*(datatype) = MPI_DATATYPE_NULL, MPI_SUCCESS)
695: #define MPI_Get_elements(status,datatype,count) \
696:      (MPIUNI_ARG(status),\
697:       MPIUNI_ARG(datatype),\
698:       MPIUNI_ARG(count),\
699:       MPIUni_Abort(MPI_COMM_WORLD,0))
700: #define MPI_Pack(inbuf,incount,datatype,outbuf,outsize,position,comm) \
701:      (MPIUNI_ARG(inbuf),\
702:       MPIUNI_ARG(incount),\
703:       MPIUNI_ARG(datatype),\
704:       MPIUNI_ARG(outbuf),\
705:       MPIUNI_ARG(outsize),\
706:       MPIUNI_ARG(position),\
707:       MPIUNI_ARG(comm),\
708:       MPIUni_Abort(MPI_COMM_WORLD,0))
709: #define MPI_Unpack(inbuf,insize,position,outbuf,outcount,datatype,comm) \
710:      (MPIUNI_ARG(inbuf),\
711:       MPIUNI_ARG(insize),\
712:       MPIUNI_ARG(position),\
713:       MPIUNI_ARG(outbuf),\
714:       MPIUNI_ARG(outcount),\
715:       MPIUNI_ARG(datatype),\
716:       MPIUNI_ARG(comm),\
717:       MPIUni_Abort(MPI_COMM_WORLD,0))
718: #define MPI_Pack_size(incount,datatype,comm,size) \
719:      (MPIUNI_ARG(incount),\
720:       MPIUNI_ARG(datatype),\
721:       MPIUNI_ARG(comm),\
722:       MPIUNI_ARG(size),\
723:       MPIUni_Abort(MPI_COMM_WORLD,0))
724: #define MPI_Barrier(comm) \
725:      (MPIUNI_ARG(comm),\
726:       MPI_SUCCESS)
727: #define MPI_Bcast(buffer,count,datatype,root,comm) \
728:      (MPIUNI_ARG(buffer),\
729:       MPIUNI_ARG(count),\
730:       MPIUNI_ARG(datatype),\
731:       MPIUNI_ARG(root),\
732:       MPIUNI_ARG(comm),\
733:       MPI_SUCCESS)
734: #define MPI_Gather(sendbuf,sendcount,sendtype,\
735:                    recvbuf,recvcount, recvtype,\
736:                    root,comm) \
737:      (MPIUNI_ARG(recvcount),\
738:       MPIUNI_ARG(root),\
739:       MPIUNI_ARG(recvtype),\
740:       MPIUNI_ARG(comm),\
741:       MPIUNI_Memcpy(recvbuf,sendbuf,(sendcount)*MPI_sizeof(sendtype)))
742: #define MPI_Gatherv(sendbuf,sendcount,sendtype,\
743:                     recvbuf,recvcounts,displs,\
744:                     recvtype,root,comm) \
745:      (MPIUNI_ARG(recvcounts),\
746:       MPIUNI_ARG(displs),\
747:       MPIUNI_ARG(recvtype),\
748:       MPIUNI_ARG(root),\
749:       MPIUNI_ARG(comm),\
750:       MPIUNI_Memcpy(recvbuf,sendbuf,(sendcount)*MPI_sizeof(sendtype)))
751: #define MPI_Scatter(sendbuf,sendcount,sendtype,\
752:                     recvbuf,recvcount,recvtype,\
753:                     root,comm) \
754:      (MPIUNI_ARG(sendcount),\
755:       MPIUNI_ARG(sendtype),\
756:       MPIUNI_ARG(recvbuf),\
757:       MPIUNI_ARG(recvtype),\
758:       MPIUNI_ARG(root),\
759:       MPIUNI_ARG(comm),\
760:       MPIUNI_Memcpy(recvbuf,sendbuf,(recvcount)*MPI_sizeof(recvtype)))
761: #define MPI_Scatterv(sendbuf,sendcounts,displs,\
762:                      sendtype,recvbuf,recvcount,\
763:                      recvtype,root,comm) \
764:      (MPIUNI_ARG(displs),\
765:       MPIUNI_ARG(sendtype),\
766:       MPIUNI_ARG(sendcounts),\
767:       MPIUNI_ARG(root),\
768:       MPIUNI_ARG(comm),\
769:       MPIUNI_Memcpy(recvbuf,sendbuf,(recvcount)*MPI_sizeof(recvtype)))
770: #define MPI_Allgather(sendbuf,sendcount,sendtype,\
771:                      recvbuf,recvcount,recvtype,comm) \
772:      (MPIUNI_ARG(recvcount),\
773:       MPIUNI_ARG(recvtype),\
774:       MPIUNI_ARG(comm),\
775:       MPIUNI_Memcpy(recvbuf,sendbuf,(sendcount)*MPI_sizeof(sendtype)))
776: #define MPI_Allgatherv(sendbuf,sendcount,sendtype,\
777:      recvbuf,recvcounts,displs,recvtype,comm) \
778:      (MPIUNI_ARG(recvcounts),\
779:       MPIUNI_ARG(displs),\
780:       MPIUNI_ARG(recvtype),\
781:       MPIUNI_ARG(comm),\
782:       MPIUNI_Memcpy(recvbuf,sendbuf,(sendcount)*MPI_sizeof(sendtype)))
783: #define MPI_Alltoall(sendbuf,sendcount,sendtype,\
784:                      recvbuf,recvcount,recvtype,comm) \
785:      (MPIUNI_ARG(recvcount),\
786:       MPIUNI_ARG(recvtype),\
787:       MPIUNI_ARG(comm),\
788:       MPIUNI_Memcpy(recvbuf,sendbuf,(sendcount)*MPI_sizeof(sendtype)))
789: #define MPI_Alltoallv(sendbuf,sendcounts,sdispls,sendtype,\
790:                       recvbuf,recvcounts,rdispls,recvtype,comm) \
791:      (MPIUNI_ARG(sendbuf),\
792:       MPIUNI_ARG(sendcounts),\
793:       MPIUNI_ARG(sdispls),\
794:       MPIUNI_ARG(sendtype),\
795:       MPIUNI_ARG(recvbuf),\
796:       MPIUNI_ARG(recvcounts),\
797:       MPIUNI_ARG(rdispls),\
798:       MPIUNI_ARG(recvtype),\
799:       MPIUNI_ARG(comm),\
800:       MPIUni_Abort(MPI_COMM_WORLD,0))
801: #define MPI_Alltoallw(sendbuf,sendcounts,sdispls,sendtypes,\
802:                       recvbuf,recvcounts,rdispls,recvtypes,comm) \
803:      (MPIUNI_ARG(sendbuf),\
804:       MPIUNI_ARG(sendcounts),\
805:       MPIUNI_ARG(sdispls),\
806:       MPIUNI_ARG(sendtypes),\
807:       MPIUNI_ARG(recvbuf),\
808:       MPIUNI_ARG(recvcount),\
809:       MPIUNI_ARG(rdispls),\
810:       MPIUNI_ARG(recvtypes),\
811:       MPIUNI_ARG(comm),\
812:       MPIUni_Abort(MPI_COMM_WORLD,0))
813: #define MPI_Reduce(sendbuf,recvbuf,count,datatype,op,root,comm) \
814:      (MPIUNI_ARG(op),\
815:       MPIUNI_ARG(root),\
816:       MPIUNI_ARG(comm),\
817:       MPIUNI_Memcpy(recvbuf,sendbuf,(count)*MPI_sizeof(datatype)))
818: #define MPI_Allreduce(sendbuf, recvbuf,count,datatype,op,comm) \
819:      (MPIUNI_ARG(op),\
820:       MPIUNI_ARG(comm),\
821:       MPIUNI_Memcpy(recvbuf,sendbuf,(count)*MPI_sizeof(datatype)))
822: #define MPI_Scan(sendbuf, recvbuf,count,datatype,op,comm) \
823:      (MPIUNI_ARG(op),\
824:       MPIUNI_ARG(comm),\
825:       MPIUNI_Memcpy(recvbuf,sendbuf,(count)*MPI_sizeof(datatype)))
826: #define MPI_Exscan(sendbuf,recvbuf,count,datatype,op,comm) \
827:      (MPIUNI_ARG(sendbuf),\
828:       MPIUNI_ARG(recvbuf),\
829:       MPIUNI_ARG(count),\
830:       MPIUNI_ARG(datatype),\
831:       MPIUNI_ARG(op),\
832:       MPIUNI_ARG(comm),\
833:       MPI_SUCCESS)
834: #define MPI_Reduce_scatter(sendbuf,recvbuf,recvcounts,datatype,op,comm) \
835:      (MPIUNI_ARG(op),\
836:       MPIUNI_ARG(comm),\
837:       MPIUNI_Memcpy(recvbuf,sendbuf,(*recvcounts)*MPI_sizeof(datatype)))
838: #define MPI_Op_create(function,commute,op) \
839:      (MPIUNI_ARG(function),\
840:       MPIUNI_ARG(commute),\
841:       MPIUNI_ARG(op),\
842:       MPI_SUCCESS)
843: #define MPI_Op_free(op) \
844:      (*(op) = MPI_OP_NULL, MPI_SUCCESS)

846: #define MPI_Group_size(group,size) \
847:   (MPIUNI_ARG(group),\
848:    *(size)=1,\
849:    MPI_SUCCESS)
850: #define MPI_Group_rank(group,rank) \
851:   (MPIUNI_ARG(group),\
852:    *(rank)=0,\
853:    MPI_SUCCESS)
854: #define MPI_Group_translate_ranks(group1,n,ranks1,group2,ranks2) \
855:      (MPIUNI_ARG(group1),\
856:       MPIUNI_ARG(group2),\
857:       MPIUNI_Memcpy((ranks2),(ranks1),(n)*sizeof(int)))
858: #define MPI_Group_compare(group1,group2,result) \
859:     (MPIUNI_ARG(group1),\
860:      MPIUNI_ARG(group2),\
861:      *(result)=1,\
862:      MPI_SUCCESS)
863: #define MPI_Group_union(group1,group2,newgroup) MPI_SUCCESS
864: #define MPI_Group_intersection(group1,group2,newgroup) MPI_SUCCESS
865: #define MPI_Group_difference(group1,group2,newgroup) MPI_SUCCESS
866: #define MPI_Group_excl(group,n,ranks,newgroup) MPI_SUCCESS
867: #define MPI_Group_range_incl(group,n,ranges,newgroup) MPI_SUCCESS
868: #define MPI_Group_range_excl(group,n,ranges,newgroup) MPI_SUCCESS
869: #define MPI_Group_free(group) \
870:      (*(group) = MPI_GROUP_NULL, MPI_SUCCESS)

872: #define MPI_Comm_compare(comm1,comm2,result) \
873:      (MPIUNI_ARG(comm1),\
874:       MPIUNI_ARG(comm2),\
875:       *(result)=MPI_IDENT,\
876:       MPI_SUCCESS)
877: #define MPI_Comm_split(comm,color,key,newcomm) \
878:      (MPIUNI_ARG(color),\
879:       MPIUNI_ARG(key),\
880:       MPI_Comm_dup(comm,newcomm))
881: #define MPI_Comm_split_type(comm,color,key,info,newcomm) \
882:      (MPIUNI_ARG(color),\
883:       MPIUNI_ARG(key),\
884:       MPIUNI_ARG(info),\
885:       MPI_Comm_dup(comm,newcomm))
886: #define MPI_Comm_test_inter(comm,flag) (*(flag)=1, MPI_SUCCESS)
887: #define MPI_Comm_remote_size(comm,size) (*(size)=1 ,MPI_SUCCESS)
888: #define MPI_Comm_remote_group(comm,group) MPI_SUCCESS
889: #define MPI_Intercomm_create(local_comm,local_leader,peer_comm,\
890:      remote_leader,tag,newintercomm) MPI_SUCCESS
891: #define MPI_Intercomm_merge(intercomm,high,newintracomm) MPI_SUCCESS
892: #define MPI_Topo_test(comm,flag) MPI_SUCCESS
893: #define MPI_Cart_create(comm_old,ndims,dims,periods,\
894:      reorder,comm_cart) MPIUni_Abort(MPI_COMM_WORLD,0)
895: #define MPI_Dims_create(nnodes,ndims,dims) MPIUni_Abort(MPI_COMM_WORLD,0)
896: #define MPI_Graph_create(comm,a,b,c,d,e) MPIUni_Abort(MPI_COMM_WORLD,0)
897: #define MPI_Graphdims_Get(comm,nnodes,nedges) MPIUni_Abort(MPI_COMM_WORLD,0)
898: #define MPI_Graph_get(comm,a,b,c,d) MPIUni_Abort(MPI_COMM_WORLD,0)
899: #define MPI_Cartdim_get(comm,ndims) MPIUni_Abort(MPI_COMM_WORLD,0)
900: #define MPI_Cart_get(comm,maxdims,dims,periods,coords) \
901:      MPIUni_Abort(MPI_COMM_WORLD,0)
902: #define MPI_Cart_rank(comm,coords,rank) MPIUni_Abort(MPI_COMM_WORLD,0)
903: #define MPI_Cart_coords(comm,rank,maxdims,coords) \
904:      MPIUni_Abort(MPI_COMM_WORLD,0)
905: #define MPI_Graph_neighbors_count(comm,rank,nneighbors) \
906:      MPIUni_Abort(MPI_COMM_WORLD,0)
907: #define MPI_Graph_neighbors(comm,rank,maxneighbors,neighbors) \
908:      MPIUni_Abort(MPI_COMM_WORLD,0)
909: #define MPI_Cart_shift(comm,direction,disp,rank_source,rank_dest) \
910:      MPIUni_Abort(MPI_COMM_WORLD,0)
911: #define MPI_Cart_sub(comm,remain_dims,newcomm) MPIUni_Abort(MPI_COMM_WORLD,0)
912: #define MPI_Cart_map(comm,ndims,dims,periods,newrank) MPIUni_Abort(MPI_COMM_WORLD,0)
913: #define MPI_Graph_map(comm,a,b,c,d) MPIUni_Abort(MPI_COMM_WORLD,0)

915: #define MPI_Get_processor_name(name,result_len)                         \
916:      (*(result_len) = 9,MPIUNI_Memcpy(name,"localhost",10*sizeof(char)))
917: #define MPI_Errhandler_create(function,errhandler) \
918:      (MPIUNI_ARG(function),\
919:       *(errhandler) = MPI_ERRORS_RETURN,\
920:       MPI_SUCCESS)
921: #define MPI_Errhandler_set(comm,errhandler) \
922:      (MPIUNI_ARG(comm),\
923:       MPIUNI_ARG(errhandler),\
924:       MPI_SUCCESS)
925: #define MPI_Errhandler_get(comm,errhandler) \
926:      (MPIUNI_ARG(comm),\
927:       (*errhandler) = MPI_ERRORS_RETURN,\
928:       MPI_SUCCESS)
929: #define MPI_Errhandler_free(errhandler) \
930:      (*(errhandler) = MPI_ERRHANDLER_NULL,\
931:       MPI_SUCCESS)
932: #define MPI_Error_string(errorcode,string,result_len) \
933:      (MPIUNI_ARG(errorcode),\
934:       *(result_len) = 9,\
935:       MPIUNI_Memcpy(string,"MPI error",10*sizeof(char)))
936: #define MPI_Error_class(errorcode,errorclass) \
937:      (*(errorclass) = errorcode, MPI_SUCCESS)
938: #define MPI_Wtick() 1.0
939: #define MPI_Pcontrol(level) MPI_SUCCESS

941: /* MPI-IO additions */

943: typedef int MPI_File;
944: #define MPI_FILE_NULL 0

946: typedef int MPI_Offset;

948: #define MPI_MODE_RDONLY  0
949: #define MPI_MODE_WRONLY  0
950: #define MPI_MODE_CREATE  0

952: #define MPI_File_open(comm,filename,amode,info,mpi_fh) \
953:   (MPIUNI_ARG(comm),\
954:    MPIUNI_ARG(filename),\
955:    MPIUNI_ARG(amode),\
956:    MPIUNI_ARG(info),\
957:    MPIUNI_ARG(mpi_fh),\
958:    MPIUni_Abort(MPI_COMM_WORLD,0))

960: #define MPI_File_close(mpi_fh) \
961:   (MPIUNI_ARG(mpi_fh),\
962:    MPIUni_Abort(MPI_COMM_WORLD,0))

964: #define MPI_File_set_view(mpi_fh,disp,etype,filetype,datarep,info) \
965:   (MPIUNI_ARG(mpi_fh),\
966:    MPIUNI_ARG(disp),\
967:    MPIUNI_ARG(etype),\
968:    MPIUNI_ARG(filetype),\
969:    MPIUNI_ARG(datarep),\
970:    MPIUNI_ARG(info),\
971:    MPIUni_Abort(MPI_COMM_WORLD,0))

973: #define MPI_File_write_all(mpi_fh,buf,count,datatype,status) \
974:   (MPIUNI_ARG(mpi_fh),\
975:    MPIUNI_ARG(buf),\
976:    MPIUNI_ARG(count),\
977:    MPIUNI_ARG(datatype),\
978:    MPIUNI_ARG(status),\
979:    MPIUni_Abort(MPI_COMM_WORLD,0))

981: #define MPI_File_read_all(mpi_fh,buf,count,datatype,status) \
982:   (MPIUNI_ARG(mpi_fh),\
983:    MPIUNI_ARG(buf),\
984:    MPIUNI_ARG(count),\
985:    MPIUNI_ARG(datatype),\
986:    MPIUNI_ARG(status),\
987:    MPIUni_Abort(MPI_COMM_WORLD,0))

989:   /* called from PetscInitialize() - so return success */
990: #define MPI_Register_datarep(name,read_conv_fn,write_conv_fn,extent_fn,state) \
991:   (MPIUNI_ARG(name),\
992:    MPIUNI_ARG(read_conv_fn),\
993:    MPIUNI_ARG(write_conv_fn),\
994:    MPIUNI_ARG(extent_fn),\
995:    MPIUNI_ARG(state),\
996:    MPI_SUCCESS)

998: #define MPI_Type_create_subarray(ndims,array_of_sizes,array_of_subsizes,array_of_starts,order,oldtype,newtype) \
999:   (MPIUNI_ARG(ndims),\
1000:    MPIUNI_ARG(array_of_sizes),\
1001:    MPIUNI_ARG(array_of_subsizes),\
1002:    MPIUNI_ARG(array_of_starts),\
1003:    MPIUNI_ARG(order),\
1004:    MPIUNI_ARG(oldtype),\
1005:    MPIUNI_ARG(newtype),\
1006:    MPIUni_Abort(MPI_COMM_WORLD,0))

1008: #define MPI_Type_create_resized(oldtype,lb,extent,newtype) \
1009:   (MPIUNI_ARG(oldtype),\
1010:    MPIUNI_ARG(lb),\
1011:    MPIUNI_ARG(extent),\
1012:    MPIUNI_ARG(newtype),\
1013:    MPIUni_Abort(MPI_COMM_WORLD,0))

1015: #define MPI_Type_create_indexed_block(count,blocklength,array_of_displacements,oldtype,newtype) \
1016:   (MPIUNI_ARG(count),\
1017:    MPIUNI_ARG(blocklength),\
1018:    MPIUNI_ARG(array_of_displacements),\
1019:    MPIUNI_ARG(oldtype),\
1020:    MPIUNI_ARG(newtype),\
1021:    MPIUni_Abort(MPI_COMM_WORLD,0))

1023: #if defined(__cplusplus)
1024: }
1025: #endif
1026: #endif