-/* Copyright (c) 2009-2020. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2009-2021. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "smpi_group.hpp"
#include "smpi_request.hpp"
#include "xbt/replay.hpp"
-#include <simgrid/smpi/replay.hpp>
+#include <simgrid/smpi/smpi_replay.hpp>
#include <src/smpi/include/private.hpp>
#include <memory>
};
}
-typedef std::tuple</*sender*/ int, /* receiver */ int, /* tag */ int> req_key_t;
-typedef std::unordered_map<req_key_t, MPI_Request, hash_tuple::hash<std::tuple<int,int,int>>> req_storage_t;
+using req_key_t = std::tuple</*sender*/ int, /* receiver */ int, /* tag */ int>;
+using req_storage_t = std::unordered_map<req_key_t, MPI_Request, hash_tuple::hash<std::tuple<int, int, int>>>;
void log_timed_action(const simgrid::xbt::ReplayAction& action, double clock)
{
}
/** @brief actually run the replay after initialization */
-void smpi_replay_main(int rank, const char* trace_filename)
+void smpi_replay_main(int rank, const char* private_trace_filename)
{
static int active_processes = 0;
active_processes++;
storage[simgrid::s4u::this_actor::get_pid()] = simgrid::smpi::replay::RequestStorage();
std::string rank_string = std::to_string(rank);
- simgrid::xbt::replay_runner(rank_string.c_str(), trace_filename);
+ simgrid::xbt::replay_runner(rank_string.c_str(), private_trace_filename);
/* and now, finalize everything */
/* One active process will stop. Decrease the counter*/
unsigned int count_requests = storage[simgrid::s4u::this_actor::get_pid()].size();
XBT_DEBUG("There are %ud elements in reqq[*]", count_requests);
if (count_requests > 0) {
- auto* requests = new MPI_Request[count_requests];
+ std::vector<MPI_Request> requests(count_requests);
unsigned int i=0;
for (auto const& pair : storage[simgrid::s4u::this_actor::get_pid()].get_store()) {
requests[i] = pair.second;
i++;
}
- simgrid::smpi::Request::waitall(count_requests, requests, MPI_STATUSES_IGNORE);
- delete[] requests;
+ simgrid::smpi::Request::waitall(count_requests, requests.data(), MPI_STATUSES_IGNORE);
}
active_processes--;
}
/** @brief chain a replay initialization and a replay start */
-void smpi_replay_run(const char* instance_id, int rank, double start_delay_flops, const char* trace_filename)
+void smpi_replay_run(const char* instance_id, int rank, double start_delay_flops, const char* private_trace_filename)
{
smpi_replay_init(instance_id, rank, start_delay_flops);
- smpi_replay_main(rank, trace_filename);
+ smpi_replay_main(rank, private_trace_filename);
}