13#include "gadgetconfig.h"
21#include "../data/allvars.h"
22#include "../data/dtypes.h"
23#include "../mpi_utils/mpi_utils.h"
25int myMPI_Sendrecv(
void *sendb,
size_t sendcount, MPI_Datatype sendtype,
int dest,
int sendtag,
void *recvb,
size_t recvcount,
26 MPI_Datatype recvtype,
int source,
int recvtag, MPI_Comm comm, MPI_Status *status)
28 int iter = 0, size_sendtype, size_recvtype, send_now, recv_now;
29 char *sendbuf = (
char *)sendb;
30 char *recvbuf = (
char *)recvb;
35 MPI_Type_size(sendtype, &size_sendtype);
36 MPI_Type_size(recvtype, &size_recvtype);
39 MPI_Comm_rank(comm, &thistask);
43 memcpy(recvbuf, sendbuf, recvcount * size_recvtype);
49 while(sendcount > 0 || recvcount > 0)
51 if(sendcount > count_limit)
53 send_now = count_limit;
60 if(recvcount > count_limit)
61 recv_now = count_limit;
65 MPI_Sendrecv(sendbuf, send_now, sendtype, dest, sendtag, recvbuf, recv_now, recvtype, source, recvtag, comm, status);
67 sendcount -= send_now;
68 recvcount -= recv_now;
70 sendbuf += send_now * size_sendtype;
71 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)