| 1 | /* |
| 2 | * Copyright (C) by Argonne National Laboratory |
| 3 | * See COPYRIGHT in top-level directory |
| 4 | */ |
| 5 | |
| 6 | #include "mpiimpl.h"cxx . . $ `<file>/src/include/mpiimpl.h`/ |
| 7 | |
| 8 | /* Algorithm: Ring |
| 9 | * |
| 10 | * In the first step, each process i sends its contribution to process |
| 11 | * i+1 and receives the contribution from process i-1 (with |
| 12 | * wrap-around). From the second step onwards, each process i |
| 13 | * forwards to process i+1 the data it received from process i-1 in |
| 14 | * the previous step. This takes a total of p-1 steps. |
| 15 | * |
| 16 | * Cost = (p-1).alpha + n.((p-1)/p).beta |
| 17 | * |
| 18 | * This algorithm is preferred to recursive doubling for long messages |
| 19 | * because we find that this communication pattern (nearest neighbor) |
| 20 | * performs twice as fast as recursive doubling for long messages (on |
| 21 | * Myrinet and IBM SP). |
| 22 | */ |
| 23 | int MPIR_Iallgather_intra_sched_ringcxx . . $ MPIR_Iallgather_intra_sched_ring(c41cc56d95858bf1).(const void *sendbuf, MPI_Aintcxx . . $ MPI_Aint# sendcount, MPI_Datatypecxx . . $ MPI_Datatype# |
| 24 | sendtype, void *recvbuf, MPI_Aintcxx . . $ MPI_Aint# recvcount, |
| 25 | MPI_Datatypecxx . . $ MPI_Datatype# recvtype, MPIR_Commcxx . . $ MPIR_Comm# * comm_ptr, MPIR_Sched_tcxx . . $ MPIR_Sched_t# s) |
| 26 | { |
| 27 | int mpi_errno = MPI_SUCCESScxx . . $ `src/include/mpi.h:655:9`!; |
| 28 | int rank, comm_size; |
| 29 | int i, j, jnext, left, right; |
| 30 | MPI_Aintcxx . . $ MPI_Aint# recvtype_extent; |
| 31 | |
| 32 | MPIR_COMM_RANK_SIZEcxx . . $ `src/include/mpir_comm.h:412:9`!(comm_ptr, rank, comm_size); |
| 33 | |
| 34 | MPIR_Datatype_get_extent_macrocxx . . $ `src/include/mpir_datatype.h:462:9`!(recvtype, recvtype_extent); |
| 35 | |
| 36 | /* First, load the "local" version in the recvbuf. */ |
| 37 | if (sendbuf != MPI_IN_PLACEcxx . . $ `src/include/mpi.h:555:9`!) { |
| 38 | mpi_errno = MPIR_Sched_copycxx . . $ `src/mpid/ch4/include/mpid_sched.h:27:9`!(sendbuf, sendcount, sendtype, |
| 39 | ((char *) recvbuf + rank * recvcount * recvtype_extent), |
| 40 | recvcount, recvtype, s); |
| 41 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 42 | MPIR_SCHED_BARRIERcxx . . $ `src/include/mpir_nbc.h:93:9`!(s); |
| 43 | } |
| 44 | |
| 45 | /* Now, send left to right. This fills in the receive area in |
| 46 | * reverse order. */ |
| 47 | left = (comm_size + rank - 1) % comm_size; |
| 48 | right = (rank + 1) % comm_size; |
| 49 | |
| 50 | j = rank; |
| 51 | jnext = left; |
| 52 | for (i = 1; i < comm_size; i++) { |
| 53 | mpi_errno = MPIR_Sched_sendcxx . . $ `src/mpid/ch4/include/mpid_sched.h:20:9`!(((char *) recvbuf + j * recvcount * recvtype_extent), |
| 54 | recvcount, recvtype, right, comm_ptr, s); |
| 55 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 56 | /* concurrent, no barrier here */ |
| 57 | mpi_errno = MPIR_Sched_recvcxx . . $ `src/mpid/ch4/include/mpid_sched.h:23:9`!(((char *) recvbuf + jnext * recvcount * recvtype_extent), |
| 58 | recvcount, recvtype, left, comm_ptr, s); |
| 59 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 60 | MPIR_SCHED_BARRIERcxx . . $ `src/include/mpir_nbc.h:93:9`!(s); |
| 61 | |
| 62 | j = jnext; |
| 63 | jnext = (comm_size + jnext - 1) % comm_size; |
| 64 | } |
| 65 | |
| 66 | fn_exit: |
| 67 | return mpi_errno; |
| 68 | fn_fail: |
| 69 | goto fn_exit; |
| 70 | } |