From: Martin Quinson Date: Mon, 19 Mar 2018 13:47:21 +0000 (+0100) Subject: stop loading private headers from now public NetZoneImpl.hpp X-Git-Tag: v3.19~20 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/fa159d28bf7eb7b7876fbd85ea11a8d74cf489fc stop loading private headers from now public NetZoneImpl.hpp --- diff --git a/include/simgrid/forward.h b/include/simgrid/forward.h index ecf224bdad..6e8fdd02ea 100644 --- a/include/simgrid/forward.h +++ b/include/simgrid/forward.h @@ -54,8 +54,11 @@ class Model; class Resource; } namespace routing { - class NetPoint; - class NetZoneImpl; +class ClusterCreationArgs; +class LinkCreationArgs; +class NetPoint; +class NetZoneImpl; +class RouteCreationArgs; } } namespace simix { diff --git a/include/simgrid/kernel/routing/NetZoneImpl.hpp b/include/simgrid/kernel/routing/NetZoneImpl.hpp index eb79d1475a..afb2d38970 100644 --- a/include/simgrid/kernel/routing/NetZoneImpl.hpp +++ b/include/simgrid/kernel/routing/NetZoneImpl.hpp @@ -12,7 +12,6 @@ #include "simgrid/forward.h" #include "simgrid/s4u/NetZone.hpp" -#include "src/surf/xml/platf_private.hpp" // FIXME: kill sg_platf_route_cbarg_t to remove that UGLY include namespace simgrid { namespace kernel { diff --git a/src/bindings/lua/lua_platf.cpp b/src/bindings/lua/lua_platf.cpp index ebd4cb8698..c91e07b1a2 100644 --- a/src/bindings/lua/lua_platf.cpp +++ b/src/bindings/lua/lua_platf.cpp @@ -63,7 +63,7 @@ int console_close(lua_State *L) { } int console_add_backbone(lua_State *L) { - LinkCreationArgs link; + simgrid::kernel::routing::LinkCreationArgs link; link.properties = nullptr; @@ -111,7 +111,7 @@ int console_add_backbone(lua_State *L) { } int console_add_host___link(lua_State *L) { - HostLinkCreationArgs hostlink; + simgrid::kernel::routing::HostLinkCreationArgs hostlink; int type; lua_ensure(lua_istable(L, -1), "Bad Arguments to create host_link in Lua. Should be a table with named arguments."); @@ -143,7 +143,7 @@ int console_add_host___link(lua_State *L) { } int console_add_host(lua_State *L) { - s_sg_platf_host_cbarg_t host; + simgrid::kernel::routing::HostCreationArgs host; int type; // we get values from the table passed as argument @@ -202,7 +202,7 @@ int console_add_host(lua_State *L) { } int console_add_link(lua_State *L) { - LinkCreationArgs link; + simgrid::kernel::routing::LinkCreationArgs link; const char* policy; @@ -308,7 +308,7 @@ int console_add_router(lua_State* L) { int console_add_route(lua_State *L) { XBT_DEBUG("Adding route"); - RouteCreationArgs route; + simgrid::kernel::routing::RouteCreationArgs route; int type; lua_ensure(lua_istable(L, -1), "Bad Arguments to add a route. Should be a table with named arguments"); @@ -379,7 +379,7 @@ int console_add_route(lua_State *L) { } int console_add_ASroute(lua_State *L) { - RouteCreationArgs ASroute; + simgrid::kernel::routing::RouteCreationArgs ASroute; lua_pushstring(L, "src"); lua_gettable(L, -2); @@ -480,7 +480,7 @@ int console_AS_open(lua_State *L) { mode_int = A_surfxml_AS_routing_None; else xbt_die("Don't have the model name '%s'",mode); - ZoneCreationArgs AS; + simgrid::kernel::routing::ZoneCreationArgs AS; AS.id = id; AS.routing = mode_int; simgrid::s4u::NetZone* new_as = sg_platf_new_Zone_begin(&AS); diff --git a/src/kernel/routing/ClusterZone.cpp b/src/kernel/routing/ClusterZone.cpp index 58d8a7238b..aefe976b62 100644 --- a/src/kernel/routing/ClusterZone.cpp +++ b/src/kernel/routing/ClusterZone.cpp @@ -7,6 +7,7 @@ #include "simgrid/kernel/routing/NetPoint.hpp" #include "simgrid/kernel/routing/RoutedZone.hpp" #include "src/surf/network_interface.hpp" +#include "src/surf/xml/platf_private.hpp" // FIXME: RouteCreationArgs and friends XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf"); diff --git a/src/kernel/routing/DijkstraZone.cpp b/src/kernel/routing/DijkstraZone.cpp index 022445517c..346cdf7f03 100644 --- a/src/kernel/routing/DijkstraZone.cpp +++ b/src/kernel/routing/DijkstraZone.cpp @@ -6,6 +6,7 @@ #include "simgrid/kernel/routing/DijkstraZone.hpp" #include "simgrid/kernel/routing/NetPoint.hpp" #include "src/surf/network_interface.hpp" +#include "src/surf/xml/platf_private.hpp" #include #include @@ -22,7 +23,7 @@ static void graph_node_data_free(void* n) static void graph_edge_data_free(void* e) { - delete static_cast(e); + delete static_cast(e); } /* Utility functions */ @@ -54,7 +55,7 @@ void DijkstraZone::seal() } if (not found) { - RouteCreationArgs* e_route = new RouteCreationArgs(); + RouteCreationArgs* e_route = new simgrid::kernel::routing::RouteCreationArgs(); e_route->link_list.push_back(surf_network_model->loopback_); xbt_graph_new_edge(routeGraph_, node, node, e_route); } @@ -90,7 +91,7 @@ xbt_node_t DijkstraZone::nodeMapSearch(int id) /* Parsing */ -void DijkstraZone::newRoute(int src_id, int dst_id, RouteCreationArgs* e_route) +void DijkstraZone::newRoute(int src_id, int dst_id, simgrid::kernel::routing::RouteCreationArgs* e_route) { XBT_DEBUG("Load Route from \"%d\" to \"%d\"", src_id, dst_id); xbt_node_t src = nullptr; diff --git a/src/kernel/routing/DragonflyZone.cpp b/src/kernel/routing/DragonflyZone.cpp index 438320c114..1ca681447b 100644 --- a/src/kernel/routing/DragonflyZone.cpp +++ b/src/kernel/routing/DragonflyZone.cpp @@ -6,6 +6,7 @@ #include "simgrid/kernel/routing/DragonflyZone.hpp" #include "simgrid/kernel/routing/NetPoint.hpp" #include "src/surf/network_interface.hpp" +#include "src/surf/xml/platf_private.hpp" #include #include diff --git a/src/kernel/routing/FatTreeZone.cpp b/src/kernel/routing/FatTreeZone.cpp index ad33b99593..3da6df43aa 100644 --- a/src/kernel/routing/FatTreeZone.cpp +++ b/src/kernel/routing/FatTreeZone.cpp @@ -10,6 +10,8 @@ #include "simgrid/kernel/routing/FatTreeZone.hpp" #include "simgrid/kernel/routing/NetPoint.hpp" #include "src/surf/network_interface.hpp" +#include "src/surf/xml/platf_private.hpp" + #include #include diff --git a/src/kernel/routing/FloydZone.cpp b/src/kernel/routing/FloydZone.cpp index 8f14b40803..b3aa1105b2 100644 --- a/src/kernel/routing/FloydZone.cpp +++ b/src/kernel/routing/FloydZone.cpp @@ -7,6 +7,7 @@ #include "simgrid/kernel/routing/NetPoint.hpp" #include "src/surf/network_interface.hpp" #include "xbt/log.h" +#include "src/surf/xml/platf_private.hpp" #include #include diff --git a/src/kernel/routing/FullZone.cpp b/src/kernel/routing/FullZone.cpp index e83fda3f45..a0af248b3d 100644 --- a/src/kernel/routing/FullZone.cpp +++ b/src/kernel/routing/FullZone.cpp @@ -6,6 +6,7 @@ #include "simgrid/kernel/routing/FullZone.hpp" #include "simgrid/kernel/routing/NetPoint.hpp" #include "src/surf/network_interface.hpp" +#include "src/surf/xml/platf_private.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf"); diff --git a/src/kernel/routing/NetZoneImpl.cpp b/src/kernel/routing/NetZoneImpl.cpp index f896d7a539..3597560dab 100644 --- a/src/kernel/routing/NetZoneImpl.cpp +++ b/src/kernel/routing/NetZoneImpl.cpp @@ -9,7 +9,7 @@ #include "simgrid/s4u/Host.hpp" #include "src/surf/cpu_interface.hpp" #include "src/surf/network_interface.hpp" - +#include "src/surf/xml/platf_private.hpp" #include "xbt/log.h" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_route); diff --git a/src/kernel/routing/RoutedZone.cpp b/src/kernel/routing/RoutedZone.cpp index 1e4854a620..73df03a896 100644 --- a/src/kernel/routing/RoutedZone.cpp +++ b/src/kernel/routing/RoutedZone.cpp @@ -7,10 +7,10 @@ #include "xbt/graph.h" #include "xbt/log.h" #include "xbt/sysdep.h" - #include "simgrid/kernel/routing/NetPoint.hpp" #include "simgrid/kernel/routing/RoutedZone.hpp" #include "src/surf/network_interface.hpp" +#include "src/surf/xml/platf_private.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing"); diff --git a/src/kernel/routing/TorusZone.cpp b/src/kernel/routing/TorusZone.cpp index 0e45b8101f..4a607d81f5 100644 --- a/src/kernel/routing/TorusZone.cpp +++ b/src/kernel/routing/TorusZone.cpp @@ -6,6 +6,7 @@ #include "simgrid/kernel/routing/TorusZone.hpp" #include "simgrid/kernel/routing/NetPoint.hpp" #include "src/surf/network_interface.hpp" +#include "src/surf/xml/platf_private.hpp" #include #include diff --git a/src/kernel/routing/VivaldiZone.cpp b/src/kernel/routing/VivaldiZone.cpp index bfdcbc2711..18b5553868 100644 --- a/src/kernel/routing/VivaldiZone.cpp +++ b/src/kernel/routing/VivaldiZone.cpp @@ -8,6 +8,7 @@ #include "simgrid/s4u/Engine.hpp" #include "simgrid/s4u/Host.hpp" #include "src/surf/network_interface.hpp" +#include "src/surf/xml/platf_private.hpp" #include diff --git a/src/simix/smx_deployment.cpp b/src/simix/smx_deployment.cpp index c9ce06ae5b..e767079aaa 100644 --- a/src/simix/smx_deployment.cpp +++ b/src/simix/smx_deployment.cpp @@ -117,7 +117,7 @@ simgrid::simix::ActorCodeFactory& SIMIX_get_actor_code_factory(const char *name) void SIMIX_process_set_function(const char* process_host, const char* process_function, xbt_dynar_t arguments, double process_start_time, double process_kill_time) { - ActorCreationArgs actor; + simgrid::kernel::routing::ActorCreationArgs actor; sg_host_t host = sg_host_by_name(process_host); if (not host) @@ -139,7 +139,7 @@ void SIMIX_process_set_function(const char* process_host, const char* process_fu actor.host = process_host; actor.kill_time = process_kill_time; actor.start_time = process_start_time; - actor.on_failure = ActorOnFailure::DIE; + actor.on_failure = simgrid::kernel::routing::ActorOnFailure::DIE; sg_platf_new_actor(&actor); } diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index b49a92f254..ab86421b0c 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -25,6 +25,7 @@ #include "simgrid/plugins/energy.h" #include "simgrid/s4u/Engine.hpp" #include "simgrid/s4u/NetZone.hpp" +#include "src/surf/xml/platf_private.hpp" #include "src/instr/instr_private.hpp" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ns3, surf, "Logging specific to the SURF network NS3 module"); @@ -61,7 +62,7 @@ NetPointNs3::NetPointNs3() * Callbacks * *************/ -static void clusterCreation_cb(ClusterCreationArgs* cluster) +static void clusterCreation_cb(simgrid::kernel::routing::ClusterCreationArgs* cluster) { for (int const& i : *cluster->radicals) { // Routers don't create a router on the other end of the private link by themselves. diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 3ed44de19f..fb7716b349 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -5,16 +5,13 @@ #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" @@ -26,7 +23,9 @@ #include "simgrid/kernel/routing/NetZoneImpl.hpp" #include "simgrid/kernel/routing/TorusZone.hpp" #include "simgrid/kernel/routing/VivaldiZone.hpp" + #include + XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse); XBT_PRIVATE std::map mount_list; @@ -35,7 +34,7 @@ XBT_PRIVATE std::vector known_storages; namespace simgrid { namespace surf { -simgrid::xbt::signal on_cluster; +simgrid::xbt::signal on_cluster; } } @@ -65,7 +64,7 @@ void sg_platf_exit() { } /** @brief Add an host to the current AS */ -void sg_platf_new_host(sg_platf_host_cbarg_t args) +void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* args) { std::map props; if (args->properties) { @@ -112,7 +111,7 @@ simgrid::kernel::routing::NetPoint* sg_platf_new_router(std::string name, const return netpoint; } -void sg_platf_new_link(LinkCreationArgs* link) +void sg_platf_new_link(simgrid::kernel::routing::LinkCreationArgs* link) { std::vector names; @@ -141,7 +140,7 @@ void sg_platf_new_link(LinkCreationArgs* link) delete link->properties; } -void sg_platf_new_cluster(ClusterCreationArgs* cluster) +void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster) { using simgrid::kernel::routing::ClusterZone; using simgrid::kernel::routing::DragonflyZone; @@ -151,16 +150,16 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster) int rankId=0; // What an inventive way of initializing the AS that I have as ancestor :-( - ZoneCreationArgs zone; + simgrid::kernel::routing::ZoneCreationArgs zone; zone.id = cluster->id; switch (cluster->topology) { - case ClusterTopology::TORUS: + case simgrid::kernel::routing::ClusterTopology::TORUS: zone.routing = A_surfxml_AS_routing_ClusterTorus; break; - case ClusterTopology::DRAGONFLY: + case simgrid::kernel::routing::ClusterTopology::DRAGONFLY: zone.routing = A_surfxml_AS_routing_ClusterDragonfly; break; - case ClusterTopology::FAT_TREE: + case simgrid::kernel::routing::ClusterTopology::FAT_TREE: zone.routing = A_surfxml_AS_routing_ClusterFatTree; break; default: @@ -187,7 +186,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster) XBT_DEBUG("", host_id.c_str(), cluster->speeds.front()); - s_sg_platf_host_cbarg_t host; + simgrid::kernel::routing::HostCreationArgs host; host.id = host_id.c_str(); if ((cluster->properties != nullptr) && (not cluster->properties->empty())) { host.properties = new std::map; @@ -218,7 +217,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster) std::string tmp_link = link_id + "_loopback"; XBT_DEBUG("", tmp_link.c_str(), cluster->loopback_bw); - LinkCreationArgs link; + simgrid::kernel::routing::LinkCreationArgs link; link.id = tmp_link; link.bandwidth = cluster->loopback_bw; link.latency = cluster->loopback_lat; @@ -238,7 +237,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster) std::string tmp_link = std::string(link_id) + "_limiter"; XBT_DEBUG("", tmp_link.c_str(), cluster->limiter_link); - LinkCreationArgs link; + simgrid::kernel::routing::LinkCreationArgs link; link.id = tmp_link; link.bandwidth = cluster->limiter_link; link.latency = 0; @@ -250,7 +249,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster) } //call the cluster function that adds the others links - if (cluster->topology == ClusterTopology::FAT_TREE) { + if (cluster->topology == simgrid::kernel::routing::ClusterTopology::FAT_TREE) { static_cast(current_as)->addProcessingNode(i); } else { current_as->create_links_for_node(cluster, i, rankId, current_as->nodePositionWithLimiter(rankId)); @@ -272,7 +271,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster) //Make the backbone if ((cluster->bb_bw > 0) || (cluster->bb_lat > 0)) { - LinkCreationArgs link; + simgrid::kernel::routing::LinkCreationArgs link; link.id = std::string(cluster->id)+ "_backbone"; link.bandwidth = cluster->bb_bw; link.latency = cluster->bb_lat; @@ -303,25 +302,25 @@ void routing_cluster_add_backbone(simgrid::surf::LinkImpl* bb) XBT_DEBUG("Add a backbone to AS '%s'", current_routing->getCname()); } -void sg_platf_new_cabinet(CabinetCreationArgs* cabinet) +void sg_platf_new_cabinet(simgrid::kernel::routing::CabinetCreationArgs* cabinet) { for (int const& radical : *cabinet->radicals) { std::string hostname = cabinet->prefix + std::to_string(radical) + cabinet->suffix; - s_sg_platf_host_cbarg_t host; + simgrid::kernel::routing::HostCreationArgs host; host.pstate = 0; host.core_amount = 1; host.id = hostname.c_str(); host.speed_per_pstate.push_back(cabinet->speed); sg_platf_new_host(&host); - LinkCreationArgs link; + simgrid::kernel::routing::LinkCreationArgs link; link.policy = SURF_LINK_SPLITDUPLEX; link.latency = cabinet->lat; link.bandwidth = cabinet->bw; link.id = "link_" + hostname; sg_platf_new_link(&link); - HostLinkCreationArgs host_link; + simgrid::kernel::routing::HostLinkCreationArgs host_link; host_link.id = hostname; host_link.link_up = std::string("link_") + hostname + "_UP"; host_link.link_down = std::string("link_") + hostname + "_DOWN"; @@ -330,7 +329,7 @@ void sg_platf_new_cabinet(CabinetCreationArgs* cabinet) delete cabinet->radicals; } -void sg_platf_new_storage(StorageCreationArgs* storage) +void sg_platf_new_storage(simgrid::kernel::routing::StorageCreationArgs* storage) { xbt_assert(std::find(known_storages.begin(), known_storages.end(), storage->id) == known_storages.end(), "Refusing to add a second storage named \"%s\"", storage->id.c_str()); @@ -370,7 +369,7 @@ void sg_platf_new_storage(StorageCreationArgs* storage) } } -void sg_platf_new_storage_type(StorageTypeCreationArgs* storage_type) +void sg_platf_new_storage_type(simgrid::kernel::routing::StorageTypeCreationArgs* storage_type) { xbt_assert(storage_types.find(storage_type->id) == storage_types.end(), "Reading a storage type, processing unit \"%s\" already exists", storage_type->id.c_str()); @@ -385,7 +384,7 @@ void sg_platf_new_storage_type(StorageTypeCreationArgs* storage_type) storage_types[storage_type->id] = stype; } -void sg_platf_new_mount(MountCreationArgs* mount) +void sg_platf_new_mount(simgrid::kernel::routing::MountCreationArgs* mount) { xbt_assert(std::find(known_storages.begin(), known_storages.end(), mount->storageId) != known_storages.end(), "Cannot mount non-existent disk \"%s\"", mount->storageId.c_str()); @@ -397,19 +396,19 @@ void sg_platf_new_mount(MountCreationArgs* mount) mount_list.insert({mount->name, simgrid::s4u::Engine::getInstance()->storageByName(mount->storageId)->getImpl()}); } -void sg_platf_new_route(RouteCreationArgs* route) +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); } -void sg_platf_new_bypassRoute(RouteCreationArgs* bypassRoute) +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); } -void sg_platf_new_actor(ActorCreationArgs* actor) +void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor) { sg_host_t host = sg_host_by_name(actor->host); if (not host) { @@ -435,7 +434,7 @@ void sg_platf_new_actor(ActorCreationArgs* actor) double start_time = actor->start_time; double kill_time = actor->kill_time; - bool auto_restart = actor->on_failure != ActorOnFailure::DIE; + bool auto_restart = actor->on_failure != simgrid::kernel::routing::ActorOnFailure::DIE; std::string actor_name = actor->args[0]; std::function code = factory(std::move(actor->args)); @@ -476,7 +475,7 @@ void sg_platf_new_actor(ActorCreationArgs* actor) } } -void sg_platf_new_peer(PeerCreationArgs* peer) +void sg_platf_new_peer(simgrid::kernel::routing::PeerCreationArgs* peer) { simgrid::kernel::routing::VivaldiZone* as = dynamic_cast(current_routing); xbt_assert(as, " tag can only be used in Vivaldi netzones."); @@ -549,7 +548,7 @@ static void surf_config_models_setup() * * @param zone the parameters defining the Zone to build. */ -simgrid::s4u::NetZone* sg_platf_new_Zone_begin(ZoneCreationArgs* zone) +simgrid::s4u::NetZone* sg_platf_new_Zone_begin(simgrid::kernel::routing::ZoneCreationArgs* zone) { if (not surf_parse_models_setup_already_called) { /* Initialize the surf models. That must be done after we got all config, and before we need the models. @@ -640,7 +639,7 @@ void sg_platf_new_Zone_seal() } /** @brief Add a link connecting an host to the rest of its AS (which must be cluster or vivaldi) */ -void sg_platf_new_hostlink(HostLinkCreationArgs* hostlink) +void sg_platf_new_hostlink(simgrid::kernel::routing::HostLinkCreationArgs* hostlink) { simgrid::kernel::routing::NetPoint* netpoint = sg_host_by_name(hostlink->id.c_str())->pimpl_netpoint; xbt_assert(netpoint, "Host '%s' not found!", hostlink->id.c_str()); @@ -662,7 +661,7 @@ void sg_platf_new_hostlink(HostLinkCreationArgs* hostlink) as_cluster->privateLinks_.insert({netpoint->id(), {linkUp, linkDown}}); } -void sg_platf_new_trace(TraceCreationArgs* trace) +void sg_platf_new_trace(simgrid::kernel::routing::TraceCreationArgs* trace) { tmgr_trace_t tmgr_trace; if (not trace->file.empty()) { diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index d2424193a7..cc8b5e1305 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -7,6 +7,7 @@ #include "simgrid/kernel/routing/NetPoint.hpp" #include "simgrid/s4u/Engine.hpp" #include "simgrid/s4u/Host.hpp" +#include "src/surf/xml/platf.hpp" #include "src/kernel/lmm/maxmin.hpp" #include "xbt/utility.hpp" #include /*ceil*/ diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 00c2e121ed..79a3f27c4b 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -12,6 +12,7 @@ #include "src/kernel/lmm/maxmin.hpp" // Constraint #include "src/surf/HostImpl.hpp" #include "xbt/utility.hpp" +#include "src/surf/xml/platf.hpp" #include #include diff --git a/src/surf/xml/platf_private.hpp b/src/surf/xml/platf_private.hpp index 456a10a0be..cf233ba126 100644 --- a/src/surf/xml/platf_private.hpp +++ b/src/surf/xml/platf_private.hpp @@ -15,14 +15,9 @@ #include #include -extern "C" { -#include "src/surf/xml/simgrid_dtd.h" - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - +namespace simgrid { +namespace kernel { +namespace routing { /* ***************************************** */ /* * Platform creation functions. Instead of passing 123 arguments to the creation functions @@ -34,7 +29,7 @@ typedef size_t yy_size_t; * used, instead of malloced structures. */ -struct s_sg_platf_host_cbarg_t { +struct HostCreationArgs { const char* id = nullptr; std::vector speed_per_pstate; int pstate = 0; @@ -44,7 +39,7 @@ struct s_sg_platf_host_cbarg_t { const char* coord = nullptr; std::map* properties = nullptr; }; -typedef s_sg_platf_host_cbarg_t* sg_platf_host_cbarg_t; +typedef HostCreationArgs* sg_platf_host_cbarg_t; // FIXME: killme class HostLinkCreationArgs { public: @@ -164,7 +159,7 @@ public: std::string element; }; -enum class ActorOnFailure { DIE, RESTART }; +enum class ActorOnFailure { DIE, RESTART }; // FIXME: move to a better namespace class ActorCreationArgs { public: @@ -182,6 +177,15 @@ public: std::string id; int routing; }; +}}} + +extern "C" { +#include "src/surf/xml/simgrid_dtd.h" + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif /********** Routing **********/ void routing_cluster_add_backbone(simgrid::surf::LinkImpl* bb); @@ -190,29 +194,29 @@ void routing_cluster_add_backbone(simgrid::surf::LinkImpl* bb); XBT_PUBLIC void sg_platf_begin(); // Start a new platform XBT_PUBLIC void sg_platf_end(); // Finish the creation of the platform -XBT_PUBLIC simgrid::s4u::NetZone* sg_platf_new_Zone_begin(ZoneCreationArgs* zone); // Begin description of new Zone +XBT_PUBLIC simgrid::s4u::NetZone* sg_platf_new_Zone_begin(simgrid::kernel::routing::ZoneCreationArgs* zone); // Begin description of new Zone XBT_PUBLIC void sg_platf_new_Zone_seal(); // That Zone is fully described -XBT_PUBLIC void sg_platf_new_host(sg_platf_host_cbarg_t host); // Add a host to the current Zone -XBT_PUBLIC void sg_platf_new_hostlink(HostLinkCreationArgs* h); // Add a host_link to the current Zone -XBT_PUBLIC void sg_platf_new_link(LinkCreationArgs* link); // Add a link to the current Zone -XBT_PUBLIC void sg_platf_new_peer(PeerCreationArgs* peer); // Add a peer to the current Zone -XBT_PUBLIC void sg_platf_new_cluster(ClusterCreationArgs* clust); // Add a cluster to the current Zone -XBT_PUBLIC void sg_platf_new_cabinet(CabinetCreationArgs* cabinet); // Add a cabinet to the current Zone +XBT_PUBLIC void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* host); // Add a host to the current Zone +XBT_PUBLIC void sg_platf_new_hostlink(simgrid::kernel::routing::HostLinkCreationArgs* h); // Add a host_link to the current Zone +XBT_PUBLIC void sg_platf_new_link(simgrid::kernel::routing::LinkCreationArgs* link); // Add a link to the current Zone +XBT_PUBLIC void sg_platf_new_peer(simgrid::kernel::routing::PeerCreationArgs* peer); // Add a peer to the current Zone +XBT_PUBLIC void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* clust); // Add a cluster to the current Zone +XBT_PUBLIC void sg_platf_new_cabinet(simgrid::kernel::routing::CabinetCreationArgs* cabinet); // Add a cabinet to the current Zone XBT_PUBLIC simgrid::kernel::routing::NetPoint* // Add a router to the current Zone sg_platf_new_router(std::string, const char* coords); -XBT_PUBLIC void sg_platf_new_route(RouteCreationArgs* route); // Add a route -XBT_PUBLIC void sg_platf_new_bypassRoute(RouteCreationArgs* bypassroute); // Add a bypassRoute +XBT_PUBLIC void sg_platf_new_route(simgrid::kernel::routing::RouteCreationArgs* route); // Add a route +XBT_PUBLIC void sg_platf_new_bypassRoute(simgrid::kernel::routing::RouteCreationArgs* bypassroute); // Add a bypassRoute -XBT_PUBLIC void sg_platf_new_trace(TraceCreationArgs* trace); +XBT_PUBLIC void sg_platf_new_trace(simgrid::kernel::routing::TraceCreationArgs* trace); -XBT_PUBLIC void sg_platf_new_storage(StorageCreationArgs* storage); // Add a storage to the current Zone -XBT_PUBLIC void sg_platf_new_storage_type(StorageTypeCreationArgs* storage_type); -XBT_PUBLIC void sg_platf_new_mount(MountCreationArgs* mount); +XBT_PUBLIC void sg_platf_new_storage(simgrid::kernel::routing::StorageCreationArgs* storage); // Add a storage to the current Zone +XBT_PUBLIC void sg_platf_new_storage_type(simgrid::kernel::routing::StorageTypeCreationArgs* storage_type); +XBT_PUBLIC void sg_platf_new_mount(simgrid::kernel::routing::MountCreationArgs* mount); -XBT_PUBLIC void sg_platf_new_actor(ActorCreationArgs* actor); -XBT_PRIVATE void sg_platf_trace_connect(TraceConnectCreationArgs* trace_connect); +XBT_PUBLIC void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor); +XBT_PRIVATE void sg_platf_trace_connect(simgrid::kernel::routing::TraceConnectCreationArgs* trace_connect); /* Prototypes of the functions offered by flex */ XBT_PUBLIC int surf_parse_lex(); @@ -232,7 +236,7 @@ XBT_PUBLIC int surf_parse_lex_destroy(); namespace simgrid { namespace surf { -extern XBT_PRIVATE simgrid::xbt::signal on_cluster; +extern XBT_PRIVATE simgrid::xbt::signal on_cluster; } } diff --git a/src/surf/xml/surfxml_parseplatf.cpp b/src/surf/xml/surfxml_parseplatf.cpp index ddcc6775e8..de90f8d12b 100644 --- a/src/surf/xml/surfxml_parseplatf.cpp +++ b/src/surf/xml/surfxml_parseplatf.cpp @@ -34,26 +34,26 @@ XBT_PRIVATE std::unordered_map trace_connect_list_link XBT_PRIVATE std::unordered_map trace_connect_list_link_lat; extern "C" { -void sg_platf_trace_connect(TraceConnectCreationArgs* trace_connect) +void sg_platf_trace_connect(simgrid::kernel::routing::TraceConnectCreationArgs* trace_connect) { xbt_assert(traces_set_list.find(trace_connect->trace) != traces_set_list.end(), "Cannot connect trace %s to %s: trace unknown", trace_connect->trace.c_str(), trace_connect->element.c_str()); switch (trace_connect->kind) { - case TraceConnectKind::HOST_AVAIL: + case simgrid::kernel::routing::TraceConnectKind::HOST_AVAIL: trace_connect_list_host_avail.insert({trace_connect->trace, trace_connect->element}); break; - case TraceConnectKind::SPEED: + case simgrid::kernel::routing::TraceConnectKind::SPEED: trace_connect_list_host_speed.insert({trace_connect->trace, trace_connect->element}); break; - case TraceConnectKind::LINK_AVAIL: + case simgrid::kernel::routing::TraceConnectKind::LINK_AVAIL: trace_connect_list_link_avail.insert({trace_connect->trace, trace_connect->element}); break; - case TraceConnectKind::BANDWIDTH: + case simgrid::kernel::routing::TraceConnectKind::BANDWIDTH: trace_connect_list_link_bw.insert({trace_connect->trace, trace_connect->element}); break; - case TraceConnectKind::LATENCY: + case simgrid::kernel::routing::TraceConnectKind::LATENCY: trace_connect_list_link_lat.insert({trace_connect->trace, trace_connect->element}); break; default: diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index aa22f1c944..7a9d0175cc 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -284,7 +284,7 @@ void STag_surfxml_storage() void ETag_surfxml_storage() { - StorageCreationArgs storage; + simgrid::kernel::routing::StorageCreationArgs storage; storage.properties = current_property_set; current_property_set = nullptr; @@ -305,7 +305,7 @@ void STag_surfxml_storage___type() } void ETag_surfxml_storage___type() { - StorageTypeCreationArgs storage_type; + simgrid::kernel::routing::StorageTypeCreationArgs storage_type; storage_type.properties = current_property_set; current_property_set = nullptr; @@ -328,7 +328,7 @@ void STag_surfxml_mount() void ETag_surfxml_mount() { - MountCreationArgs mount; + simgrid::kernel::routing::MountCreationArgs mount; mount.name = A_surfxml_mount_name; mount.storageId = A_surfxml_mount_storageId; @@ -421,7 +421,7 @@ void STag_surfxml_prop() } void ETag_surfxml_host() { - s_sg_platf_host_cbarg_t host; + simgrid::kernel::routing::HostCreationArgs host; host.properties = current_property_set; current_property_set = nullptr; @@ -442,7 +442,7 @@ void ETag_surfxml_host() { void STag_surfxml_host___link(){ XBT_DEBUG("Create a Host_link for %s",A_surfxml_host___link_id); - HostLinkCreationArgs host_link; + simgrid::kernel::routing::HostLinkCreationArgs host_link; host_link.id = A_surfxml_host___link_id; host_link.link_up = A_surfxml_host___link_up; @@ -455,7 +455,7 @@ void STag_surfxml_router(){ } void ETag_surfxml_cluster(){ - ClusterCreationArgs cluster; + simgrid::kernel::routing::ClusterCreationArgs cluster; cluster.properties = current_property_set; current_property_set = nullptr; @@ -480,16 +480,16 @@ void ETag_surfxml_cluster(){ switch(AX_surfxml_cluster_topology){ case A_surfxml_cluster_topology_FLAT: - cluster.topology = ClusterTopology::FLAT; + cluster.topology = simgrid::kernel::routing::ClusterTopology::FLAT; break; case A_surfxml_cluster_topology_TORUS: - cluster.topology = ClusterTopology::TORUS; + cluster.topology = simgrid::kernel::routing::ClusterTopology::TORUS; break; case A_surfxml_cluster_topology_FAT___TREE: - cluster.topology = ClusterTopology::FAT_TREE; + cluster.topology = simgrid::kernel::routing::ClusterTopology::FAT_TREE; break; case A_surfxml_cluster_topology_DRAGONFLY: - cluster.topology = ClusterTopology::DRAGONFLY; + cluster.topology = simgrid::kernel::routing::ClusterTopology::DRAGONFLY; break; default: surf_parse_error(std::string("Invalid cluster topology for cluster ") + cluster.id); @@ -539,7 +539,7 @@ void STag_surfxml_cluster(){ void STag_surfxml_cabinet(){ parse_after_config(); - CabinetCreationArgs cabinet; + simgrid::kernel::routing::CabinetCreationArgs cabinet; cabinet.id = A_surfxml_cabinet_id; cabinet.prefix = A_surfxml_cabinet_prefix; cabinet.suffix = A_surfxml_cabinet_suffix; @@ -553,7 +553,7 @@ void STag_surfxml_cabinet(){ void STag_surfxml_peer(){ parse_after_config(); - PeerCreationArgs peer; + simgrid::kernel::routing::PeerCreationArgs peer; peer.id = std::string(A_surfxml_peer_id); peer.speed = surf_parse_get_speed(A_surfxml_peer_speed, "speed of peer", peer.id.c_str()); @@ -576,7 +576,7 @@ void STag_surfxml_link(){ } void ETag_surfxml_link(){ - LinkCreationArgs link; + simgrid::kernel::routing::LinkCreationArgs link; link.properties = current_property_set; current_property_set = nullptr; @@ -645,7 +645,7 @@ void STag_surfxml_link___ctn() } void ETag_surfxml_backbone(){ - LinkCreationArgs link; + simgrid::kernel::routing::LinkCreationArgs link; link.properties = nullptr; link.id = std::string(A_surfxml_backbone_id); @@ -695,7 +695,7 @@ void STag_surfxml_bypassZoneRoute(){ } void ETag_surfxml_route(){ - RouteCreationArgs route; + simgrid::kernel::routing::RouteCreationArgs route; route.src = sg_netpoint_by_name_or_null(A_surfxml_route_src); // tested to not be nullptr in start tag route.dst = sg_netpoint_by_name_or_null(A_surfxml_route_dst); // tested to not be nullptr in start tag @@ -719,7 +719,7 @@ void ETag_surfxml_ASroute() } void ETag_surfxml_zoneRoute() { - RouteCreationArgs ASroute; + simgrid::kernel::routing::RouteCreationArgs ASroute; ASroute.src = sg_netpoint_by_name_or_null(A_surfxml_zoneRoute_src); // tested to not be nullptr in start tag ASroute.dst = sg_netpoint_by_name_or_null(A_surfxml_zoneRoute_dst); // tested to not be nullptr in start tag @@ -745,7 +745,7 @@ void ETag_surfxml_zoneRoute() } void ETag_surfxml_bypassRoute(){ - RouteCreationArgs route; + simgrid::kernel::routing::RouteCreationArgs route; route.src = sg_netpoint_by_name_or_null(A_surfxml_bypassRoute_src); // tested to not be nullptr in start tag route.dst = sg_netpoint_by_name_or_null(A_surfxml_bypassRoute_dst); // tested to not be nullptr in start tag @@ -768,7 +768,7 @@ void ETag_surfxml_bypassASroute() } void ETag_surfxml_bypassZoneRoute() { - RouteCreationArgs ASroute; + simgrid::kernel::routing::RouteCreationArgs ASroute; ASroute.src = sg_netpoint_by_name_or_null(A_surfxml_bypassZoneRoute_src); ASroute.dst = sg_netpoint_by_name_or_null(A_surfxml_bypassZoneRoute_dst); @@ -783,7 +783,7 @@ void ETag_surfxml_bypassZoneRoute() } void ETag_surfxml_trace(){ - TraceCreationArgs trace; + simgrid::kernel::routing::TraceCreationArgs trace; trace.id = A_surfxml_trace_id; trace.file = A_surfxml_trace_file; @@ -796,7 +796,7 @@ void ETag_surfxml_trace(){ void STag_surfxml_trace___connect() { parse_after_config(); - TraceConnectCreationArgs trace_connect; + simgrid::kernel::routing::TraceConnectCreationArgs trace_connect; trace_connect.element = A_surfxml_trace___connect_element; trace_connect.trace = A_surfxml_trace___connect_trace; @@ -804,19 +804,19 @@ void STag_surfxml_trace___connect() switch (A_surfxml_trace___connect_kind) { case AU_surfxml_trace___connect_kind: case A_surfxml_trace___connect_kind_SPEED: - trace_connect.kind = TraceConnectKind::SPEED; + trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::SPEED; break; case A_surfxml_trace___connect_kind_BANDWIDTH: - trace_connect.kind = TraceConnectKind::BANDWIDTH; + trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::BANDWIDTH; break; case A_surfxml_trace___connect_kind_HOST___AVAIL: - trace_connect.kind = TraceConnectKind::HOST_AVAIL; + trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::HOST_AVAIL; break; case A_surfxml_trace___connect_kind_LATENCY: - trace_connect.kind = TraceConnectKind::LATENCY; + trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::LATENCY; break; case A_surfxml_trace___connect_kind_LINK___AVAIL: - trace_connect.kind = TraceConnectKind::LINK_AVAIL; + trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::LINK_AVAIL; break; default: surf_parse_error("Invalid trace kind"); @@ -841,7 +841,7 @@ void STag_surfxml_zone() { parse_after_config(); ZONE_TAG = 1; - ZoneCreationArgs zone; + simgrid::kernel::routing::ZoneCreationArgs zone; zone.id = A_surfxml_zone_id; zone.routing = static_cast(A_surfxml_zone_routing); @@ -907,7 +907,7 @@ void ETag_surfxml_process() void ETag_surfxml_actor() { - ActorCreationArgs actor; + simgrid::kernel::routing::ActorCreationArgs actor; actor.properties = current_property_set; current_property_set = nullptr; @@ -921,10 +921,10 @@ void ETag_surfxml_actor() switch (A_surfxml_actor_on___failure) { case AU_surfxml_actor_on___failure: case A_surfxml_actor_on___failure_DIE: - actor.on_failure = ActorOnFailure::DIE; + actor.on_failure = simgrid::kernel::routing::ActorOnFailure::DIE; break; case A_surfxml_actor_on___failure_RESTART: - actor.on_failure = ActorOnFailure::RESTART; + actor.on_failure = simgrid::kernel::routing::ActorOnFailure::RESTART; break; default: surf_parse_error("Invalid on failure behavior");