Date: 2015-10-02T22:01:15+00:00

Actual source code: mpi.h
petsc-3.6.2 2015-10-02
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:     Instructions for building standalone MPIUNI [for eg: linux/gcc+gfortran]:
     93:     - extract include/mpiuni/mpi.h,mpif.f, src/sys/mpiuni/mpi.c from PETSc
     94:     - remove reference to petscconf.h from mpi.h
     95:     - gcc -c mpi.c -DPETSC_HAVE_STDLIB_H -DPETSC_HAVE_FORTRAN_UNDERSCORE
     96:     - ar cr libmpiuni.a mpi.o

     98: */

    103: /* Requred by abort() in mpi.c & for win64 */
    104: #include <petscconf.h>

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

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

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

    130: #if defined(__cplusplus)
    131: extern "C" {
    132: #endif

    134: /* require an int variable large enough to hold a pointer */
    135: #if (PETSC_SIZEOF_LONG == PETSC_SIZEOF_VOID_P)
    136: typedef long MPIUNI_INTPTR;
    137: #elif (PETSC_SIZEOF_SIZE_T == PETSC_SIZEOF_VOID_P)
    138: typedef size_t MPIUNI_INTPTR;
    139: #else
    140: typedef unknownuniptr MPIUNI_INTPTR;
    141: #endif

    143: /*

    145:     MPIUNI_TMP is used in the macros below only to stop various C/C++ compilers
    146: from generating warning messages about unused variables while compiling PETSc.
    147: */
    148: MPIUni_PETSC_EXTERN void *MPIUNI_TMP;

    150: #define MPI_COMM_SELF        1
    151: #define MPI_COMM_WORLD       2
    152: #define MPI_COMM_NULL        0
    153: #define MPI_SUCCESS          0
    154: #define MPI_IDENT            0
    155: #define MPI_CONGRUENT        1
    156: #define MPI_SIMILAR          2
    157: #define MPI_UNEQUAL          3
    158: #define MPI_ANY_SOURCE     (-2)
    159: #define MPI_KEYVAL_INVALID   0
    160: #define MPI_ERR_UNKNOWN     18
    161: #define MPI_ERR_INTERN      21
    162: #define MPI_ERR_OTHER        1
    163: #define MPI_TAG_UB           0
    164: #define MPI_ERRORS_RETURN    0
    165: #define MPI_UNDEFINED      (-32766)
    166: #define MPI_ERRORS_ARE_FATAL (-32765)
    167: #define MPI_MAXLOC           5
    168: #define MPI_MINLOC           6

    171: /* External types */
    172: typedef int    MPI_Comm;
    173: typedef void   *MPI_Request;
    174: typedef void   *MPI_Group;
    175: typedef struct {int MPI_TAG,MPI_SOURCE,MPI_ERROR;} MPI_Status;
    176: typedef char   *MPI_Errhandler;
    177: typedef int    MPI_Fint;
    178: typedef int    MPI_File;
    179: typedef int    MPI_Info;
    180: typedef int    MPI_Offset;

    183: /* In order to handle datatypes, we make them into "sizeof(raw-type)";
    184:     this allows us to do the MPIUNI_Memcpy's easily */
    185: #define MPI_Datatype         int
    186: #define MPI_FLOAT            (1 << 16 | sizeof(float))
    187: #define MPI_DOUBLE           (1 << 16 | sizeof(double))
    188: #define MPI_LONG_DOUBLE      (1 << 16 | sizeof(long double))

    190: #define MPI_COMPLEX          (2 << 16 | 2*sizeof(float))
    191: #define MPI_C_COMPLEX        (2 << 16 | 2*sizeof(float))
    192: #define MPI_C_DOUBLE_COMPLEX (2 << 16 | 2*sizeof(double))

    194: #define MPI_CHAR             (3 << 16 | sizeof(char))
    195: #define MPI_BYTE             (3 << 16 | sizeof(char))
    196: #define MPI_UNSIGNED_CHAR    (3 << 16 | sizeof(unsigned char))

    198: #define MPI_INT              (4 << 16 | sizeof(int))
    199: #define MPI_LONG             (4 << 16 | sizeof(long))
    200: #define MPI_LONG_LONG_INT    (4 << 16 | sizeof(long long))
    201: #define MPI_SHORT            (4 << 16 | sizeof(short))

    203: #define MPI_UNSIGNED_SHORT   (5 << 16 | sizeof(unsigned short))
    204: #define MPI_UNSIGNED         (5 << 16 | sizeof(unsigned))
    205: #define MPI_UNSIGNED_LONG    (5 << 16 | sizeof(unsigned long))
    206: #define MPI_UNSIGNED_LONG_LONG (5 << 16 | sizeof(unsigned long long))

    208: #define MPI_FLOAT_INT        (10 << 16 | (sizeof(float) + sizeof(int)))
    209: #define MPI_DOUBLE_INT       (11 << 16 | (sizeof(double) + sizeof(int)))
    210: #define MPI_LONG_INT         (12 << 16 | (sizeof(long) + sizeof(int)))
    211: #define MPI_SHORT_INT        (13 << 16 | (sizeof(short) + sizeof(int)))
    212: #define MPI_2INT             (14 << 16 | (2* sizeof(int)))

    214: #if defined(PETSC_USE_REAL___FLOAT128)
    215: extern MPI_Datatype MPIU___FLOAT128;
    216: #define MPI_sizeof(datatype) ((datatype == MPIU___FLOAT128) ? 2*sizeof(double) : (datatype) & 0xff)
    217: #else
    218: #define MPI_sizeof(datatype) ((datatype) & 0xff)
    219: #endif
    220: MPIUni_PETSC_EXTERN int MPIUNI_Memcpy(void*,const void*,int);

    222: #define MPI_MAX_PROCESSOR_NAME 1024

    224: #define MPI_REQUEST_NULL     ((MPI_Request)0)
    225: #define MPI_GROUP_NULL       ((MPI_Group)0)
    226: #define MPI_INFO_NULL        ((MPI_Info)0)
    227: #define MPI_BOTTOM           (void *)0
    228: typedef int MPI_Op;

    230: #define MPI_MODE_RDONLY   0
    231: #define MPI_MODE_WRONLY   0
    232: #define MPI_MODE_CREATE   0

    234: #define MPI_SUM           1
    235: #define MPI_MAX           2
    236: #define MPI_MIN           3
    237: #define MPI_REPLACE       4
    238: #define MPI_PROD          5
    239: #define MPI_LAND          6
    240: #define MPI_BAND          7
    241: #define MPI_LOR           8
    242: #define MPI_BOR           9
    243: #define MPI_LXOR          10
    244: #define MPI_BXOR          11
    245: #define MPI_ANY_TAG     (-1)
    246: #define MPI_DATATYPE_NULL 0
    247: #define MPI_PACKED        0
    248: #define MPI_MAX_ERROR_STRING 2056
    249: #define MPI_STATUS_IGNORE (MPI_Status *)1
    250: #define MPI_STATUSES_IGNORE (MPI_Status *)1
    251: #define MPI_ORDER_FORTRAN        57
    252: #define MPI_IN_PLACE      (void *) -1

    254: /*
    255:   Prototypes of some functions which are implemented in mpi.c
    256: */
    257: typedef int   (MPI_Copy_function)(MPI_Comm,int,void *,void *,void *,int *);
    258: typedef int   (MPI_Delete_function)(MPI_Comm,int,void *,void *);
    259: typedef void  (MPI_User_function)(void*, void *, int *, MPI_Datatype *);

    261: /*
    262:   In order that the PETSc MPIUNI can be used with another package that has its
    263:   own MPIUni we map the following function names to a unique PETSc name. Those functions
    264:   are defined in mpi.c and put into the libpetscsys.a or libpetsc.a library.

    266:   Note that this does not work for the MPIUni Fortran symbols which are explicitly in the
    267:   PETSc libraries unless the flag MPIUNI_AVOID_MPI_NAMESPACE is set.
    268: */
    269: #define MPI_Abort         Petsc_MPI_Abort
    270: #define MPI_Attr_get      Petsc_MPI_Attr_get
    271: #define MPI_Keyval_free   Petsc_MPI_Keyval_free
    272: #define MPI_Attr_put      Petsc_MPI_Attr_put
    273: #define MPI_Attr_delete   Petsc_MPI_Attr_delete
    274: #define MPI_Keyval_create Petsc_MPI_Keyval_create
    275: #define MPI_Comm_free     Petsc_MPI_Comm_free
    276: #define MPI_Comm_dup      Petsc_MPI_Comm_dup
    277: #define MPI_Comm_create   Petsc_MPI_Comm_create
    278: #define MPI_Init          Petsc_MPI_Init
    279: #define MPI_Finalize      Petsc_MPI_Finalize
    280: #define MPI_Initialized   Petsc_MPI_Initialized
    281: #define MPI_Finalized     Petsc_MPI_Finalized
    282: #define MPI_Comm_size     Petsc_MPI_Comm_size
    283: #define MPI_Comm_rank     Petsc_MPI_Comm_rank
    284: #define MPI_Wtime         Petsc_MPI_Wtime

    286: /* identical C bindings */
    287: #define MPI_Comm_create_keyval Petsc_MPI_Keyval_create
    288: #define MPI_Comm_free_keyval   Petsc_MPI_Keyval_free
    289: #define MPI_Comm_get_attr      Petsc_MPI_Attr_get
    290: #define MPI_Comm_set_attr      Petsc_MPI_Attr_put

    292: MPIUni_PETSC_EXTERN int    MPI_Abort(MPI_Comm,int);
    293: MPIUni_PETSC_EXTERN int    MPI_Attr_get(MPI_Comm comm,int keyval,void *attribute_val,int *flag);
    294: MPIUni_PETSC_EXTERN int    MPI_Keyval_free(int*);
    295: MPIUni_PETSC_EXTERN int    MPI_Attr_put(MPI_Comm,int,void *);
    296: MPIUni_PETSC_EXTERN int    MPI_Attr_delete(MPI_Comm,int);
    297: MPIUni_PETSC_EXTERN int    MPI_Keyval_create(MPI_Copy_function *,MPI_Delete_function *,int *,void *);
    298: MPIUni_PETSC_EXTERN int    MPI_Comm_free(MPI_Comm*);
    299: MPIUni_PETSC_EXTERN int    MPI_Comm_dup(MPI_Comm,MPI_Comm *);
    300: MPIUni_PETSC_EXTERN int    MPI_Comm_create(MPI_Comm,MPI_Group,MPI_Comm *);
    301: MPIUni_PETSC_EXTERN int    MPI_Init(int *, char ***);
    302: MPIUni_PETSC_EXTERN int    MPI_Finalize(void);
    303: MPIUni_PETSC_EXTERN int    MPI_Initialized(int*);
    304: MPIUni_PETSC_EXTERN int    MPI_Finalized(int*);
    305: MPIUni_PETSC_EXTERN int    MPI_Comm_size(MPI_Comm,int*);
    306: MPIUni_PETSC_EXTERN int    MPI_Comm_rank(MPI_Comm,int*);
    307: MPIUni_PETSC_EXTERN double MPI_Wtime(void);

    309: #define MPI_Aint MPIUNI_INTPTR
    310: /*
    311:     Routines we have replace with macros that do nothing
    312:     Some return error codes others return success
    313: */

    315: #define MPI_Comm_f2c(comm) (MPI_Comm)(comm)
    316: #define MPI_Comm_c2f(comm) (MPI_Fint)(comm)
    317: #define MPI_Type_f2c(type) (MPI_Datatype)(type)
    318: #define MPI_Type_c2f(type) (MPI_Fint)(type)
    319: #define MPI_Op_c2f(op) (MPI_Fint)(op)

    321: #define MPI_Send(buf,count,datatype,dest,tag,comm)  \
    322:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
    323:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    324:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    325:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
    326:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
    327:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    328:       MPI_Abort(MPI_COMM_WORLD,0))
    329: #define MPI_Recv(buf,count,datatype,source,tag,comm,status) \
    330:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
    331:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    332:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    333:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (source),\
    334:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
    335:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    336:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (status),\
    337:       MPI_Abort(MPI_COMM_WORLD,0))
    338: #define MPI_Get_count(status, datatype,count) \
    339:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (status),\
    340:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    341:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    342:       MPI_Abort(MPI_COMM_WORLD,0))
    343: #define MPI_Bsend(buf,count,datatype,dest,tag,comm)  \
    344:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
    345:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    346:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    347:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
    348:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
    349:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    350:       MPI_Abort(MPI_COMM_WORLD,0))
    351: #define MPI_Ssend(buf,count, datatype,dest,tag,comm) \
    352:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
    353:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    354:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    355:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
    356:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
    357:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    358:       MPI_Abort(MPI_COMM_WORLD,0))
    359: #define MPI_Rsend(buf,count, datatype,dest,tag,comm) \
    360:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
    361:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    362:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    363:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
    364:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
    365:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    366:       MPI_Abort(MPI_COMM_WORLD,0))
    367: #define MPI_Buffer_attach(buffer,size) \
    368:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buffer),\
    369:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (size),\
    370:       MPI_SUCCESS)
    371: #define MPI_Buffer_detach(buffer,size)\
    372:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buffer),\
    373:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (size),\
    374:       MPI_SUCCESS)
    375: #define MPI_Ibsend(buf,count, datatype,dest,tag,comm,request) \
    376:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
    377:        MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    378:        MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    379:        MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
    380:        MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
    381:        MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    382:        MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
    383:        MPI_Abort(MPI_COMM_WORLD,0))
    384: #define MPI_Issend(buf,count, datatype,dest,tag,comm,request) \
    385:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
    386:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    387:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    388:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
    389:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
    390:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    391:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
    392:       MPI_Abort(MPI_COMM_WORLD,0))
    393: #define MPI_Irsend(buf,count, datatype,dest,tag,comm,request) \
    394:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
    395:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    396:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    397:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
    398:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
    399:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    400:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
    401:       MPI_Abort(MPI_COMM_WORLD,0))
    402: #define MPI_Irecv(buf,count, datatype,source,tag,comm,request) \
    403:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
    404:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    405:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    406:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (source),\
    407:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
    408:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    409:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
    410:       MPI_Abort(MPI_COMM_WORLD,0))
    411: #define MPI_Isend(buf,count, datatype,dest,tag,comm,request) \
    412:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
    413:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    414:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    415:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
    416:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
    417:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    418:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
    419:       MPI_Abort(MPI_COMM_WORLD,0))
    420: #define MPI_Wait(request,status) \
    421:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
    422:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (status),\
    423:       MPI_SUCCESS)
    424: #define MPI_Test(request,flag,status) \
    425:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
    426:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (status),\
    427:       *(flag) = 0, \
    428:       MPI_SUCCESS)
    429: #define MPI_Request_free(request) \
    430:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
    431:       MPI_SUCCESS)
    432: #define MPI_Waitany(a,b,c,d) \
    433:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (a),\
    434:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (b),\
    435:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (c),\
    436:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (d),(*c = 0), \
    437:       MPI_SUCCESS)
    438: #define MPI_Testany(a,b,c,d,e) \
    439:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (a),\
    440:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (b),\
    441:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (c),\
    442:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (d),\
    443:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (e),\
    444:       MPI_SUCCESS)
    445: #define MPI_Waitall(count,array_of_requests,array_of_statuses) \
    446:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    447:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_requests),\
    448:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_statuses),\
    449:       MPI_SUCCESS)
    450: #define MPI_Testall(count,array_of_requests,flag,array_of_statuses) \
    451:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    452:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_requests),\
    453:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (flag),\
    454:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_statuses),\
    455:       MPI_SUCCESS)
    456: #define MPI_Waitsome(incount,array_of_requests,outcount,\
    457:                      array_of_indices,array_of_statuses) \
    458:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (incount),\
    459:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_requests),\
    460:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (outcount),\
    461:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_indices),\
    462:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_statuses),\
    463:       MPI_SUCCESS)
    464: #define MPI_Comm_group(comm,group) \
    465:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    466:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (group),\
    467:       MPI_SUCCESS)
    468: #define MPI_Group_incl(group,n,ranks,newgroup) \
    469:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (group),\
    470:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (n),\
    471:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (ranks),\
    472:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (newgroup),\
    473:       MPI_SUCCESS)
    474: #define MPI_Testsome(incount,array_of_requests,outcount,\
    475:                      array_of_indices,array_of_statuses) MPI_SUCCESS
    476: #define MPI_Iprobe(source,tag,comm,flag,status) (*(flag)=0, MPI_SUCCESS)
    477: #define MPI_Probe(source,tag,comm,status) MPI_SUCCESS
    478: #define MPI_Cancel(request) (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),MPI_SUCCESS)
    479: #define MPI_Test_cancelled(status,flag) (*(flag)=0,MPI_SUCCESS)
    480: #define MPI_Send_init(buf,count, datatype,dest,tag,comm,request) \
    481:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
    482:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    483:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    484:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
    485:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
    486:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    487:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
    488:      MPI_SUCCESS)
    489: #define MPI_Bsend_init(buf,count, datatype,dest,tag,comm,request) \
    490:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
    491:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    492:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    493:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
    494:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
    495:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    496:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
    497:      MPI_SUCCESS)
    498: #define MPI_Ssend_init(buf,count, datatype,dest,tag,comm,request) \
    499:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
    500:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    501:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    502:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
    503:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
    504:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    505:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
    506:      MPI_SUCCESS)
    507: #define MPI_Bsend_init(buf,count, datatype,dest,tag,comm,request) \
    508:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
    509:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    510:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    511:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
    512:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
    513:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    514:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
    515:      MPI_SUCCESS)
    516: #define MPI_Rsend_init(buf,count, datatype,dest,tag,comm,request) \
    517:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
    518:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    519:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    520:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
    521:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
    522:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    523:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
    524:      MPI_SUCCESS)
    525: #define MPI_Recv_init(buf,count, datatype,source,tag,comm,request) \
    526:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
    527:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    528:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    529:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (source),\
    530:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
    531:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    532:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
    533:      MPI_SUCCESS)
    534: #define MPI_Start(request) (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),MPI_SUCCESS)
    535: #define MPI_Startall(count,array_of_requests) \
    536:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    537:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_requests),\
    538:      MPI_SUCCESS)
    539: #define MPI_Op_create(function,commute,op) \
    540:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (function),\
    541:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (commute),\
    542:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (op),\
    543:      MPI_SUCCESS)
    544: #define MPI_Op_free(op) \
    545:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (op),\
    546:      MPI_SUCCESS)
    547:      /* Need to determine sizeof "sendtype" */
    548: #define MPI_Sendrecv(sendbuf,sendcount, sendtype,\
    549:      dest,sendtag,recvbuf,recvcount,\
    550:      recvtype,source,recvtag,\
    551:      comm,status) \
    552:   MPIUNI_Memcpy(recvbuf,sendbuf,(sendcount) * MPI_sizeof(sendtype))
    553: #define MPI_Sendrecv_replace(buf,count, datatype,dest,sendtag,\
    554:      source,recvtag,comm,status) MPI_SUCCESS
    555: #define MPI_Type_contiguous(count, oldtype,newtype) \
    556:      (*(newtype) = (count)*(oldtype),MPI_SUCCESS)
    557: #define MPI_Type_vector(count,blocklength,stride,oldtype, newtype) MPI_SUCCESS
    558: #define MPI_Type_hvector(count,blocklength,stride,oldtype, newtype) MPI_SUCCESS
    559: #define MPI_Type_indexed(count,array_of_blocklengths,\
    560:      array_of_displacements, oldtype,\
    561:      newtype) MPI_SUCCESS
    562: #define MPI_Type_hindexed(count,array_of_blocklengths,\
    563:      array_of_displacements, oldtype,\
    564:      newtype) MPI_SUCCESS
    565: #define MPI_Type_struct(count,array_of_blocklengths,\
    566:      array_of_displacements,\
    567:      array_of_types, newtype) \
    568:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    569:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_blocklengths),\
    570:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_displacements),\
    571:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_types),\
    572:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (newtype),\
    573:       MPI_SUCCESS)
    574: #define MPI_Address(location,address) \
    575:      (*(address) = (MPIUNI_INTPTR)(char *)(location),MPI_SUCCESS)
    576: #define MPI_Type_extent(datatype,extent) *(extent) = datatype
    577: #define MPI_Type_size(datatype,size) (*(size) = (datatype) & 0xff, MPI_SUCCESS)
    578: #define MPI_Type_lb(datatype,displacement) \
    579:      MPI_Abort(MPI_COMM_WORLD,0)
    580: #define MPI_Type_ub(datatype,displacement) \
    581:      MPI_Abort(MPI_COMM_WORLD,0)
    582: #define MPI_Type_commit(datatype) (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    583:      MPI_SUCCESS)
    584: #define MPI_Type_free(datatype) MPI_SUCCESS
    585: #define MPI_Get_elements(status, datatype,count) \
    586:      MPI_Abort(MPI_COMM_WORLD,0)
    587: #define MPI_Pack(inbuf,incount, datatype,outbuf,\
    588:      outsize,position, comm) \
    589:      MPI_Abort(MPI_COMM_WORLD,0)
    590: #define MPI_Unpack(inbuf,insize,position,outbuf,\
    591:      outcount, datatype,comm) \
    592:      MPI_Abort(MPI_COMM_WORLD,0)
    593: #define MPI_Pack_size(incount, datatype,comm,size) \
    594:      MPI_Abort(MPI_COMM_WORLD,0)
    595: #define MPI_Barrier(comm) \
    596:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    597:      MPI_SUCCESS)
    598: #define MPI_Bcast(buffer,count,datatype,root,comm) \
    599:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buffer),\
    600:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
    601:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
    602:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (root),\
    603:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    604:      MPI_SUCCESS)
    605: #define MPI_Gather(sendbuf,sendcount, sendtype,\
    606:      recvbuf,recvcount, recvtype,\
    607:      root,comm) \
    608:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvcount),\
    609:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (root),\
    610:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvtype),\
    611:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    612:      MPIUNI_Memcpy(recvbuf,sendbuf,(sendcount)*MPI_sizeof(sendtype)),\
    613:      MPI_SUCCESS)
    614: #define MPI_Gatherv(sendbuf,sendcount, sendtype,\
    615:      recvbuf,recvcounts,displs,\
    616:      recvtype,root,comm) \
    617:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvcounts),\
    618:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (displs),\
    619:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvtype),\
    620:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (root),\
    621:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    622:      MPIUNI_Memcpy(recvbuf,sendbuf,(sendcount)*MPI_sizeof(sendtype)),\
    623:      MPI_SUCCESS)
    624: #define MPI_Scatter(sendbuf,sendcount, sendtype,\
    625:      recvbuf,recvcount, recvtype,\
    626:      root,comm) \
    627:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (sendbuf),\
    628:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (sendcount),\
    629:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (sendtype),\
    630:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvbuf),\
    631:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvcount),\
    632:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvtype),\
    633:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (root),\
    634:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),MPI_Abort(MPI_COMM_WORLD,0))
    635: #define MPI_Scatterv(sendbuf,sendcounts,displs,\
    636:      sendtype, recvbuf,recvcount,\
    637:      recvtype,root,comm) \
    638:      (MPIUNI_Memcpy(recvbuf,sendbuf,(recvcount)*MPI_sizeof(recvtype)),\
    639:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (displs),\
    640:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (sendtype),\
    641:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (sendcounts),\
    642:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (root),\
    643:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    644:      MPI_SUCCESS)
    645: #define MPI_Allgather(sendbuf,sendcount, sendtype,\
    646:      recvbuf,recvcount, recvtype,comm) \
    647:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvcount),\
    648:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvtype),\
    649:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    650:      MPIUNI_Memcpy(recvbuf,sendbuf,(sendcount)*MPI_sizeof(sendtype)),\
    651:      MPI_SUCCESS)
    652: #define MPI_Allgatherv(sendbuf,sendcount, sendtype,\
    653:      recvbuf,recvcounts,displs,recvtype,comm) \
    654:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvcounts),\
    655:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (displs),\
    656:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvtype),\
    657:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    658:      MPIUNI_Memcpy((recvbuf),(sendbuf),(sendcount)*MPI_sizeof(sendtype)), \
    659:      MPI_SUCCESS)
    660: #define MPI_Alltoall(sendbuf,sendcount, sendtype,\
    661:      recvbuf,recvcount, recvtype,comm) \
    662:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvcount),\
    663:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvtype),\
    664:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    665:       MPIUNI_Memcpy(recvbuf,sendbuf,(sendcount)*MPI_sizeof(sendtype)),\
    666:       MPI_SUCCESS)
    667: #define MPI_Alltoallv(sendbuf,sendcounts,sdispls,\
    668:      sendtype, recvbuf,recvcounts,\
    669:      rdispls, recvtype,comm) MPI_Abort(MPI_COMM_WORLD,0)
    670: #define MPI_Alltoallw(sendbuf,sendcounts,sdispls,\
    671:      sendtypes, recvbuf,recvcounts,\
    672:      rdispls, recvtypes,comm) MPI_Abort(MPI_COMM_WORLD,0)
    673: #define MPI_Reduce(sendbuf, recvbuf,count,\
    674:      datatype,op,root,comm) \
    675:      (MPIUNI_Memcpy(recvbuf,sendbuf,(count)*MPI_sizeof(datatype)),\
    676:       MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),MPI_SUCCESS)
    677: #define MPI_Allreduce(sendbuf, recvbuf,count,datatype,op,comm) \
    678:     (MPIUNI_Memcpy(recvbuf,sendbuf,(count)*MPI_sizeof(datatype)), \
    679:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),MPI_SUCCESS)
    680: #define MPI_Scan(sendbuf, recvbuf,count,datatype,op,comm) \
    681:      (MPIUNI_Memcpy(recvbuf,sendbuf,(count)*MPI_sizeof(datatype)),\
    682:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),MPI_SUCCESS)
    683: #define MPI_Exscan(sendbuf, recvbuf,count,datatype,op,comm) MPI_SUCCESS
    684: #define MPI_Reduce_scatter(sendbuf, recvbuf,recvcounts,\
    685:      datatype,op,comm) \
    686:      MPI_Abort(MPI_COMM_WORLD,0)
    687: #define MPI_Group_size(group,size) (*(size)=1,MPI_SUCCESS)
    688: #define MPI_Group_rank(group,rank) (*(rank)=0,MPI_SUCCESS)
    689: #define MPI_Group_translate_ranks(group1,n,ranks1,group2,ranks2) \
    690:   (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (group1),                 \
    691:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (group2),                 \
    692:    MPIUNI_Memcpy((ranks2),(ranks1),(n) * sizeof(int)),           \
    693:    MPI_SUCCESS)
    694: #define MPI_Group_compare(group1,group2,result) \
    695:      (*(result)=1,MPI_SUCCESS)
    696: #define MPI_Group_union(group1,group2,newgroup) MPI_SUCCESS
    697: #define MPI_Group_intersection(group1,group2,newgroup) MPI_SUCCESS
    698: #define MPI_Group_difference(group1,group2,newgroup) MPI_SUCCESS
    699: #define MPI_Group_excl(group,n,ranks,newgroup) MPI_SUCCESS
    700: #define MPI_Group_range_incl(group,n,ranges,newgroup) MPI_SUCCESS
    701: #define MPI_Group_range_excl(group,n,ranges,newgroup) MPI_SUCCESS
    702: #define MPI_Group_free(group) \
    703:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (group),\
    704:      MPI_SUCCESS)
    705: #define MPI_Comm_compare(comm1,comm2,result) \
    706:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm1),\
    707:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm2),\
    708:      *(result)=MPI_IDENT,\
    709:      MPI_SUCCESS)
    710: #define MPI_Comm_split(comm,color,key,newcomm) \
    711:   (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (color),\
    712:   MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (key),\
    713:    MPI_Comm_dup(comm,newcomm))
    714: #define MPI_Comm_test_inter(comm,flag) (*(flag)=1,MPI_SUCCESS)
    715: #define MPI_Comm_remote_size(comm,size) (*(size)=1,MPI_SUCCESS)
    716: #define MPI_Comm_remote_group(comm,group) MPI_SUCCESS
    717: #define MPI_Intercomm_create(local_comm,local_leader,peer_comm,\
    718:      remote_leader,tag,newintercomm) MPI_SUCCESS
    719: #define MPI_Intercomm_merge(intercomm,high,newintracomm) MPI_SUCCESS

    721: #define MPI_Topo_test(comm,status) MPI_SUCCESS
    722: #define MPI_Cart_create(comm_old,ndims,dims,periods,\
    723:      reorder,comm_cart) MPI_SUCCESS
    724: #define MPI_Dims_create(nnodes,ndims,dims) MPI_Abort(MPI_COMM_WORLD,0)
    725: #define MPI_Graph_create(comm,a,b,c,d,e) MPI_SUCCESS
    726: #define MPI_Graphdims_Get(comm,nnodes,nedges) MPI_Abort(MPI_COMM_WORLD,0)
    727: #define MPI_Graph_get(comm,a,b,c,d) MPI_Abort(MPI_COMM_WORLD,0)
    728: #define MPI_Cartdim_get(comm,ndims) MPI_Abort(MPI_COMM_WORLD,0)
    729: #define MPI_Cart_get(comm,maxdims,dims,periods,coords) \
    730:      MPI_Abort(MPI_COMM_WORLD,0)
    731: #define MPI_Cart_rank(comm,coords,rank) MPI_Abort(MPI_COMM_WORLD,0)
    732: #define MPI_Cart_coords(comm,rank,maxdims,coords) \
    733:      MPI_Abort(MPI_COMM_WORLD,0)
    734: #define MPI_Graph_neighbors_count(comm,rank,nneighbors) \
    735:      MPI_Abort(MPI_COMM_WORLD,0)
    736: #define MPI_Graph_neighbors(comm,rank,maxneighbors,neighbors) \
    737:      MPI_Abort(MPI_COMM_WORLD,0)
    738: #define MPI_Cart_shift(comm,direction,disp,rank_source,rank_dest) \
    739:      MPI_Abort(MPI_COMM_WORLD,0)
    740: #define MPI_Cart_sub(comm,remain_dims,newcomm) MPI_Abort(MPI_COMM_WORLD,0)
    741: #define MPI_Cart_map(comm,ndims,dims,periods,newrank) MPI_Abort(MPI_COMM_WORLD,0)
    742: #define MPI_Graph_map(comm,a,b,c,d) MPI_Abort(MPI_COMM_WORLD,0)
    743: #define MPI_Get_processor_name(name,result_len) \
    744:      (MPIUNI_Memcpy(name,"localhost",9*sizeof(char)),name[10] = 0,*(result_len) = 10)
    745: #define MPI_Errhandler_create(function,errhandler) (*(errhandler) = (MPI_Errhandler) 0, MPI_SUCCESS)
    746: #define MPI_Errhandler_set(comm,errhandler) \
    747:      (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
    748:      MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (errhandler),\
    749:      MPI_SUCCESS)
    750: #define MPI_Errhandler_get(comm,errhandler) MPI_SUCCESS
    751: #define MPI_Errhandler_free(errhandler) MPI_SUCCESS
    752: #define MPI_Error_string(errorcode,string,result_len) MPI_SUCCESS
    753: #define MPI_Error_class(errorcode,errorclass) MPI_SUCCESS
    754: #define MPI_Wtick() 1.0
    755: #define MPI_Pcontrol(level) MPI_SUCCESS

    757: #define MPI_NULL_COPY_FN   0
    758: #define MPI_NULL_DELETE_FN 0

    760:   /* MPI-IO additions */

    762: #define MPI_File_open(comm,filename,amode,info,mpi_fh) \
    763:   (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),  \
    764:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (filename), \
    765:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (amode), \
    766:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (info), \
    767:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (mpi_fh), \
    768:    MPI_Abort(MPI_COMM_WORLD,0))

    770: #define MPI_File_close(mpi_fh) \
    771:   (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (mpi_fh),  \
    772:    MPI_Abort(MPI_COMM_WORLD,0))

    774: #define MPI_File_set_view(mpi_fh,disp,etype,filetype,datarep,info) \
    775:   (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (mpi_fh),  \
    776:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (disp), \
    777:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (etype), \
    778:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (filetype), \
    779:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datarep), \
    780:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (info), \
    781:    MPI_Abort(MPI_COMM_WORLD,0))

    783: #define MPI_Type_get_extent(datatype,lb,extent) \
    784:   (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),      \
    785:    *(lb) = 0, *(extent) = datatype,0)

    787: #define MPI_File_write_all(mpi_fh,buf,count,datatype,status) \
    788:   (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (mpi_fh),             \
    789:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf), \
    790:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count), \
    791:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype), \
    792:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (status), \
    793:    MPI_Abort(MPI_COMM_WORLD,0))

    795: #define MPI_File_read_all(mpi_fh,buf,count,datatype,status) \
    796:   (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (mpi_fh),            \
    797:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf), \
    798:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count), \
    799:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype), \
    800:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (status), \
    801:    MPI_Abort(MPI_COMM_WORLD,0))

    803:   /* called from PetscInitialize() - so return success */
    804: #define MPI_Register_datarep(name,read_conv_fn,write_conv_fn,extent_fn,state) \
    805:   (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (name),                          \
    806:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (read_conv_fn), \
    807:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (write_conv_fn), \
    808:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (extent_fn), \
    809:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (state), \
    810:    MPI_SUCCESS)

    812: #define MPI_Type_create_subarray(ndims,array_of_sizes,array_of_subsizes,array_of_starts,order,oldtype,newtype) \
    813:   (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (ndims),                         \
    814:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_sizes), \
    815:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_subsizes), \
    816:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_starts), \
    817:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (order), \
    818:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (oldtype), \
    819:    MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (newtype), \
    820:    MPI_Abort(MPI_COMM_WORLD,0))

    822: #if defined(__cplusplus)
    823: }
    824: #endif
    825: #endif