| 1 | /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */cxx . . $ `<file>/src/mpi/coll/allreduce/allreduce_intra_k_reduce_scatter_allgather.c`/ |
| 2 | /* |
| 3 | * Copyright (C) by Argonne National Laboratory. |
| 4 | * See COPYRIGHT in top-level directory. |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include "mpiimpl.h"cxx . . $ `<file>/src/include/mpiimpl.h`/ |
| 9 | #include "recexchalgo.h"cxx . . $ `<file>/src/mpi/coll/algorithms/recexchalgo/recexchalgo.h`/ |
| 10 | #include "algo_common.h"cxx . . $ `<file>/src/mpi/coll/algorithms/common/algo_common.h`/ |
| 11 | |
| 12 | |
| 13 | int MPIR_Allreduce_intra_k_reduce_scatter_allgathercxx . . $ MPIR_Allreduce_intra_k_reduce_scatter_allgather(76ad3e972c37ca59).(const void *sendbuf, |
| 14 | void *recvbuf, |
| 15 | MPI_Aintcxx . . $ MPI_Aint# count, |
| 16 | MPI_Datatypecxx . . $ MPI_Datatype# datatype, |
| 17 | MPI_Opcxx . . $ MPI_Op# op, MPIR_Commcxx . . $ MPIR_Comm# * comm, int k, |
| 18 | int single_phase_recv, int coll_attr) |
| 19 | { |
| 20 | int mpi_errno = MPI_SUCCESScxx . . $ `src/include/mpi.h:655:9`!; |
| 21 | int rank, nranks, nbr; |
| 22 | int rem = 0, idx = 0, dst = 0, rank_for_offset; |
| 23 | MPI_Aintcxx . . $ MPI_Aint# true_extent, true_lb, extent; |
| 24 | int current_cnt = 0, send_count = 0, recv_count = 0, send_cnt = 0, recv_cnt = 0, iter = 0; |
| 25 | int offset = 0; |
| 26 | int step1_sendto = -1, step1_nrecvs = 0, *step1_recvfrom = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 27 | int step2_nphases = 0, **step2_nbrs; |
| 28 | int i, j, x, phase, recv_phase, p_of_k, T; |
| 29 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! in_step2 = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 30 | int index = 0, comm_alloc = 1; |
| 31 | MPIR_Requestcxx . . $ MPIR_Request# *sreqs[MAX_RADIXcxx . . $ `src/include/mpir_comm.h:15:9`! * 2], *rreqs[MAX_RADIXcxx . . $ `src/include/mpir_comm.h:15:9`! * 2]; |
| 32 | MPIR_Requestcxx . . $ MPIR_Request# **send_reqs = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, **recv_reqs = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 33 | int num_sreq = 0, num_rreq = 0, total_phases = 0; |
| 34 | void *tmp_recvbuf = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 35 | MPIR_CHKLMEM_DECLcxx . . $ `src/include/mpir_mem.h:108:9`!(); |
| 36 | |
| 37 | MPIR_Assertcxx . . $ `src/include/mpir_assert.h:39:9`!(k > 1); |
| 38 | |
| 39 | MPIR_COMM_RANK_SIZEcxx . . $ `src/include/mpir_comm.h:412:9`!(comm, rank, nranks); |
| 40 | MPIR_Assertcxx . . $ `src/include/mpir_assert.h:39:9`!(MPIR_Op_is_commutative(op)); |
| 41 | |
| 42 | /* need to allocate temporary buffer to store incoming data */ |
| 43 | MPIR_Type_get_true_extent_implcxx . . $ MPIR_Type_get_true_extent_impl(76a2ea8aac5bbe77).(datatype, &true_lb, &true_extent); |
| 44 | MPIR_Datatype_get_extent_macrocxx . . $ `src/include/mpir_datatype.h:462:9`!(datatype, extent); |
| 45 | |
| 46 | /* copy local data into recvbuf */ |
| 47 | if (sendbuf != MPI_IN_PLACEcxx . . $ `src/include/mpi.h:555:9`! && count > 0) { |
| 48 | mpi_errno = MPIR_Localcopycxx . . $ MPIR_Localcopy(cf422982ceb8df2).(sendbuf, count, datatype, recvbuf, count, datatype); |
| 49 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 50 | } |
| 51 | |
| 52 | /* If k value is greater than the maximum radix for which nbrs |
| 53 | * are stored in comm, generate nbrs here in the function. Otherwise, |
| 54 | * get the nbrs information stored in the communicator */ |
| 55 | if (k > MAX_RADIXcxx . . $ `src/include/mpir_comm.h:15:9`!) { |
| 56 | comm_alloc = 0; |
| 57 | /* get the neighbors, the function allocates the required memory */ |
| 58 | MPII_Recexchalgo_get_neighborscxx . . $ MPII_Recexchalgo_get_neighbors(21383f888eb87359).(rank, nranks, &k, &step1_sendto, |
| 59 | &step1_recvfrom, &step1_nrecvs, |
| 60 | &step2_nbrs, &step2_nphases, &p_of_k, &T); |
| 61 | /* Allocate requests */ |
| 62 | if (step1_sendto == -1) { |
| 63 | recv_reqs = |
| 64 | (MPIR_Requestcxx . . $ MPIR_Request# **) MPL_malloccxx . . $ MPL_malloc(47e2c277390bf45).((k - 1) * 2 * sizeof(MPIR_Requestcxx . . $ MPIR_Request# *), MPL_MEM_BUFFERcxx . . $ MPL_MEM_BUFFER.); |
| 65 | MPIR_ERR_CHKANDJUMPcxx . . $ `src/include/mpir_err.h:1034:9`!(!recv_reqs, mpi_errno, MPI_ERR_OTHERcxx . . $ `src/include/mpi.h:679:9`!, "**nomem"); |
| 66 | send_reqs = |
| 67 | (MPIR_Requestcxx . . $ MPIR_Request# **) MPL_malloccxx . . $ MPL_malloc(47e2c277390bf45).((k - 1) * 2 * sizeof(MPIR_Requestcxx . . $ MPIR_Request# *), MPL_MEM_BUFFERcxx . . $ MPL_MEM_BUFFER.); |
| 68 | MPIR_ERR_CHKANDJUMPcxx . . $ `src/include/mpir_err.h:1034:9`!(!send_reqs, mpi_errno, MPI_ERR_OTHERcxx . . $ `src/include/mpi.h:679:9`!, "**nomem"); |
| 69 | } |
| 70 | } else { |
| 71 | index = k - 2; /* we calculate starting k = 2 */ |
| 72 | /* If this is the first time a recursive exchange is called with k, populate the nbr calculation in |
| 73 | * the communicator */ |
| 74 | if (comm->collcxx . . $ MPIR_Comm#coll..nbrs_definedcxx . . $ MPIR_Comm#$anonymous_type_4#nbrs_defined.[index] == 0) { |
| 75 | comm->collcxx . . $ MPIR_Comm#coll..nbrs_definedcxx . . $ MPIR_Comm#$anonymous_type_4#nbrs_defined.[index] = 1; |
| 76 | comm->collcxx . . $ MPIR_Comm#coll..kcxx . . $ MPIR_Comm#$anonymous_type_4#k.[index] = k; |
| 77 | comm->collcxx . . $ MPIR_Comm#coll..step1_sendtocxx . . $ MPIR_Comm#$anonymous_type_4#step1_sendto.[index] = -1; |
| 78 | comm->collcxx . . $ MPIR_Comm#coll..step1_nrecvscxx . . $ MPIR_Comm#$anonymous_type_4#step1_nrecvs.[index] = 0; |
| 79 | comm->collcxx . . $ MPIR_Comm#coll..step2_nphasescxx . . $ MPIR_Comm#$anonymous_type_4#step2_nphases.[index] = 0; |
| 80 | mpi_errno = MPII_Recexchalgo_get_neighborscxx . . $ MPII_Recexchalgo_get_neighbors(21383f888eb87359).(rank, nranks, &comm->collcxx . . $ MPIR_Comm#coll..kcxx . . $ MPIR_Comm#$anonymous_type_4#k.[index], |
| 81 | &comm->collcxx . . $ MPIR_Comm#coll..step1_sendtocxx . . $ MPIR_Comm#$anonymous_type_4#step1_sendto.[index], |
| 82 | &comm->collcxx . . $ MPIR_Comm#coll..step1_recvfromcxx . . $ MPIR_Comm#$anonymous_type_4#step1_recvfrom.[index], |
| 83 | &comm->collcxx . . $ MPIR_Comm#coll..step1_nrecvscxx . . $ MPIR_Comm#$anonymous_type_4#step1_nrecvs.[index], |
| 84 | &comm->collcxx . . $ MPIR_Comm#coll..step2_nbrscxx . . $ MPIR_Comm#$anonymous_type_4#step2_nbrs.[index], |
| 85 | &comm->collcxx . . $ MPIR_Comm#coll..step2_nphasescxx . . $ MPIR_Comm#$anonymous_type_4#step2_nphases.[index], |
| 86 | &comm->collcxx . . $ MPIR_Comm#coll..pofkcxx . . $ MPIR_Comm#$anonymous_type_4#pofk.[index], &T); |
| 87 | } |
| 88 | k = comm->collcxx . . $ MPIR_Comm#coll..kcxx . . $ MPIR_Comm#$anonymous_type_4#k.[index]; |
| 89 | p_of_k = comm->collcxx . . $ MPIR_Comm#coll..pofkcxx . . $ MPIR_Comm#$anonymous_type_4#pofk.[index]; |
| 90 | step1_sendto = comm->collcxx . . $ MPIR_Comm#coll..step1_sendtocxx . . $ MPIR_Comm#$anonymous_type_4#step1_sendto.[index]; |
| 91 | step1_recvfrom = comm->collcxx . . $ MPIR_Comm#coll..step1_recvfromcxx . . $ MPIR_Comm#$anonymous_type_4#step1_recvfrom.[index]; |
| 92 | step1_nrecvs = comm->collcxx . . $ MPIR_Comm#coll..step1_nrecvscxx . . $ MPIR_Comm#$anonymous_type_4#step1_nrecvs.[index]; |
| 93 | step2_nbrs = comm->collcxx . . $ MPIR_Comm#coll..step2_nbrscxx . . $ MPIR_Comm#$anonymous_type_4#step2_nbrs.[index]; |
| 94 | step2_nphases = comm->collcxx . . $ MPIR_Comm#coll..step2_nphasescxx . . $ MPIR_Comm#$anonymous_type_4#step2_nphases.[index]; |
| 95 | |
| 96 | recv_reqs = rreqs; |
| 97 | send_reqs = sreqs; |
| 98 | } |
| 99 | /* allocate temp buffer for receiving in reduce scatter phase */ |
| 100 | tmp_recvbuf = MPL_malloccxx . . $ MPL_malloc(47e2c277390bf45).(count * extent, MPL_MEM_BUFFERcxx . . $ MPL_MEM_BUFFER.); |
| 101 | MPIR_ERR_CHKANDJUMPcxx . . $ `src/include/mpir_err.h:1034:9`!(!tmp_recvbuf, mpi_errno, MPI_ERR_OTHERcxx . . $ `src/include/mpi.h:679:9`!, "**nomem"); |
| 102 | |
| 103 | in_step2 = (step1_sendto == -1); /* whether this rank participates in Step 2 */ |
| 104 | if (!in_step2) { /* even */ |
| 105 | /* non-participating rank sends the data to a participating rank */ |
| 106 | mpi_errno = MPIC_Sendcxx . . $ MPIC_Send(7db7c678554c168).(recvbuf, count, |
| 107 | datatype, step1_sendto, MPIR_ALLREDUCE_TAGcxx . . $ `src/include/mpir_tags.h:24:9`!, comm, coll_attr); |
| 108 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 109 | } else { /* odd */ |
| 110 | for (i = 0; i < step1_nrecvs; i++) { /* participating rank gets data from non-partcipating ranks */ |
| 111 | mpi_errno = |
| 112 | MPIC_Recvcxx . . $ MPIC_Recv(d0ba731ba304c173).(tmp_recvbuf, count, datatype, step1_recvfrom[i], MPIR_ALLREDUCE_TAGcxx . . $ `src/include/mpir_tags.h:24:9`!, comm, |
| 113 | MPI_STATUS_IGNOREcxx . . $ `src/include/mpi.h:560:9`!); |
| 114 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 115 | /* Do reduction of reduced data */ |
| 116 | mpi_errno = MPIR_Reduce_localcxx . . $ MPIR_Reduce_local(7a92db00d5378e78).(tmp_recvbuf, recvbuf, count, datatype, op); |
| 117 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | /* Main recursive exchange step */ |
| 122 | if (in_step2) { |
| 123 | MPI_Aintcxx . . $ MPI_Aint# *cnts = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, *displs = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 124 | MPIR_CHKLMEM_MALLOCcxx . . $ `src/include/mpir_mem.h:118:9`!(cnts, sizeof(MPI_Aint) * nranks); |
| 125 | MPIR_CHKLMEM_MALLOCcxx . . $ `src/include/mpir_mem.h:118:9`!(displs, sizeof(MPI_Aint) * nranks); |
| 126 | idx = 0; |
| 127 | rem = nranks - p_of_k; |
| 128 | |
| 129 | /* create a counts and displacements array for reduce scatter and allgatherv stages */ |
| 130 | for (i = 0; i < nranks; i++) |
| 131 | cnts[i] = 0; |
| 132 | for (i = 0; i < (p_of_k - 1); i++) { |
| 133 | idx = (i < rem / (k - 1)) ? (i * k) + (k - 1) : i + rem; |
| 134 | cnts[idx] = count / p_of_k; |
| 135 | } |
| 136 | idx = (p_of_k - 1 < rem / (k - 1)) ? (p_of_k - 1 * k) + (k - 1) : p_of_k - 1 + rem; |
| 137 | cnts[idx] = count - (count / p_of_k) * (p_of_k - 1); |
| 138 | |
| 139 | displs[0] = 0; |
| 140 | for (i = 1; i < nranks; i++) { |
| 141 | displs[i] = displs[i - 1] + cnts[i - 1]; |
| 142 | } |
| 143 | |
| 144 | /* reduce scatter - distance doubling and vector halving. Exchange data with the closest nbr in the first phase |
| 145 | * and increase the distance between nbrs in subsequent phases while the data decreases */ |
| 146 | for (phase = 0, j = step2_nphases - 1; phase < step2_nphases; j--, phase++) { |
| 147 | /* send data to all the neighbors */ |
| 148 | for (i = 0; i < k - 1; i++) { |
| 149 | num_rreq = 0; |
| 150 | dst = step2_nbrs[phase][i]; |
| 151 | |
| 152 | rank_for_offset = MPII_Recexchalgo_reverse_digits_step2cxx . . $ MPII_Recexchalgo_reverse_digits_step2(2326284602b0bb2d).(dst, nranks, k); |
| 153 | MPII_Recexchalgo_get_count_and_offsetcxx . . $ MPII_Recexchalgo_get_count_and_offset(38f85d30b56b1458).(rank_for_offset, j, k, nranks, |
| 154 | ¤t_cnt, &offset); |
| 155 | MPI_Aintcxx . . $ MPI_Aint# send_offset = displs[offset] * extent; |
| 156 | send_cnt = 0; |
| 157 | for (x = 0; x < current_cnt; x++) |
| 158 | send_cnt += cnts[offset + x]; |
| 159 | mpi_errno = |
| 160 | MPIC_Isendcxx . . $ MPIC_Isend(92f04c3ea3bbad99).((char *) recvbuf + send_offset, send_cnt, |
| 161 | datatype, dst, MPIR_ALLREDUCE_TAGcxx . . $ `src/include/mpir_tags.h:24:9`!, comm, &recv_reqs[num_rreq++], |
| 162 | coll_attr); |
| 163 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 164 | |
| 165 | rank_for_offset = MPII_Recexchalgo_reverse_digits_step2cxx . . $ MPII_Recexchalgo_reverse_digits_step2(2326284602b0bb2d).(rank, nranks, k); |
| 166 | MPII_Recexchalgo_get_count_and_offsetcxx . . $ MPII_Recexchalgo_get_count_and_offset(38f85d30b56b1458).(rank_for_offset, j, k, nranks, |
| 167 | ¤t_cnt, &offset); |
| 168 | |
| 169 | MPI_Aintcxx . . $ MPI_Aint# recv_offset = displs[offset] * extent; |
| 170 | recv_cnt = 0; |
| 171 | for (x = 0; x < current_cnt; x++) |
| 172 | recv_cnt += cnts[offset + x]; |
| 173 | mpi_errno = |
| 174 | MPIC_Irecvcxx . . $ MPIC_Irecv(d5a3955da26b940f).((char *) tmp_recvbuf + recv_offset, recv_cnt, datatype, |
| 175 | dst, MPIR_ALLREDUCE_TAGcxx . . $ `src/include/mpir_tags.h:24:9`!, comm, &recv_reqs[num_rreq++]); |
| 176 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 177 | |
| 178 | mpi_errno = MPIC_Waitallcxx . . $ MPIC_Waitall(96058919363a54c1).(num_rreq, recv_reqs, MPI_STATUSES_IGNOREcxx . . $ `src/include/mpi.h:561:9`!); |
| 179 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 180 | mpi_errno = |
| 181 | MPIR_Reduce_localcxx . . $ MPIR_Reduce_local(7a92db00d5378e78).((char *) tmp_recvbuf + recv_offset, |
| 182 | (char *) recvbuf + recv_offset, recv_cnt, datatype, op); |
| 183 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | /* allgatherv - distance halving and vector doubling. Exchange data with the farthest nbr in the first phase |
| 188 | * and decrease the distance between nbrs in subsequent phases while the data increases */ |
| 189 | phase = step2_nphases - 1; |
| 190 | recv_phase = step2_nphases - 1; |
| 191 | for (j = 0; j < step2_nphases && step1_sendto == -1; j++) { |
| 192 | /* post recvs for two phases. If optimization enabled, post for one phase */ |
| 193 | total_phases = (single_phase_recv) ? 1 : 2; |
| 194 | num_sreq = 0; |
| 195 | num_rreq = 0; |
| 196 | for (iter = 0; iter < total_phases && (j + iter) < step2_nphases; iter++) { |
| 197 | for (i = 0; i < k - 1; i++) { |
| 198 | nbr = step2_nbrs[recv_phase][i]; |
| 199 | rank_for_offset = MPII_Recexchalgo_reverse_digits_step2cxx . . $ MPII_Recexchalgo_reverse_digits_step2(2326284602b0bb2d).(nbr, nranks, k); |
| 200 | |
| 201 | MPII_Recexchalgo_get_count_and_offsetcxx . . $ MPII_Recexchalgo_get_count_and_offset(38f85d30b56b1458).(rank_for_offset, j + iter, k, nranks, |
| 202 | ¤t_cnt, &offset); |
| 203 | MPI_Aintcxx . . $ MPI_Aint# recv_offset = displs[offset] * extent; |
| 204 | recv_count = 0; |
| 205 | for (x = 0; x < current_cnt; x++) |
| 206 | recv_count += cnts[offset + x]; |
| 207 | mpi_errno = MPIC_Irecvcxx . . $ MPIC_Irecv(d5a3955da26b940f).(((char *) recvbuf + recv_offset), recv_count, datatype, |
| 208 | nbr, MPIR_ALLREDUCE_TAGcxx . . $ `src/include/mpir_tags.h:24:9`!, comm, &recv_reqs[num_rreq++]); |
| 209 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 210 | } |
| 211 | recv_phase--; |
| 212 | } |
| 213 | /* send data to all the neighbors */ |
| 214 | for (i = 0; i < k - 1; i++) { |
| 215 | nbr = step2_nbrs[phase][i]; |
| 216 | rank_for_offset = MPII_Recexchalgo_reverse_digits_step2cxx . . $ MPII_Recexchalgo_reverse_digits_step2(2326284602b0bb2d).(rank, nranks, k); |
| 217 | MPII_Recexchalgo_get_count_and_offsetcxx . . $ MPII_Recexchalgo_get_count_and_offset(38f85d30b56b1458).(rank_for_offset, j, k, nranks, ¤t_cnt, |
| 218 | &offset); |
| 219 | MPI_Aintcxx . . $ MPI_Aint# send_offset = displs[offset] * extent; |
| 220 | send_count = 0; |
| 221 | for (x = 0; x < current_cnt; x++) |
| 222 | send_count += cnts[offset + x]; |
| 223 | mpi_errno = MPIC_Isendcxx . . $ MPIC_Isend(92f04c3ea3bbad99).(((char *) recvbuf + send_offset), send_count, datatype, |
| 224 | nbr, MPIR_ALLREDUCE_TAGcxx . . $ `src/include/mpir_tags.h:24:9`!, comm, &send_reqs[num_sreq++], |
| 225 | coll_attr); |
| 226 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 227 | } |
| 228 | /* wait on prev recvs */ |
| 229 | mpi_errno = MPIC_Waitallcxx . . $ MPIC_Waitall(96058919363a54c1).((k - 1), recv_reqs, MPI_STATUSES_IGNOREcxx . . $ `src/include/mpi.h:561:9`!); |
| 230 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 231 | |
| 232 | phase--; |
| 233 | if (single_phase_recv == falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!) { |
| 234 | j++; |
| 235 | if (j < step2_nphases) { |
| 236 | /* send data to all the neighbors */ |
| 237 | for (i = 0; i < k - 1; i++) { |
| 238 | nbr = step2_nbrs[phase][i]; |
| 239 | rank_for_offset = MPII_Recexchalgo_reverse_digits_step2cxx . . $ MPII_Recexchalgo_reverse_digits_step2(2326284602b0bb2d).(rank, nranks, k); |
| 240 | MPII_Recexchalgo_get_count_and_offsetcxx . . $ MPII_Recexchalgo_get_count_and_offset(38f85d30b56b1458).(rank_for_offset, j, k, nranks, |
| 241 | ¤t_cnt, &offset); |
| 242 | MPI_Aintcxx . . $ MPI_Aint# send_offset = displs[offset] * extent; |
| 243 | send_count = 0; |
| 244 | for (x = 0; x < current_cnt; x++) |
| 245 | send_count += cnts[offset + x]; |
| 246 | mpi_errno = |
| 247 | MPIC_Isendcxx . . $ MPIC_Isend(92f04c3ea3bbad99).(((char *) recvbuf + send_offset), send_count, datatype, nbr, |
| 248 | MPIR_ALLREDUCE_TAGcxx . . $ `src/include/mpir_tags.h:24:9`!, comm, &send_reqs[num_sreq++], coll_attr); |
| 249 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 250 | } |
| 251 | /* wait on prev recvs */ |
| 252 | mpi_errno = MPIC_Waitallcxx . . $ MPIC_Waitall(96058919363a54c1).((k - 1), recv_reqs + (k - 1), MPI_STATUSES_IGNOREcxx . . $ `src/include/mpi.h:561:9`!); |
| 253 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 254 | |
| 255 | phase--; |
| 256 | } |
| 257 | } |
| 258 | mpi_errno = MPIC_Waitallcxx . . $ MPIC_Waitall(96058919363a54c1).(num_sreq, send_reqs, MPI_STATUSES_IGNOREcxx . . $ `src/include/mpi.h:561:9`!); |
| 259 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | /* Step 3: This is reverse of Step 1. Rans that participated in Step 2 |
| 264 | * send the data to non-partcipating rans */ |
| 265 | if (step1_sendto != -1) { /* I am a Step 2 non-participating rank */ |
| 266 | mpi_errno = MPIC_Recvcxx . . $ MPIC_Recv(d0ba731ba304c173).(recvbuf, count, datatype, step1_sendto, MPIR_ALLREDUCE_TAGcxx . . $ `src/include/mpir_tags.h:24:9`!, comm, |
| 267 | MPI_STATUS_IGNOREcxx . . $ `src/include/mpi.h:560:9`!); |
| 268 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 269 | } else { |
| 270 | if (step1_nrecvs > 0) { |
| 271 | for (i = 0; i < step1_nrecvs; i++) { |
| 272 | mpi_errno = |
| 273 | MPIC_Isendcxx . . $ MPIC_Isend(92f04c3ea3bbad99).(recvbuf, count, datatype, step1_recvfrom[i], MPIR_ALLREDUCE_TAGcxx . . $ `src/include/mpir_tags.h:24:9`!, |
| 274 | comm, &send_reqs[i], coll_attr); |
| 275 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 276 | } |
| 277 | |
| 278 | mpi_errno = MPIC_Waitallcxx . . $ MPIC_Waitall(96058919363a54c1).(i, send_reqs, MPI_STATUSES_IGNOREcxx . . $ `src/include/mpi.h:561:9`!); |
| 279 | MPIR_ERR_CHECKcxx . . $ `src/include/mpir_err.h:810:9`!(mpi_errno); |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | if (!comm_alloc) { |
| 284 | /* free the memory */ |
| 285 | for (i = 0; i < step2_nphases; i++) |
| 286 | MPL_freecxx . . $ `src/mpl/include/mpl_trmem.h:308:9`!(step2_nbrs[i]); |
| 287 | MPL_freecxx . . $ `src/mpl/include/mpl_trmem.h:308:9`!(step2_nbrs); |
| 288 | MPL_freecxx . . $ `src/mpl/include/mpl_trmem.h:308:9`!(step1_recvfrom); |
| 289 | if (in_step2) { |
| 290 | MPL_freecxx . . $ `src/mpl/include/mpl_trmem.h:308:9`!(recv_reqs); |
| 291 | MPL_freecxx . . $ `src/mpl/include/mpl_trmem.h:308:9`!(send_reqs); |
| 292 | } |
| 293 | } |
| 294 | MPL_freecxx . . $ `src/mpl/include/mpl_trmem.h:308:9`!(tmp_recvbuf); |
| 295 | fn_exit: |
| 296 | MPIR_CHKLMEM_FREEALLcxx . . $ `src/include/mpir_mem.h:129:9`!(); |
| 297 | return mpi_errno; |
| 298 | fn_fail: |
| 299 | goto fn_exit; |
| 300 | } |