From c1b693f3f39b3f531eb47f0820bd6455fe6710ff Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Thu, 5 Aug 2021 13:09:33 +0200 Subject: [PATCH] Fix for fg #78 : allotallv/w tracing was reporting wrong size in some cases for replayable traces. --- src/smpi/bindings/smpi_pmpi_coll.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/smpi/bindings/smpi_pmpi_coll.cpp b/src/smpi/bindings/smpi_pmpi_coll.cpp index 534a94a9eb..456b2336bf 100644 --- a/src/smpi/bindings/smpi_pmpi_coll.cpp +++ b/src/smpi/bindings/smpi_pmpi_coll.cpp @@ -808,7 +808,7 @@ int PMPI_Ialltoallv(const void* sendbuf, const int* sendcounts, const int* sendd int recv_size = 0; auto trace_sendcounts = std::make_shared>(); auto trace_recvcounts = std::make_shared>(); - int dt_size_recv = recvtype->size(); + int dt_size_recv = recvtype->is_replayable() ? 1 : recvtype->size(); const int* real_sendcounts = sendcounts; const int* real_senddispls = senddispls; @@ -838,7 +838,7 @@ int PMPI_Ialltoallv(const void* sendbuf, const int* sendcounts, const int* sendd return MPI_ERR_TRUNCATE; } - int dt_size_send = real_sendtype->size(); + int dt_size_send = real_sendtype->is_replayable() ? 1 : real_sendtype->size(); for (int i = 0; i < size; i++) { // copy data to avoid bad free send_size += real_sendcounts[i] * dt_size_send; @@ -907,12 +907,14 @@ int PMPI_Ialltoallw(const void* sendbuf, const int* sendcounts, const int* sendd const int* real_sendcounts = sendcounts; const int* real_senddispls = senddispls; const MPI_Datatype* real_sendtypes = sendtypes; + unsigned long maxsize = 0; for (int i = 0; i < size; i++) { // copy data to avoid bad free if (recvtypes[i] == MPI_DATATYPE_NULL) return MPI_ERR_TYPE; + int dt_size_recv = recvtypes[i]->is_replayable() ? 1 : recvtypes[i]->size(); recv_size += recvcounts[i] * recvtypes[i]->size(); - trace_recvcounts->push_back(recvcounts[i] * recvtypes[i]->size()); + trace_recvcounts->push_back(recvcounts[i] * dt_size_recv); if ((recvdispls[i] + (recvcounts[i] * recvtypes[i]->size())) > maxsize) maxsize = recvdispls[i] + (recvcounts[i] * recvtypes[i]->size()); } @@ -938,8 +940,9 @@ int PMPI_Ialltoallw(const void* sendbuf, const int* sendcounts, const int* sendd } for (int i = 0; i < size; i++) { // copy data to avoid bad free + int dt_size_send = real_sendtypes[i]->is_replayable() ? 1 : real_sendtypes[i]->size(); send_size += real_sendcounts[i] * real_sendtypes[i]->size(); - trace_sendcounts->push_back(real_sendcounts[i] * real_sendtypes[i]->size()); + trace_sendcounts->push_back(real_sendcounts[i] * dt_size_send); } TRACE_smpi_comm_in(pid, request == MPI_REQUEST_IGNORED ? "PMPI_Alltoallw" : "PMPI_Ialltoallw", -- 2.20.1