int MPIR_Alltoallv_impl(const void *sendbuf, const int *sendcounts, const int *sdispls, MPI_Datatype sendtype, void *recvbuf, const int *recvcounts, const int *rdispls, MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag) { int mpi_errno = MPI_SUCCESS; if (comm_ptr->coll_fns != NULL && comm_ptr->coll_fns->Alltoallv != NULL) { /* --BEGIN USEREXTENSION-- */ mpi_errno = comm_ptr->coll_fns->Alltoallv(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm_ptr, errflag); if (mpi_errno) MPIR_ERR_POP(mpi_errno); /* --END USEREXTENSION-- */ } else { mpi_errno = MPIR_Alltoallv(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm_ptr, errflag); if (mpi_errno) MPIR_ERR_POP(mpi_errno); } fn_exit: return mpi_errno; fn_fail: goto fn_exit; }
/* ****************************************************************** */ int MPIDO_Allgather_alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Aint send_true_lb, MPI_Aint recv_true_lb, size_t send_size, size_t recv_size, MPID_Comm * comm_ptr, int *mpierrno) { int i, rc; void *a2a_sendbuf = NULL; char *destbuf=NULL; char *startbuf=NULL; int a2a_sendcounts[comm_ptr->local_size]; int a2a_senddispls[comm_ptr->local_size]; int a2a_recvcounts[comm_ptr->local_size]; int a2a_recvdispls[comm_ptr->local_size]; for (i = 0; i < comm_ptr->local_size; ++i) { a2a_sendcounts[i] = send_size; a2a_senddispls[i] = 0; a2a_recvcounts[i] = recvcount; a2a_recvdispls[i] = recvcount * i; } if (sendbuf != MPI_IN_PLACE) { a2a_sendbuf = (char *)sendbuf + send_true_lb; } else { startbuf = (char *) recvbuf + recv_true_lb; destbuf = startbuf + comm_ptr->rank * send_size; a2a_sendbuf = destbuf; a2a_sendcounts[comm_ptr->rank] = 0; a2a_recvcounts[comm_ptr->rank] = 0; } /* TODO: Change to PAMI */ rc = MPIR_Alltoallv((const void *)a2a_sendbuf, a2a_sendcounts, a2a_senddispls, MPI_CHAR, recvbuf, a2a_recvcounts, a2a_recvdispls, recvtype, comm_ptr, mpierrno); return rc; }