/* This is a C interface library to the Fortran version of a   Partial MPI library based on the Program-to-Program Communications   ToolBox in the Macintosh OS.  No local buffering of messages is   implemented, so that all messages must be received in the order sent,   and receives with wildcard sources are not supported.   the following subroutines are implemented:   MPI_Init, MPI_Finalize, MPI_Send, MPI_Recv, MPI_Isend, MPI_Irecv   MPI_Test, MPI_Wait, MPI_Sendrecv, MPI_Ssend, MPI_Issend, MPI_Waitall   MPI_Waitany, MPI_Get_count, MPI_Initialized, MPI_Comm_size   MPI_Comm_rank, MPI_Comm_dup, MPI_Comm_split, MPI_Comm_free   MPI_Cart_create, MPI_Cart_coords, MPI_Cart_get, MPI_Cart_shift   MPI_Cart_rank, MPI_Cart_sub, MPI_Dims_create   MPI_Bcast, MPI_Barrier, MPI_Reduce, MPI_Scan   MPI_Allreduce, MPI_Gather, MPI_Allgather, MPI_Scatter, MPI_Alltoall   MPI_Gatherv, MPI_Allgatherv, MPI_Scatterv, MPI_Alltoallv   MPI_Reduce_scatter, MPI_Abort, MPI_Wtime, MPI_Wtick. MPI_Type_extent   written by viktor k. decyk, ucla   copyright 1998, regents of the university of california   update: september 7, 2000                                                 */#include "mpi.h"/* prototypes for MacMPI.f functions   */void MPI_INIT(int *error);void MPI_FINALIZE(int *error);void MPI_SEND(void* buf, int *count, MPI_Datatype *datatype, int *dest,             int *tag, MPI_Comm *comm, int *error);void MPI_RECV(void* buf, int *count, MPI_Datatype *datatype, int *source,             int *tag, MPI_Comm *comm, MPI_Status *status, int *error);void MPI_ISEND(void* buf, int *count, MPI_Datatype *datatype, int *dest,              int *tag, MPI_Comm *comm, MPI_Request *request, int *error);void MPI_IRECV(void* buf, int *count, MPI_Datatype *datatype, int *source,              int *tag, MPI_Comm *comm, MPI_Request *request, int *error);void MPI_TEST(MPI_Request *request, int *flag, MPI_Status *status,             int *error);void MPI_WAIT(MPI_Request *request, MPI_Status *status, int *error);void MPI_SENDRECV(void* sendbuf, int *sendcount, MPI_Datatype *sendtype,                 int *dest, int *sendtag, void* recvbuf, int *recvcount,                 MPI_Datatype *recvtype, int *source, int *recvtag,                 MPI_Comm *comm, MPI_Status *status, int *error);void MPI_SSEND(void* buf, int *count, MPI_Datatype *datatype, int *dest,              int *tag, MPI_Comm *comm, int *error);void MPI_ISSEND(void* buf, int *count, MPI_Datatype *datatype, int *dest,               int *tag, MPI_Comm *comm, MPI_Request *request, int *error);void MPI_WAITALL(int *count, MPI_Request *array_of_requests,                MPI_Status *array_of_statuses, int *error);void MPI_WAITANY(int *count, MPI_Request *array_of_requests,                int *index, MPI_Status *status, int *error);void MPI_GET_COUNT(MPI_Status *status, MPI_Datatype *datatype,                  int *count, int *error);void MPI_INITIALIZED(int *flag, int *error);void MPI_COMM_SIZE(MPI_Comm *comm, int *size, int *error);void MPI_COMM_RANK(MPI_Comm *comm, int *rank, int *error);void MPI_COMM_DUP(MPI_Comm *comm, MPI_Comm *newcomm, int *error);void MPI_COMM_SPLIT(MPI_Comm *comm, int *color, int *key, MPI_Comm *newcomm,                    int *error);void MPI_COMM_FREE(MPI_Comm *comm, int *error);void MPI_CART_CREATE(MPI_Comm *comm_old, int *ndims, int *dims, int *periods,                     int *reorder, MPI_Comm *comm_cart,int *ierror);	     void MPI_CART_COORDS(MPI_Comm *comm, int *rank, int *maxdims, int *coords,                     int *ierror);void MPI_CART_GET(MPI_Comm *comm, int *maxdims, int *dims, int *periods,                 int *coords, int *ierror);void MPI_CART_SHIFT(MPI_Comm *comm, int *direction, int *disp, int *rank_source,                    int *rank_dest, int *ierror);void MPI_CART_RANK(MPI_Comm *comm, int *coords, int *rank, int *ierror);void MPI_CART_SUB(MPI_Comm *comm, int *remain_dims, int *newcomm, int *ierror);void MPI_DIMS_CREATE(int *nnodes, int *ndims, int *dims, int *ierror);void MPI_BCAST(void* buffer, int *count, MPI_Datatype *datatype,              int *root, MPI_Comm *comm, int *error);void MPI_BARRIER(MPI_Comm *comm, int *error);void MPI_REDUCE(void* sendbuf, void* recvbuf, int *count,               MPI_Datatype *datatype, MPI_Op *op, int *root,               MPI_Comm *comm, int *error);void MPI_SCAN(void* sendbuf, void* recvbuf, int *count,             MPI_Datatype *datatype, MPI_Op *op, MPI_Comm *comm, int *error);void MPI_ALLREDUCE(void* sendbuf, void* recvbuf, int *count,                  MPI_Datatype *datatype, MPI_Op *op, MPI_Comm *comm,                  int *error);void MPI_GATHER(void* sendbuf, int *sendcount, MPI_Datatype *sendtype,               void* recvbuf, int *recvcount, MPI_Datatype *recvtype,               int *root, MPI_Comm *comm, int *error);void MPI_ALLGATHER(void* sendbuf, int *sendcount,                  MPI_Datatype *sendtype, void* recvbuf, int *recvcount,                  MPI_Datatype *recvtype, MPI_Comm *comm, int *error);void MPI_SCATTER(void* sendbuf, int *sendcount, MPI_Datatype *sendtype,                void* recvbuf, int *recvcount, MPI_Datatype *recvtype,                int *root, MPI_Comm *comm, int *error);void MPI_ALLTOALL(void* sendbuf, int *sendcount, MPI_Datatype *sendtype,                 void* recvbuf, int *recvcount, MPI_Datatype *recvtype,                 MPI_Comm *comm, int *error);void MPI_GATHERV(void* sendbuf, int *sendcount, MPI_Datatype *sendtype,                void* recvbuf, int *recvcounts, int *displs,                MPI_Datatype *recvtype, int *root, MPI_Comm *comm,                int *error);void MPI_ALLGATHERV(void* sendbuf, int *sendcount,                   MPI_Datatype *sendtype, void* recvbuf, int *recvcounts,                   int *displs, MPI_Datatype *recvtype, MPI_Comm *comm,                   int *error);void MPI_SCATTERV(void* sendbuf, int *sendcounts, int *displs,                 MPI_Datatype *sendtype, void* recvbuf, int *recvcount,                 MPI_Datatype *recvtype, int *root, MPI_Comm *comm,                 int *error);void MPI_ALLTOALLV(void* sendbuf, int *sendcounts, int *sdispls,                  MPI_Datatype *sendtype, void* recvbuf, int *recvcounts,                  int *rdispls, MPI_Datatype *recvtype, MPI_Comm *comm,                  int *error);void MPI_REDUCE_SCATTER(void* sendbuf, void* recvbuf, int *recvcounts,                       MPI_Datatype *datatype, MPI_Op *op, MPI_Comm *comm,                       int *error);void MPI_ABORT(MPI_Comm *comm, int *errorcode, int *error);double MPI_WTIME(void);double MPI_WTICK(void);void MPI_TYPE_EXTENT(MPI_Datatype *datatype, MPI_Aint *extent, int *error);int MPI_Init(int *argc, char ***argv) {int ierror;   MPI_INIT(&ierror);   return ierror;}int MPI_Finalize(void) {int ierror;   MPI_FINALIZE(&ierror);   return ierror;}int MPI_Send(void* buf, int count, MPI_Datatype datatype, int dest,             int tag, MPI_Comm comm) {int ierror;   MPI_SEND(buf,&count,&datatype,&dest,&tag,&comm,&ierror);   return ierror;} int MPI_Recv(void* buf, int count, MPI_Datatype datatype, int source,             int tag, MPI_Comm comm, MPI_Status *status) {int ierror;   MPI_RECV(buf,&count,&datatype,&source,&tag,&comm,status,&ierror);   return ierror;}int MPI_Isend(void* buf, int count, MPI_Datatype datatype, int dest,              int tag, MPI_Comm comm, MPI_Request *request) {int ierror;   MPI_ISEND(buf,&count,&datatype,&dest,&tag,&comm,request,&ierror);   return ierror;}int MPI_Irecv(void* buf, int count, MPI_Datatype datatype, int source,              int tag, MPI_Comm comm, MPI_Request *request) {int ierror;   MPI_IRECV(buf,&count,&datatype,&source,&tag,&comm,request,&ierror);   return ierror;}int MPI_Test(MPI_Request *request, int *flag, MPI_Status *status) {int ierror;   MPI_TEST(request,flag,status,&ierror);   return ierror;}int MPI_Wait(MPI_Request *request, MPI_Status *status) {int ierror;   MPI_WAIT(request,status,&ierror);   return ierror;}int MPI_Sendrecv(void* sendbuf, int sendcount, MPI_Datatype sendtype,                  int dest, int sendtag, void* recvbuf, int recvcount,                  MPI_Datatype recvtype, int source, int recvtag,                  MPI_Comm comm, MPI_Status *status) {int ierror;   MPI_SENDRECV(sendbuf,&sendcount,&sendtype,&dest,&sendtag,recvbuf,   &recvcount,&recvtype,&source,&recvtag,&comm,status,&ierror);   return ierror;}int MPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dest,              int tag, MPI_Comm comm) {int ierror;   MPI_SSEND(buf,&count,&datatype,&dest,&tag,&comm,&ierror);   return ierror;}int MPI_Issend(void* buf, int count, MPI_Datatype datatype, int dest,               int tag, MPI_Comm comm, MPI_Request *request) {int ierror;   MPI_ISSEND(buf,&count,&datatype,&dest,&tag,&comm,request,&ierror);   return ierror;}int MPI_Waitall(int count, MPI_Request *array_of_requests,                MPI_Status *array_of_statuses) {int ierror;   MPI_WAITALL(&count,array_of_requests,array_of_statuses,&ierror);   return ierror;}int MPI_Waitany(int count, MPI_Request *array_of_requests,                int *index, MPI_Status *status) {int ierror;   MPI_WAITANY(&count,array_of_requests,index,status,&ierror);   return ierror;}int MPI_Get_count(MPI_Status *status, MPI_Datatype datatype,                  int *count) {int ierror;   MPI_GET_COUNT(status,&datatype,count,&ierror);   return ierror;}int MPI_Initialized(int *flag) {int ierror;   MPI_INITIALIZED(flag,&ierror);   return ierror;}int MPI_Comm_size(MPI_Comm comm, int *size) {int ierror;   MPI_COMM_SIZE(&comm,size,&ierror);   return ierror;}int MPI_Comm_rank(MPI_Comm comm, int *rank) {int ierror;   MPI_COMM_RANK(&comm,rank,&ierror);   return ierror;}int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm) {int ierror;   MPI_COMM_DUP(&comm,newcomm,&ierror);   return ierror;}   int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *newcomm) {int ierror;   MPI_COMM_SPLIT(&comm,&color,&key,newcomm,&ierror);   return ierror;} int MPI_Comm_free(MPI_Comm *comm) {int ierror;   MPI_COMM_FREE(comm,&ierror);   return ierror;}int MPI_Cart_create(MPI_Comm comm_old, int ndims, int *dims, int *periods,                    int reorder, MPI_Comm *comm_cart) {int ierror;   MPI_CART_CREATE(&comm_old,&ndims,dims,periods,&reorder,comm_cart,&ierror);   return ierror;}int MPI_Cart_coords(MPI_Comm comm, int rank, int maxdims, int *coords) {int ierror;   MPI_CART_COORDS(&comm,&rank,&maxdims,coords,&ierror);   return ierror;}int MPI_Cart_get(MPI_Comm comm, int maxdims, int *dims, int *periods,                int *coords) {int ierror;   MPI_CART_GET(&comm,&maxdims,dims,periods,coords,&ierror);   return ierror;}int MPI_Cart_shift(MPI_Comm comm, int direction, int disp, int *rank_source,                   int *rank_dest) {int ierror;   MPI_CART_SHIFT(&comm,&direction,&disp,rank_source,rank_dest,&ierror);   return ierror;}int MPI_Cart_rank(MPI_Comm comm, int *coords, int *rank) {int ierror;   MPI_CART_RANK(&comm,coords,rank,&ierror);   return ierror;}int MPI_Cart_sub(MPI_Comm comm, int *remain_dims, MPI_Comm *newcomm) {int ierror;   MPI_CART_SUB(&comm,remain_dims,newcomm,&ierror);   return ierror;}int MPI_Dims_create(int nnodes, int ndims, int *dims) {int ierror;   MPI_DIMS_CREATE(&nnodes,&ndims,dims,&ierror);   return ierror;}int MPI_Bcast(void* buffer, int count, MPI_Datatype datatype,              int root, MPI_Comm comm) {int ierror;   MPI_BCAST(buffer,&count,&datatype,&root,&comm,&ierror);   return ierror;}int MPI_Barrier(MPI_Comm comm) {int ierror;   MPI_BARRIER(&comm,&ierror);   return ierror;}int MPI_Reduce(void* sendbuf, void* recvbuf, int count,               MPI_Datatype datatype, MPI_Op op, int root,               MPI_Comm comm) {int ierror;   MPI_REDUCE(sendbuf,recvbuf,&count,&datatype,&op,&root,&comm,   &ierror);   return ierror;}int MPI_Scan(void* sendbuf, void* recvbuf, int count,             MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) {int ierror;   MPI_SCAN(sendbuf,recvbuf,&count,&datatype,&op,&comm,&ierror);   return ierror;}int MPI_Allreduce(void* sendbuf, void* recvbuf, int count,                  MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) {int ierror;   MPI_ALLREDUCE(sendbuf,recvbuf,&count,&datatype,&op,&comm,&ierror);   return ierror;}int MPI_Gather(void* sendbuf, int sendcount, MPI_Datatype sendtype,               void* recvbuf, int recvcount, MPI_Datatype recvtype,               int root, MPI_Comm comm) {int ierror;   MPI_GATHER(sendbuf,&sendcount,&sendtype,recvbuf,&recvcount,   &recvtype,&root,&comm,&ierror);   return ierror;}int MPI_Allgather(void* sendbuf, int sendcount,                  MPI_Datatype sendtype, void* recvbuf, int recvcount,                  MPI_Datatype recvtype, MPI_Comm comm) {int ierror;   MPI_ALLGATHER(sendbuf,&sendcount,&sendtype,recvbuf,&recvcount,   &recvtype,&comm,&ierror);   return ierror;}int MPI_Scatter(void* sendbuf, int sendcount, MPI_Datatype sendtype,                void* recvbuf, int recvcount, MPI_Datatype recvtype,                int root, MPI_Comm comm) {int ierror;   MPI_SCATTER(sendbuf,&sendcount,&sendtype,recvbuf,&recvcount,   &recvtype,&root,&comm,&ierror);   return ierror;}int MPI_Alltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype,                 void* recvbuf, int recvcount, MPI_Datatype recvtype,                 MPI_Comm comm) {int ierror;   MPI_ALLTOALL(sendbuf,&sendcount,&sendtype,recvbuf,&recvcount,   &recvtype,&comm,&ierror);   return ierror;}int MPI_Gatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype,                void* recvbuf, int *recvcounts, int *displs,                MPI_Datatype recvtype, int root, MPI_Comm comm) {int ierror;   MPI_GATHERV(sendbuf,&sendcount,&sendtype,recvbuf,recvcounts,   displs,&recvtype,&root,&comm,&ierror);   return ierror;}int MPI_Allgatherv(void* sendbuf, int sendcount,                   MPI_Datatype sendtype, void* recvbuf, int *recvcounts,                   int *displs, MPI_Datatype recvtype, MPI_Comm comm) {int ierror;   MPI_ALLGATHERV(sendbuf,&sendcount,&sendtype,recvbuf,recvcounts,   displs,&recvtype,&comm,&ierror);   return ierror;}int MPI_Scatterv(void* sendbuf, int *sendcounts, int *displs,                 MPI_Datatype sendtype, void* recvbuf, int recvcount,                 MPI_Datatype recvtype, int root, MPI_Comm comm) {int ierror;   MPI_SCATTERV(sendbuf,sendcounts,displs,&sendtype,recvbuf,   &recvcount,&recvtype,&root,&comm,&ierror);   return ierror;}int MPI_Alltoallv(void* sendbuf, int *sendcounts, int *sdispls,                  MPI_Datatype sendtype, void* recvbuf, int *recvcounts,                  int *rdispls, MPI_Datatype recvtype, MPI_Comm comm) {int ierror;   MPI_ALLTOALLV(sendbuf,sendcounts,sdispls,&sendtype,recvbuf,   recvcounts,rdispls,&recvtype,&comm,&ierror);   return ierror;}int MPI_Reduce_scatter(void* sendbuf, void* recvbuf, int *recvcounts,                       MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) {int ierror;   MPI_REDUCE_SCATTER(sendbuf,recvbuf,recvcounts,&datatype,&op,&comm,   &ierror);   return ierror;}int MPI_Abort(MPI_Comm comm, int errorcode) {int ierror;   MPI_ABORT(&comm,&errorcode,&ierror);   return ierror;}double MPI_Wtime(void) {   return MPI_WTIME();}double MPI_Wtick(void) {   return MPI_WTICK();}int MPI_Type_extent(MPI_Datatype datatype, MPI_Aint *extent) {int ierror;   MPI_TYPE_EXTENT(&datatype,extent,&ierror);   return ierror;}