From: Loic Guegan Date: Tue, 9 Jul 2019 16:09:05 +0000 (+0200) Subject: Wifi model interface: X-Git-Tag: v3.24~367 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5d71ff352093c45c115ab45ca55b1b91cedcd2b5 Wifi model interface: - Modify CM02 to handle WIFI links - Modify xml parser to handle WIFI sharing policy - Modify xml parser to create links with sevral bandwidths for WIFI --- diff --git a/include/simgrid/s4u/Link.hpp b/include/simgrid/s4u/Link.hpp index bf34cc73c0..3ef6ceef78 100644 --- a/include/simgrid/s4u/Link.hpp +++ b/include/simgrid/s4u/Link.hpp @@ -32,7 +32,7 @@ class XBT_PUBLIC Link : public xbt::Extendable { kernel::resource::LinkImpl* const pimpl_; public: - enum class SharingPolicy { SPLITDUPLEX = 2, SHARED = 1, FATPIPE = 0 }; + enum class SharingPolicy { WIFI = 3, SPLITDUPLEX = 2, SHARED = 1, FATPIPE = 0 }; kernel::resource::LinkImpl* get_impl() const { return pimpl_; } diff --git a/src/bindings/lua/lua_platf.cpp b/src/bindings/lua/lua_platf.cpp index a806124ce2..eba4663362 100644 --- a/src/bindings/lua/lua_platf.cpp +++ b/src/bindings/lua/lua_platf.cpp @@ -94,7 +94,7 @@ int console_add_backbone(lua_State *L) { type = lua_gettable(L, -2); lua_ensure(type == LUA_TSTRING || type == LUA_TNUMBER, "Attribute 'bandwidth' must be specified for backbone and must either be a string (in the right format; see docs) or a number."); - link.bandwidth = surf_parse_get_bandwidth(lua_tostring(L, -1), "bandwidth of backbone", link.id.c_str()); + link.bandwidths.push_back(surf_parse_get_bandwidth(lua_tostring(L, -1), "bandwidth of backbone", link.id.c_str())); lua_pop(L, 1); lua_pushstring(L, "lat"); @@ -228,9 +228,9 @@ int console_add_link(lua_State *L) { lua_ensure(type == LUA_TSTRING || type == LUA_TNUMBER, "Attribute 'bandwidth' must be specified for any link and must either be either a string (in the right format; see docs) or a number."); if (type == LUA_TNUMBER) - link.bandwidth = lua_tonumber(L, -1); + link.bandwidths.push_back(lua_tonumber(L, -1)); else // LUA_TSTRING - link.bandwidth = surf_parse_get_bandwidth(lua_tostring(L, -1), "bandwidth of link", link.id.c_str()); + link.bandwidths.push_back(surf_parse_get_bandwidth(lua_tostring(L, -1), "bandwidth of link", link.id.c_str())); lua_pop(L, 1); //get latency value diff --git a/src/kernel/routing/ClusterZone.cpp b/src/kernel/routing/ClusterZone.cpp index e49e486ba2..fd2a827452 100644 --- a/src/kernel/routing/ClusterZone.cpp +++ b/src/kernel/routing/ClusterZone.cpp @@ -129,7 +129,7 @@ void ClusterZone::create_links_for_node(ClusterCreationArgs* cluster, int id, in LinkCreationArgs link; link.id = link_id; - link.bandwidth = cluster->bw; + link.bandwidths.push_back(cluster->bw); link.latency = cluster->lat; link.policy = cluster->sharing_policy; sg_platf_new_link(&link); diff --git a/src/kernel/routing/DragonflyZone.cpp b/src/kernel/routing/DragonflyZone.cpp index fd526d16b1..d390e513ef 100644 --- a/src/kernel/routing/DragonflyZone.cpp +++ b/src/kernel/routing/DragonflyZone.cpp @@ -138,7 +138,7 @@ void DragonflyZone::create_link(const std::string& id, int numlinks, resource::L *linkup = nullptr; *linkdown = nullptr; LinkCreationArgs linkTemplate; - linkTemplate.bandwidth = this->bw_ * numlinks; + linkTemplate.bandwidths.push_back(this->bw_ * numlinks); linkTemplate.latency = this->lat_; linkTemplate.policy = this->sharing_policy_; linkTemplate.id = std::move(id); diff --git a/src/kernel/routing/FatTreeZone.cpp b/src/kernel/routing/FatTreeZone.cpp index d8b6e507da..c2774628c0 100644 --- a/src/kernel/routing/FatTreeZone.cpp +++ b/src/kernel/routing/FatTreeZone.cpp @@ -445,7 +445,7 @@ FatTreeNode::FatTreeNode(ClusterCreationArgs* cluster, int id, int level, int po { LinkCreationArgs linkTemplate; if (cluster->limiter_link) { - linkTemplate.bandwidth = cluster->limiter_link; + linkTemplate.bandwidths.push_back(cluster->limiter_link); linkTemplate.latency = 0; linkTemplate.policy = s4u::Link::SharingPolicy::SHARED; linkTemplate.id = "limiter_"+std::to_string(id); @@ -453,7 +453,7 @@ FatTreeNode::FatTreeNode(ClusterCreationArgs* cluster, int id, int level, int po this->limiter_link_ = s4u::Link::by_name(linkTemplate.id)->get_impl(); } if (cluster->loopback_bw || cluster->loopback_lat) { - linkTemplate.bandwidth = cluster->loopback_bw; + linkTemplate.bandwidths.push_back(cluster->loopback_bw); linkTemplate.latency = cluster->loopback_lat; linkTemplate.policy = s4u::Link::SharingPolicy::FATPIPE; linkTemplate.id = "loopback_"+ std::to_string(id); @@ -467,7 +467,7 @@ FatTreeLink::FatTreeLink(ClusterCreationArgs* cluster, FatTreeNode* downNode, Fa { static int uniqueId = 0; LinkCreationArgs linkTemplate; - linkTemplate.bandwidth = cluster->bw; + linkTemplate.bandwidths.push_back(cluster->bw); linkTemplate.latency = cluster->lat; linkTemplate.policy = cluster->sharing_policy; // sthg to do with that ? linkTemplate.id = diff --git a/src/kernel/routing/TorusZone.cpp b/src/kernel/routing/TorusZone.cpp index dd4e9a3186..a1001e6921 100644 --- a/src/kernel/routing/TorusZone.cpp +++ b/src/kernel/routing/TorusZone.cpp @@ -40,7 +40,7 @@ void TorusZone::create_links_for_node(ClusterCreationArgs* cluster, int id, int std::string link_id = std::string(cluster->id) + "_link_from_" + std::to_string(id) + "_to_" + std::to_string(neighbor_rank_id); link.id = link_id; - link.bandwidth = cluster->bw; + link.bandwidths.push_back(cluster->bw); link.latency = cluster->lat; link.policy = cluster->sharing_policy; sg_platf_new_link(&link); diff --git a/src/kernel/routing/VivaldiZone.cpp b/src/kernel/routing/VivaldiZone.cpp index 5eb06947e5..818bffe49d 100644 --- a/src/kernel/routing/VivaldiZone.cpp +++ b/src/kernel/routing/VivaldiZone.cpp @@ -73,8 +73,10 @@ void VivaldiZone::set_peer_link(NetPoint* netpoint, double bw_in, double bw_out, std::string link_up = "link_" + netpoint->get_name() + "_UP"; std::string link_down = "link_" + netpoint->get_name() + "_DOWN"; - resource::LinkImpl* linkUp = network_model_->create_link(link_up, bw_out, 0, s4u::Link::SharingPolicy::SHARED); - resource::LinkImpl* linkDown = network_model_->create_link(link_down, bw_in, 0, s4u::Link::SharingPolicy::SHARED); + resource::LinkImpl* linkUp = + network_model_->create_link(link_up, std::vector(1, bw_out), 0, s4u::Link::SharingPolicy::SHARED); + resource::LinkImpl* linkDown = + network_model_->create_link(link_down, std::vector(1, bw_in), 0, s4u::Link::SharingPolicy::SHARED); private_links_.insert({netpoint->id(), {linkUp, linkDown}}); } diff --git a/src/surf/link_wifi.cpp b/src/surf/link_wifi.cpp deleted file mode 100644 index fa99474e71..0000000000 --- a/src/surf/link_wifi.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (c) 2013-2019. The SimGrid Team. All rights reserved. */ - -/* 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/surf/link_wifi.hpp" - -namespace simgrid { -namespace kernel { -namespace resource { - -NetworkWifiLink::NetworkWifiLink(NetworkCm02Model* model, const std::string& name, std::vector bandwidths, - s4u::Link::SharingPolicy policy, lmm::System* system) - : NetworkCm02Link(model, name, 0, 0, policy, system) -{ - for (auto bandwith : bandwidths) { - bandwidths_.push_back({bandwith, 1.0, nullptr}); - } -} - -void NetworkWifiLink::set_host_rate(sg_host_t host, int rate_level) -{ - host_rates_.insert(std::make_pair(host->get_name(), rate_level)); -} -} // namespace resource -} // namespace kernel -} // namespace simgrid diff --git a/src/surf/link_wifi.hpp b/src/surf/link_wifi.hpp deleted file mode 100644 index 9aa5d914be..0000000000 --- a/src/surf/link_wifi.hpp +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (c) 2013-2019. The SimGrid Team. All rights reserved. */ - -/* 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. */ - -#ifndef SURF_LINK_WIFI_HPP_ -#define SURF_LINK_WIFI_HPP_ - -#include "network_cm02.hpp" -#include "network_interface.hpp" -#include "src/surf/HostImpl.hpp" -#include "xbt/string.hpp" - -namespace simgrid { -namespace kernel { -namespace resource { - -class NetworkWifiLink : public NetworkCm02Link { - /** @brief Hold every rates association between host and links (host name, rates id) */ - std::map host_rates_; - - /** @brief Hold every rates available for this Access Point */ - // double* rates; FIXME: unused - - /** @brief A link can have several bandwith attach to it (mostly use by wifi model) */ - std::vector bandwidths_; - -public: - NetworkWifiLink(NetworkCm02Model* model, const std::string& name, std::vector bandwidths, - s4u::Link::SharingPolicy policy, lmm::System* system); - - void set_host_rate(sg_host_t host, int rate_level); -}; - -} // namespace resource -} // namespace kernel -} // namespace simgrid - -#endif diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 883578bf6b..d606b2a30b 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -86,13 +86,18 @@ NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(b } set_maxmin_system(make_new_lmm_system(select)); - loopback_ = NetworkCm02Model::create_link("__loopback__", 498000000, 0.000015, s4u::Link::SharingPolicy::FATPIPE); + loopback_ = NetworkCm02Model::create_link("__loopback__", std::vector(1, 498000000), 0.000015, + s4u::Link::SharingPolicy::FATPIPE); } -LinkImpl* NetworkCm02Model::create_link(const std::string& name, double bandwidth, double latency, +LinkImpl* NetworkCm02Model::create_link(const std::string& name, std::vector bandwidths, double latency, s4u::Link::SharingPolicy policy) { - return new NetworkCm02Link(this, name, bandwidth, latency, policy, get_maxmin_system()); + if (policy == s4u::Link::SharingPolicy::WIFI) { + return (new NetworkWifiLink(this, name, bandwidths, policy, get_maxmin_system())); + } + xbt_assert(bandwidths.size() == 1, "Non WIFI links must use only 1 bandwidth."); + return new NetworkCm02Link(this, name, bandwidths[0], latency, policy, get_maxmin_system()); } void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/) @@ -350,6 +355,20 @@ void NetworkCm02Link::set_latency(double value) } } +NetworkWifiLink::NetworkWifiLink(NetworkCm02Model* model, const std::string& name, std::vector bandwidths, + s4u::Link::SharingPolicy policy, lmm::System* system) + : NetworkCm02Link(model, name, 0, 0, policy, system) +{ + for (auto bandwith : bandwidths) { + bandwidths_.push_back({bandwith, 1.0, nullptr}); + } +} + +void NetworkWifiLink::set_host_rate(sg_host_t host, int rate_level) +{ + host_rates_.insert(std::make_pair(host->get_name(), rate_level)); +} + /********** * Action * **********/ diff --git a/src/surf/network_cm02.hpp b/src/surf/network_cm02.hpp index cd576d6e94..235b7f06b0 100644 --- a/src/surf/network_cm02.hpp +++ b/src/surf/network_cm02.hpp @@ -10,7 +10,7 @@ #include "network_interface.hpp" #include "xbt/graph.h" - +#include "xbt/string.hpp" /*********** * Classes * @@ -32,7 +32,7 @@ class NetworkCm02Model : public NetworkModel { public: explicit NetworkCm02Model(lmm::System* (*make_new_sys)(bool) = &lmm::make_new_maxmin_system); virtual ~NetworkCm02Model() = default; - LinkImpl* create_link(const std::string& name, double bandwidth, double latency, + LinkImpl* create_link(const std::string& name, std::vector bandwidths, double latency, s4u::Link::SharingPolicy policy) override; void update_actions_state_lazy(double now, double delta) override; void update_actions_state_full(double now, double delta) override; @@ -53,6 +53,23 @@ public: void set_latency(double value) override; }; +class NetworkWifiLink : public NetworkCm02Link { + /** @brief Hold every rates association between host and links (host name, rates id) */ + std::map host_rates_; + + /** @brief Hold every rates available for this Access Point */ + // double* rates; FIXME: unused + + /** @brief A link can have several bandwith attach to it (mostly use by wifi model) */ + std::vector bandwidths_; + +public: + NetworkWifiLink(NetworkCm02Model* model, const std::string& name, std::vector bandwidths, + s4u::Link::SharingPolicy policy, lmm::System* system); + + void set_host_rate(sg_host_t host, int rate_level); +}; + /********** * Action * **********/ diff --git a/src/surf/network_constant.cpp b/src/surf/network_constant.cpp index 6ec3a519f6..84d70ad419 100644 --- a/src/surf/network_constant.cpp +++ b/src/surf/network_constant.cpp @@ -27,8 +27,8 @@ NetworkConstantModel::NetworkConstantModel() : NetworkModel(Model::UpdateAlgo::F all_existing_models.push_back(this); } -LinkImpl* NetworkConstantModel::create_link(const std::string& name, double /*bandwidth*/, double /*latency*/, - s4u::Link::SharingPolicy) +LinkImpl* NetworkConstantModel::create_link(const std::string& name, std::vector /*bandwidth*/, + double /*latency*/, s4u::Link::SharingPolicy) { xbt_die("Refusing to create the link %s: there is no link in the Constant network model. " diff --git a/src/surf/network_constant.hpp b/src/surf/network_constant.hpp index 63a08d0a8a..daa5ff76c7 100644 --- a/src/surf/network_constant.hpp +++ b/src/surf/network_constant.hpp @@ -21,7 +21,8 @@ public: double next_occuring_event(double now) override; void update_actions_state(double now, double delta) override; - LinkImpl* create_link(const std::string& name, double bw, double lat, s4u::Link::SharingPolicy policy) override; + LinkImpl* create_link(const std::string& name, std::vector bws, double lat, + s4u::Link::SharingPolicy policy) override; }; class NetworkConstantAction : public NetworkAction { diff --git a/src/surf/network_interface.hpp b/src/surf/network_interface.hpp index 79103fdc16..d86a5968fd 100644 --- a/src/surf/network_interface.hpp +++ b/src/surf/network_interface.hpp @@ -48,7 +48,7 @@ public: * @param latency The initial latency of the Link in seconds * @param policy The sharing policy of the Link */ - virtual LinkImpl* create_link(const std::string& name, double bandwidth, double latency, + virtual LinkImpl* create_link(const std::string& name, std::vector bandwidths, double latency, s4u::Link::SharingPolicy policy) = 0; /** diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 36b798db18..c6e2ccef03 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -173,10 +173,11 @@ NetworkNS3Model::~NetworkNS3Model() { IPV4addr.clear(); } -LinkImpl* NetworkNS3Model::create_link(const std::string& name, double bandwidth, double latency, +LinkImpl* NetworkNS3Model::create_link(const std::string& name, std::vector bandwidths, double latency, s4u::Link::SharingPolicy policy) { - return new LinkNS3(this, name, bandwidth, latency); + xbt_assert(bandwidths.size() == 1, "Non WIFI links must use only 1 bandwidth."); + return new LinkNS3(this, name, bandwidths[0], latency); } Action* NetworkNS3Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index 18cba8cae7..dc1ec5815c 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -57,7 +57,8 @@ NetworkL07Model::NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys) : NetworkModel(Model::UpdateAlgo::FULL), hostModel_(hmodel) { set_maxmin_system(sys); - loopback_ = NetworkL07Model::create_link("__loopback__", 498000000, 0.000015, s4u::Link::SharingPolicy::FATPIPE); + loopback_ = NetworkL07Model::create_link("__loopback__", std::vector(1, 498000000), 0.000015, + s4u::Link::SharingPolicy::FATPIPE); } NetworkL07Model::~NetworkL07Model() @@ -224,10 +225,11 @@ kernel::resource::Cpu* CpuL07Model::create_cpu(s4u::Host* host, const std::vecto return new CpuL07(this, host, speed_per_pstate, core); } -kernel::resource::LinkImpl* NetworkL07Model::create_link(const std::string& name, double bandwidth, double latency, - s4u::Link::SharingPolicy policy) +kernel::resource::LinkImpl* NetworkL07Model::create_link(const std::string& name, std::vector bandwidths, + double latency, s4u::Link::SharingPolicy policy) { - return new LinkL07(this, name, bandwidth, latency, policy); + xbt_assert(bandwidths.size() == 1, "Non WIFI link must have only 1 bandwidth."); + return new LinkL07(this, name, bandwidths[0], latency, policy); } /************ diff --git a/src/surf/ptask_L07.hpp b/src/surf/ptask_L07.hpp index 523e00f167..83f62f3332 100644 --- a/src/surf/ptask_L07.hpp +++ b/src/surf/ptask_L07.hpp @@ -63,7 +63,7 @@ public: NetworkL07Model(const NetworkL07Model&) = delete; NetworkL07Model& operator=(const NetworkL07Model&) = delete; ~NetworkL07Model(); - kernel::resource::LinkImpl* create_link(const std::string& name, double bandwidth, double latency, + kernel::resource::LinkImpl* create_link(const std::string& name, std::vector bandwidths, double latency, s4u::Link::SharingPolicy policy) override; kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override; diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 21dd6c1989..3e41181153 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -113,7 +113,7 @@ simgrid::kernel::routing::NetPoint* sg_platf_new_router(const std::string& name, static void sg_platf_new_link(simgrid::kernel::routing::LinkCreationArgs* link, const std::string& link_name) { simgrid::kernel::resource::LinkImpl* l = - surf_network_model->create_link(link_name, link->bandwidth, link->latency, link->policy); + surf_network_model->create_link(link_name, link->bandwidths, link->latency, link->policy); if (link->properties) { l->set_properties(*link->properties); @@ -217,7 +217,7 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster simgrid::kernel::routing::LinkCreationArgs link; link.id = tmp_link; - link.bandwidth = cluster->loopback_bw; + link.bandwidths.push_back(cluster->loopback_bw); link.latency = cluster->loopback_lat; link.policy = simgrid::s4u::Link::SharingPolicy::FATPIPE; sg_platf_new_link(&link); @@ -237,7 +237,7 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster simgrid::kernel::routing::LinkCreationArgs link; link.id = tmp_link; - link.bandwidth = cluster->limiter_link; + link.bandwidths.push_back(cluster->limiter_link); link.latency = 0; link.policy = simgrid::s4u::Link::SharingPolicy::SHARED; sg_platf_new_link(&link); @@ -272,7 +272,7 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster simgrid::kernel::routing::LinkCreationArgs link; link.id = std::string(cluster->id)+ "_backbone"; - link.bandwidth = cluster->bb_bw; + link.bandwidths.push_back(cluster->bb_bw); link.latency = cluster->bb_lat; link.policy = cluster->bb_sharing_policy; @@ -315,7 +315,7 @@ void sg_platf_new_cabinet(simgrid::kernel::routing::CabinetCreationArgs* cabinet simgrid::kernel::routing::LinkCreationArgs link; link.policy = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX; link.latency = cabinet->lat; - link.bandwidth = cabinet->bw; + link.bandwidths.push_back(cabinet->bw); link.id = "link_" + hostname; sg_platf_new_link(&link); diff --git a/src/surf/xml/platf.hpp b/src/surf/xml/platf.hpp index 4160d869a2..35d4bca6a0 100644 --- a/src/surf/xml/platf.hpp +++ b/src/surf/xml/platf.hpp @@ -24,6 +24,8 @@ XBT_PUBLIC int surf_parse_get_int(const std::string& s); XBT_PUBLIC double surf_parse_get_time(const char* string, const char* entity_kind, const std::string& name); XBT_PUBLIC double surf_parse_get_size(const char* string, const char* entity_kind, const std::string& name); XBT_PUBLIC double surf_parse_get_bandwidth(const char* string, const char* entity_kind, const std::string& name); +XBT_PUBLIC std::vector surf_parse_get_bandwidths(const char* string, const char* entity_kind, + const std::string& name); XBT_PUBLIC double surf_parse_get_speed(const char* string, const char* entity_kind, const std::string& name); XBT_PUBLIC int surf_parse(); /* Entry-point to the parser */ diff --git a/src/surf/xml/platf_private.hpp b/src/surf/xml/platf_private.hpp index e321afc296..09aaaad7fb 100644 --- a/src/surf/xml/platf_private.hpp +++ b/src/surf/xml/platf_private.hpp @@ -53,7 +53,7 @@ public: class LinkCreationArgs { public: std::string id; - double bandwidth = 0; + std::vector bandwidths; profile::Profile* bandwidth_trace = nullptr; double latency = 0; profile::Profile* latency_trace = nullptr; diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index 118e7362e6..5544791786 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -229,6 +229,23 @@ double surf_parse_get_bandwidth(const char* string, const char* entity_kind, con "Append 'Bps' to get bytes per second (or 'bps' for bits but 1Bps = 8bps)", "Bps"); } +std::vector surf_parse_get_bandwidths(const char* string, const char* entity_kind, const std::string& name) +{ + static const unit_scale units{std::make_tuple("bps", 0.125, 2, true), std::make_tuple("bps", 0.125, 10, true), + std::make_tuple("Bps", 1.0, 2, true), std::make_tuple("Bps", 1.0, 10, true)}; + + std::vector bandwidths; + std::vector tokens; + boost::split(tokens, string, boost::is_any_of(";")); + for (auto token : tokens) { + bandwidths.push_back(surf_parse_get_value_with_unit( + token.c_str(), units, entity_kind, name, + "Append 'Bps' to get bytes per second (or 'bps' for bits but 1Bps = 8bps)", "Bps")); + } + + return (bandwidths); +} + double surf_parse_get_speed(const char* string, const char* entity_kind, const std::string& name) { static const unit_scale units{std::make_tuple("f", 1.0, 10, true), std::make_tuple("flops", 1.0, 10, false)}; @@ -589,7 +606,7 @@ void ETag_surfxml_link(){ current_property_set = nullptr; link.id = std::string(A_surfxml_link_id); - link.bandwidth = surf_parse_get_bandwidth(A_surfxml_link_bandwidth, "bandwidth of link", link.id.c_str()); + link.bandwidths = surf_parse_get_bandwidths(A_surfxml_link_bandwidth, "bandwidth of link", link.id.c_str()); link.bandwidth_trace = A_surfxml_link_bandwidth___file[0] ? simgrid::kernel::profile::Profile::from_file(A_surfxml_link_bandwidth___file) : nullptr; @@ -615,6 +632,9 @@ void ETag_surfxml_link(){ case A_surfxml_link_sharing___policy_SPLITDUPLEX: link.policy = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX; break; + case A_surfxml_link_sharing___policy_WIFI: + link.policy = simgrid::s4u::Link::SharingPolicy::WIFI; + break; default: surf_parse_error(std::string("Invalid sharing policy in link ") + link.id); } @@ -660,7 +680,8 @@ void ETag_surfxml_backbone(){ link.properties = nullptr; link.id = std::string(A_surfxml_backbone_id); - link.bandwidth = surf_parse_get_bandwidth(A_surfxml_backbone_bandwidth, "bandwidth of backbone", link.id.c_str()); + link.bandwidths.push_back( + surf_parse_get_bandwidth(A_surfxml_backbone_bandwidth, "bandwidth of backbone", link.id.c_str())); link.latency = surf_parse_get_time(A_surfxml_backbone_latency, "latency of backbone", link.id.c_str()); link.policy = simgrid::s4u::Link::SharingPolicy::SHARED; diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 04c57b0169..11bd51d1e2 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -340,8 +340,6 @@ set(SURF_SRC src/surf/cpu_interface.cpp src/surf/cpu_ti.cpp src/surf/network_cm02.cpp - src/surf/link_wifi.cpp - src/surf/link_wifi.hpp src/surf/network_constant.cpp src/surf/network_interface.cpp src/surf/PropertyHolder.cpp