1 #include "colls_private.h"
6 * Openmpi calls this routine when the message size sent to each rank < 2000 bytes and size < 12
7 * FIXME: uh, check smpi_pmpi again, but this routine is called for > 12, not
10 int smpi_coll_tuned_alltoallv_bruck(void *sendbuf, int *sendcounts, int *senddisps,
11 MPI_Datatype sendtype, void *recvbuf,
12 int *recvcounts, int *recvdisps, MPI_Datatype recvtype,
15 int system_tag = COLL_TAG_ALLTOALLV;
16 int i, rank, size, err, count;
20 MPI_Request *requests;
22 // FIXME: check implementation
23 rank = smpi_comm_rank(comm);
24 size = smpi_comm_size(comm);
25 XBT_DEBUG("<%d> algorithm alltoall_bruck() called.", rank);
27 err = smpi_datatype_extent(sendtype, &lb, &sendext);
28 err = smpi_datatype_extent(recvtype, &lb, &recvext);
29 /* Local copy from self */
31 smpi_datatype_copy((char *)sendbuf + senddisps[rank] * sendext,
32 sendcounts[rank], sendtype,
33 (char *)recvbuf + recvdisps[rank] * recvext,
34 recvcounts[rank], recvtype);
35 if (err == MPI_SUCCESS && size > 1) {
36 /* Initiate all send/recv to/from others. */
37 requests = xbt_new(MPI_Request, 2 * (size - 1));
39 /* Create all receives that will be posted first */
40 for (i = 0; i < size; ++i) {
42 XBT_DEBUG("<%d> skip request creation [src = %d, recvcount = %d]",
43 rank, i, recvcounts[i]);
47 smpi_irecv_init((char *)recvbuf + recvdisps[i] * recvext, recvcounts[i],
48 recvtype, i, system_tag, comm);
51 /* Now create all sends */
52 for (i = 0; i < size; ++i) {
54 XBT_DEBUG("<%d> skip request creation [dst = %d, sendcount = %d]",
55 rank, i, sendcounts[i]);
59 smpi_isend_init((char *)sendbuf + senddisps[i] * sendext, sendcounts[i],
60 sendtype, i, system_tag, comm);
63 /* Wait for them all. */
64 smpi_mpi_startall(count, requests);
65 XBT_DEBUG("<%d> wait for %d requests", rank, count);
66 smpi_mpi_waitall(count, requests, MPI_STATUS_IGNORE);