Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make cmd-line option "network/TCP-gamma" neat and clean
[simgrid.git] / src / surf / sg_platf.cpp
index fb7716b..10f6747 100644 (file)
@@ -3,15 +3,6 @@
 /* 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. */
 
-#include "simgrid/s4u/Engine.hpp"
-#include "simgrid/s4u/Storage.hpp"
-#include "src/kernel/EngineImpl.hpp"
-#include "src/simix/smx_private.hpp"
-#include "src/include/simgrid/sg_config.h"
-#include "src/surf/HostImpl.hpp"
-#include "src/surf/cpu_interface.hpp"
-#include "src/surf/network_interface.hpp"
-#include "src/surf/xml/platf_private.hpp"
 #include "simgrid/kernel/routing/ClusterZone.hpp"
 #include "simgrid/kernel/routing/DijkstraZone.hpp"
 #include "simgrid/kernel/routing/DragonflyZone.hpp"
 #include "simgrid/kernel/routing/NetZoneImpl.hpp"
 #include "simgrid/kernel/routing/TorusZone.hpp"
 #include "simgrid/kernel/routing/VivaldiZone.hpp"
+#include "simgrid/s4u/Engine.hpp"
+#include "simgrid/s4u/Storage.hpp"
+#include "src/include/simgrid/sg_config.hpp"
+#include "src/kernel/EngineImpl.hpp"
+#include "src/simix/smx_private.hpp"
+#include "src/surf/HostImpl.hpp"
+#include "src/surf/cpu_interface.hpp"
+#include "src/surf/network_interface.hpp"
+#include "src/surf/xml/platf_private.hpp"
 
 #include <string>
 
@@ -74,7 +74,7 @@ void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* args)
   }
 
   simgrid::s4u::Host* host =
-      routing_get_current()->createHost(args->id, &args->speed_per_pstate, args->core_amount, &props);
+      routing_get_current()->create_host(args->id, &args->speed_per_pstate, args->core_amount, &props);
 
   host->pimpl_->storage_ = mount_list;
   mount_list.clear();
@@ -83,7 +83,7 @@ void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* args)
   if (args->state_trace)
     host->pimpl_cpu->setStateTrace(args->state_trace);
   if (args->speed_trace)
-    host->pimpl_cpu->setSpeedTrace(args->speed_trace);
+    host->pimpl_cpu->set_speed_trace(args->speed_trace);
   if (args->pstate != 0)
     host->pimpl_cpu->setPState(args->pstate);
   if (args->coord && strcmp(args->coord, ""))
@@ -171,13 +171,13 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster
   current_as->parse_specific_arguments(cluster);
 
   if(cluster->loopback_bw > 0 || cluster->loopback_lat > 0){
-    current_as->linkCountPerNode_++;
-    current_as->hasLoopback_ = true;
+    current_as->num_links_per_node_++;
+    current_as->has_loopback_ = true;
   }
 
   if(cluster->limiter_link > 0){
-    current_as->linkCountPerNode_++;
-    current_as->hasLimiter_ = true;
+    current_as->num_links_per_node_++;
+    current_as->has_limiter_ = true;
   }
 
   for (int const& i : *cluster->radicals) {
@@ -227,7 +227,7 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster
       linkDown = simgrid::surf::LinkImpl::byName(tmp_link);
 
       auto* as_cluster = static_cast<ClusterZone*>(current_as);
-      as_cluster->privateLinks_.insert({as_cluster->nodePosition(rankId), {linkUp, linkDown}});
+      as_cluster->private_links_.insert({as_cluster->node_pos(rankId), {linkUp, linkDown}});
     }
 
     //add a limiter link (shared link to account for maximal bandwidth of the node)
@@ -245,14 +245,14 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster
       sg_platf_new_link(&link);
       linkDown = simgrid::surf::LinkImpl::byName(tmp_link);
       linkUp   = linkDown;
-      current_as->privateLinks_.insert({current_as->nodePositionWithLoopback(rankId), {linkUp, linkDown}});
+      current_as->private_links_.insert({current_as->node_pos_with_loopback(rankId), {linkUp, linkDown}});
     }
 
     //call the cluster function that adds the others links
     if (cluster->topology == simgrid::kernel::routing::ClusterTopology::FAT_TREE) {
-      static_cast<FatTreeZone*>(current_as)->addProcessingNode(i);
+      static_cast<FatTreeZone*>(current_as)->add_processing_node(i);
     } else {
-      current_as->create_links_for_node(cluster, i, rankId, current_as->nodePositionWithLimiter(rankId));
+      current_as->create_links_for_node(cluster, i, rankId, current_as->node_pos_with_loopback_limiter(rankId));
     }
     rankId++;
   }
@@ -296,10 +296,10 @@ void routing_cluster_add_backbone(simgrid::surf::LinkImpl* bb)
       dynamic_cast<simgrid::kernel::routing::ClusterZone*>(current_routing);
 
   xbt_assert(cluster, "Only hosts from Cluster can get a backbone.");
-  xbt_assert(nullptr == cluster->backbone_, "Cluster %s already has a backbone link!", cluster->getCname());
+  xbt_assert(nullptr == cluster->backbone_, "Cluster %s already has a backbone link!", cluster->get_cname());
 
   cluster->backbone_ = bb;
-  XBT_DEBUG("Add a backbone to AS '%s'", current_routing->getCname());
+  XBT_DEBUG("Add a backbone to AS '%s'", current_routing->get_cname());
 }
 
 void sg_platf_new_cabinet(simgrid::kernel::routing::CabinetCreationArgs* cabinet)
