]> AND Public Git Repository - simgrid.git/blobdiff - src/smpi/internals/smpi_replay.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Prefer nullptr and bool literals.
[simgrid.git] / src / smpi / internals / smpi_replay.cpp
index d05719e85d44d448ef369069daaef5f395c5991f..10bb834385ba88ec003e90869b8c21263c7fdc0f 100644 (file)
@@ -90,17 +90,14 @@ private:
 
 public:
     RequestStorage() {}
-    int size()
-    {
-      return store.size();
-    }
+    int size() const { return store.size(); }
 
     req_storage_t& get_store()
     {
       return store;
     }
 
-    void get_requests(std::vector<MPI_Request>& vec)
+    void get_requests(std::vector<MPI_Request>& vec) const
     {
       for (auto const& pair : store) {
         auto& req = pair.second;
@@ -118,7 +115,7 @@ public:
       return (it == store.end()) ? MPI_REQUEST_NULL : it->second;
     }
 
-    void remove(MPI_Request req)
+    void remove(const Request* req)
     {
       if (req == MPI_REQUEST_NULL) return;
 
@@ -264,7 +261,7 @@ void GatherVArgParser::parse(simgrid::xbt::ReplayAction& action, const std::stri
   CHECK_ACTION_PARAMS(action, comm_size + 1, 2)
   send_size  = parse_double(action[2]);
   disps      = std::vector<int>(comm_size, 0);
-  recvcounts = std::shared_ptr<std::vector<int>>(new std::vector<int>(comm_size));
+  recvcounts = std::make_shared<std::vector<int>>(comm_size);
 
   if (name == "gatherv") {
     root = (action.size() > 3 + comm_size) ? std::stoi(action[3 + comm_size]) : 0;
@@ -339,7 +336,7 @@ void ScatterVArgParser::parse(simgrid::xbt::ReplayAction& action, const std::str
   CHECK_ACTION_PARAMS(action, comm_size + 1, 2)
   recv_size  = parse_double(action[2 + comm_size]);
   disps      = std::vector<int>(comm_size, 0);
-  sendcounts = std::shared_ptr<std::vector<int>>(new std::vector<int>(comm_size));
+  sendcounts = std::make_shared<std::vector<int>>(comm_size);
 
   if (action.size() > 5 + comm_size)
     datatype1 = simgrid::smpi::Datatype::decode(action[4 + comm_size]);
@@ -365,7 +362,7 @@ void ReduceScatterArgParser::parse(simgrid::xbt::ReplayAction& action, const std
   comm_size = MPI_COMM_WORLD->size();
   CHECK_ACTION_PARAMS(action, comm_size + 1, 1)
   comp_size  = parse_double(action[2 + comm_size]);
-  recvcounts = std::shared_ptr<std::vector<int>>(new std::vector<int>(comm_size));
+  recvcounts = std::make_shared<std::vector<int>>(comm_size);
   if (action.size() > 3 + comm_size)
     datatype1 = simgrid::smpi::Datatype::decode(action[3 + comm_size]);
 
@@ -387,8 +384,8 @@ void AllToAllVArgParser::parse(simgrid::xbt::ReplayAction& action, const std::st
   */
   comm_size = MPI_COMM_WORLD->size();
   CHECK_ACTION_PARAMS(action, 2 * comm_size + 2, 2)
-  sendcounts = std::shared_ptr<std::vector<int>>(new std::vector<int>(comm_size));
-  recvcounts = std::shared_ptr<std::vector<int>>(new std::vector<int>(comm_size));
+  sendcounts = std::make_shared<std::vector<int>>(comm_size);
+  recvcounts = std::make_shared<std::vector<int>>(comm_size);
   senddisps  = std::vector<int>(comm_size, 0);
   recvdisps  = std::vector<int>(comm_size, 0);
 
@@ -475,7 +472,7 @@ void RecvAction::kernel(simgrid::xbt::ReplayAction&)
     arg_size = status.count;
   }
 
-  bool is_recv = false; // Help analyzers understanding that status is not used unintialized
+  bool is_recv = false; // Help analyzers understanding that status is not used uninitialized
   if (get_name() == "recv") {
     is_recv = true;
     Request::recv(nullptr, arg_size, args.datatype1, args.partner, args.tag, MPI_COMM_WORLD, &status);
@@ -827,7 +824,7 @@ 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) {
-    MPI_Request* requests= new MPI_Request[count_requests];
+    auto* requests = new MPI_Request[count_requests];
     unsigned int i=0;
 
     for (auto const& pair : storage[simgrid::s4u::this_actor::get_pid()].get_store()) {