| 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 | /* Pairwise Exchange |
| 9 | * |
| 10 | * We use a pairwise exchange algorithm similar to the one used in |
| 11 | * intracommunicator alltoall for long messages. Since the local and |
| 12 | * remote groups can be of different sizes, we first compute the max |
| 13 | * of local_group_size, remote_group_size. At step i, 0 <= i < |
| 14 | * max_size, each process receives from src = (rank - i + max_size) % |
| 15 | * max_size if src < remote_size, and sends to dst = (rank + i) % |
| 16 | * max_size if dst < remote_size. |
| 17 | */ |
| 18 | |
| 19 | int MPIR_Ialltoall_inter_sched_pairwise_exchangecxx . . $ MPIR_Ialltoall_inter_sched_pairwise_exchange(c41cc56d95858bf1).(const void *sendbuf, MPI_Aintcxx . . $ MPI_Aint# sendcount, |
| 20 | MPI_Datatypecxx . . $ MPI_Datatype# sendtype, void *recvbuf, |
| 21 | MPI_Aintcxx . . $ MPI_Aint# recvcount, MPI_Datatypecxx . . $ MPI_Datatype# recvtype, |
| 22 | MPIR_Commcxx . . $ MPIR_Comm# * comm_ptr, MPIR_Sched_tcxx . . $ MPIR_Sched_t# s) |
| 23 | { |
| 24 | int mpi_errno = MPI_SUCCESScxx . . $ `src/include/mpi.h:655:9`!; |
| 25 | int local_size, remote_size, max_size, i; |
| 26 | MPI_Aintcxx . . $ MPI_Aint# sendtype_extent, recvtype_extent; |
| 27 | int src, dst, rank; |
| 28 | char *sendaddr, *recvaddr; |
| 29 | |
| 30 | local_size = comm_ptr->local_sizecxx . . $ MPIR_Comm#local_size.; |
| 31 | remote_size = comm_ptr->remote_sizecxx . . $ MPIR_Comm#remote_size.; |
| 32 | rank = comm_ptr->rankcxx . . $ MPIR_Comm#rank.; |
| 33 | |
| 34 | /* Get extent of send and recv types */ |
| 35 | MPIR_Datatype_get_extent_macrocxx . . $ `src/include/mpir_datatype.h:462:9`!(sendtype, sendtype_extent); |
| 36 | MPIR_Datatype_get_extent_macrocxx . . $ `src/include/mpir_datatype.h:462:9`!(recvtype, recvtype_extent); |
| 37 | |
| 38 | /* Do the pairwise exchanges */ |
| 39 | max_size = MPL_MAXcxx . . $ `src/mpl/include/mpl_base.h:105:9`!(local_size, remote_size); |
| 40 | for (i = 0; i < max_size; i++) { |
| 41 | src = (rank - i + max_size) % max_size; |
| 42 | dst = (rank + i) % max_size; |
| 43 | if (src >= remote_size) { |
| 44 | src = MPI_PROC_NULLcxx . . $ `src/include/mpi.h:549:9`!; |
| 45 | recvaddr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 46 | } else { |
| 47 | recvaddr = (char *) recvbuf + src * recvcount * recvtype_extent; |
| 48 | } |
| 49 | if (dst >= remote_size) { |
| 50 | dst = MPI_PROC_NULLcxx . . $ `src/include/mpi.h:549:9`!; |
| 51 | sendaddr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 52 | } else { |
| 53 | sendaddr = (char *) sendbuf + dst * sendcount * sendtype_extent; |
| 54 | } |
| 55 | |
| 56 | mpi_errno = MPIR_Sched_sendcxx . . $ `src/mpid/ch4/include/mpid_sched.h:20:9`!(sendaddr, sendcount, sendtype, dst, comm_ptr, s); |
| 57 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 58 | mpi_errno = MPIR_Sched_recvcxx . . $ `src/mpid/ch4/include/mpid_sched.h:23:9`!(recvaddr, recvcount, recvtype, src, 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 | |
| 63 | fn_exit: |
| 64 | return mpi_errno; |
| 65 | fn_fail: |
| 66 | goto fn_exit; |
| 67 | } |