@@ -398,14 +398,14 @@ void sg_platf_new_mount(simgrid::kernel::routing::MountCreationArgs* mount)
 
 void sg_platf_new_route(simgrid::kernel::routing::RouteCreationArgs* route)
 {
-  routing_get_current()->addRoute(route->src, route->dst, route->gw_src, route->gw_dst, route->link_list,
-                                  route->symmetrical);
+  routing_get_current()->add_route(route->src, route->dst, route->gw_src, route->gw_dst, route->link_list,
+                                   route->symmetrical);
 }
 
 void sg_platf_new_bypassRoute(simgrid::kernel::routing::RouteCreationArgs* bypassRoute)
 {
-  routing_get_current()->addBypassRoute(bypassRoute->src, bypassRoute->dst, bypassRoute->gw_src, bypassRoute->gw_dst,
-                                        bypassRoute->link_list, bypassRoute->symmetrical);
+  routing_get_current()->add_bypass_route(bypassRoute->src, bypassRoute->dst, bypassRoute->gw_src, bypassRoute->gw_dst,
+                                          bypassRoute->link_list, bypassRoute->symmetrical);
 }
 
 void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor)
@@ -419,7 +419,7 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor)
     std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::getInstance()->getAllHosts();
 
     for (auto const& host : list) {
-      msg += host->getName();
+      msg += host->get_name();
       msg += "', '";
       if (msg.length() > 1024) {
         msg.pop_back(); // remove trailing quote
@@ -440,16 +440,16 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor)
   std::function<void()> code = factory(std::move(actor->args));
   std::shared_ptr<std::map<std::string, std::string>> properties(actor->properties);
 
-  simgrid::simix::ProcessArg* arg =
-      new simgrid::simix::ProcessArg(actor_name, code, nullptr, host, kill_time, properties, auto_restart);
+  simgrid::kernel::actor::ProcessArg* arg =
+      new simgrid::kernel::actor::ProcessArg(actor_name, code, nullptr, host, kill_time, properties, auto_restart);
 
   host->extension<simgrid::simix::Host>()->boot_processes.push_back(arg);
 
   if (start_time > SIMIX_get_clock()) {
 
-    arg = new simgrid::simix::ProcessArg(actor_name, code, nullptr, host, kill_time, properties, auto_restart);
+    arg = new simgrid::kernel::actor::ProcessArg(actor_name, code, nullptr, host, kill_time, properties, auto_restart);
 
-    XBT_DEBUG("Process %s@%s will be started at time %f", arg->name.c_str(), arg->host->getCname(), start_time);
+    XBT_DEBUG("Process %s@%s will be started at time %f", arg->name.c_str(), arg->host->get_cname(), start_time);
     SIMIX_timer_set(start_time, [arg, auto_restart]() {
       smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), std::move(arg->code), arg->data,
                                                                 arg->host, arg->properties.get(), nullptr);
@@ -460,7 +460,7 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor)
       delete arg;
     });
   } else {                      // start_time <= SIMIX_get_clock()
-    XBT_DEBUG("Starting Process %s(%s) right now", arg->name.c_str(), host->getCname());
+    XBT_DEBUG("Starting Process %s(%s) right now", arg->name.c_str(), host->get_cname());
 
     smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), std::move(code), nullptr, host,
                                                               arg->properties.get(), nullptr);
@@ -482,7 +482,7 @@ void sg_platf_new_peer(simgrid::kernel::routing::PeerCreationArgs* peer)
 
   std::vector<double> speedPerPstate;
   speedPerPstate.push_back(peer->speed);
-  simgrid::s4u::Host* host = as->createHost(peer->id.c_str(), &speedPerPstate, 1, nullptr);
+  simgrid::s4u::Host* host = as->create_host(peer->id.c_str(), &speedPerPstate, 1, nullptr);
 
   as->setPeerLink(host->pimpl_netpoint, peer->bw_in, peer->bw_out, peer->coord);
 
@@ -490,7 +490,7 @@ void sg_platf_new_peer(simgrid::kernel::routing::PeerCreationArgs* peer)
   if (peer->state_trace)
     host->pimpl_cpu->setStateTrace(peer->state_trace);
   if (peer->speed_trace)
-    host->pimpl_cpu->setSpeedTrace(peer->speed_trace);
+    host->pimpl_cpu->set_speed_trace(peer->speed_trace);
 }
 
 void sg_platf_begin() { /* Do nothing: just for symmetry of user code */ }
@@ -654,11 +654,11 @@ void sg_platf_new_hostlink(simgrid::kernel::routing::HostLinkCreationArgs* hostl
 
   auto* as_cluster = static_cast<simgrid::kernel::routing::ClusterZone*>(current_routing);
 
-  if (as_cluster->privateLinks_.find(netpoint->id()) != as_cluster->privateLinks_.end())
+  if (as_cluster->private_links_.find(netpoint->id()) != as_cluster->private_links_.end())
     surf_parse_error(std::string("Host_link for '") + hostlink->id.c_str() + "' is already defined!");
 
-  XBT_DEBUG("Push Host_link for host '%s' to position %u", netpoint->getCname(), netpoint->id());
-  as_cluster->privateLinks_.insert({netpoint->id(), {linkUp, linkDown}});
+  XBT_DEBUG("Push Host_link for host '%s' to position %u", netpoint->get_cname(), netpoint->id());
+  as_cluster->private_links_.insert({netpoint->id(), {linkUp, linkDown}});
 }
 
 void sg_platf_new_trace(simgrid::kernel::routing::TraceCreationArgs* trace)