| 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 | #include "algo_common.h"cxx . . $ `<file>/src/mpi/coll/algorithms/common/algo_common.h`/ |
| 8 | |
| 9 | /* Routine to schedule inplace algorithm for alltoallw */ |
| 10 | int MPIR_TSP_Ialltoallw_sched_intra_inplacecxx . . $ MPIR_TSP_Ialltoallw_sched_intra_inplace(ce4d71c0d5621526).(const void *sendbuf, const MPI_Aintcxx . . $ MPI_Aint# sendcounts[], |
| 11 | const MPI_Aintcxx . . $ MPI_Aint# sdispls[], |
| 12 | const MPI_Datatypecxx . . $ MPI_Datatype# sendtypes[], void *recvbuf, |
| 13 | const MPI_Aintcxx . . $ MPI_Aint# recvcounts[], const MPI_Aintcxx . . $ MPI_Aint# rdispls[], |
| 14 | const MPI_Datatypecxx . . $ MPI_Datatype# recvtypes[], MPIR_Commcxx . . $ MPIR_Comm# * comm, |
| 15 | MPIR_TSP_sched_tcxx . . $ MPIR_TSP_sched_t# sched) |
| 16 | { |
| 17 | int mpi_errno = MPI_SUCCESScxx . . $ `src/include/mpi.h:655:9`!; |
| 18 | int tag; |
| 19 | MPI_Aintcxx . . $ MPI_Aint# recv_extent; |
| 20 | MPI_Aintcxx . . $ MPI_Aint# true_extent, true_lb; |
| 21 | int nranks, rank, nvtcs; |
| 22 | int i, dst, send_id, recv_id, dtcopy_id = -1, vtcs[2]; |
| 23 | void *tmp_buf = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, *adj_tmp_buf = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 24 | MPIR_FUNC_ENTERcxx . . $ `src/include/mpir_func.h:57:9`!; |
| 25 | |
| 26 | MPIR_Assertcxx . . $ `src/include/mpir_assert.h:39:9`!(sendbuf == MPI_IN_PLACEcxx . . $ `src/include/mpi.h:555:9`!); |
| 27 | |
| 28 | MPIR_COMM_RANK_SIZEcxx . . $ `src/include/mpir_comm.h:412:9`!(comm, rank, nranks); |
| 29 | |
| 30 | /* For correctness, transport based collectives need to get the |
| 31 | * tag from the same pool as schedule based collectives */ |
| 32 | mpi_errno = MPIR_Sched_next_tagcxx . . $ `src/mpid/ch4/include/mpid_sched.h:12:9`!(comm, &tag); |
| 33 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 34 | |
| 35 | /* FIXME: Here we allocate tmp_buf using extent and send/recv with datatype directly, |
| 36 | * which can be potentially very inefficient. Why don't we use bytes as in |
| 37 | * ialltoallw_intra_sched_inplace.c ? |
| 38 | */ |
| 39 | MPI_Aintcxx . . $ MPI_Aint# max_size; |
| 40 | max_size = 0; |
| 41 | for (i = 0; i < nranks; ++i) { |
| 42 | /* only look at recvtypes/recvcounts because the send vectors are |
| 43 | * ignored when sendbuf==MPI_IN_PLACE */ |
| 44 | MPIR_Type_get_true_extent_implcxx . . $ MPIR_Type_get_true_extent_impl(76a2ea8aac5bbe77).(recvtypes[i], &true_lb, &true_extent); |
| 45 | MPIR_Datatype_get_extent_macrocxx . . $ `src/include/mpir_datatype.h:462:9`!(recvtypes[i], recv_extent); |
| 46 | max_size = MPL_MAXcxx . . $ `src/mpl/include/mpl_base.h:105:9`!(max_size, recvcounts[i] * MPL_MAXcxx . . $ `src/mpl/include/mpl_base.h:105:9`!(recv_extent, true_extent)); |
| 47 | } |
| 48 | |
| 49 | tmp_buf = MPIR_TSP_sched_malloccxx . . $ MPIR_TSP_sched_malloc(7cf5f2fc6057a0cc).(max_size, sched); |
| 50 | MPIR_ERR_CHKANDJUMPcxx . . $ `src/include/mpir_err.h:1034:9`!(!tmp_buf, mpi_errno, MPI_ERR_OTHERcxx . . $ `src/include/mpi.h:679:9`!, "**nomem"); |
| 51 | |
| 52 | for (i = 0; i < nranks; ++i) { |
| 53 | if (rank != i) { |
| 54 | dst = i; |
| 55 | nvtcs = (dtcopy_id == -1) ? 0 : 1; |
| 56 | vtcs[0] = dtcopy_id; |
| 57 | |
| 58 | MPIR_Type_get_true_extent_implcxx . . $ MPIR_Type_get_true_extent_impl(76a2ea8aac5bbe77).(recvtypes[i], &true_lb, &true_extent); |
| 59 | adj_tmp_buf = (void *) ((char *) tmp_buf - true_lb); |
| 60 | |
| 61 | mpi_errno = MPIR_TSP_sched_isendcxx . . $ MPIR_TSP_sched_isend(29099b4ae230c868).((char *) recvbuf + rdispls[dst], |
| 62 | recvcounts[dst], recvtypes[dst], dst, tag, comm, sched, |
| 63 | nvtcs, vtcs, &send_id); |
| 64 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 65 | mpi_errno = |
| 66 | MPIR_TSP_sched_irecvcxx . . $ MPIR_TSP_sched_irecv(2270ed5ad98bfa2b).(adj_tmp_buf, recvcounts[dst], recvtypes[dst], dst, tag, comm, |
| 67 | sched, nvtcs, vtcs, &recv_id); |
| 68 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 69 | |
| 70 | nvtcs = 2; |
| 71 | vtcs[0] = send_id; |
| 72 | vtcs[1] = recv_id; |
| 73 | mpi_errno = MPIR_TSP_sched_localcopycxx . . $ MPIR_TSP_sched_localcopy(e23c285a5816c4b9).(adj_tmp_buf, recvcounts[dst], recvtypes[dst], |
| 74 | ((char *) recvbuf + rdispls[dst]), recvcounts[dst], |
| 75 | recvtypes[dst], sched, nvtcs, vtcs, &dtcopy_id); |
| 76 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | fn_exit: |
| 81 | MPIR_FUNC_EXITcxx . . $ `src/include/mpir_func.h:58:9`!; |
| 82 | return mpi_errno; |
| 83 | fn_fail: |
| 84 | goto fn_exit; |
| 85 | } |