| 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 | int MPIR_Ialltoallv_inter_sched_pairwise_exchangecxx . . $ MPIR_Ialltoallv_inter_sched_pairwise_exchange(7e2eefb9b0d8b8e6).(const void *sendbuf, const MPI_Aintcxx . . $ MPI_Aint# sendcounts[], |
| 9 | const MPI_Aintcxx . . $ MPI_Aint# sdispls[], MPI_Datatypecxx . . $ MPI_Datatype# sendtype, |
| 10 | void *recvbuf, const MPI_Aintcxx . . $ MPI_Aint# recvcounts[], |
| 11 | const MPI_Aintcxx . . $ MPI_Aint# rdispls[], MPI_Datatypecxx . . $ MPI_Datatype# recvtype, |
| 12 | MPIR_Commcxx . . $ MPIR_Comm# * comm_ptr, MPIR_Sched_tcxx . . $ MPIR_Sched_t# s) |
| 13 | { |
| 14 | /* Intercommunicator alltoallv. We use a pairwise exchange algorithm |
| 15 | * similar to the one used in intracommunicator alltoallv. Since the |
| 16 | * local and remote groups can be of different |
| 17 | * sizes, we first compute the max of local_group_size, |
| 18 | * remote_group_size. At step i, 0 <= i < max_size, each process |
| 19 | * receives from src = (rank - i + max_size) % max_size if src < |
| 20 | * remote_size, and sends to dst = (rank + i) % max_size if dst < |
| 21 | * remote_size. |
| 22 | */ |
| 23 | int mpi_errno = MPI_SUCCESScxx . . $ `src/include/mpi.h:655:9`!; |
| 24 | int local_size, remote_size, max_size, i; |
| 25 | MPI_Aintcxx . . $ MPI_Aint# send_extent, recv_extent, sendtype_size, recvtype_size; |
| 26 | int src, dst, rank; |
| 27 | char *sendaddr, *recvaddr; |
| 28 | |
| 29 | MPIR_Assertcxx . . $ `src/include/mpir_assert.h:39:9`!(comm_ptr->comm_kind == MPIR_COMM_KIND__INTERCOMM); |
| 30 | |
| 31 | local_size = comm_ptr->local_sizecxx . . $ MPIR_Comm#local_size.; |
| 32 | remote_size = comm_ptr->remote_sizecxx . . $ MPIR_Comm#remote_size.; |
| 33 | rank = comm_ptr->rankcxx . . $ MPIR_Comm#rank.; |
| 34 | |
| 35 | /* Get extent of send and recv types */ |
| 36 | MPIR_Datatype_get_extent_macrocxx . . $ `src/include/mpir_datatype.h:462:9`!(sendtype, send_extent); |
| 37 | MPIR_Datatype_get_extent_macrocxx . . $ `src/include/mpir_datatype.h:462:9`!(recvtype, recv_extent); |
| 38 | MPIR_Datatype_get_size_macrocxx . . $ `src/include/mpir_datatype.h:437:9`!(sendtype, sendtype_size); |
| 39 | MPIR_Datatype_get_size_macrocxx . . $ `src/include/mpir_datatype.h:437:9`!(recvtype, recvtype_size); |
| 40 | |
| 41 | /* Use pairwise exchange algorithm. */ |
| 42 | max_size = MPL_MAXcxx . . $ `src/mpl/include/mpl_base.h:105:9`!(local_size, remote_size); |
| 43 | for (i = 0; i < max_size; i++) { |
| 44 | MPI_Aintcxx . . $ MPI_Aint# sendcount, recvcount; |
| 45 | src = (rank - i + max_size) % max_size; |
| 46 | dst = (rank + i) % max_size; |
| 47 | if (src >= remote_size) { |
| 48 | src = MPI_PROC_NULLcxx . . $ `src/include/mpi.h:549:9`!; |
| 49 | recvaddr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 50 | recvcount = 0; |
| 51 | } else { |
| 52 | recvaddr = (char *) recvbuf + rdispls[src] * recv_extent; |
| 53 | recvcount = recvcounts[src]; |
| 54 | } |
| 55 | if (dst >= remote_size) { |
| 56 | dst = MPI_PROC_NULLcxx . . $ `src/include/mpi.h:549:9`!; |
| 57 | sendaddr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 58 | sendcount = 0; |
| 59 | } else { |
| 60 | sendaddr = (char *) sendbuf + sdispls[dst] * send_extent; |
| 61 | sendcount = sendcounts[dst]; |
| 62 | } |
| 63 | |
| 64 | if (sendcount * sendtype_size == 0) |
| 65 | dst = MPI_PROC_NULLcxx . . $ `src/include/mpi.h:549:9`!; |
| 66 | if (recvcount * recvtype_size == 0) |
| 67 | src = MPI_PROC_NULLcxx . . $ `src/include/mpi.h:549:9`!; |
| 68 | |
| 69 | mpi_errno = MPIR_Sched_sendcxx . . $ `src/mpid/ch4/include/mpid_sched.h:20:9`!(sendaddr, sendcount, sendtype, dst, comm_ptr, s); |
| 70 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 71 | mpi_errno = MPIR_Sched_recvcxx . . $ `src/mpid/ch4/include/mpid_sched.h:23:9`!(recvaddr, recvcount, recvtype, src, comm_ptr, s); |
| 72 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 73 | mpi_errno = MPIR_Sched_barriercxx . . $ `src/mpid/ch4/include/mpid_sched.h:28:9`!(s); |
| 74 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 75 | } |
| 76 | |
| 77 | fn_exit: |
| 78 | return mpi_errno; |
| 79 | fn_fail: |
| 80 | goto fn_exit; |
| 81 | } |