12 #include "gadgetconfig.h"
20 #include "../data/allvars.h"
21 #include "../data/dtypes.h"
22 #include "../mpi_utils/mpi_utils.h"
24 int myMPI_Sendrecv(
void *sendb,
size_t sendcount, MPI_Datatype sendtype,
int dest,
int sendtag,
void *recvb,
size_t recvcount,
25 MPI_Datatype recvtype,
int source,
int recvtag, MPI_Comm comm, MPI_Status *status)
27 int iter = 0, size_sendtype, size_recvtype, send_now, recv_now;
28 char *sendbuf = (
char *)sendb;
29 char *recvbuf = (
char *)recvb;
34 MPI_Type_size(sendtype, &size_sendtype);
35 MPI_Type_size(recvtype, &size_recvtype);
38 MPI_Comm_rank(comm, &thistask);
42 memcpy(recvbuf, sendbuf, recvcount * size_recvtype);
48 while(sendcount > 0 || recvcount > 0)
50 if(sendcount > count_limit)
52 send_now = count_limit;
59 if(recvcount > count_limit)
60 recv_now = count_limit;
64 MPI_Sendrecv(sendbuf, send_now, sendtype, dest, sendtag, recvbuf, recv_now, recvtype, source, recvtag, comm, status);
66 sendcount -= send_now;
67 recvcount -= recv_now;
69 sendbuf += send_now * size_sendtype;
70 recvbuf += recv_now * size_recvtype;
#define MPI_MESSAGE_SIZELIMIT_IN_BYTES
int myMPI_Sendrecv(void *sendb, size_t sendcount, MPI_Datatype sendtype, int dest, int sendtag, void *recvb, size_t recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Status *status)