From 1da823524b70dedc98de1076d033706688f72d88 Mon Sep 17 00:00:00 2001 From: Christian Heinrich Date: Mon, 19 Mar 2018 14:30:24 +0100 Subject: [PATCH] [SMPI] Replay/Allgatherv: Account for disps parameters in a replay trace --- src/smpi/internals/smpi_replay.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/smpi/internals/smpi_replay.cpp b/src/smpi/internals/smpi_replay.cpp index 16da1e66cf..0f844a4f83 100644 --- a/src/smpi/internals/smpi_replay.cpp +++ b/src/smpi/internals/smpi_replay.cpp @@ -720,10 +720,23 @@ static void action_allgatherv(const char *const *action) { std::shared_ptr> recvcounts(new std::vector(comm_size)); std::vector disps(comm_size, 0); - MPI_Datatype MPI_CURRENT_TYPE = - (action[3 + comm_size] && action[4 + comm_size]) ? decode_datatype(action[3 + comm_size]) : MPI_DEFAULT_TYPE; - MPI_Datatype MPI_CURRENT_TYPE2{ - (action[3 + comm_size] && action[4 + comm_size]) ? decode_datatype(action[4 + comm_size]) : MPI_DEFAULT_TYPE}; + int datatype_index = 0, disp_index = 0; + if (action[3 + 2 * comm_size]) { /* datatype + disp are specified */ + datatype_index = 3 + comm_size; + disp_index = datatype_index + 1; + } else if (action[3 + 2 * comm_size]) { /* disps specified; datatype is not specified; use the default one */ + datatype_index = -1; + disp_index = 3 + comm_size; + } else if (action[3 + comm_size]) { /* only datatype, no disp specified */ + datatype_index = 3 + comm_size; + } + + if (disp_index != 0) { + std::copy(action[disp_index], action[disp_index + comm_size], disps.begin()); + } + + MPI_Datatype MPI_CURRENT_TYPE{(datatype_index > 0) ? decode_datatype(action[datatype_index]) : MPI_DEFAULT_TYPE}; + MPI_Datatype MPI_CURRENT_TYPE2{(datatype_index > 0) ? decode_datatype(action[datatype_index]) : MPI_DEFAULT_TYPE}; void *sendbuf = smpi_get_tmp_sendbuffer(sendcount* MPI_CURRENT_TYPE->size()); -- 2.20.1