Skip to content
Snippets Groups Projects
Commit e5589800 authored by Thomas Steinreiter's avatar Thomas Steinreiter
Browse files

simplified SendStore

parent 9273bae1
Branches
No related merge requests found
......@@ -86,11 +86,8 @@ namespace nbody {
//mpi send wrapper
void MpiSimulation::send(std::vector<Body>&& bodies, int target) {
const auto bodySize = bodies.size();
//do unblocking send
auto store = std::make_unique<SendStore>(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<MPI_Request> requests;
std::transform(std::begin(sendStores), std::end(sendStores), std::back_inserter(requests), [](const std::unique_ptr<SendStore>& 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();
}
......
......@@ -23,7 +23,7 @@ namespace nbody {
MPI_Datatype boxType{MPI_DATATYPE_NULL};
std::vector<Box> domains;
Box overallDomain;
std::vector<std::unique_ptr<SendStore>> sendStores;
std::vector<SendStore> sendStores;
void flushSendStore();
virtual void send(std::vector<Body>&& bodies, int target);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment