Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Misc. Sonar smells.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 10 Jun 2021 08:23:37 +0000 (10:23 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 10 Jun 2021 09:26:04 +0000 (11:26 +0200)
src/smpi/include/private.hpp
src/smpi/internals/smpi_deployment.cpp

index 4deaddd..08e6cf3 100644 (file)
@@ -84,7 +84,7 @@ XBT_PRIVATE void smpi_deployment_unregister_process(const std::string& instance_
 
 XBT_PRIVATE MPI_Comm* smpi_deployment_comm_world(const std::string& instance_id);
 XBT_PRIVATE void smpi_deployment_cleanup_instances();
-XBT_PRIVATE int smpi_deployment_smpirun(simgrid::s4u::Engine* e, const std::string& hostfile, int np,
+XBT_PRIVATE int smpi_deployment_smpirun(const simgrid::s4u::Engine* e, const std::string& hostfile, int np,
                                         const std::string& replayfile, int map, int argc, char* argv[]);
 
 XBT_PRIVATE void smpi_comm_copy_buffer_callback(simgrid::kernel::activity::CommImpl* comm, void* buff,
index 93c7e61..ec87025 100644 (file)
@@ -105,7 +105,7 @@ int smpi_get_universe_size()
 }
 
 /** @brief Auxiliary method to get list of hosts to deploy app */
-static std::vector<simgrid::s4u::Host*> smpi_get_hosts(simgrid::s4u::Engine* e, const std::string& hostfile)
+static std::vector<simgrid::s4u::Host*> smpi_get_hosts(const simgrid::s4u::Engine* e, const std::string& hostfile)
 {
   if (hostfile == "") {
     return e->get_all_hosts();
@@ -148,12 +148,12 @@ static std::vector<std::string> smpi_deployment_get_args(int rank_id, const std:
   // pass arguments to process only if not a replay execution
   if (replay.empty()) {
     for (int i = 0; i < argc; i++) {
-      args.push_back(argv[i]);
+      args.emplace_back(argv[i]);
     }
   }
   /* one trace per process */
   if (replay.size() > 1) {
-    args.push_back(replay[rank_id]);
+    args.emplace_back(replay[rank_id]);
   }
   return args;
 }
@@ -164,8 +164,8 @@ static std::vector<std::string> smpi_deployment_get_args(int rank_id, const std:
  * This used to be done at smpirun script, parsing either the hostfile or the platform XML.
  * If hostfile isn't provided, get the list of hosts from engine.
  */
-int smpi_deployment_smpirun(simgrid::s4u::Engine* e, const std::string& hostfile, int np, const std::string& replayfile,
-                            int map, int argc, char* argv[])
+int smpi_deployment_smpirun(const simgrid::s4u::Engine* e, const std::string& hostfile, int np,
+                            const std::string& replayfile, int map, int argc, char* argv[])
 {
   auto hosts     = smpi_get_hosts(e, hostfile);
   auto replay    = smpi_read_replay(replayfile);