1 #include "colls_private.h"
3 int smpi_coll_tuned_alltoallv_pairwise(void *sendbuf, int *sendcounts, int *senddisps,
4 MPI_Datatype sendtype, void *recvbuf,
5 int *recvcounts, int *recvdisps, MPI_Datatype recvtype,
9 int rank, size, step, sendto, recvfrom, sendsize, recvsize;
11 rank = smpi_comm_rank(comm);
12 size = smpi_comm_size(comm);
13 XBT_DEBUG("<%d> algorithm alltoallv_pairwise() called.", rank);
14 sendsize = smpi_datatype_size(sendtype);
15 recvsize = smpi_datatype_size(recvtype);
16 /* Perform pairwise exchange - starting from 1 so the local copy is last */
17 for (step = 1; step < size + 1; step++) {
18 /* who do we talk to in this step? */
19 sendto = (rank + step) % size;
20 recvfrom = (rank + size - step) % size;
21 /* send and receive */
22 smpi_mpi_sendrecv(&((char *) sendbuf)[senddisps[sendto] * sendsize],
23 sendcounts[sendto], sendtype, sendto, system_tag,
24 &((char *) recvbuf)[recvdisps[recvfrom] * recvsize],
25 recvcounts[recvfrom], recvtype, recvfrom, system_tag, comm,