- TRACE_smpi_comm_in(rank, __FUNCTION__,
- new simgrid::instr::VarCollTIData("reduceScatter", -1, 0, nullptr, -1, trace_recvcounts,
- encode_datatype(datatype), ""));
+ smpi_bench_end();
+ int count = comm->size();
+
+ aid_t pid = simgrid::s4u::this_actor::get_pid();
+ int dt_send_size = datatype->is_replayable() ? 1 : datatype->size();
+ auto trace_recvcounts = std::make_shared<std::vector<int>>(recvcount * dt_send_size); // copy data to avoid bad free
+ std::vector<unsigned char> tmp_sendbuf;
+ const void* real_sendbuf = smpi_get_in_place_buf(sendbuf, recvbuf, tmp_sendbuf, recvcount * count, datatype);
+
+ TRACE_smpi_comm_in(
+ pid, request == MPI_REQUEST_IGNORED ? "PMPI_Reduce_scatter_block" : "PMPI_Ireduce_scatter_block",
+ new simgrid::instr::VarCollTIData(request == MPI_REQUEST_IGNORED ? "reducescatter" : "ireducescatter", -1, 0,
+ nullptr, -1, trace_recvcounts, simgrid::smpi::Datatype::encode(datatype), ""));
+
+ std::vector<int> recvcounts(count);
+ for (int i = 0; i < count; i++)
+ recvcounts[i] = recvcount;
+ if (request == MPI_REQUEST_IGNORED)
+ simgrid::smpi::colls::reduce_scatter(real_sendbuf, recvbuf, recvcounts.data(), datatype, op, comm);
+ else
+ simgrid::smpi::colls::ireduce_scatter(real_sendbuf, recvbuf, recvcounts.data(), datatype, op, comm, request);
+
+ TRACE_smpi_comm_out(pid);
+ smpi_bench_begin();
+ return MPI_SUCCESS;
+}