Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines.
[simgrid.git] / src / smpi / internals / smpi_replay.cpp
index 9bdb30a..21951ba 100644 (file)
@@ -1,4 +1,4 @@
-/* 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. */
@@ -61,8 +61,8 @@ public:
 };
 }
 
-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)
 {
@@ -821,15 +821,14 @@ void smpi_replay_main(int rank, const char* trace_filename)
   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--;