From e5589800b7daf7e029287eb2123283252c9b9139 Mon Sep 17 00:00:00 2001 From: Thomas Steinreiter Date: Mon, 21 Nov 2016 15:12:54 +0100 Subject: [PATCH] simplified SendStore --- bhtree_mpi/src/simulation/MpiSimulation.cpp | 9 +++------ bhtree_mpi/src/simulation/MpiSimulation.hpp | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/bhtree_mpi/src/simulation/MpiSimulation.cpp b/bhtree_mpi/src/simulation/MpiSimulation.cpp index 9c6fbc2..cb3acb3 100644 --- a/bhtree_mpi/src/simulation/MpiSimulation.cpp +++ b/bhtree_mpi/src/simulation/MpiSimulation.cpp @@ -86,11 +86,8 @@ namespace nbody { //mpi send wrapper void MpiSimulation::send(std::vector&& bodies, int target) { const auto bodySize = bodies.size(); - - //do unblocking send - auto store = std::make_unique(std::move(bodies)); //TODO(steinret): ask ponweist if this could be done w/o unique_ptr - - MPI_Isend(store->bodies.data(), bodySize, bodyType, target, 0, MPI_COMM_WORLD, &store->request); + SendStore store{ std::move(bodies) }; + MPI_Isend(store.bodies.data(), bodySize, bodyType, target, 0, MPI_COMM_WORLD, &store.request); sendStores.push_back(std::move(store)); } @@ -179,7 +176,7 @@ namespace nbody { void MpiSimulation::flushSendStore() { std::vector requests; - std::transform(std::begin(sendStores), std::end(sendStores), std::back_inserter(requests), [](const std::unique_ptr& ss) {return ss->request; }); + std::transform(std::begin(sendStores), std::end(sendStores), std::back_inserter(requests), [](const SendStore& ss) {return ss.request; }); MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE); sendStores.clear(); } diff --git a/bhtree_mpi/src/simulation/MpiSimulation.hpp b/bhtree_mpi/src/simulation/MpiSimulation.hpp index 8fd9328..b266b9e 100644 --- a/bhtree_mpi/src/simulation/MpiSimulation.hpp +++ b/bhtree_mpi/src/simulation/MpiSimulation.hpp @@ -23,7 +23,7 @@ namespace nbody { MPI_Datatype boxType{MPI_DATATYPE_NULL}; std::vector domains; Box overallDomain; - std::vector> sendStores; + std::vector sendStores; void flushSendStore(); virtual void send(std::vector&& bodies, int target); -- GitLab