text: /*
  Copyright 2014, The University of Texas at Austin 
  All rights reserved.
  
  THIS FILE IS PART OF THE CONTAINMENT DOMAINS RUNTIME LIBRARY
  
  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are
  met: 
  
  1. Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer. 
  
  2. Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution. 
  
  3. Neither the name of the copyright holder nor the names of its
  contributors may be used to endorse or promote products derived from
  this software without specific prior written permission. 
  
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
    FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
    BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
    ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.
  */
  
  
  #ifndef _CD_MPIWRAPPER_H
  #define _CD_MPIWRAPPER_H
  
  #include "cd_config.h"
  #if _MPI_VER
  
  #include <stdio.h>
  #include <mpi.h>
  #include "cd_global.h"
  
  using namespace cd;
  
  // blocking p2p communication
  int MPI_Send(const void *buf, 
               int count, 
               MPI_Datatype datatype, 
               int dest, 
               int tag, 
               MPI_Comm comm);
  int MPI_Ssend(const void *buf, 
                int count, 
                MPI_Datatype datatype, 
                int dest, 
                int tag, 
                MPI_Comm comm);
  int MPI_Rsend(const void *buf, 
                int count, 
                MPI_Datatype datatype, 
                int dest, 
                int tag, 
                MPI_Comm comm);
  int MPI_Bsend(const void *buf, 
                int count, 
                MPI_Datatype datatype, 
                int dest, 
                int tag, 
                MPI_Comm comm);
  int MPI_Recv(void *buf, 
               int count, 
               MPI_Datatype datatype, 
               int src, 
               int tag, 
               MPI_Comm comm, 
               MPI_Status *status);
  int MPI_Sendrecv(const void *sendbuf, 
                   int sendcount, 
                   MPI_Datatype sendtype, 
                   int dest, 
                   int sendtag, 
                   void *recvbuf, 
                   int recvcount, 
                   MPI_Datatype recvtype, 
                   int src, 
                   int recvtag, 
                   MPI_Comm comm, 
                   MPI_Status *status);
  int MPI_Sendrecv_replace(void *buf, 
                           int count, 
                           MPI_Datatype datatype, 
                           int dest, 
                           int sendtag,
                           int src, 
                           int recvtag, 
                           MPI_Comm comm, 
                           MPI_Status *status);
  
  // non-blocking p2p communication
  int MPI_Isend(const void *buf, 
                int count, 
                MPI_Datatype datatype, 
                int dest, 
                int tag, 
                MPI_Comm comm, 
                MPI_Request *request);
  int MPI_Irecv(void *buf, 
                int count, 
                MPI_Datatype datatype, 
                int src, 
                int tag, 
                MPI_Comm comm, 
                MPI_Request *request);
  
  int MPI_Wait(MPI_Request *request, 
               MPI_Status *status);
  int MPI_Waitall(int count, 
                  MPI_Request array_of_requests[], 
                  MPI_Status array_of_statuses[]);
  int MPI_Waitany(int count,
                  MPI_Request array_of_requests[],
                  int *index,
                  MPI_Status *status);
  int MPI_Waitsome(int incount,
                   MPI_Request array_of_requests[],
                   int *outcount,
                   int array_of_indices[],
                   MPI_Status array_of_statuses[]);
  
  int MPI_Test(MPI_Request *request, 
               int * flag,
               MPI_Status *status);
  int MPI_Testall(int count,
                  MPI_Request array_of_requests[],
                  int *flag,
                  MPI_Status array_of_statuses[]);
  int MPI_Testany(int count,
                  MPI_Request array_of_requests[],
                  int *index,
                  int *flag,
                  MPI_Status *status);
  int MPI_Testsome(int incount,
                   MPI_Request array_of_requests[],
                   int *outcount,
                   int array_of_indices[],
                   MPI_Status array_of_statuses[]);
  
  // collective communication
  int MPI_Barrier (MPI_Comm comm);
  
  int MPI_Bcast (void *buffer,
                 int count,
                 MPI_Datatype datatype,
                 int root,
                 MPI_Comm comm);
  
  int MPI_Gather(void *sendbuf,
                 int sendcnt,
                 MPI_Datatype sendtype,
                 void *recvbuf,
                 int recvcnt,
                 MPI_Datatype recvtype,
                 int root, 
                 MPI_Comm comm);
  
  int MPI_Gatherv(const void *sendbuf,
                  int sendcnt,
                  MPI_Datatype sendtype,
                  void *recvbuf,
                  const int *recvcnts,
                  const int *displs,
                  MPI_Datatype recvtype,
                  int root, 
                  MPI_Comm comm);
  
  int MPI_Allgather(const void *sendbuf,
                    int sendcnt,
                    MPI_Datatype sendtype,
                    void *recvbuf,
                    int recvcnt,
                    MPI_Datatype recvtype,
                    MPI_Comm comm);
  
  int MPI_Allgatherv(const void *sendbuf,
                     int sendcnt,
                     MPI_Datatype sendtype,
                     void *recvbuf,
                     const int *recvcnts,
                     const int *displs,
                     MPI_Datatype recvtype,
                     MPI_Comm comm);
  
  int MPI_Reduce(const void *sendbuf,
                 void *recvbuf, 
                 int count,
                 MPI_Datatype datatype,
                 MPI_Op op, 
                 int root,
                 MPI_Comm comm);
  
  int MPI_Allreduce(const void *sendbuf,
                    void *recvbuf, 
                    int count,
                    MPI_Datatype datatype,
                    MPI_Op op, 
                    MPI_Comm comm);
  
  int MPI_Alltoall(const void *sendbuf,
                   int sendcnt,
                   MPI_Datatype sendtype,
                   void *recvbuf,
                   int recvcnt,
                   MPI_Datatype recvtype,
                   MPI_Comm comm);
  
  int MPI_Alltoallv(const void *sendbuf,
                    const int *sendcnts,
                    const int *sdispls,
                    MPI_Datatype sendtype,
                    void *recvbuf,
                    const int *recvcnts,
                    const int *rdispls,
                    MPI_Datatype recvtype,
                    MPI_Comm comm);
  
  int MPI_Scatter(const void *sendbuf,
                  int sendcnt,
                  MPI_Datatype sendtype,
                  void *recvbuf,
                  int recvcnt,
                  MPI_Datatype recvtype,
                  int root, 
                  MPI_Comm comm);
  
  int MPI_Scatterv(const void *sendbuf,
                   const int *sendcnts,
                   const int *displs,
                   MPI_Datatype sendtype,
                   void *recvbuf,
                   int recvcnt,
                   MPI_Datatype recvtype,
                   int root, 
                   MPI_Comm comm);
  
  int MPI_Reduce_scatter(const void *sendbuf,
                         void *recvbuf,
                         const int *recvcnts,
                         MPI_Datatype datatype,
                         MPI_Op op,
                         MPI_Comm comm);
  
  int MPI_Scan(const void *sendbuf,
               void *recvbuf,
               int count,
               MPI_Datatype datatype,
               MPI_Op op,
               MPI_Comm comm);
  
  // persistent communication
  int MPI_Send_init(const void *buf,
                    int count,
                    MPI_Datatype datatype,
                    int dest,
                    int tag,
                    MPI_Comm comm,
                    MPI_Request *request);
  
  int MPI_Init(int *argc, char ***argv);
  int MPI_Init_thread(int *argc, char ***argv, int required, int *provided);
  int MPI_Finalize(void);
  
  int MPI_Group_translate_ranks(MPI_Group group1, int n, const int ranks1[],
                                MPI_Group group2, int ranks2[]);
  int MPI_Win_fence(int assert, MPI_Win win);
  #endif
  
  #endif
  