- TRACE_smpi_comm_in(rank, __func__,
- new simgrid::instr::VarCollTIData("reducescatter", -1, 0, nullptr, -1, trace_recvcounts,
- simgrid::smpi::Datatype::encode(datatype), ""));
+int PMPI_Ireduce_scatter_block(const void* sendbuf, void* recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op,
+ MPI_Comm comm, MPI_Request* request)
+{
+ CHECK_COMM(6)
+ SET_BUF1(sendbuf)
+ SET_BUF2(recvbuf)
+ CHECK_TYPE(4, datatype)
+ CHECK_COUNT(3, recvcount)
+ CHECK_BUFFER(1, sendbuf, recvcount, datatype)
+ CHECK_BUFFER(2, recvbuf, recvcount, datatype)
+ CHECK_REQUEST(7)
+ CHECK_OP(5, op, datatype)
+
+ const SmpiBenchGuard suspend_bench;
+ 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, 0, 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);
+ return MPI_SUCCESS;
+}