Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Please sonar
authorBruno Donassolo <bruno.donassolo@inria.fr>
Mon, 7 Jun 2021 08:08:30 +0000 (10:08 +0200)
committerBruno Donassolo <bruno.donassolo@inria.fr>
Mon, 7 Jun 2021 08:08:30 +0000 (10:08 +0200)
examples/platforms/griffon.cpp
examples/platforms/routing_cluster.cpp
src/s4u/s4u_Engine.cpp

index c821a4f..d326305 100644 (file)
@@ -19,10 +19,11 @@ namespace sg4 = simgrid::s4u;
  * @return netzone,router the created netzone and its router
  */
 static std::pair<sg4::NetZone*, simgrid::kernel::routing::NetPoint*>
-create_cabinet(sg4::NetZone* root, const std::string& name, const std::vector<int>& radicals)
+create_cabinet(const sg4::NetZone* root, const std::string& name, const std::vector<int>& radicals)
 {
   auto* cluster      = sg4::create_star_zone(name);
-  std::string prefix = "griffon-", suffix = ".nancy.grid5000.fr";
+  std::string prefix = "griffon-";
+  std::string suffix = ".nancy.grid5000.fr";
   cluster->set_parent(root);
 
   /* create the backbone link */
@@ -32,7 +33,7 @@ create_cabinet(sg4::NetZone* root, const std::string& name, const std::vector<in
   for (const auto& id : radicals) {
     std::string hostname = prefix + std::to_string(id) + suffix;
     /* create host */
-    sg4::Host* host = cluster->create_host(hostname, "286.087kf");
+    const sg4::Host* host = cluster->create_host(hostname, "286.087kf");
     /* create UP/DOWN link */
     sg4::Link* l_up   = cluster->create_link(hostname + "_up", "125MBps")->set_latency("24us")->seal();
     sg4::Link* l_down = cluster->create_link(hostname + "_down", "125MBps")->set_latency("24us")->seal();
@@ -52,7 +53,7 @@ create_cabinet(sg4::NetZone* root, const std::string& name, const std::vector<in
 
 /** @brief Programmatic version of griffon.xml */
 extern "C" void load_platform(const sg4::Engine& e);
-void load_platform(const sg4::Engine& e)
+void load_platform(const sg4::Engine& /*e*/)
 {
   /**
    * C++ version of griffon.xml
index 364d76e..eb97e96 100644 (file)
@@ -16,8 +16,8 @@ namespace sg4 = simgrid::s4u;
  * @param host List of hostname inside the cluster
  * @param single_link_host Hostname of "special" node
  */
-static void create_cluster(sg4::NetZone* root, const std::string& cluster_suffix, const std::vector<std::string>& hosts,
-                           const std::string& single_link_host)
+static void create_cluster(const sg4::NetZone* root, const std::string& cluster_suffix,
+                           const std::vector<std::string>& hosts, const std::string& single_link_host)
 {
   auto* cluster = sg4::create_star_zone("cluster" + cluster_suffix);
   cluster->set_parent(root);
@@ -29,7 +29,7 @@ static void create_cluster(sg4::NetZone* root, const std::string& cluster_suffix
   /* create all hosts and connect them to outside world */
   for (const auto& hostname : hosts) {
     /* create host */
-    sg4::Host* host = cluster->create_host(hostname, std::vector<double>{1e9});
+    const sg4::Host* host = cluster->create_host(hostname, std::vector<double>{1e9});
     /* create UP link */
     sg4::Link* l_up = cluster->create_link(hostname + "_up", std::vector<double>{1.25e8})->set_latency(0.0001)->seal();
     /* create DOWN link, if needed */
index bc91b66..51975c0 100644 (file)
@@ -119,9 +119,9 @@ void Engine::load_platform(const std::string& platf) const
 #else
     void* handle = dlopen(platf.c_str(), RTLD_LAZY);
     xbt_assert(handle, "Impossible to open platform file: %s", platf.c_str());
-    typedef void (*load_fct_t)(const Engine&);
+    using load_fct_t = void (*)(const Engine&);
     dlerror();
-    load_fct_t callable     = (load_fct_t)dlsym(handle, "load_platform");
+    auto callable           = (load_fct_t)dlsym(handle, "load_platform");
     const char* dlsym_error = dlerror();
     xbt_assert(not dlsym_error, "Error: %s", dlsym_error);
     callable(*this);