From ebee0de43b18a921c6d76f678b0ba50ea0a75025 Mon Sep 17 00:00:00 2001 From: Christian Heinrich Date: Mon, 12 Mar 2018 20:11:50 +0100 Subject: [PATCH 1/1] [SMPI] Replay: Use std::vector copy-constr. instead of loop --- src/smpi/internals/smpi_replay.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/smpi/internals/smpi_replay.cpp b/src/smpi/internals/smpi_replay.cpp index 9813e79f6b..b3e2fc6a84 100644 --- a/src/smpi/internals/smpi_replay.cpp +++ b/src/smpi/internals/smpi_replay.cpp @@ -619,9 +619,7 @@ static void action_gatherv(const char *const *action) { if(rank==root) recv = smpi_get_tmp_recvbuffer(recv_sum* MPI_CURRENT_TYPE2->size()); - std::vector* trace_recvcounts = new std::vector; - for (int i = 0; i < comm_size; i++) // copy data to avoid bad free - trace_recvcounts->push_back(recvcounts[i]); + std::vector* trace_recvcounts = new std::vector(recvcounts, recvcounts + comm_size); TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::VarCollTIData( "gatherV", root, send_size, nullptr, -1, trace_recvcounts, @@ -671,9 +669,7 @@ static void action_scatterv(const char* const* action) if (rank == root) send = smpi_get_tmp_sendbuffer(send_sum * MPI_CURRENT_TYPE2->size()); - std::vector* trace_sendcounts = new std::vector; - for (int i = 0; i < comm_size; i++) // copy data to avoid bad free - trace_sendcounts->push_back(sendcounts[i]); + std::vector* trace_sendcounts = new std::vector(sendcounts, sendcounts + comm_size); TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::VarCollTIData( "gatherV", root, -1, trace_sendcounts, recv_size, nullptr, @@ -790,9 +786,7 @@ static void action_allgatherv(const char *const *action) { int my_proc_id = Actor::self()->getPid(); - std::vector* trace_recvcounts = new std::vector; - for (int i = 0; i < comm_size; i++) // copy data to avoid bad free - trace_recvcounts->push_back(recvcounts[i]); + std::vector* trace_recvcounts = new std::vector(recvcounts, recvcounts + comm_size); TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::VarCollTIData("allGatherV", -1, sendcount, nullptr, -1, trace_recvcounts, -- 2.20.1