From 07c12189c716ea527ddcf8f8b55983213dead2bf Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 23 Jan 2017 22:51:47 +0100 Subject: [PATCH] Rename NetCards to NetPoints --- ChangeLog | 4 +++ include/simgrid/forward.h | 8 +++--- include/simgrid/s4u/NetZone.hpp | 8 +++--- include/simgrid/s4u/engine.hpp | 8 +++--- include/simgrid/s4u/host.hpp | 2 +- src/bindings/lua/lua_platf.cpp | 2 +- src/instr/instr_interface.cpp | 2 +- src/instr/instr_paje_containers.cpp | 2 +- src/kernel/EngineImpl.cpp | 4 +-- src/kernel/EngineImpl.hpp | 4 +-- src/kernel/routing/ClusterZone.cpp | 4 +-- src/kernel/routing/ClusterZone.hpp | 4 +-- src/kernel/routing/DijkstraZone.cpp | 14 +++++----- src/kernel/routing/DijkstraZone.hpp | 2 +- src/kernel/routing/DragonflyZone.cpp | 4 +-- src/kernel/routing/DragonflyZone.hpp | 2 +- src/kernel/routing/EmptyZone.cpp | 2 +- src/kernel/routing/EmptyZone.hpp | 2 +- src/kernel/routing/FatTreeZone.cpp | 4 +-- src/kernel/routing/FatTreeZone.hpp | 2 +- src/kernel/routing/FloydZone.cpp | 7 +++-- src/kernel/routing/FloydZone.hpp | 2 +- src/kernel/routing/FullZone.cpp | 10 +++---- src/kernel/routing/FullZone.hpp | 2 +- .../routing/{NetCard.cpp => NetPoint.cpp} | 11 ++++---- .../routing/{NetCard.hpp => NetPoint.hpp} | 14 +++++----- src/kernel/routing/NetZoneImpl.cpp | 24 ++++++++--------- src/kernel/routing/NetZoneImpl.hpp | 10 +++---- src/kernel/routing/RoutedZone.cpp | 8 +++--- src/kernel/routing/RoutedZone.hpp | 2 +- src/kernel/routing/TorusZone.cpp | 5 ++-- src/kernel/routing/TorusZone.hpp | 2 +- src/kernel/routing/VivaldiZone.cpp | 14 +++++----- src/kernel/routing/VivaldiZone.hpp | 8 +++--- src/plugins/vm/VirtualMachineImpl.cpp | 2 +- src/plugins/vm/s4u_VirtualMachine.cpp | 4 +-- src/s4u/s4u_engine.cpp | 26 +++++++++---------- src/s4u/s4u_host.cpp | 8 +++--- src/s4u/s4u_netzone.cpp | 8 +++--- src/simgrid/host.cpp | 6 ++--- src/surf/network_ns3.cpp | 22 ++++++++-------- src/surf/ns3/ns3_interface.h | 2 +- src/surf/sg_platf.cpp | 14 +++++----- src/surf/storage_n11.cpp | 5 ++-- src/surf/surf_interface.cpp | 2 +- src/surf/xml/platf_private.hpp | 2 +- src/surf/xml/surfxml_sax_cb.cpp | 2 +- teshsuite/simdag/flatifier/flatifier.cpp | 16 ++++++------ teshsuite/simdag/is-router/is-router.cpp | 12 ++++----- tools/cmake/DefinePackages.cmake | 4 +-- 50 files changed, 170 insertions(+), 168 deletions(-) rename src/kernel/routing/{NetCard.cpp => NetPoint.cpp} (74%) rename src/kernel/routing/{NetCard.hpp => NetPoint.hpp} (79%) diff --git a/ChangeLog b/ChangeLog index 4e58ce7ae2..7db8399fb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ SimGrid (3.15) UNRELEASED; urgency=low + - Rename NetCards to NetPoints. + This was intended to help NS3 users, but that's not a netcard. + That's a point in the routing algorithm, let's avoid do wrong simplifications. + -- target_date=March 20 2017 -- Da SimGrid team SimGrid (3.14.159) stable; urgency=low diff --git a/include/simgrid/forward.h b/include/simgrid/forward.h index 10cf0ec667..610f34fe5c 100644 --- a/include/simgrid/forward.h +++ b/include/simgrid/forward.h @@ -22,7 +22,7 @@ namespace simgrid { class ActivityImpl; } namespace routing { - class NetCard; + class NetPoint; } } namespace simix { @@ -43,7 +43,7 @@ namespace simgrid { typedef simgrid::s4u::NetZone simgrid_NetZone; typedef simgrid::s4u::Host simgrid_Host; typedef simgrid::kernel::activity::ActivityImpl kernel_Activity; -typedef simgrid::kernel::routing::NetCard routing_NetCard; +typedef simgrid::kernel::routing::NetPoint routing_NetPoint; typedef simgrid::surf::Cpu surf_Cpu; typedef simgrid::surf::Link Link; typedef simgrid::surf::Resource surf_Resource; @@ -58,7 +58,7 @@ typedef struct simgrid_NetZone simgrid_NetZone; typedef struct simgrid_Host simgrid_Host; typedef struct kernel_Activity kernel_Activity; typedef struct surf_Cpu surf_Cpu; -typedef struct routing_NetCard routing_NetCard; +typedef struct routing_NetPoint routing_NetPoint; typedef struct surf_Resource surf_Resource; typedef struct Link Link; typedef struct Trace tmgr_Trace; @@ -72,7 +72,7 @@ typedef simgrid_Host* sg_host_t; typedef kernel_Activity *smx_activity_t; typedef surf_Cpu *surf_cpu_t; -typedef routing_NetCard *sg_netcard_t; +typedef routing_NetPoint* sg_netcard_t; typedef surf_Resource *sg_resource_t; // Types which are in fact dictelmt: diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index bf96c02933..155a95cf56 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -58,18 +58,18 @@ public: void setProperty(const char* key, const char* value); /* Add content to the netzone, at parsing time. It should be sealed afterward. */ - virtual int addComponent(kernel::routing::NetCard * elm); /* A host, a router or a netzone, whatever */ + virtual int addComponent(kernel::routing::NetPoint * elm); /* A host, a router or a netzone, whatever */ virtual void addRoute(sg_platf_route_cbarg_t route); virtual void addBypassRoute(sg_platf_route_cbarg_t e_route) = 0; /*** Called on each newly created regular route (not on bypass routes) */ - static simgrid::xbt::signal* link_list)> onRouteCreation; protected: - std::vector + std::vector vertices_; // our content, as known to our graph routing algorithm (maps vertexId -> vertex) private: diff --git a/include/simgrid/s4u/engine.hpp b/include/simgrid/s4u/engine.hpp index 7f5177adc3..3caf268250 100644 --- a/include/simgrid/s4u/engine.hpp +++ b/include/simgrid/s4u/engine.hpp @@ -73,10 +73,10 @@ public: simgrid::s4u::NetZone* netzoneByNameOrNull(const char* name); /** @brief Retrieve the netcard of the given name (or nullptr if not found) */ - simgrid::kernel::routing::NetCard* netcardByNameOrNull(const char* name); - void netcardList(std::vector * list); - void netcardRegister(simgrid::kernel::routing::NetCard * card); - void netcardUnregister(simgrid::kernel::routing::NetCard * card); + simgrid::kernel::routing::NetPoint* netcardByNameOrNull(const char* name); + void netcardList(std::vector * list); + void netcardRegister(simgrid::kernel::routing::NetPoint * card); + void netcardUnregister(simgrid::kernel::routing::NetPoint * card); template void registerFunction(const char* name) diff --git a/include/simgrid/s4u/host.hpp b/include/simgrid/s4u/host.hpp index b03753569c..23e91e25bb 100644 --- a/include/simgrid/s4u/host.hpp +++ b/include/simgrid/s4u/host.hpp @@ -114,7 +114,7 @@ public: /** DO NOT USE DIRECTLY (@todo: these should be protected, once our code is clean) */ surf::Cpu *pimpl_cpu = nullptr; /** DO NOT USE DIRECTLY (@todo: these should be protected, once our code is clean) */ - kernel::routing::NetCard *pimpl_netcard = nullptr; + kernel::routing::NetPoint* pimpl_netpoint = nullptr; public: /*** Called on each newly created object */ diff --git a/src/bindings/lua/lua_platf.cpp b/src/bindings/lua/lua_platf.cpp index c662f755ac..bdcfef6ce2 100644 --- a/src/bindings/lua/lua_platf.cpp +++ b/src/bindings/lua/lua_platf.cpp @@ -7,7 +7,7 @@ /* SimGrid Lua bindings */ #include "lua_private.h" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/surf/network_interface.hpp" #include "src/surf/xml/platf_private.hpp" #include "surf/surf_routing.h" diff --git a/src/instr/instr_interface.cpp b/src/instr/instr_interface.cpp index 6801500b8f..da48497150 100644 --- a/src/instr/instr_interface.cpp +++ b/src/instr/instr_interface.cpp @@ -6,7 +6,7 @@ #include "simgrid_config.h" #include "src/instr/instr_private.h" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/surf/network_interface.hpp" #include "src/surf/surf_private.h" #include "surf/surf.h" diff --git a/src/instr/instr_paje_containers.cpp b/src/instr/instr_paje_containers.cpp index 6af90f2fd1..48d1af162d 100644 --- a/src/instr/instr_paje_containers.cpp +++ b/src/instr/instr_paje_containers.cpp @@ -68,7 +68,7 @@ container_t PJ_container_new (const char *name, e_container_types kind, containe //Search for network_element_t switch (kind){ case INSTR_HOST: - newContainer->netcard = sg_host->pimpl_netcard; + newContainer->netcard = sg_host->pimpl_netpoint; xbt_assert(newContainer->netcard, "Element '%s' not found",name); break; case INSTR_ROUTER: diff --git a/src/kernel/EngineImpl.cpp b/src/kernel/EngineImpl.cpp index f88b59cad8..3375539c53 100644 --- a/src/kernel/EngineImpl.cpp +++ b/src/kernel/EngineImpl.cpp @@ -4,7 +4,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "src/kernel/EngineImpl.hpp" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/kernel/routing/NetZoneImpl.hpp" #include @@ -15,7 +15,7 @@ EngineImpl::EngineImpl() = default; EngineImpl::~EngineImpl() { delete netRoot_; - for (auto kv : netcards_) + for (auto kv : netpoints_) delete kv.second; } } diff --git a/src/kernel/EngineImpl.hpp b/src/kernel/EngineImpl.hpp index d3501dc660..c25063d629 100644 --- a/src/kernel/EngineImpl.hpp +++ b/src/kernel/EngineImpl.hpp @@ -13,7 +13,7 @@ namespace simgrid { namespace kernel { namespace routing { class NetZoneImpl; -class NetCard; +class NetPoint; } class EngineImpl { @@ -23,7 +23,7 @@ public: kernel::routing::NetZoneImpl* netRoot_ = nullptr; protected: - std::unordered_map netcards_; + std::unordered_map netpoints_; friend simgrid::s4u::Engine; }; } diff --git a/src/kernel/routing/ClusterZone.cpp b/src/kernel/routing/ClusterZone.cpp index d2eb784757..c6e2679544 100644 --- a/src/kernel/routing/ClusterZone.cpp +++ b/src/kernel/routing/ClusterZone.cpp @@ -4,7 +4,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "src/kernel/routing/ClusterZone.hpp" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/kernel/routing/RoutedZone.hpp" #include "src/surf/network_interface.hpp" @@ -20,7 +20,7 @@ ClusterZone::ClusterZone(NetZone* father, const char* name) : NetZoneImpl(father { } -void ClusterZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat) +void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) { XBT_VERB("cluster getLocalRoute from '%s'[%d] to '%s'[%d]", src->cname(), src->id(), dst->cname(), dst->id()); xbt_assert(!privateLinks_.empty(), diff --git a/src/kernel/routing/ClusterZone.hpp b/src/kernel/routing/ClusterZone.hpp index a9065181ab..0137d371d1 100644 --- a/src/kernel/routing/ClusterZone.hpp +++ b/src/kernel/routing/ClusterZone.hpp @@ -69,7 +69,7 @@ class XBT_PRIVATE ClusterZone : public NetZoneImpl { public: explicit ClusterZone(NetZone* father, const char* name); - void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override; + void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override; void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override; virtual void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position); @@ -81,7 +81,7 @@ public: Link* backbone_ = nullptr; void* loopback_ = nullptr; - NetCard* router_ = nullptr; + NetPoint* router_ = nullptr; bool hasLimiter_ = false; bool hasLoopback_ = false; unsigned int linkCountPerNode_ = 1; /* may be 1 (if only a private link), 2 or 3 (if limiter and loopback) */ diff --git a/src/kernel/routing/DijkstraZone.cpp b/src/kernel/routing/DijkstraZone.cpp index 75068094a3..08fd4430fa 100644 --- a/src/kernel/routing/DijkstraZone.cpp +++ b/src/kernel/routing/DijkstraZone.cpp @@ -4,7 +4,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "src/kernel/routing/DijkstraZone.hpp" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/surf/network_interface.hpp" #include @@ -141,7 +141,7 @@ void DijkstraZone::newRoute(int src_id, int dst_id, sg_platf_route_cbarg_t e_rou xbt_graph_new_edge(routeGraph_, src, dst, e_route); } -void DijkstraZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat) +void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) { getRouteCheckParams(src, dst); int src_id = src->id(); @@ -239,8 +239,8 @@ void DijkstraZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbar } /* compose route path with links */ - NetCard *gw_src = nullptr, *gw_dst, *prev_gw_src, *first_gw = nullptr; - NetCard *gw_dst_net_elm = nullptr, *prev_gw_src_net_elm = nullptr; + NetPoint *gw_src = nullptr, *gw_dst, *prev_gw_src, *first_gw = nullptr; + NetPoint *gw_dst_net_elm = nullptr, *prev_gw_src_net_elm = nullptr; for (int v = dst_node_id; v != src_node_id; v = pred_arr[v]) { xbt_node_t node_pred_v = xbt_dynar_get_as(nodes, pred_arr[v], xbt_node_t); @@ -315,8 +315,8 @@ DijkstraZone::DijkstraZone(NetZone* father, const char* name, bool cached) : Rou void DijkstraZone::addRoute(sg_platf_route_cbarg_t route) { - NetCard* src = route->src; - NetCard* dst = route->dst; + NetPoint* src = route->src; + NetPoint* dst = route->dst; const char* srcName = src->name().c_str(); const char* dstName = dst->name().c_str(); @@ -353,7 +353,7 @@ void DijkstraZone::addRoute(sg_platf_route_cbarg_t route) route->gw_src->name().c_str()); if (route->gw_dst && route->gw_src) { - NetCard* gw_tmp = route->gw_src; + NetPoint* gw_tmp = route->gw_src; route->gw_src = route->gw_dst; route->gw_dst = gw_tmp; } diff --git a/src/kernel/routing/DijkstraZone.hpp b/src/kernel/routing/DijkstraZone.hpp index bf443fb83e..b19cd34155 100644 --- a/src/kernel/routing/DijkstraZone.hpp +++ b/src/kernel/routing/DijkstraZone.hpp @@ -58,7 +58,7 @@ public: * After this function returns, any node in the graph * will have a loopback attached to it. */ - void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat) override; + void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) override; void addRoute(sg_platf_route_cbarg_t route) override; xbt_graph_t routeGraph_ = nullptr; /* xbt_graph */ diff --git a/src/kernel/routing/DragonflyZone.cpp b/src/kernel/routing/DragonflyZone.cpp index 02d4f0249a..0de5c30295 100644 --- a/src/kernel/routing/DragonflyZone.cpp +++ b/src/kernel/routing/DragonflyZone.cpp @@ -4,7 +4,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "src/kernel/routing/DragonflyZone.hpp" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/surf/network_interface.hpp" #include @@ -245,7 +245,7 @@ void DragonflyZone::generateLinks() } } -void DragonflyZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* latency) +void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* latency) { // Minimal routing version. // TODO : non-minimal random one, and adaptive ? diff --git a/src/kernel/routing/DragonflyZone.hpp b/src/kernel/routing/DragonflyZone.hpp index 2cc15a51fa..bb3117d9d0 100644 --- a/src/kernel/routing/DragonflyZone.hpp +++ b/src/kernel/routing/DragonflyZone.hpp @@ -63,7 +63,7 @@ public: explicit DragonflyZone(NetZone* father, const char* name); ~DragonflyZone() override; // void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override; - void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override; + void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override; void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster) override; void seal() override; void generateRouters(); diff --git a/src/kernel/routing/EmptyZone.cpp b/src/kernel/routing/EmptyZone.cpp index 66729e69a6..b861258a8e 100644 --- a/src/kernel/routing/EmptyZone.cpp +++ b/src/kernel/routing/EmptyZone.cpp @@ -21,7 +21,7 @@ EmptyZone::EmptyZone(NetZone* father, const char* name) : NetZoneImpl(father, na EmptyZone::~EmptyZone() = default; -void EmptyZone::getLocalRoute(NetCard* /*src*/, NetCard* /*dst*/, sg_platf_route_cbarg_t /*res*/, double* /*lat*/) +void EmptyZone::getLocalRoute(NetPoint* /*src*/, NetPoint* /*dst*/, sg_platf_route_cbarg_t /*res*/, double* /*lat*/) { } diff --git a/src/kernel/routing/EmptyZone.hpp b/src/kernel/routing/EmptyZone.hpp index 09b2fda222..90036ff87d 100644 --- a/src/kernel/routing/EmptyZone.hpp +++ b/src/kernel/routing/EmptyZone.hpp @@ -24,7 +24,7 @@ public: explicit EmptyZone(NetZone* father, const char* name); ~EmptyZone() override; - void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override; + void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override; void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override; }; } diff --git a/src/kernel/routing/FatTreeZone.cpp b/src/kernel/routing/FatTreeZone.cpp index 7a0222aae7..9475591fff 100644 --- a/src/kernel/routing/FatTreeZone.cpp +++ b/src/kernel/routing/FatTreeZone.cpp @@ -7,7 +7,7 @@ #include #include "src/kernel/routing/FatTreeZone.hpp" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/surf/network_interface.hpp" #include "xbt/lib.h" @@ -57,7 +57,7 @@ bool FatTreeZone::isInSubTree(FatTreeNode* root, FatTreeNode* node) return true; } -void FatTreeZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) +void FatTreeZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) { if (dst->isRouter() || src->isRouter()) diff --git a/src/kernel/routing/FatTreeZone.hpp b/src/kernel/routing/FatTreeZone.hpp index 50776677c0..8d8538752f 100644 --- a/src/kernel/routing/FatTreeZone.hpp +++ b/src/kernel/routing/FatTreeZone.hpp @@ -100,7 +100,7 @@ class XBT_PRIVATE FatTreeZone : public ClusterZone { public: explicit FatTreeZone(NetZone* father, const char* name); ~FatTreeZone() override; - void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override; + void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override; /** \brief Generate the fat tree * diff --git a/src/kernel/routing/FloydZone.cpp b/src/kernel/routing/FloydZone.cpp index 0caacff9c3..1c20629d16 100644 --- a/src/kernel/routing/FloydZone.cpp +++ b/src/kernel/routing/FloydZone.cpp @@ -3,9 +3,8 @@ /* 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 "src/kernel/routing/FloydZone.hpp" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/surf/network_interface.hpp" #include "xbt/log.h" @@ -44,7 +43,7 @@ FloydZone::~FloydZone() xbt_free(costTable_); } -void FloydZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat) +void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) { size_t table_size = vertices_.size(); @@ -136,7 +135,7 @@ void FloydZone::addRoute(sg_platf_route_cbarg_t route) route->dst->name().c_str(), route->src->name().c_str()); if (route->gw_dst && route->gw_src) { - NetCard* gw_tmp = route->gw_src; + NetPoint* gw_tmp = route->gw_src; route->gw_src = route->gw_dst; route->gw_dst = gw_tmp; } diff --git a/src/kernel/routing/FloydZone.hpp b/src/kernel/routing/FloydZone.hpp index 74f0868cb9..f1cb156936 100644 --- a/src/kernel/routing/FloydZone.hpp +++ b/src/kernel/routing/FloydZone.hpp @@ -26,7 +26,7 @@ public: explicit FloydZone(NetZone* father, const char* name); ~FloydZone() override; - void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override; + void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override; void addRoute(sg_platf_route_cbarg_t route) override; void seal() override; diff --git a/src/kernel/routing/FullZone.cpp b/src/kernel/routing/FullZone.cpp index d9b0babfc8..71723c7292 100644 --- a/src/kernel/routing/FullZone.cpp +++ b/src/kernel/routing/FullZone.cpp @@ -4,7 +4,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "src/kernel/routing/FullZone.hpp" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/surf/network_interface.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf"); @@ -58,7 +58,7 @@ FullZone::~FullZone() } } -void FullZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t res, double* lat) +void FullZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t res, double* lat) { XBT_DEBUG("full getLocalRoute from %s[%d] to %s[%d]", src->cname(), src->id(), dst->cname(), dst->id()); @@ -78,8 +78,8 @@ void FullZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t void FullZone::addRoute(sg_platf_route_cbarg_t route) { - NetCard* src = route->src; - NetCard* dst = route->dst; + NetPoint* src = route->src; + NetPoint* dst = route->dst; addRouteCheckParams(route); size_t table_size = vertices_.size(); @@ -102,7 +102,7 @@ void FullZone::addRoute(sg_platf_route_cbarg_t route) if (route->symmetrical == true && src != dst) { if (route->gw_dst && route->gw_src) { - NetCard* gw_tmp = route->gw_src; + NetPoint* gw_tmp = route->gw_src; route->gw_src = route->gw_dst; route->gw_dst = gw_tmp; } diff --git a/src/kernel/routing/FullZone.hpp b/src/kernel/routing/FullZone.hpp index e81519c180..f13764ffa8 100644 --- a/src/kernel/routing/FullZone.hpp +++ b/src/kernel/routing/FullZone.hpp @@ -25,7 +25,7 @@ public: void seal() override; ~FullZone() override; - void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override; + void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override; void addRoute(sg_platf_route_cbarg_t route) override; sg_platf_route_cbarg_t* routingTable_ = nullptr; diff --git a/src/kernel/routing/NetCard.cpp b/src/kernel/routing/NetPoint.cpp similarity index 74% rename from src/kernel/routing/NetCard.cpp rename to src/kernel/routing/NetPoint.cpp index d875e898b8..5bf404bfe0 100644 --- a/src/kernel/routing/NetCard.cpp +++ b/src/kernel/routing/NetPoint.cpp @@ -4,7 +4,8 @@ /* 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 "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" + #include "simgrid/s4u/engine.hpp" #include "simgrid/s4u/host.hpp" #include "surf/surf_routing.h" @@ -15,15 +16,15 @@ namespace simgrid { namespace kernel { namespace routing { -simgrid::xbt::signal NetCard::onCreation; +simgrid::xbt::signal NetPoint::onCreation; -NetCard::NetCard(std::string name, NetCard::Type componentType, NetZoneImpl* netzone_p) +NetPoint::NetPoint(std::string name, NetPoint::Type componentType, NetZoneImpl* netzone_p) : name_(name), componentType_(componentType), netzone_(netzone_p) { if (netzone_p != nullptr) id_ = netzone_p->addComponent(this); simgrid::s4u::Engine::instance()->netcardRegister(this); - simgrid::kernel::routing::NetCard::onCreation(this); + simgrid::kernel::routing::NetPoint::onCreation(this); } } } @@ -33,7 +34,7 @@ NetCard::NetCard(std::string name, NetCard::Type componentType, NetZoneImpl* net * * Netcards are the thing that connect host or routers to the network */ -simgrid::kernel::routing::NetCard* sg_netcard_by_name_or_null(const char* name) +simgrid::kernel::routing::NetPoint* sg_netcard_by_name_or_null(const char* name) { return simgrid::s4u::Engine::instance()->netcardByNameOrNull(name); } diff --git a/src/kernel/routing/NetCard.hpp b/src/kernel/routing/NetPoint.hpp similarity index 79% rename from src/kernel/routing/NetCard.hpp rename to src/kernel/routing/NetPoint.hpp index 0f0b45ddf9..b077a37c79 100644 --- a/src/kernel/routing/NetCard.hpp +++ b/src/kernel/routing/NetPoint.hpp @@ -22,15 +22,15 @@ namespace routing { /** @ingroup ROUTING_API * @brief Network cards are the vertices in the graph representing the network, used to compute paths between nodes. * - * @details This represents a position in the network. One can send information between two netcards + * @details This represents a position in the network. One can send information between two netpoints */ -class NetCard : public simgrid::xbt::Extendable { +class NetPoint : public simgrid::xbt::Extendable { public: enum class Type { Host, Router, NetZone }; - NetCard(std::string name, NetCard::Type componentType, NetZoneImpl* netzone_p); - ~NetCard() = default; + NetPoint(std::string name, NetPoint::Type componentType, NetZoneImpl* netzone_p); + ~NetPoint() = default; // Our rank in the vertices_ array of the netzone that contains us. unsigned int id() { return id_; } @@ -43,14 +43,14 @@ public: bool isHost() { return componentType_ == Type::Host; } bool isRouter() { return componentType_ == Type::Router; } - static simgrid::xbt::signal onCreation; + static simgrid::xbt::signal onCreation; - bool operator<(const NetCard &rhs) const { return name_ < rhs.name_; } + bool operator<(const NetPoint& rhs) const { return name_ < rhs.name_; } private: unsigned int id_; std::string name_; - NetCard::Type componentType_; + NetPoint::Type componentType_; NetZoneImpl* netzone_; }; } diff --git a/src/kernel/routing/NetZoneImpl.cpp b/src/kernel/routing/NetZoneImpl.cpp index d4637b302e..464e973735 100644 --- a/src/kernel/routing/NetZoneImpl.cpp +++ b/src/kernel/routing/NetZoneImpl.cpp @@ -6,7 +6,7 @@ #include "src/kernel/routing/NetZoneImpl.hpp" #include "simgrid/s4u/engine.hpp" #include "simgrid/s4u/host.hpp" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/surf/cpu_interface.hpp" #include "src/surf/network_interface.hpp" @@ -20,9 +20,9 @@ namespace routing { class BypassRoute { public: - explicit BypassRoute(NetCard* gwSrc, NetCard* gwDst) : gw_src(gwSrc), gw_dst(gwDst) {} - const NetCard* gw_src; - const NetCard* gw_dst; + explicit BypassRoute(NetPoint* gwSrc, NetPoint* gwDst) : gw_src(gwSrc), gw_dst(gwDst) {} + const NetPoint* gw_src; + const NetPoint* gw_dst; std::vector links; }; @@ -31,7 +31,7 @@ NetZoneImpl::NetZoneImpl(NetZone* father, const char* name) : NetZone(father, na xbt_assert(nullptr == simgrid::s4u::Engine::instance()->netcardByNameOrNull(name), "Refusing to create a second NetZone called '%s'.", name); - netcard_ = new NetCard(name, NetCard::Type::NetZone, static_cast(father)); + netcard_ = new NetPoint(name, NetPoint::Type::NetZone, static_cast(father)); XBT_DEBUG("NetZone '%s' created with the id '%d'", name, netcard_->id()); } NetZoneImpl::~NetZoneImpl() @@ -50,7 +50,7 @@ simgrid::s4u::Host* NetZoneImpl::createHost(const char* name, std::vectorpimpl_netcard = new NetCard(name, NetCard::Type::Host, this); + res->pimpl_netpoint = new NetPoint(name, NetPoint::Type::Host, this); surf_cpu_model_pm->createCpu(res, speedPerPstate, coreAmount); @@ -141,7 +141,7 @@ void NetZoneImpl::addBypassRoute(sg_platf_route_cbarg_t e_route) * dst * @endverbatim */ -static void find_common_ancestors(NetCard* src, NetCard* dst, +static void find_common_ancestors(NetPoint* src, NetPoint* dst, /* OUT */ NetZoneImpl** common_ancestor, NetZoneImpl** src_ancestor, NetZoneImpl** dst_ancestor) { @@ -201,7 +201,7 @@ static void find_common_ancestors(NetCard* src, NetCard* dst, } /* PRECONDITION: this is the common ancestor of src and dst */ -bool NetZoneImpl::getBypassRoute(routing::NetCard* src, routing::NetCard* dst, +bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst, /* OUT */ std::vector* links, double* latency) { // If never set a bypass route return nullptr without any further computations @@ -255,7 +255,7 @@ bool NetZoneImpl::getBypassRoute(routing::NetCard* src, routing::NetCard* dst, /* (3) Search for a bypass making the path up to the ancestor useless */ BypassRoute* bypassedRoute = nullptr; - std::pair key; + std::pair key; for (int max = 0; max <= max_index; max++) { for (int i = 0; i < max; i++) { if (i <= max_index_src && max <= max_index_dst) { @@ -292,21 +292,21 @@ bool NetZoneImpl::getBypassRoute(routing::NetCard* src, routing::NetCard* dst, "calls to getRoute", src->cname(), dst->cname(), bypassedRoute->links.size()); if (src != key.first) - getGlobalRoute(src, const_cast(bypassedRoute->gw_src), links, latency); + getGlobalRoute(src, const_cast(bypassedRoute->gw_src), links, latency); for (surf::Link* link : bypassedRoute->links) { links->push_back(link); if (latency) *latency += link->latency(); } if (dst != key.second) - getGlobalRoute(const_cast(bypassedRoute->gw_dst), dst, links, latency); + getGlobalRoute(const_cast(bypassedRoute->gw_dst), dst, links, latency); return true; } XBT_DEBUG("No bypass route from '%s' to '%s'.", src->cname(), dst->cname()); return false; } -void NetZoneImpl::getGlobalRoute(routing::NetCard* src, routing::NetCard* dst, +void NetZoneImpl::getGlobalRoute(routing::NetPoint* src, routing::NetPoint* dst, /* OUT */ std::vector* links, double* latency) { s_sg_platf_route_cbarg_t route; diff --git a/src/kernel/routing/NetZoneImpl.hpp b/src/kernel/routing/NetZoneImpl.hpp index bac785d56f..bc922794db 100644 --- a/src/kernel/routing/NetZoneImpl.hpp +++ b/src/kernel/routing/NetZoneImpl.hpp @@ -72,10 +72,10 @@ protected: * @param into Container into which the traversed links and gateway informations should be pushed * @param latency Accumulator in which the latencies should be added (caller must set it to 0) */ - virtual void getLocalRoute(NetCard * src, NetCard * dst, sg_platf_route_cbarg_t into, double* latency) = 0; + virtual void getLocalRoute(NetPoint * src, NetPoint * dst, sg_platf_route_cbarg_t into, double* latency) = 0; /** @brief retrieves the list of all routes of size 1 (of type src x dst x Link) */ /* returns whether we found a bypass path */ - bool getBypassRoute(routing::NetCard * src, routing::NetCard * dst, + bool getBypassRoute(routing::NetPoint * src, routing::NetPoint * dst, /* OUT */ std::vector * links, double* latency); public: @@ -86,7 +86,7 @@ public: * @param links Accumulator in which all traversed links should be pushed (caller must empty it) * @param latency Accumulator in which the latencies should be added (caller must set it to 0) */ - static void getGlobalRoute(routing::NetCard * src, routing::NetCard * dst, + static void getGlobalRoute(routing::NetPoint * src, routing::NetPoint * dst, /* OUT */ std::vector * links, double* latency); virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) = 0; @@ -99,8 +99,8 @@ public: RoutingMode hierarchy_ = RoutingMode::unset; private: - std::map, BypassRoute*> bypassRoutes_; // src x dst -> route - routing::NetCard* netcard_ = nullptr; // Our representative in the father NetZone + std::map, BypassRoute*> bypassRoutes_; // src x dst -> route + routing::NetPoint* netcard_ = nullptr; // Our representative in the father NetZone }; } } diff --git a/src/kernel/routing/RoutedZone.cpp b/src/kernel/routing/RoutedZone.cpp index 5209a95e81..deaadbe0ef 100644 --- a/src/kernel/routing/RoutedZone.cpp +++ b/src/kernel/routing/RoutedZone.cpp @@ -9,7 +9,7 @@ #include "xbt/log.h" #include "xbt/sysdep.h" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/kernel/routing/RoutedZone.hpp" #include "src/surf/network_interface.hpp" @@ -157,7 +157,7 @@ sg_platf_route_cbarg_t RoutedZone::newExtendedRoute(RoutingMode hierarchy, sg_pl return result; } -void RoutedZone::getRouteCheckParams(NetCard* src, NetCard* dst) +void RoutedZone::getRouteCheckParams(NetPoint* src, NetPoint* dst) { xbt_assert(src, "Cannot find a route from nullptr to %s", dst->cname()); xbt_assert(dst, "Cannot find a route from %s to nullptr", src->cname()); @@ -175,8 +175,8 @@ void RoutedZone::getRouteCheckParams(NetCard* src, NetCard* dst) } void RoutedZone::addRouteCheckParams(sg_platf_route_cbarg_t route) { - NetCard* src = route->src; - NetCard* dst = route->dst; + NetPoint* src = route->src; + NetPoint* dst = route->dst; const char* srcName = src->cname(); const char* dstName = dst->cname(); diff --git a/src/kernel/routing/RoutedZone.hpp b/src/kernel/routing/RoutedZone.hpp index c90df9de0b..25be9b45e5 100644 --- a/src/kernel/routing/RoutedZone.hpp +++ b/src/kernel/routing/RoutedZone.hpp @@ -57,7 +57,7 @@ public: bool change_order); protected: - void getRouteCheckParams(NetCard* src, NetCard* dst); + void getRouteCheckParams(NetPoint* src, NetPoint* dst); void addRouteCheckParams(sg_platf_route_cbarg_t route); }; } diff --git a/src/kernel/routing/TorusZone.cpp b/src/kernel/routing/TorusZone.cpp index 226d0f109f..a7fc92c8a7 100644 --- a/src/kernel/routing/TorusZone.cpp +++ b/src/kernel/routing/TorusZone.cpp @@ -4,8 +4,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "src/kernel/routing/TorusZone.hpp" -#include "src/kernel/routing/NetCard.hpp" - +#include "src/kernel/routing/NetPoint.hpp" #include "src/surf/network_interface.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster_torus, surf_route_cluster, "Torus Routing part of surf"); @@ -110,7 +109,7 @@ void TorusZone::parse_specific_arguments(sg_platf_cluster_cbarg_t cluster) xbt_dynar_free(&dimensions); } -void TorusZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat) +void TorusZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) { XBT_VERB("torus getLocalRoute from '%s'[%d] to '%s'[%d]", src->name().c_str(), src->id(), dst->name().c_str(), diff --git a/src/kernel/routing/TorusZone.hpp b/src/kernel/routing/TorusZone.hpp index 8d8c7a1a92..94a98809c1 100644 --- a/src/kernel/routing/TorusZone.hpp +++ b/src/kernel/routing/TorusZone.hpp @@ -22,7 +22,7 @@ public: explicit TorusZone(NetZone* father, const char* name); ~TorusZone() override; void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override; - void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override; + void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override; void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster) override; private: diff --git a/src/kernel/routing/VivaldiZone.cpp b/src/kernel/routing/VivaldiZone.cpp index f4d289b508..9c54ab7487 100644 --- a/src/kernel/routing/VivaldiZone.cpp +++ b/src/kernel/routing/VivaldiZone.cpp @@ -8,7 +8,7 @@ #include "simgrid/s4u/engine.hpp" #include "simgrid/s4u/host.hpp" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/kernel/routing/VivaldiZone.hpp" #include "src/surf/network_interface.hpp" @@ -18,12 +18,12 @@ namespace simgrid { namespace kernel { namespace routing { namespace vivaldi { -simgrid::xbt::Extension Coords::EXTENSION_ID; +simgrid::xbt::Extension Coords::EXTENSION_ID; -Coords::Coords(NetCard* netcard, const char* coordStr) +Coords::Coords(NetPoint* netcard, const char* coordStr) { if (!Coords::EXTENSION_ID.valid()) - Coords::EXTENSION_ID = NetCard::extension_create(); + Coords::EXTENSION_ID = NetPoint::extension_create(); std::vector string_values; boost::split(string_values, coordStr, boost::is_any_of(" ")); @@ -47,7 +47,7 @@ static inline double euclidean_dist_comp(int index, std::vector* src, st return (src_coord - dst_coord) * (src_coord - dst_coord); } -static std::vector* getCoordsFromNetcard(NetCard* nc) +static std::vector* getCoordsFromNetcard(NetPoint* nc) { simgrid::kernel::routing::vivaldi::Coords* coords = nc->extension(); xbt_assert(coords, "Please specify the Vivaldi coordinates of %s %s (%p)", @@ -58,7 +58,7 @@ VivaldiZone::VivaldiZone(NetZone* father, const char* name) : ClusterZone(father { } -void VivaldiZone::setPeerLink(NetCard* netcard, double bw_in, double bw_out, const char* coord) +void VivaldiZone::setPeerLink(NetPoint* netcard, double bw_in, double bw_out, const char* coord) { xbt_assert(netcard->netzone() == this, "Cannot add a peer link to a netcard that is not in this netzone"); @@ -71,7 +71,7 @@ void VivaldiZone::setPeerLink(NetCard* netcard, double bw_in, double bw_out, con privateLinks_.insert({netcard->id(), {linkUp, linkDown}}); } -void VivaldiZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat) +void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) { XBT_DEBUG("vivaldi getLocalRoute from '%s'[%d] '%s'[%d]", src->cname(), src->id(), dst->cname(), dst->id()); diff --git a/src/kernel/routing/VivaldiZone.hpp b/src/kernel/routing/VivaldiZone.hpp index 300b7e4b67..e2a6e62104 100644 --- a/src/kernel/routing/VivaldiZone.hpp +++ b/src/kernel/routing/VivaldiZone.hpp @@ -47,15 +47,15 @@ class XBT_PRIVATE VivaldiZone : public ClusterZone { public: explicit VivaldiZone(NetZone* father, const char* name); - void setPeerLink(NetCard* netcard, double bw_in, double bw_out, const char* coord); - void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override; + void setPeerLink(NetPoint* netcard, double bw_in, double bw_out, const char* coord); + void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override; }; namespace vivaldi { class XBT_PRIVATE Coords { public: - static simgrid::xbt::Extension EXTENSION_ID; - explicit Coords(NetCard* host, const char* str); + static simgrid::xbt::Extension EXTENSION_ID; + explicit Coords(NetPoint* host, const char* str); virtual ~Coords(); std::vector coords; diff --git a/src/plugins/vm/VirtualMachineImpl.cpp b/src/plugins/vm/VirtualMachineImpl.cpp index 2e9179a4f2..5bd81fde07 100644 --- a/src/plugins/vm/VirtualMachineImpl.cpp +++ b/src/plugins/vm/VirtualMachineImpl.cpp @@ -236,7 +236,7 @@ void VirtualMachineImpl::setPm(s4u::Host* destination) const char* pm_name_dst = destination->cname(); /* update net_elm with that of the destination physical host */ - piface_->pimpl_netcard = destination->pimpl_netcard; + piface_->pimpl_netpoint = destination->pimpl_netpoint; hostPM_ = destination; diff --git a/src/plugins/vm/s4u_VirtualMachine.cpp b/src/plugins/vm/s4u_VirtualMachine.cpp index f0884c9378..97d2749e8a 100644 --- a/src/plugins/vm/s4u_VirtualMachine.cpp +++ b/src/plugins/vm/s4u_VirtualMachine.cpp @@ -19,7 +19,7 @@ VirtualMachine::VirtualMachine(const char* name, s4u::Host* pm) : Host(name) pimpl_vm_ = new vm::VirtualMachineImpl(this, pm); /* Currently, a VM uses the network resource of its physical host */ - pimpl_netcard = pm->pimpl_netcard; + pimpl_netpoint = pm->pimpl_netpoint; // Create a VCPU for this VM surf::CpuCas01* sub_cpu = dynamic_cast(pm->pimpl_cpu); @@ -51,7 +51,7 @@ VirtualMachine::~VirtualMachine() extension_set(nullptr); /* Don't free these things twice: they are the ones of my physical host */ - pimpl_netcard = nullptr; + pimpl_netpoint = nullptr; } bool VirtualMachine::isMigrating() diff --git a/src/s4u/s4u_engine.cpp b/src/s4u/s4u_engine.cpp index 6cff0b1ce6..49844d197b 100644 --- a/src/s4u/s4u_engine.cpp +++ b/src/s4u/s4u_engine.cpp @@ -14,10 +14,8 @@ #include "simgrid/s4u/storage.hpp" #include "simgrid/simix.h" #include "src/kernel/EngineImpl.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/kernel/routing/NetZoneImpl.hpp" -#include "src/kernel/routing/NetCard.hpp" - - #include "src/surf/network_interface.hpp" #include "surf/surf.h" // routing_platf. FIXME:KILLME. SOON @@ -114,31 +112,31 @@ NetZone* Engine::netzoneByNameOrNull(const char* name) } /** @brief Retrieve the netcard of the given name (or nullptr if not found) */ -simgrid::kernel::routing::NetCard* Engine::netcardByNameOrNull(const char* name) +simgrid::kernel::routing::NetPoint* Engine::netcardByNameOrNull(const char* name) { - if (pimpl->netcards_.find(name) == pimpl->netcards_.end()) + if (pimpl->netpoints_.find(name) == pimpl->netpoints_.end()) return nullptr; - return pimpl->netcards_.at(name); + return pimpl->netpoints_.at(name); } /** @brief Fill the provided vector with all existing netcards */ -void Engine::netcardList(std::vector* list) +void Engine::netcardList(std::vector* list) { - for (auto kv: pimpl->netcards_) + for (auto kv : pimpl->netpoints_) list->push_back(kv.second); } /** @brief Register a new netcard to the system */ -void Engine::netcardRegister(simgrid::kernel::routing::NetCard* card) +void Engine::netcardRegister(simgrid::kernel::routing::NetPoint* card) { // simgrid::simix::kernelImmediate([&]{ FIXME: this segfaults in set_thread - pimpl->netcards_[card->name()] = card; +pimpl->netpoints_[card->name()] = card; // }); } /** @brief Unregister a given netcard */ -void Engine::netcardUnregister(simgrid::kernel::routing::NetCard* card) +void Engine::netcardUnregister(simgrid::kernel::routing::NetPoint* card) { - simgrid::simix::kernelImmediate([&]{ - pimpl->netcards_.erase(card->name()); - delete card; + simgrid::simix::kernelImmediate([&] { + pimpl->netpoints_.erase(card->name()); + delete card; }); } } diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index d918006bcb..e602cebe6d 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -14,7 +14,7 @@ #include "simgrid/s4u/host.hpp" #include "simgrid/s4u/storage.hpp" #include "simgrid/simix.hpp" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/msg/msg_private.h" #include "src/simix/ActorImpl.hpp" #include "src/simix/smx_private.h" @@ -54,8 +54,8 @@ Host::~Host() xbt_assert(currentlyDestroying_, "Please call h->destroy() instead of manually deleting it."); delete pimpl_; - if (pimpl_netcard != nullptr) // not removed yet by a children class - simgrid::s4u::Engine::instance()->netcardUnregister(pimpl_netcard); + if (pimpl_netpoint != nullptr) // not removed yet by a children class + simgrid::s4u::Engine::instance()->netcardUnregister(pimpl_netpoint); delete pimpl_cpu; delete mounts; } @@ -142,7 +142,7 @@ int Host::pstatesCount() const { */ void Host::routeTo(Host* dest, std::vector* links, double* latency) { - simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(pimpl_netcard, dest->pimpl_netcard, links, latency); + simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(pimpl_netpoint, dest->pimpl_netpoint, links, latency); if (XBT_LOG_ISENABLED(surf_route, xbt_log_priority_debug)) { XBT_CDEBUG(surf_route, "Route from '%s' to '%s' (latency: %f):", cname(), dest->cname(), (latency == nullptr ? -1 : *latency)); diff --git a/src/s4u/s4u_netzone.cpp b/src/s4u/s4u_netzone.cpp index 1124461185..1ab825e048 100644 --- a/src/s4u/s4u_netzone.cpp +++ b/src/s4u/s4u_netzone.cpp @@ -8,7 +8,7 @@ #include "simgrid/s4u/NetZone.hpp" #include "simgrid/s4u/host.hpp" #include "simgrid/simix.hpp" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/surf/network_interface.hpp" // Link FIXME: move to proper header XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_netzone, "S4U Networking Zones"); @@ -16,8 +16,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_netzone, "S4U Networking Zones"); namespace simgrid { namespace s4u { -simgrid::xbt::signal* link_list)> NetZone::onRouteCreation; @@ -84,7 +84,7 @@ xbt_dynar_t NetZone::hosts() return res; } -int NetZone::addComponent(kernel::routing::NetCard* elm) +int NetZone::addComponent(kernel::routing::NetPoint* elm) { vertices_.push_back(elm); return vertices_.size() - 1; // The rank of the newly created object diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index e655063fde..9808aa6f69 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -11,7 +11,7 @@ #include #include -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/surf/HostImpl.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sg_host, sd, "Logging specific to sg_hosts"); @@ -91,8 +91,8 @@ xbt_dynar_t sg_hosts_as_dynar() for (auto kv : host_list) { simgrid::s4u::Host* host = kv.second; - if (host && host->pimpl_netcard && host->pimpl_netcard->isHost()) - xbt_dynar_push(res, &host); + if (host && host->pimpl_netpoint && host->pimpl_netpoint->isHost()) + xbt_dynar_push(res, &host); } xbt_dynar_sort(res, hostcmp_voidp); return res; diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 16d6986c2c..c354669848 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -16,7 +16,7 @@ #include "simgrid/sg_config.h" #include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/surf/HostImpl.hpp" #include "src/surf/surf_private.h" @@ -44,7 +44,7 @@ static int number_of_links = 1; static int number_of_networks = 1; static int port_number = 1025; //Port number is limited from 1025 to 65 000 -simgrid::xbt::Extension NetCardNs3::EXTENSION_ID; +simgrid::xbt::Extension NetCardNs3::EXTENSION_ID; NetCardNs3::NetCardNs3() { @@ -58,7 +58,7 @@ NetCardNs3::NetCardNs3() * Callbacks * *************/ -static void netcardCreation_cb(simgrid::kernel::routing::NetCard* netcard) +static void netcardCreation_cb(simgrid::kernel::routing::NetPoint* netcard) { netcard->extension_set(new NetCardNs3()); } @@ -75,7 +75,7 @@ static void clusterCreation_cb(sg_platf_cluster_cbarg_t cluster) // Create private link char* host_id = bprintf("%s%d%s", cluster->prefix, i, cluster->suffix); - NetCardNs3* host_src = sg_host_by_name(host_id)->pimpl_netcard->extension(); + NetCardNs3* host_src = sg_host_by_name(host_id)->pimpl_netpoint->extension(); xbt_assert(host_src, "Cannot find a NS3 host of name %s", host_id); ns3_add_link(host_src->node_num, host_dst->node_num, bw,lat); @@ -94,9 +94,9 @@ static void clusterCreation_cb(sg_platf_cluster_cbarg_t cluster) xbt_free(bw); } -static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetCard* src, - simgrid::kernel::routing::NetCard* dst, simgrid::kernel::routing::NetCard* gw_src, - simgrid::kernel::routing::NetCard* gw_dst, std::vector* link_list) +static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetPoint* src, + simgrid::kernel::routing::NetPoint* dst, simgrid::kernel::routing::NetPoint* gw_src, + simgrid::kernel::routing::NetPoint* gw_dst, std::vector* link_list) { if (link_list->size() == 1) { simgrid::surf::LinkNS3* link = static_cast(link_list->at(0)); @@ -154,11 +154,11 @@ namespace simgrid { namespace surf { NetworkNS3Model::NetworkNS3Model() : NetworkModel() { - NetCardNs3::EXTENSION_ID = simgrid::kernel::routing::NetCard::extension_create(); + NetCardNs3::EXTENSION_ID = simgrid::kernel::routing::NetPoint::extension_create(); ns3_initialize(ns3_tcp_model.get().c_str()); - simgrid::kernel::routing::NetCard::onCreation.connect(&netcardCreation_cb); + simgrid::kernel::routing::NetPoint::onCreation.connect(&netcardCreation_cb); simgrid::surf::on_cluster.connect(&clusterCreation_cb); simgrid::surf::on_postparse.connect(&postparse_cb); simgrid::s4u::NetZone::onRouteCreation.connect(&routeCreation_cb); @@ -343,8 +343,8 @@ void ns3_simulator(double maxSeconds) void ns3_create_flow(simgrid::s4u::Host* src, simgrid::s4u::Host* dst, double startTime, u_int32_t TotalBytes, simgrid::surf::NetworkNS3Action* action) { - int node1 = src->pimpl_netcard->extension()->node_num; - int node2 = dst->pimpl_netcard->extension()->node_num; + int node1 = src->pimpl_netpoint->extension()->node_num; + int node2 = dst->pimpl_netpoint->extension()->node_num; ns3::Ptr src_node = nodes.Get(node1); ns3::Ptr dst_node = nodes.Get(node2); diff --git a/src/surf/ns3/ns3_interface.h b/src/surf/ns3/ns3_interface.h index b9270f91f2..3a92354b5a 100644 --- a/src/surf/ns3/ns3_interface.h +++ b/src/surf/ns3/ns3_interface.h @@ -16,7 +16,7 @@ class NetworkNS3Action; class NetCardNs3 { public: - static simgrid::xbt::Extension EXTENSION_ID; + static simgrid::xbt::Extension EXTENSION_ID; explicit NetCardNs3(); int node_num; diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 3271fc0be0..3dff876900 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -21,7 +21,7 @@ #include "src/kernel/routing/FatTreeZone.hpp" #include "src/kernel/routing/FloydZone.hpp" #include "src/kernel/routing/FullZone.hpp" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/kernel/routing/NetZoneImpl.hpp" #include "src/kernel/routing/TorusZone.hpp" #include "src/kernel/routing/VivaldiZone.hpp" @@ -89,14 +89,14 @@ void sg_platf_new_host(sg_platf_host_cbarg_t args) if (args->pstate != 0) host->pimpl_cpu->setPState(args->pstate); if (args->coord && strcmp(args->coord, "")) - new simgrid::kernel::routing::vivaldi::Coords(host->pimpl_netcard, args->coord); + new simgrid::kernel::routing::vivaldi::Coords(host->pimpl_netpoint, args->coord); if (TRACE_is_enabled() && TRACE_needs_platform()) sg_instr_new_host(*host); } /** @brief Add a "router" to the network element list */ -simgrid::kernel::routing::NetCard* sg_platf_new_router(const char* name, const char* coords) +simgrid::kernel::routing::NetPoint* sg_platf_new_router(const char* name, const char* coords) { simgrid::kernel::routing::NetZoneImpl* current_routing = routing_get_current(); @@ -105,8 +105,8 @@ simgrid::kernel::routing::NetCard* sg_platf_new_router(const char* name, const c xbt_assert(nullptr == simgrid::s4u::Engine::instance()->netcardByNameOrNull(name), "Refusing to create a router named '%s': this name already describes a node.", name); - simgrid::kernel::routing::NetCard* netcard = - new simgrid::kernel::routing::NetCard(name, simgrid::kernel::routing::NetCard::Type::Router, current_routing); + simgrid::kernel::routing::NetPoint* netcard = + new simgrid::kernel::routing::NetPoint(name, simgrid::kernel::routing::NetPoint::Type::Router, current_routing); XBT_DEBUG("Router '%s' has the id %d", name, netcard->id()); if (coords && strcmp(coords, "")) @@ -557,7 +557,7 @@ void sg_platf_new_peer(sg_platf_peer_cbarg_t peer) speedPerPstate.push_back(peer->speed); simgrid::s4u::Host* host = as->createHost(peer->id, &speedPerPstate, 1, nullptr); - as->setPeerLink(host->pimpl_netcard, peer->bw_in, peer->bw_out, peer->coord); + as->setPeerLink(host->pimpl_netpoint, peer->bw_in, peer->bw_out, peer->coord); /* Change from the defaults */ if (peer->state_trace) @@ -720,7 +720,7 @@ void sg_platf_new_AS_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(sg_platf_host_link_cbarg_t hostlink) { - simgrid::kernel::routing::NetCard *netcard = sg_host_by_name(hostlink->id)->pimpl_netcard; + simgrid::kernel::routing::NetPoint* netcard = sg_host_by_name(hostlink->id)->pimpl_netpoint; xbt_assert(netcard, "Host '%s' not found!", hostlink->id); xbt_assert(dynamic_cast(current_routing), "Only hosts from Cluster and Vivaldi ASes can get an host_link."); diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index 62939cdb13..6644b52a4b 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -5,9 +5,10 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "storage_n11.hpp" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "surf_private.h" #include /*ceil*/ + XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_storage); /************* @@ -41,7 +42,7 @@ static void check_disk_attachment() if (xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != nullptr) { simgrid::surf::Storage* storage = static_cast(xbt_lib_get_or_null(storage_lib, key, SURF_STORAGE_LEVEL)); - simgrid::kernel::routing::NetCard* host_elm = sg_netcard_by_name_or_null(storage->attach_); + simgrid::kernel::routing::NetPoint* host_elm = sg_netcard_by_name_or_null(storage->attach_); if (!host_elm) surf_parse_error("Unable to attach storage %s: host %s does not exist.", storage->getName(), storage->attach_); } diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 45ccea0f66..623aeba4ce 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -12,7 +12,7 @@ #include "simgrid/sg_config.h" #include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals #include "src/internal_config.h" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/simix/smx_host_private.h" #include "src/surf/HostImpl.hpp" #include "surf_private.h" diff --git a/src/surf/xml/platf_private.hpp b/src/surf/xml/platf_private.hpp index e3edce6d4b..017ce0809d 100644 --- a/src/surf/xml/platf_private.hpp +++ b/src/surf/xml/platf_private.hpp @@ -199,7 +199,7 @@ XBT_PUBLIC(void) sg_platf_new_AS_seal(); // That AS is fully XBT_PUBLIC(void) sg_platf_new_host (sg_platf_host_cbarg_t host); // Add an host to the currently described AS XBT_PUBLIC(void) sg_platf_new_hostlink(sg_platf_host_link_cbarg_t h); // Add an host_link to the currently described AS -XBT_PUBLIC(simgrid::kernel::routing::NetCard*) +XBT_PUBLIC(simgrid::kernel::routing::NetPoint*) sg_platf_new_router(const char* name, const char* coords); // Add a router to the currently described AS XBT_PUBLIC(void) sg_platf_new_link (sg_platf_link_cbarg_t link); // Add a link to the currently described AS XBT_PUBLIC(void) sg_platf_new_peer (sg_platf_peer_cbarg_t peer); // Add a peer to the currently described AS diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index 8e5a7cd1cd..47cf277f5e 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -11,7 +11,7 @@ #include "simgrid/link.h" #include "simgrid/s4u/engine.hpp" #include "simgrid/sg_config.h" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/surf/network_interface.hpp" #include "src/surf/surf_private.h" #include "xbt/dict.h" diff --git a/teshsuite/simdag/flatifier/flatifier.cpp b/teshsuite/simdag/flatifier/flatifier.cpp index 710bb1acce..5fbf34cff9 100644 --- a/teshsuite/simdag/flatifier/flatifier.cpp +++ b/teshsuite/simdag/flatifier/flatifier.cpp @@ -19,7 +19,7 @@ #include -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "src/surf/network_interface.hpp" @@ -87,12 +87,12 @@ int main(int argc, char **argv) create_environment(parse_time, platformFile); - std::vector netcardList; + std::vector netcardList; simgrid::s4u::Engine::instance()->netcardList(&netcardList); std::sort(netcardList.begin(), netcardList.end(), - [](simgrid::kernel::routing::NetCard* a, simgrid::kernel::routing::NetCard* b) { - return a->name() < b->name(); - }); + [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) { + return a->name() < b->name(); + }); if (timings) { XBT_INFO("Parsing time: %fs (%zu hosts, %d links)", xbt_os_timer_elapsed(parse_time), @@ -150,11 +150,11 @@ int main(int argc, char **argv) for (unsigned int it_src = 0; it_src < totalHosts; it_src++) { // Routes from host simgrid::s4u::Host* host1 = hosts[it_src]; - simgrid::kernel::routing::NetCard* netcardSrc = host1->pimpl_netcard; + simgrid::kernel::routing::NetPoint* netcardSrc = host1->pimpl_netpoint; for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host simgrid::s4u::Host* host2 = hosts[it_dst]; std::vector route; - simgrid::kernel::routing::NetCard* netcardDst = host2->pimpl_netcard; + simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint; simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(netcardSrc, netcardDst, &route, nullptr); if (!route.empty()) { std::printf(" \n ", host1->cname(), host2->cname()); @@ -191,7 +191,7 @@ int main(int argc, char **argv) simgrid::s4u::Host* host2 = hosts[it_dst]; std::printf(" \n ", value1->cname(), host2->cname()); std::vector route; - simgrid::kernel::routing::NetCard* netcardDst = host2->pimpl_netcard; + simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint; simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, netcardDst, &route, nullptr); for (auto link : route) std::printf("",link->getName()); diff --git a/teshsuite/simdag/is-router/is-router.cpp b/teshsuite/simdag/is-router/is-router.cpp index 4e873ef1b0..a3401ded69 100644 --- a/teshsuite/simdag/is-router/is-router.cpp +++ b/teshsuite/simdag/is-router/is-router.cpp @@ -6,7 +6,7 @@ #include "simgrid/s4u/engine.hpp" #include "simgrid/s4u/host.hpp" #include "simgrid/simdag.h" -#include "src/kernel/routing/NetCard.hpp" +#include "src/kernel/routing/NetPoint.hpp" #include "surf/surf_routing.h" #include @@ -18,17 +18,17 @@ int main(int argc, char **argv) xbt_dynar_t hosts = sg_hosts_as_dynar(); std::printf("Host count: %zu, link number: %d\n", sg_host_count(), sg_link_count()); - std::vector netcardList; + std::vector netcardList; simgrid::s4u::Engine::instance()->netcardList(&netcardList); std::sort(netcardList.begin(), netcardList.end(), - [](simgrid::kernel::routing::NetCard* a, simgrid::kernel::routing::NetCard* b) { - return a->name() < b->name(); - }); + [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) { + return a->name() < b->name(); + }); int it; sg_host_t host; xbt_dynar_foreach(hosts, it, host) { - simgrid::kernel::routing::NetCard * nc = host->pimpl_netcard; + simgrid::kernel::routing::NetPoint* nc = host->pimpl_netpoint; std::printf(" - Seen: \"%s\". Type: %s\n", host->cname(), nc->isRouter() ? "router" : (nc->isNetZone() ? "netzone" : (nc->isHost() ? "host" : "buggy"))); } diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 114ea2019d..94262a07e2 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -295,8 +295,8 @@ set(SURF_SRC src/kernel/routing/FloydZone.hpp src/kernel/routing/FullZone.cpp src/kernel/routing/FullZone.hpp - src/kernel/routing/NetCard.cpp - src/kernel/routing/NetCard.hpp + src/kernel/routing/NetPoint.cpp + src/kernel/routing/NetPoint.hpp src/kernel/routing/NetZoneImpl.cpp src/kernel/routing/NetZoneImpl.hpp src/kernel/routing/RoutedZone.cpp -- 2.20.1