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. */
38 int bblock = 4;//MPIR_PARAM_ALLTOALL_THROTTLE
39 //if (bblock == 0) bblock = comm_size;
42 // requests = xbt_new(MPI_Request, 2 * (bblock - 1));
44 /* post only bblock isends/irecvs at a time as suggested by Tony Ladd */
45 for (ii=0; ii<size; ii+=bblock) {
46 requests = xbt_new(MPI_Request, 2 * (bblock ));
48 ss = size-ii < bblock ? size-ii : bblock;
51 /* do the communication -- post ss sends and receives: */
52 for ( i=0; i<ss; i++ ) {
53 dst = (rank+i+ii) % size;
55 XBT_DEBUG("<%d> skip request creation [src = %d, recvcount = %d]",
56 rank, i, recvcounts[dst]);
60 requests[count]=smpi_mpi_irecv((char *)recvbuf + recvdisps[dst] * recvext, recvcounts[dst],
61 recvtype, dst, system_tag, comm );
64 /* Now create all sends */
65 for ( i=0; i<ss; i++ ) {
66 dst = (rank-i-ii+size) % size;
68 XBT_DEBUG("<%d> skip request creation [dst = %d, sendcount = %d]",
69 rank, i, sendcounts[dst]);
72 requests[count]=smpi_mpi_isend((char *)sendbuf + senddisps[dst] * sendext, sendcounts[dst],
73 sendtype, dst, system_tag, comm);
76 /* Wait for them all. */
77 //smpi_mpi_startall(count, requests);
78 XBT_DEBUG("<%d> wait for %d requests", rank, count);
79 smpi_mpi_waitall(count, requests, MPI_STATUSES_IGNORE);