#include "smpi_request.hpp"
#include "src/smpi/include/private.hpp"
#include "xbt/replay.hpp"
+#include "xbt/str.h"
#include <cmath>
#include <limits>
return i < action.size() ? simgrid::smpi::Datatype::decode(action[i]) : simgrid::smpi::replay::MPI_DEFAULT_TYPE;
}
-namespace simgrid {
-namespace smpi {
-
-namespace replay {
+namespace simgrid::smpi::replay {
MPI_Datatype MPI_DEFAULT_TYPE;
class RequestStorage {
void get_requests(std::vector<MPI_Request>& vec) const
{
- for (auto const& pair : store) {
- auto& reqs = pair.second;
+ for (auto const& [_, reqs] : store) {
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
for (auto& req: reqs){
if (req != MPI_REQUEST_NULL && (req->src() == my_proc_id || req->dst() == my_proc_id)) {
void add(MPI_Request req)
{
if (req != MPI_REQUEST_NULL){ // Can and does happen in the case of TestAction
- auto it = store.find(req_key_t(req->src()-1, req->dst()-1, req->tag()));
- if (it == store.end())
- store.insert({req_key_t(req->src()-1, req->dst()-1, req->tag()), std::list<MPI_Request>()});
store[req_key_t(req->src()-1, req->dst()-1, req->tag())].push_back(req);
}
}
{
int src_pid = MPI_COMM_WORLD->group()->actor(src) - 1;
int dest_pid = MPI_COMM_WORLD->group()->actor(dst) - 1;
- auto it = store.find(req_key_t(src_pid, dest_pid, tag));
- if (it == store.end())
- store.insert({req_key_t(src_pid, dest_pid, tag), std::list<MPI_Request>()});
store[req_key_t(src_pid, dest_pid, tag)].push_back(MPI_REQUEST_NULL);
}
};
if (req != MPI_REQUEST_NULL)
Request::unref(&req);
- for (auto const& pair : sender_receiver) {
- TRACE_smpi_recv(pair.first, pair.second, 0);
+ for (auto const& [src, dst] : sender_receiver) {
+ TRACE_smpi_recv(src, dst, 0);
}
TRACE_smpi_comm_out(get_pid());
}
TRACE_smpi_comm_out(get_pid());
}
-} // Replay Namespace
-}} // namespace simgrid::smpi
+} // namespace simgrid::smpi::replay
static std::unordered_map<aid_t, simgrid::smpi::replay::RequestStorage> storage;
/** @brief Only initialize the replay, don't do it for real */
std::vector<MPI_Request> requests(count_requests);
unsigned int i=0;
- for (auto const& pair : storage[simgrid::s4u::this_actor::get_pid()].get_store()) {
- for (auto& req: pair.second){
- requests[i] = req;
+ for (auto const& [_, reqs] : storage[simgrid::s4u::this_actor::get_pid()].get_store()) {
+ for (auto& req : reqs) {
+ requests[i] = req; // FIXME: overwritten at each iteration?
}
i++;
}