namespace config {
template <class T> class Flag;
}
+
namespace kernel {
class EngineImpl;
-namespace context {
-class Context;
-class ContextFactory;
-}
namespace actor {
class ActorImpl;
using ActorImplPtr = boost::intrusive_ptr<ActorImpl>;
class MailboxImpl;
}
+namespace context {
+class Context;
+class ContextFactory;
+} // namespace context
namespace lmm {
class Element;
class Variable;
class Model;
class Resource;
class TraceEvent;
+class LinkImpl;
+class NetworkAction;
}
namespace routing {
class ClusterCreationArgs;
class NetZoneImpl;
class RouteCreationArgs;
}
-}
+} // namespace kernel
namespace simix {
class Host;
}
-
namespace surf {
class Cpu;
- class LinkImpl;
class HostImpl;
class StorageImpl;
class StorageType;
class trace;
class future_evt_set;
}
-}
+} // namespace simgrid
typedef simgrid::s4u::Actor s4u_Actor;
typedef simgrid::s4u::Host s4u_Host;
/* We use a map instead of a std::vector here because that's a sparse vector. Some values may not exist */
/* The pair is {linkUp, linkDown} */
- std::unordered_map<unsigned int, std::pair<surf::LinkImpl*, surf::LinkImpl*>> private_links_;
+ std::unordered_map<unsigned int, std::pair<kernel::resource::LinkImpl*, kernel::resource::LinkImpl*>> private_links_;
unsigned int node_pos(int id) { return id * num_links_per_node_; }
unsigned int node_pos_with_loopback(int id) { return node_pos(id) + (has_loopback_ ? 1 : 0); }
unsigned int node_pos_with_loopback_limiter(int id) { return node_pos_with_loopback(id) + (has_limiter_ ? 1 : 0); }
void* loopback_ = nullptr;
- surf::LinkImpl* backbone_ = nullptr;
+ kernel::resource::LinkImpl* backbone_ = nullptr;
NetPoint* router_ = nullptr;
bool has_limiter_ = false;
bool has_loopback_ = false;
*/
void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) override;
void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
- std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical) override;
+ std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
xbt_graph_t route_graph_ = nullptr; /* xbt_graph */
std::map<int, xbt_node_t> graph_node_map_; /* map */
unsigned int group_;
unsigned int chassis_;
unsigned int blade_;
- surf::LinkImpl** blue_links_ = nullptr;
- surf::LinkImpl** black_links_ = nullptr;
- surf::LinkImpl** green_links_ = nullptr;
- surf::LinkImpl** my_nodes_ = nullptr;
+ resource::LinkImpl** blue_links_ = nullptr;
+ resource::LinkImpl** black_links_ = nullptr;
+ resource::LinkImpl** green_links_ = nullptr;
+ resource::LinkImpl** my_nodes_ = nullptr;
DragonflyRouter(int i, int j, int k);
~DragonflyRouter();
};
void seal() override;
void generateRouters();
void generateLinks();
- void createLink(const std::string& id, int numlinks, surf::LinkImpl** linkup, surf::LinkImpl** linkdown);
+ void createLink(const std::string& id, int numlinks, resource::LinkImpl** linkup, resource::LinkImpl** linkdown);
void rankId_to_coords(int rankId, unsigned int (*coords)[4]);
/** Virtual link standing for the node global capacity.
*/
- surf::LinkImpl* limiter_link_;
+ resource::LinkImpl* limiter_link_;
/** If present, communications from this node to this node will pass through it
* instead of passing by an upper level switch.
*/
- surf::LinkImpl* loopback;
+ resource::LinkImpl* loopback;
FatTreeNode(ClusterCreationArgs* cluster, int id, int level, int position);
};
public:
FatTreeLink(ClusterCreationArgs* cluster, FatTreeNode* source, FatTreeNode* destination);
/** Link going up in the tree */
- surf::LinkImpl* up_link_;
+ resource::LinkImpl* up_link_;
/** Link going down in the tree */
- surf::LinkImpl* down_link_;
+ resource::LinkImpl* down_link_;
/** Upper end of the link */
FatTreeNode* up_node_;
/** Lower end of the link */
~FloydZone() override;
void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
- void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
- kernel::routing::NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
- bool symmetrical) override;
+ void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
+ std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
void seal() override;
private:
~FullZone() override;
void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
- void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
- kernel::routing::NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
- bool symmetrical) override;
+ void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
+ std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
private:
RouteCreationArgs** routing_table_ = nullptr;
std::map<std::string, std::string>* props);
/** @brief Creates a new route in this NetZone */
void add_bypass_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
- std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical) override;
+ std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
protected:
/**
/** @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 get_bypass_route(routing::NetPoint* src, routing::NetPoint* dst,
- /* OUT */ std::vector<surf::LinkImpl*>& links, double* latency);
+ /* OUT */ std::vector<resource::LinkImpl*>& links, double* latency);
public:
/* @brief get the route between two nodes in the full platform
* @param latency Accumulator in which the latencies should be added (caller must set it to 0)
*/
static void get_global_route(routing::NetPoint* src, routing::NetPoint* dst,
- /* OUT */ std::vector<surf::LinkImpl*>& links, double* latency);
+ /* OUT */ std::vector<resource::LinkImpl*>& links, double* latency);
virtual void get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
std::map<std::string, xbt_edge_t>* edges) = 0;
void get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
std::map<std::string, xbt_edge_t>* edges) override;
virtual RouteCreationArgs* newExtendedRoute(RoutingMode hierarchy, NetPoint* src, NetPoint* dst, NetPoint* gw_src,
- NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
+ NetPoint* gw_dst, std::vector<resource::LinkImpl*>& link_list,
bool symmetrical, bool change_order);
protected:
void getRouteCheckParams(NetPoint* src, NetPoint* dst);
- void addRouteCheckParams(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
- kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical);
+ void addRouteCheckParams(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
+ std::vector<resource::LinkImpl*>& link_list, bool symmetrical);
};
} // namespace routing
} // namespace kernel
std::unordered_map<std::string, Storage*> const& getMountedStorages();
void routeTo(Host* dest, std::vector<Link*>& links, double* latency);
- void routeTo(Host* dest, std::vector<surf::LinkImpl*>& links, double* latency);
+ void routeTo(Host* dest, std::vector<kernel::resource::LinkImpl*>& links, double* latency);
/** Block the calling actor on an execution located on the called host
*
***********/
namespace simgrid {
-namespace surf {
-class NetworkAction;
-};
namespace s4u {
/** @brief A Link represents the network facilities between [hosts](\ref simgrid::s4u::Host) */
class XBT_PUBLIC Link : public simgrid::xbt::Extendable<Link> {
- friend simgrid::surf::LinkImpl;
+ friend simgrid::kernel::resource::LinkImpl;
// Links are created from the NetZone, and destroyed by their private implementation when the simulation ends
- explicit Link(surf::LinkImpl* pimpl) : pimpl_(pimpl) {}
+ explicit Link(kernel::resource::LinkImpl* pimpl) : pimpl_(pimpl) {}
virtual ~Link() = default;
// The private implementation, that never changes
- surf::LinkImpl* const pimpl_;
+ kernel::resource::LinkImpl* const pimpl_;
public:
/** @brief Retrieve a link from its name */
static simgrid::xbt::signal<void(s4u::Link&)> onStateChange;
/** @brief Callback signal fired when a communication starts */
- static simgrid::xbt::signal<void(surf::NetworkAction*, s4u::Host* src, s4u::Host* dst)> onCommunicate;
+ static simgrid::xbt::signal<void(kernel::resource::NetworkAction*, s4u::Host* src, s4u::Host* dst)> onCommunicate;
/** @brief Callback signal fired when a communication changes it state (ready/done/cancel) */
- static simgrid::xbt::signal<void(surf::NetworkAction*)> onCommunicationStateChange;
+ static simgrid::xbt::signal<void(kernel::resource::NetworkAction*)> onCommunicationStateChange;
XBT_ATTRIB_DEPRECATED_v321("Use get_cname(): v3.21 will turn this warning into an error.") const char* name();
};
XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_cname()") const char* getCname() const { return get_cname(); }
XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::add_route()") void addRoute(
kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
- kernel::routing::NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
+ kernel::routing::NetPoint* gw_dst, std::vector<simgrid::kernel::resource::LinkImpl*>& link_list, bool symmetrical)
{
add_route(src, dst, gw_src, gw_dst, link_list, symmetrical);
}
XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::add_bypass_route()") void addBypassRoute(
kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
- kernel::routing::NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
+ kernel::routing::NetPoint* gw_dst, std::vector<simgrid::kernel::resource::LinkImpl*>& link_list, bool symmetrical)
{
add_bypass_route(src, dst, gw_src, gw_dst, link_list, symmetrical);
}
virtual int addComponent(kernel::routing::NetPoint * elm); /* A host, a router or a netzone, whatever */
virtual void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical);
+ std::vector<kernel::resource::LinkImpl*>& link_list, bool symmetrical);
virtual void add_bypass_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical) = 0;
+ std::vector<kernel::resource::LinkImpl*>& link_list, bool symmetrical) = 0;
/*** Called on each newly created regular route (not on bypass routes) */
static simgrid::xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- std::vector<surf::LinkImpl*>& link_list)>
+ std::vector<kernel::resource::LinkImpl*>& link_list)>
onRouteCreation;
static simgrid::xbt::signal<void(NetZone&)> onCreation;
static simgrid::xbt::signal<void(NetZone&)> onSeal;
}
sg_platf_new_link(&link);
- routing_cluster_add_backbone(simgrid::surf::LinkImpl::byName(link.id));
+ routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl::byName(link.id));
return 0;
}
boost::split(names, str, boost::is_any_of(", \t\r\n"));
if (names.empty()) {
/* unique name */
- route.link_list.push_back(simgrid::surf::LinkImpl::byName(lua_tostring(L, -1)));
+ route.link_list.push_back(simgrid::kernel::resource::LinkImpl::byName(lua_tostring(L, -1)));
} else {
// Several names separated by , \t\r\n
for (auto const& name : names) {
if (name.length() > 0) {
- simgrid::surf::LinkImpl* link = simgrid::surf::LinkImpl::byName(name);
+ simgrid::kernel::resource::LinkImpl* link = simgrid::kernel::resource::LinkImpl::byName(name);
route.link_list.push_back(link);
}
}
boost::split(names, str, boost::is_any_of(", \t\r\n"));
if (names.empty()) {
/* unique name with no comma */
- ASroute.link_list.push_back(simgrid::surf::LinkImpl::byName(lua_tostring(L, -1)));
+ ASroute.link_list.push_back(simgrid::kernel::resource::LinkImpl::byName(lua_tostring(L, -1)));
} else {
// Several names separated by , \t\r\n
for (auto const& name : names) {
if (name.length() > 0) {
- simgrid::surf::LinkImpl* link = simgrid::surf::LinkImpl::byName(name);
+ simgrid::kernel::resource::LinkImpl* link = simgrid::kernel::resource::LinkImpl::byName(name);
ASroute.link_list.push_back(link);
}
}
if (not dst_elm)
xbt_die("Element '%s' not found!",dst);
- std::vector<simgrid::surf::LinkImpl*> route;
+ std::vector<simgrid::kernel::resource::LinkImpl*> route;
simgrid::kernel::routing::NetZoneImpl::get_global_route(src_elm, dst_elm, route, nullptr);
for (auto const& link : route)
instr_user_variable(time, link->get_cname(), variable, father_type, value, what, nullptr, &user_link_variables);
if ((src->id() == dst->id()) && has_loopback_) {
xbt_assert(not src->is_router(), "Routing from a cluster private router to itself is meaningless");
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos(src->id()));
+ std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos(src->id()));
route->link_list.push_back(info.first);
if (lat)
*lat += info.first->latency();
if (not src->is_router()) { // No private link for the private router
if (has_limiter_) { // limiter for sender
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos_with_loopback(src->id()));
+ std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos_with_loopback(src->id()));
route->link_list.push_back(info.first);
}
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos_with_loopback_limiter(src->id()));
+ std::pair<resource::LinkImpl*, resource::LinkImpl*> info =
+ private_links_.at(node_pos_with_loopback_limiter(src->id()));
if (info.first) { // link up
route->link_list.push_back(info.first);
if (lat)
if (not dst->is_router()) { // No specific link for router
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos_with_loopback_limiter(dst->id()));
+ std::pair<resource::LinkImpl*, resource::LinkImpl*> info =
+ private_links_.at(node_pos_with_loopback_limiter(dst->id()));
if (info.second) { // link down
route->link_list.push_back(info.second);
if (lat)
if (not src->is_router()) {
xbt_node_t previous = new_xbt_graph_node(graph, src->get_cname(), nodes);
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(src->id());
+ std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(src->id());
if (info.first) { // link up
xbt_node_t current = new_xbt_graph_node(graph, info.first->get_cname(), nodes);
link.policy = cluster->sharing_policy;
sg_platf_new_link(&link);
- surf::LinkImpl *linkUp;
- surf::LinkImpl *linkDown;
+ resource::LinkImpl* linkUp;
+ resource::LinkImpl* linkDown;
if (link.policy == SURF_LINK_SPLITDUPLEX) {
- linkUp = surf::LinkImpl::byName(link_id + "_UP");
- linkDown = surf::LinkImpl::byName(link_id + "_DOWN");
+ linkUp = resource::LinkImpl::byName(link_id + "_UP");
+ linkDown = resource::LinkImpl::byName(link_id + "_DOWN");
} else {
- linkUp = surf::LinkImpl::byName(link_id);
+ linkUp = resource::LinkImpl::byName(link_id);
linkDown = linkUp;
}
private_links_.insert({position, {linkUp, linkDown}});
for (auto const& link : e_route->link_list) {
route->link_list.insert(route->link_list.begin(), link);
if (lat)
- *lat += static_cast<surf::LinkImpl*>(link)->latency();
+ *lat += static_cast<resource::LinkImpl*>(link)->latency();
}
}
first_gw = gw_dst;
if (hierarchy_ == RoutingMode::recursive && v != dst_node_id && gw_dst->get_name() != prev_gw_src->get_name()) {
- std::vector<surf::LinkImpl*> e_route_as_to_as;
+ std::vector<resource::LinkImpl*> e_route_as_to_as;
NetPoint* gw_dst_net_elm = nullptr;
NetPoint* prev_gw_src_net_elm = nullptr;
for (auto const& link : e_route->link_list) {
route->link_list.insert(route->link_list.begin(), link);
if (lat)
- *lat += static_cast<surf::LinkImpl*>(link)->latency();
+ *lat += static_cast<resource::LinkImpl*>(link)->latency();
}
}
{
}
-void DijkstraZone::add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
- kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
+void DijkstraZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
+ std::vector<resource::LinkImpl*>& link_list, bool symmetrical)
{
const char* srcName = src->get_cname();
const char* dstName = dst->get_cname();
}
}
-void DragonflyZone::createLink(const std::string& id, int numlinks, surf::LinkImpl** linkup, surf::LinkImpl** linkdown)
+void DragonflyZone::createLink(const std::string& id, int numlinks, resource::LinkImpl** linkup,
+ resource::LinkImpl** linkdown)
{
*linkup = nullptr;
*linkdown = nullptr;
linkTemplate.id = id;
sg_platf_new_link(&linkTemplate);
XBT_DEBUG("Generating link %s", id.c_str());
- surf::LinkImpl* link;
+ resource::LinkImpl* link;
if (this->sharing_policy_ == SURF_LINK_SPLITDUPLEX) {
- *linkup = surf::LinkImpl::byName(linkTemplate.id + "_UP"); // check link?
- *linkdown = surf::LinkImpl::byName(linkTemplate.id + "_DOWN"); // check link ?
+ *linkup = resource::LinkImpl::byName(linkTemplate.id + "_UP"); // check link?
+ *linkdown = resource::LinkImpl::byName(linkTemplate.id + "_DOWN"); // check link ?
} else {
- link = surf::LinkImpl::byName(linkTemplate.id);
+ link = resource::LinkImpl::byName(linkTemplate.id);
*linkup = link;
*linkdown = link;
}
void DragonflyZone::generateLinks()
{
static int uniqueId = 0;
- surf::LinkImpl* linkup;
- surf::LinkImpl* linkdown;
+ resource::LinkImpl* linkup;
+ resource::LinkImpl* linkdown;
unsigned int numRouters = this->num_groups_ * this->num_chassis_per_group_ * this->num_blades_per_chassis_;
// Links from routers to their local nodes.
for (unsigned int i = 0; i < numRouters; i++) {
// allocate structures
- this->routers_[i]->my_nodes_ = new surf::LinkImpl*[num_links_per_link_ * this->num_nodes_per_blade_];
- this->routers_[i]->green_links_ = new surf::LinkImpl*[this->num_blades_per_chassis_];
- this->routers_[i]->black_links_ = new surf::LinkImpl*[this->num_chassis_per_group_];
+ this->routers_[i]->my_nodes_ = new resource::LinkImpl*[num_links_per_link_ * this->num_nodes_per_blade_];
+ this->routers_[i]->green_links_ = new resource::LinkImpl*[this->num_blades_per_chassis_];
+ this->routers_[i]->black_links_ = new resource::LinkImpl*[this->num_chassis_per_group_];
for (unsigned int j = 0; j < num_links_per_link_ * this->num_nodes_per_blade_; j += num_links_per_link_) {
std::string id = "local_link_from_router_" + std::to_string(i) + "_to_node_" +
for (unsigned int j = i + 1; j < this->num_groups_; j++) {
unsigned int routernumi = i * num_blades_per_chassis_ * num_chassis_per_group_ + j;
unsigned int routernumj = j * num_blades_per_chassis_ * num_chassis_per_group_ + i;
- this->routers_[routernumi]->blue_links_ = new surf::LinkImpl*;
- this->routers_[routernumj]->blue_links_ = new surf::LinkImpl*;
+ this->routers_[routernumi]->blue_links_ = new resource::LinkImpl*;
+ this->routers_[routernumj]->blue_links_ = new resource::LinkImpl*;
std::string id = "blue_link_between_group_"+ std::to_string(i) +"_and_" + std::to_string(j) +"_routers_" +
std::to_string(routernumi) + "_and_" + std::to_string(routernumj) + "_" + std::to_string(uniqueId);
this->createLink(id, this->num_links_blue_, &linkup, &linkdown);
dst->id());
if ((src->id() == dst->id()) && has_loopback_) {
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos(src->id()));
+ std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos(src->id()));
route->link_list.push_back(info.first);
if (latency)
*latency += myRouter->my_nodes_[myCoords[3] * num_links_per_link_]->latency();
if (has_limiter_) { // limiter for sender
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos_with_loopback(src->id()));
+ std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos_with_loopback(src->id()));
route->link_list.push_back(info.first);
}
}
if (has_limiter_) { // limiter for receiver
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos_with_loopback(dst->id()));
+ std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos_with_loopback(dst->id()));
route->link_list.push_back(info.first);
}
linkTemplate.policy = SURF_LINK_SHARED;
linkTemplate.id = "limiter_"+std::to_string(id);
sg_platf_new_link(&linkTemplate);
- this->limiter_link_ = surf::LinkImpl::byName(linkTemplate.id);
+ this->limiter_link_ = resource::LinkImpl::byName(linkTemplate.id);
}
if (cluster->loopback_bw || cluster->loopback_lat) {
linkTemplate.bandwidth = cluster->loopback_bw;
linkTemplate.policy = SURF_LINK_FATPIPE;
linkTemplate.id = "loopback_"+ std::to_string(id);
sg_platf_new_link(&linkTemplate);
- this->loopback = surf::LinkImpl::byName(linkTemplate.id);
+ this->loopback = resource::LinkImpl::byName(linkTemplate.id);
}
}
if (cluster->sharing_policy == SURF_LINK_SPLITDUPLEX) {
std::string tmpID = std::string(linkTemplate.id) + "_UP";
- this->up_link_ = surf::LinkImpl::byName(tmpID); // check link?
+ this->up_link_ = resource::LinkImpl::byName(tmpID); // check link?
tmpID = std::string(linkTemplate.id) + "_DOWN";
- this->down_link_ = surf::LinkImpl::byName(tmpID); // check link ?
+ this->down_link_ = resource::LinkImpl::byName(tmpID); // check link ?
} else {
- this->up_link_ = surf::LinkImpl::byName(linkTemplate.id);
+ this->up_link_ = resource::LinkImpl::byName(linkTemplate.id);
this->down_link_ = this->up_link_;
}
uniqueId++;
}
void FloydZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
- std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
+ std::vector<resource::LinkImpl*>& link_list, bool symmetrical)
{
/* set the size of table routing */
unsigned int table_size = getTableSize();
}
}
-void FullZone::add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
- kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
+void FullZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
+ std::vector<resource::LinkImpl*>& link_list, bool symmetrical)
{
addRouteCheckParams(src, dst, gw_src, gw_dst, link_list, symmetrical);
explicit BypassRoute(NetPoint* gwSrc, NetPoint* gwDst) : gw_src(gwSrc), gw_dst(gwDst) {}
NetPoint* gw_src;
NetPoint* gw_dst;
- std::vector<surf::LinkImpl*> links;
+ std::vector<resource::LinkImpl*> links;
};
NetZoneImpl::NetZoneImpl(NetZone* father, std::string name) : NetZone(father, name)
}
void NetZoneImpl::add_bypass_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
- std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
+ std::vector<resource::LinkImpl*>& link_list, bool symmetrical)
{
/* Argument validity checks */
if (gw_dst) {
/* PRECONDITION: this is the common ancestor of src and dst */
bool NetZoneImpl::get_bypass_route(routing::NetPoint* src, routing::NetPoint* dst,
- /* OUT */ std::vector<surf::LinkImpl*>& links, double* latency)
+ /* OUT */ std::vector<resource::LinkImpl*>& links, double* latency)
{
// If never set a bypass route return nullptr without any further computations
if (bypass_routes_.empty())
if (dst->get_englobing_zone() == this && src->get_englobing_zone() == this) {
if (bypass_routes_.find({src, dst}) != bypass_routes_.end()) {
BypassRoute* bypassedRoute = bypass_routes_.at({src, dst});
- for (surf::LinkImpl* const& link : bypassedRoute->links) {
+ for (resource::LinkImpl* const& link : bypassedRoute->links) {
links.push_back(link);
if (latency)
*latency += link->latency();
src->get_cname(), dst->get_cname(), bypassedRoute->links.size());
if (src != key.first)
get_global_route(src, bypassedRoute->gw_src, links, latency);
- for (surf::LinkImpl* const& link : bypassedRoute->links) {
+ for (resource::LinkImpl* const& link : bypassedRoute->links) {
links.push_back(link);
if (latency)
*latency += link->latency();
return false;
}
-void NetZoneImpl::get_global_route(routing::NetPoint* src, routing::NetPoint* dst,
- /* OUT */ std::vector<surf::LinkImpl*>& links, double* latency)
+void NetZoneImpl::get_global_route(NetPoint* src, NetPoint* dst,
+ /* OUT */ std::vector<resource::LinkImpl*>& links, double* latency)
{
RouteCreationArgs route;
/* ************************* GENERIC AUX FUNCTIONS ************************** */
/* change a route containing link names into a route containing link entities */
RouteCreationArgs* RoutedZone::newExtendedRoute(RoutingMode hierarchy, NetPoint* src, NetPoint* dst, NetPoint* gw_src,
- NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
+ NetPoint* gw_dst, std::vector<resource::LinkImpl*>& link_list,
bool symmetrical, bool change_order)
{
RouteCreationArgs* result = new RouteCreationArgs();
"%s@%s). Please report that bug.",
src->get_cname(), dst->get_cname(), src_as->get_cname(), dst_as->get_cname(), get_cname());
}
-void RoutedZone::addRouteCheckParams(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
- kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
+void RoutedZone::addRouteCheckParams(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
+ std::vector<resource::LinkImpl*>& link_list, bool symmetrical)
{
const char* srcName = src->get_cname();
const char* dstName = dst->get_cname();
link.latency = cluster->lat;
link.policy = cluster->sharing_policy;
sg_platf_new_link(&link);
- surf::LinkImpl* linkUp;
- surf::LinkImpl* linkDown;
+ resource::LinkImpl* linkUp;
+ resource::LinkImpl* linkDown;
if (link.policy == SURF_LINK_SPLITDUPLEX) {
std::string tmp_link = link_id + "_UP";
- linkUp = surf::LinkImpl::byName(tmp_link);
+ linkUp = resource::LinkImpl::byName(tmp_link);
tmp_link = link_id + "_DOWN";
- linkDown = surf::LinkImpl::byName(tmp_link);
+ linkDown = resource::LinkImpl::byName(tmp_link);
} else {
- linkUp = surf::LinkImpl::byName(link_id);
+ linkUp = resource::LinkImpl::byName(link_id);
linkDown = linkUp;
}
/*
return;
if (src->id() == dst->id() && has_loopback_) {
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(src->id() * num_links_per_node_);
+ std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(src->id() * num_links_per_node_);
route->link_list.push_back(info.first);
if (lat)
dim_product *= cur_dim;
}
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info;
+ std::pair<resource::LinkImpl*, resource::LinkImpl*> info;
if (has_limiter_) { // limiter for sender
info = private_links_.at(nodeOffset + (has_loopback_ ? 1 : 0));
std::string link_up = "link_" + netpoint->get_name() + "_UP";
std::string link_down = "link_" + netpoint->get_name() + "_DOWN";
- surf::LinkImpl* linkUp = surf_network_model->createLink(link_up, bw_out, 0, SURF_LINK_SHARED);
- surf::LinkImpl* linkDown = surf_network_model->createLink(link_down, bw_in, 0, SURF_LINK_SHARED);
+ resource::LinkImpl* linkUp = surf_network_model->createLink(link_up, bw_out, 0, SURF_LINK_SHARED);
+ resource::LinkImpl* linkDown = surf_network_model->createLink(link_down, bw_in, 0, SURF_LINK_SHARED);
private_links_.insert({netpoint->id(), {linkUp, linkDown}});
}
/* Retrieve the private links */
auto src_link = private_links_.find(src->id());
if (src_link != private_links_.end()) {
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = src_link->second;
+ std::pair<resource::LinkImpl*, resource::LinkImpl*> info = src_link->second;
if (info.first) {
route->link_list.push_back(info.first);
if (lat)
auto dst_link = private_links_.find(dst->id());
if (dst_link != private_links_.end()) {
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = dst_link->second;
+ std::pair<resource::LinkImpl*, resource::LinkImpl*> info = dst_link->second;
if (info.second) {
route->link_list.push_back(info.second);
if (lat)
/** @brief Returns the amount of links in the platform */
size_t Engine::getLinkCount()
{
- return simgrid::surf::LinkImpl::linksCount();
+ return kernel::resource::LinkImpl::linksCount();
}
/** @brief Fills the passed list with all links found in the platform
void XBT_ATTRIB_DEPRECATED_v322("Engine::getLinkList() is deprecated in favor of Engine::getAllLinks(). Please switch before v3.22")
Engine::getLinkList(std::vector<Link*>* list)
{
- simgrid::surf::LinkImpl::linksList(list);
+ kernel::resource::LinkImpl::linksList(list);
}
/** @brief Returns the list of all links found in the platform */
std::vector<Link*> Engine::getAllLinks()
{
std::vector<Link*> res;
- simgrid::surf::LinkImpl::linksList(&res);
+ kernel::resource::LinkImpl::linksList(&res);
return res;
}
*/
void Host::routeTo(Host* dest, std::vector<Link*>& links, double* latency)
{
- std::vector<surf::LinkImpl*> linkImpls;
+ std::vector<kernel::resource::LinkImpl*> linkImpls;
this->routeTo(dest, linkImpls, latency);
- for (surf::LinkImpl* const& l : linkImpls)
+ for (kernel::resource::LinkImpl* const& l : linkImpls)
links.push_back(&l->piface_);
}
/** @brief Just like Host::routeTo, but filling an array of link implementations */
-void Host::routeTo(Host* dest, std::vector<surf::LinkImpl*>& links, double* latency)
+void Host::routeTo(Host* dest, std::vector<kernel::resource::LinkImpl*>& links, double* latency)
{
simgrid::kernel::routing::NetZoneImpl::get_global_route(pimpl_netpoint, dest->pimpl_netpoint, links, latency);
if (XBT_LOG_ISENABLED(surf_route, xbt_log_priority_debug)) {
}
int sg_link_count()
{
- return simgrid::surf::LinkImpl::linksCount();
+ return simgrid::kernel::resource::LinkImpl::linksCount();
}
sg_link_t* sg_link_list()
{
- simgrid::surf::LinkImpl** list = simgrid::surf::LinkImpl::linksList();
+ simgrid::kernel::resource::LinkImpl** list = simgrid::kernel::resource::LinkImpl::linksList();
sg_link_t* res = (sg_link_t*)list; // Use the same memory area
int size = sg_link_count();
}
void sg_link_exit()
{
- simgrid::surf::LinkImpl::linksExit();
+ simgrid::kernel::resource::LinkImpl::linksExit();
}
/***********
namespace s4u {
Link* Link::byName(const char* name)
{
- surf::LinkImpl* res = surf::LinkImpl::byName(name);
+ kernel::resource::LinkImpl* res = kernel::resource::LinkImpl::byName(name);
if (res == nullptr)
return nullptr;
return &res->piface_;
simgrid::xbt::signal<void(s4u::Link&)> Link::onCreation;
simgrid::xbt::signal<void(s4u::Link&)> Link::onDestruction;
simgrid::xbt::signal<void(s4u::Link&)> Link::onStateChange;
-simgrid::xbt::signal<void(surf::NetworkAction*, s4u::Host* src, s4u::Host* dst)> Link::onCommunicate;
-simgrid::xbt::signal<void(surf::NetworkAction*)> Link::onCommunicationStateChange;
+simgrid::xbt::signal<void(kernel::resource::NetworkAction*, s4u::Host* src, s4u::Host* dst)> Link::onCommunicate;
+simgrid::xbt::signal<void(kernel::resource::NetworkAction*)> Link::onCommunicationStateChange;
}
}
simgrid::xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- std::vector<surf::LinkImpl*>& link_list)>
+ std::vector<kernel::resource::LinkImpl*>& link_list)>
NetZone::onRouteCreation;
simgrid::xbt::signal<void(NetZone&)> NetZone::onCreation;
simgrid::xbt::signal<void(NetZone&)> NetZone::onSeal;
void NetZone::add_route(kernel::routing::NetPoint* /*src*/, kernel::routing::NetPoint* /*dst*/,
kernel::routing::NetPoint* /*gw_src*/, kernel::routing::NetPoint* /*gw_dst*/,
- std::vector<simgrid::surf::LinkImpl*>& /*link_list*/, bool /*symmetrical*/)
+ std::vector<kernel::resource::LinkImpl*>& /*link_list*/, bool /*symmetrical*/)
{
xbt_die("NetZone '%s' does not accept new routes (wrong class).", name_.c_str());
}
if (surf_network_model)
return;
- surf_network_model = new simgrid::surf::NetworkCm02Model();
+ surf_network_model = new simgrid::kernel::resource::NetworkCm02Model();
all_existing_models->push_back(surf_network_model);
xbt_cfg_setdefault_double("network/latency-factor", 13.01);
xbt_cfg_setdefault_double("network/bandwidth-factor", 1.0);
xbt_cfg_setdefault_double("network/weight-S", 0.0);
- surf_network_model = new simgrid::surf::NetworkCm02Model();
+ surf_network_model = new simgrid::kernel::resource::NetworkCm02Model();
all_existing_models->push_back(surf_network_model);
}
xbt_cfg_setdefault_double("network/bandwidth-factor", 0.97);
xbt_cfg_setdefault_double("network/weight-S", 20537);
- surf_network_model = new simgrid::surf::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
+ surf_network_model = new simgrid::kernel::resource::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
all_existing_models->push_back(surf_network_model);
}
xbt_cfg_setdefault_double("network/bandwidth-factor", 0.97);
xbt_cfg_setdefault_double("network/weight-S", 20537);
- surf_network_model = new simgrid::surf::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
+ surf_network_model = new simgrid::kernel::resource::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
all_existing_models->push_back(surf_network_model);
}
xbt_cfg_setdefault_double("network/bandwidth-factor", 0.97);
xbt_cfg_setdefault_double("network/weight-S", 20537);
- surf_network_model = new simgrid::surf::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
+ surf_network_model = new simgrid::kernel::resource::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
all_existing_models->push_back(surf_network_model);
}
namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(bool))
- : NetworkModel(xbt_cfg_get_string("network/optim") == "Full" ? kernel::resource::Model::UpdateAlgo::Full
- : kernel::resource::Model::UpdateAlgo::Lazy)
+ : NetworkModel(xbt_cfg_get_string("network/optim") == "Full" ? Model::UpdateAlgo::Full : Model::UpdateAlgo::Lazy)
{
std::string optim = xbt_cfg_get_string("network/optim");
bool select = xbt_cfg_get_boolean("network/maxmin-selective-update");
}
// if I am wearing a latency hat
- if (action->get_type() == kernel::resource::ActionHeap::Type::latency) {
+ if (action->get_type() == ActionHeap::Type::latency) {
XBT_DEBUG("Latency paid for action %p. Activating", action);
get_maxmin_system()->update_variable_weight(action->get_variable(), action->weight_);
get_action_heap().remove(action);
action->set_last_update();
// if I am wearing a max_duration or normal hat
- } else if (action->get_type() == kernel::resource::ActionHeap::Type::max_duration ||
- action->get_type() == kernel::resource::ActionHeap::Type::normal) {
+ } else if (action->get_type() == ActionHeap::Type::max_duration || action->get_type() == ActionHeap::Type::normal) {
// no need to communicate anymore
// assume that flows that reached max_duration have remaining of 0
XBT_DEBUG("Action %p finished", action);
- action->finish(kernel::resource::Action::State::done);
+ action->finish(Action::State::done);
get_action_heap().remove(action);
}
}
if (((action.get_remains() <= 0) && (action.get_variable()->get_weight() > 0)) ||
((action.get_max_duration() > NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
- action.finish(kernel::resource::Action::State::done);
+ action.finish(Action::State::done);
}
}
}
-kernel::resource::Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
+Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
{
int failed = 0;
double latency = 0.0;
action->weight_ = latency;
action->latency_ = latency;
action->rate_ = rate;
- if (get_update_algorithm() == kernel::resource::Model::UpdateAlgo::Lazy) {
+ if (get_update_algorithm() == Model::UpdateAlgo::Lazy) {
action->set_last_update();
}
if (action->latency_ > 0) {
action->set_variable(get_maxmin_system()->variable_new(action, 0.0, -1.0, constraints_per_variable));
- if (get_update_algorithm() == kernel::resource::Model::UpdateAlgo::Lazy) {
+ if (get_update_algorithm() == Model::UpdateAlgo::Lazy) {
// add to the heap the event when the latency is payed
double date = action->latency_ + action->get_last_update();
- kernel::resource::ActionHeap::Type type;
+ ActionHeap::Type type;
if (route.empty())
- type = kernel::resource::ActionHeap::Type::normal;
+ type = ActionHeap::Type::normal;
else
- type = kernel::resource::ActionHeap::Type::latency;
+ type = ActionHeap::Type::latency;
XBT_DEBUG("Added action (%p) one latency event at date %f", action, date);
get_action_heap().insert(action, date, type);
turn_off();
while ((var = get_constraint()->get_variable(&elem))) {
- kernel::resource::Action* action = static_cast<kernel::resource::Action*>(var->get_id());
+ Action* action = static_cast<Action*>(var->get_id());
- if (action->get_state() == kernel::resource::Action::State::running ||
- action->get_state() == kernel::resource::Action::State::ready) {
+ if (action->get_state() == Action::State::running || action->get_state() == Action::State::ready) {
action->set_finish_time(now);
- action->set_state(kernel::resource::Action::State::failed);
+ action->set_state(Action::State::failed);
}
}
}
}
}
+} // namespace simgrid
***********/
namespace simgrid {
- namespace surf {
+namespace kernel {
+namespace resource {
- class XBT_PRIVATE NetworkCm02Model;
- class XBT_PRIVATE NetworkCm02Action;
- class XBT_PRIVATE NetworkSmpiModel;
-
- }
-}
+class XBT_PRIVATE NetworkCm02Model;
+class XBT_PRIVATE NetworkCm02Action;
+class XBT_PRIVATE NetworkSmpiModel;
/*********
* Model *
*********/
-namespace simgrid {
-namespace surf {
-
class NetworkCm02Model : public NetworkModel {
public:
- explicit NetworkCm02Model(kernel::lmm::System* (*make_new_sys)(bool) = &simgrid::kernel::lmm::make_new_maxmin_system);
+ explicit NetworkCm02Model(lmm::System* (*make_new_sys)(bool) = &lmm::make_new_maxmin_system);
virtual ~NetworkCm02Model() = default;
LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy) override;
void update_actions_state_lazy(double now, double delta) override;
void update_actions_state_full(double now, double delta) override;
- kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
+ Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
};
/************
class NetworkCm02Link : public LinkImpl {
public:
NetworkCm02Link(NetworkCm02Model* model, const std::string& name, double bandwidth, double latency,
- e_surf_link_sharing_policy_t policy, kernel::lmm::System* system);
+ e_surf_link_sharing_policy_t policy, lmm::System* system);
virtual ~NetworkCm02Link() = default;
void apply_event(tmgr_trace_event_t event, double value) override;
void setBandwidth(double value) override;
friend NetworkSmpiModel;
public:
- NetworkCm02Action(kernel::resource::Model* model, double cost, bool failed) : NetworkAction(model, cost, failed){};
+ NetworkCm02Action(Model* model, double cost, bool failed) : NetworkAction(model, cost, failed){};
virtual ~NetworkCm02Action() = default;
void update_remains_lazy(double now) override;
};
}
}
-
+} // namespace simgrid
#endif /* SURF_NETWORK_CM02_HPP_ */
void surf_network_model_init_Constant()
{
xbt_assert(surf_network_model == nullptr);
- surf_network_model = new simgrid::surf::NetworkConstantModel();
+ surf_network_model = new simgrid::kernel::resource::NetworkConstantModel();
all_existing_models->push_back(surf_network_model);
}
namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
LinkImpl* NetworkConstantModel::createLink(const std::string& name, double bw, double lat,
e_surf_link_sharing_policy_t policy)
{
THROW_IMPOSSIBLE;
}
}
+} // namespace kernel
}
#include "network_interface.hpp"
namespace simgrid {
- namespace surf {
-
- /***********
- * Classes *
- ***********/
-
- class XBT_PRIVATE NetworkConstantModel;
- class XBT_PRIVATE NetworkConstantAction;
-
- /*********
- * Model *
- *********/
- class NetworkConstantModel : public NetworkModel {
- public:
- NetworkConstantModel() : NetworkModel(Model::UpdateAlgo::Full) {}
- kernel::resource::Action* communicate(simgrid::s4u::Host* src, simgrid::s4u::Host* dst, double size,
- double rate) override;
- double next_occuring_event(double now) override;
- void update_actions_state(double now, double delta) override;
-
- LinkImpl* createLink(const std::string& name, double bw, double lat,
- e_surf_link_sharing_policy_t policy) override;
+namespace kernel {
+namespace resource {
+
+/***********
+ * Classes *
+ ***********/
+
+class XBT_PRIVATE NetworkConstantModel;
+class XBT_PRIVATE NetworkConstantAction;
+
+/*********
+ * Model *
+ *********/
+class NetworkConstantModel : public NetworkModel {
+public:
+ NetworkConstantModel() : NetworkModel(Model::UpdateAlgo::Full) {}
+ Action* communicate(simgrid::s4u::Host* src, simgrid::s4u::Host* dst, double size, double rate) override;
+ double next_occuring_event(double now) override;
+ void update_actions_state(double now, double delta) override;
+
+ LinkImpl* createLink(const std::string& name, double bw, double lat, e_surf_link_sharing_policy_t policy) override;
};
/**********
}
}
+} // namespace simgrid
#endif /* NETWORK_CONSTANT_HPP_ */
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network);
static void IB_create_host_callback(simgrid::s4u::Host& host){
- using simgrid::surf::NetworkIBModel;
- using simgrid::surf::IBNode;
+ using simgrid::kernel::resource::IBNode;
+ using simgrid::kernel::resource::NetworkIBModel;
static int id=0;
// pour t->id -> rajouter une nouvelle struct dans le dict, pour stocker les comms actives
((NetworkIBModel*)surf_network_model)->active_nodes.insert({host.get_name(), act});
}
-static void IB_action_state_changed_callback(simgrid::surf::NetworkAction* action)
+static void IB_action_state_changed_callback(simgrid::kernel::resource::NetworkAction* action)
{
- using simgrid::surf::NetworkIBModel;
- using simgrid::surf::IBNode;
+ using simgrid::kernel::resource::IBNode;
+ using simgrid::kernel::resource::NetworkIBModel;
if (action->get_state() != simgrid::kernel::resource::Action::State::done)
return;
}
-static void IB_action_init_callback(simgrid::surf::NetworkAction* action, simgrid::s4u::Host* src,
+static void IB_action_init_callback(simgrid::kernel::resource::NetworkAction* action, simgrid::s4u::Host* src,
simgrid::s4u::Host* dst)
{
- simgrid::surf::NetworkIBModel* ibModel = (simgrid::surf::NetworkIBModel*)surf_network_model;
- simgrid::surf::IBNode* act_src;
- simgrid::surf::IBNode* act_dst;
+ simgrid::kernel::resource::NetworkIBModel* ibModel = (simgrid::kernel::resource::NetworkIBModel*)surf_network_model;
+ simgrid::kernel::resource::IBNode* act_src;
+ simgrid::kernel::resource::IBNode* act_dst;
auto asrc = ibModel->active_nodes.find(src->get_name());
if (asrc != ibModel->active_nodes.end()) {
if (surf_network_model)
return;
- surf_network_model = new simgrid::surf::NetworkIBModel();
+ surf_network_model = new simgrid::kernel::resource::NetworkIBModel();
all_existing_models->push_back(surf_network_model);
simgrid::s4u::Link::onCommunicationStateChange.connect(IB_action_state_changed_callback);
simgrid::s4u::Link::onCommunicate.connect(IB_action_init_callback);
}
namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
NetworkIBModel::NetworkIBModel() : NetworkSmpiModel()
{
}
}
}
+} // namespace simgrid
#include <vector>
namespace simgrid {
- namespace surf {
+namespace kernel {
+namespace resource {
- class XBT_PRIVATE IBNode;
+class XBT_PRIVATE IBNode;
- class XBT_PRIVATE ActiveComm{
- public :
- //IBNode* origin;
- IBNode* destination;
- NetworkAction *action;
- double init_rate;
- ActiveComm() : destination(nullptr),action(nullptr),init_rate(-1){};
- virtual ~ActiveComm() = default;
- };
+class XBT_PRIVATE ActiveComm {
+public:
+ IBNode* destination;
+ NetworkAction* action;
+ double init_rate;
+ ActiveComm() : destination(nullptr), action(nullptr), init_rate(-1){};
+ virtual ~ActiveComm() = default;
+};
- class IBNode{
- public :
- int id;
- //store related links, to ease computation of the penalties
- std::vector<ActiveComm*> ActiveCommsUp;
- //store the number of comms received from each node
- std::map<IBNode*, int> ActiveCommsDown;
- //number of comms the node is receiving
- int nbActiveCommsDown;
- explicit IBNode(int id) : id(id),nbActiveCommsDown(0){};
- virtual ~IBNode() = default;
- };
+class IBNode {
+public:
+ int id;
+ // store related links, to ease computation of the penalties
+ std::vector<ActiveComm*> ActiveCommsUp;
+ // store the number of comms received from each node
+ std::map<IBNode*, int> ActiveCommsDown;
+ // number of comms the node is receiving
+ int nbActiveCommsDown;
+ explicit IBNode(int id) : id(id), nbActiveCommsDown(0){};
+ virtual ~IBNode() = default;
+};
- class XBT_PRIVATE NetworkIBModel : public NetworkSmpiModel {
- private:
- void updateIBfactors_rec(IBNode* root, std::vector<bool>& updatedlist);
- void computeIBfactors(IBNode *root);
- public:
- NetworkIBModel();
- explicit NetworkIBModel(const char *name);
- ~NetworkIBModel() override;
- void updateIBfactors(NetworkAction *action, IBNode *from, IBNode * to, int remove);
+class XBT_PRIVATE NetworkIBModel : public NetworkSmpiModel {
+private:
+ void updateIBfactors_rec(IBNode* root, std::vector<bool>& updatedlist);
+ void computeIBfactors(IBNode* root);
- std::unordered_map<std::string, IBNode*> active_nodes;
- std::unordered_map<NetworkAction*, std::pair<IBNode*, IBNode*>> active_comms;
+public:
+ NetworkIBModel();
+ explicit NetworkIBModel(const char* name);
+ ~NetworkIBModel() override;
+ void updateIBfactors(NetworkAction* action, IBNode* from, IBNode* to, int remove);
- double Bs;
- double Be;
- double ys;
+ std::unordered_map<std::string, IBNode*> active_nodes;
+ std::unordered_map<NetworkAction*, std::pair<IBNode*, IBNode*>> active_comms;
- };
-
- }
+ double Bs;
+ double Be;
+ double ys;
+};
}
-
+} // namespace kernel
+} // namespace simgrid
#endif
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network, surf, "Logging specific to the SURF network module");
namespace simgrid {
- namespace surf {
+namespace kernel {
+namespace resource {
- /* List of links */
- std::unordered_map<std::string, LinkImpl*>* LinkImpl::links = new std::unordered_map<std::string, LinkImpl*>();
+/* List of links */
+std::unordered_map<std::string, LinkImpl*>* LinkImpl::links = new std::unordered_map<std::string, LinkImpl*>();
- LinkImpl* LinkImpl::byName(std::string name)
- {
- auto link = links->find(name);
- return link == links->end() ? nullptr : link->second;
+LinkImpl* LinkImpl::byName(std::string name)
+{
+ auto link = links->find(name);
+ return link == links->end() ? nullptr : link->second;
}
/** @brief Returns the amount of links in the platform */
int LinkImpl::linksCount()
}
}
}
+} // namespace simgrid
/*********
* Model *
*********/
-simgrid::surf::NetworkModel *surf_network_model = nullptr;
+simgrid::kernel::resource::NetworkModel* surf_network_model = nullptr;
namespace simgrid {
- namespace surf {
+namespace kernel {
+namespace resource {
- /** @brief Command-line option 'network/TCP-gamma' -- see \ref options_model_network_gamma */
- simgrid::config::Flag<double> NetworkModel::cfg_tcp_gamma(
- {"network/TCP-gamma", "network/TCP_gamma"},
- "Size of the biggest TCP window (cat /proc/sys/net/ipv4/tcp_[rw]mem for recv/send window; "
- "Use the last given value, which is the max window size)",
- 4194304.0);
+/** @brief Command-line option 'network/TCP-gamma' -- see \ref options_model_network_gamma */
+simgrid::config::Flag<double> NetworkModel::cfg_tcp_gamma(
+ {"network/TCP-gamma", "network/TCP_gamma"},
+ "Size of the biggest TCP window (cat /proc/sys/net/ipv4/tcp_[rw]mem for recv/send window; "
+ "Use the last given value, which is the max window size)",
+ 4194304.0);
- /** @brief Command-line option 'network/crosstraffic' -- see \ref options_model_network_crosstraffic */
- simgrid::config::Flag<bool> NetworkModel::cfg_crosstraffic(
- "network/crosstraffic",
- "Activate the interferences between uploads and downloads for fluid max-min models (LV08, CM02)", "yes");
+/** @brief Command-line option 'network/crosstraffic' -- see \ref options_model_network_crosstraffic */
+simgrid::config::Flag<bool> NetworkModel::cfg_crosstraffic(
+ "network/crosstraffic",
+ "Activate the interferences between uploads and downloads for fluid max-min models (LV08, CM02)", "yes");
- NetworkModel::~NetworkModel() = default;
+NetworkModel::~NetworkModel() = default;
- double NetworkModel::latencyFactor(double /*size*/) {
- return sg_latency_factor;
+double NetworkModel::latencyFactor(double /*size*/)
+{
+ return sg_latency_factor;
}
double NetworkModel::bandwidthFactor(double /*size*/) {
{
double minRes = Model::next_occuring_event_full(now);
- for (kernel::resource::Action const& action : *get_running_action_set()) {
+ for (Action const& action : *get_running_action_set()) {
const NetworkAction& net_action = static_cast<const NetworkAction&>(action);
if (net_action.latency_ > 0)
minRes = (minRes < 0) ? net_action.latency_ : std::min(minRes, net_action.latency_);
* Resource *
************/
- LinkImpl::LinkImpl(simgrid::surf::NetworkModel* model, const std::string& name, kernel::lmm::Constraint* constraint)
+ LinkImpl::LinkImpl(NetworkModel* model, const std::string& name, lmm::Constraint* constraint)
: Resource(model, name, constraint), piface_(this)
{
for (int i = 0; i < llen; i++) {
/* Beware of composite actions: ptasks put links and cpus together */
// extra pb: we cannot dynamic_cast from void*...
- kernel::resource::Resource* resource =
- static_cast<kernel::resource::Resource*>(get_variable()->get_constraint(i)->get_id());
+ Resource* resource = static_cast<Resource*>(get_variable()->get_constraint(i)->get_id());
LinkImpl* link = dynamic_cast<LinkImpl*>(resource);
if (link != nullptr)
retlist.push_back(link);
return retlist;
}
}
+ } // namespace kernel
}
#endif /* NETWORK_INTERFACE_CPP_ */
***********/
namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
/*********
* Model *
*********/
* @brief SURF network model interface class
* @details A model is an object which handles the interactions between its Resources and its Actions
*/
-class NetworkModel : public kernel::resource::Model {
+class NetworkModel : public Model {
public:
static simgrid::config::Flag<double> cfg_tcp_gamma;
static simgrid::config::Flag<bool> cfg_crosstraffic;
- explicit NetworkModel(kernel::resource::Model::UpdateAlgo algo) : Model(algo) {}
+ explicit NetworkModel(Model::UpdateAlgo algo) : Model(algo) {}
~NetworkModel() override;
/**
* unlimited.
* @return The action representing the communication
*/
- virtual kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) = 0;
+ virtual Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) = 0;
/**
* @brief Get the right multiplicative factor for the latency.
* @brief SURF network link interface class
* @details A Link represents the link between two [hosts](\ref simgrid::surf::HostImpl)
*/
-class LinkImpl : public simgrid::kernel::resource::Resource, public simgrid::surf::PropertyHolder {
+class LinkImpl : public Resource, public simgrid::surf::PropertyHolder {
protected:
- LinkImpl(simgrid::surf::NetworkModel* model, const std::string& name, kernel::lmm::Constraint* constraint);
+ LinkImpl(NetworkModel* model, const std::string& name, lmm::Constraint* constraint);
~LinkImpl() override;
public:
* @brief SURF network action interface class
* @details A NetworkAction represents a communication between two [hosts](\ref HostImpl)
*/
-class NetworkAction : public simgrid::kernel::resource::Action {
+class NetworkAction : public Action {
public:
/** @brief Constructor
*
* @param cost The cost of this NetworkAction in [TODO]
* @param failed [description]
*/
- NetworkAction(simgrid::kernel::resource::Model* model, double cost, bool failed)
- : simgrid::kernel::resource::Action(model, cost, failed)
- {
- }
+ NetworkAction(Model* model, double cost, bool failed) : Action(model, cost, failed) {}
/**
* @brief NetworkAction constructor
*
* @param model The NetworkModel associated to this NetworkAction
- * @param cost The cost of this NetworkAction in [TODO]
- * @param failed [description]
+ * @param cost The cost of this NetworkAction in bytes
+ * @param failed Actions can be created in a failed state
* @param var The lmm variable associated to this Action if it is part of a LMM component
*/
- NetworkAction(simgrid::kernel::resource::Model* model, double cost, bool failed, kernel::lmm::Variable* var)
- : simgrid::kernel::resource::Action(model, cost, failed, var){};
+ NetworkAction(Model* model, double cost, bool failed, lmm::Variable* var) : Action(model, cost, failed, var){};
- void set_state(simgrid::kernel::resource::Action::State state) override;
+ void set_state(Action::State state) override;
virtual std::list<LinkImpl*> links();
double latency_ = {};
};
}
}
-
+} // namespace simgrid
/** \ingroup SURF_models
* \brief The network model
*/
-XBT_PUBLIC_DATA simgrid::surf::NetworkModel* surf_network_model;
+XBT_PUBLIC_DATA simgrid::kernel::resource::NetworkModel* surf_network_model;
#endif /* SURF_NETWORK_INTERFACE_HPP_ */
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<simgrid::surf::LinkImpl*>& link_list)
+ std::vector<simgrid::kernel::resource::LinkImpl*>& link_list)
{
if (link_list.size() == 1) {
- simgrid::surf::LinkNS3* link = static_cast<simgrid::surf::LinkNS3*>(link_list[0]);
+ simgrid::kernel::resource::LinkNS3* link = static_cast<simgrid::kernel::resource::LinkNS3*>(link_list[0]);
XBT_DEBUG("Route from '%s' to '%s' with link '%s' %s", src->get_cname(), dst->get_cname(), link->get_cname(),
(symmetrical ? "(symmetrical)" : "(not symmetrical)"));
if (surf_network_model)
return;
- surf_network_model = new simgrid::surf::NetworkNS3Model();
+ surf_network_model = new simgrid::kernel::resource::NetworkNS3Model();
all_existing_models->push_back(surf_network_model);
}
ns3_tcp_model("ns3/TcpModel", "The ns3 tcp model can be : NewReno or Reno or Tahoe", "default");
namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
NetworkNS3Model::NetworkNS3Model() : NetworkModel(Model::UpdateAlgo::Full)
{
THROW_IMPOSSIBLE;
}
+} // namespace resource
}
}
#include "network_interface.hpp"
namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
class NetworkNS3Model : public NetworkModel {
public:
s4u::Host* dst_;
};
+} // namespace resource
}
}
{
if (surf_network_model)
return;
- surf_network_model = new simgrid::surf::NetworkSmpiModel();
+ surf_network_model = new simgrid::kernel::resource::NetworkSmpiModel();
all_existing_models->push_back(surf_network_model);
xbt_cfg_setdefault_double("network/weight-S", 8775);
}
namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
NetworkSmpiModel::NetworkSmpiModel() : NetworkCm02Model()
{
**********/
}
}
+} // namespace simgrid
#include "network_cm02.hpp"
namespace simgrid {
- namespace surf {
+namespace kernel {
+namespace resource {
- class XBT_PRIVATE NetworkSmpiModel : public NetworkCm02Model {
- public:
- NetworkSmpiModel();
- ~NetworkSmpiModel();
+class XBT_PRIVATE NetworkSmpiModel : public NetworkCm02Model {
+public:
+ NetworkSmpiModel();
+ ~NetworkSmpiModel();
- double latencyFactor(double size);
- double bandwidthFactor(double size);
- double bandwidthConstraint(double rate, double bound, double size);
- };
- }
+ double latencyFactor(double size);
+ double bandwidthFactor(double size);
+ double bandwidthConstraint(double rate, double bound, double size);
+};
+} // namespace resource
+} // namespace kernel
}
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(ns3);
-SgFlow::SgFlow(uint32_t totalBytes, simgrid::surf::NetworkNS3Action* action)
+SgFlow::SgFlow(uint32_t totalBytes, simgrid::kernel::resource::NetworkNS3Action* action)
{
totalBytes_ = totalBytes;
remaining_ = totalBytes;
#define NS3_SIMULATOR_HPP
#include "simgrid/s4u/Host.hpp"
+#include "src/surf/network_ns3.hpp"
#include <ns3/node.h>
#include <ns3/tcp-socket-factory.h>
#include <cstdint>
-namespace simgrid {
-namespace surf {
-class NetworkNS3Action;
-}
-} // namespace simgrid
-
class NetPointNs3 {
public:
static simgrid::xbt::Extension<simgrid::kernel::routing::NetPoint, NetPointNs3> EXTENSION_ID;
class XBT_PRIVATE SgFlow {
public:
- SgFlow(uint32_t totalBytes, simgrid::surf::NetworkNS3Action* action);
+ SgFlow(uint32_t totalBytes, simgrid::kernel::resource::NetworkNS3Action* action);
// private:
std::uint32_t bufferedBytes_ = 0;
std::uint32_t remaining_;
std::uint32_t totalBytes_;
bool finished_ = false;
- simgrid::surf::NetworkNS3Action* action_;
+ simgrid::kernel::resource::NetworkNS3Action* action_;
};
void StartFlow(ns3::Ptr<ns3::Socket> sock, const char* to, uint16_t port_number);
using simgrid::plugin::LinkEnergy;
/* **************************** events callback *************************** */
-static void onCommunicate(simgrid::surf::NetworkAction* action, simgrid::s4u::Host* src, simgrid::s4u::Host* dst)
+static void onCommunicate(simgrid::kernel::resource::NetworkAction* action, simgrid::s4u::Host* src,
+ simgrid::s4u::Host* dst)
{
XBT_DEBUG("onCommunicate is called");
- for (simgrid::surf::LinkImpl* link : action->links()) {
+ for (simgrid::kernel::resource::LinkImpl* link : action->links()) {
if (link == nullptr)
continue;
link.extension<LinkEnergy>()->getConsumedEnergy());
});
- simgrid::s4u::Link::onCommunicationStateChange.connect([](simgrid::surf::NetworkAction* action) {
- for (simgrid::surf::LinkImpl* link : action->links()) {
+ simgrid::s4u::Link::onCommunicationStateChange.connect([](simgrid::kernel::resource::NetworkAction* action) {
+ for (simgrid::kernel::resource::LinkImpl* link : action->links()) {
if (link != nullptr)
link->piface_.extension<LinkEnergy>()->update();
}
if (bytes_amount[i * host_nb + j] > 0) {
double lat=0.0;
- std::vector<LinkImpl*> route;
+ std::vector<kernel::resource::LinkImpl*> route;
hostList_->at(i)->routeTo(hostList_->at(j), route, &lat);
latency = std::max(latency, lat);
for (int i = 0; i < host_nb; i++) {
for (int j = 0; j < host_nb; j++) {
if (bytes_amount[i * host_nb + j] > 0.0) {
- std::vector<LinkImpl*> route;
+ std::vector<kernel::resource::LinkImpl*> route;
hostList_->at(i)->routeTo(hostList_->at(j), route, nullptr);
for (auto const& link : route)
return new CpuL07(this, host, speedPerPstate, core);
}
-LinkImpl* NetworkL07Model::createLink(const std::string& name, double bandwidth, double latency,
- e_surf_link_sharing_policy_t policy)
+kernel::resource::LinkImpl* NetworkL07Model::createLink(const std::string& name, double bandwidth, double latency,
+ e_surf_link_sharing_policy_t policy)
{
return new LinkL07(this, name, bandwidth, latency, policy);
}
if (communicationAmount_[i * hostNb + j] > 0) {
double lat = 0.0;
- std::vector<LinkImpl*> route;
+ std::vector<kernel::resource::LinkImpl*> route;
hostList_->at(i)->routeTo(hostList_->at(j), route, &lat);
lat_current = std::max(lat_current, lat * communicationAmount_[i * hostNb + j]);
}
}
}
- double lat_bound = NetworkModel::cfg_tcp_gamma / (2.0 * lat_current);
+ double lat_bound = kernel::resource::NetworkModel::cfg_tcp_gamma / (2.0 * lat_current);
XBT_DEBUG("action (%p) : lat_bound = %g", this, lat_bound);
if ((latency_ <= 0.0) && (suspended_ == Action::SuspendStates::not_suspended)) {
if (rate_ < 0)
HostL07Model *hostModel_;
};
-class NetworkL07Model : public NetworkModel {
+class NetworkL07Model : public kernel::resource::NetworkModel {
public:
NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys);
~NetworkL07Model();
- LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
- e_surf_link_sharing_policy_t policy) override;
+ kernel::resource::LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
+ e_surf_link_sharing_policy_t policy) override;
kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
void onSpeedChange() override;
};
-class LinkL07 : public LinkImpl {
+class LinkL07 : public kernel::resource::LinkImpl {
public:
LinkL07(NetworkL07Model* model, const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy);
names.push_back(link->id);
}
for (auto const& link_name : names) {
- simgrid::surf::LinkImpl* l =
+ simgrid::kernel::resource::LinkImpl* l =
surf_network_model->createLink(link_name, link->bandwidth, link->latency, link->policy);
if (link->properties) {
// other columns are to store one or more link for the node
//add a loopback link
- simgrid::surf::LinkImpl* linkUp = nullptr;
- simgrid::surf::LinkImpl* linkDown = nullptr;
+ simgrid::kernel::resource::LinkImpl* linkUp = nullptr;
+ simgrid::kernel::resource::LinkImpl* linkDown = nullptr;
if(cluster->loopback_bw > 0 || cluster->loopback_lat > 0){
std::string tmp_link = link_id + "_loopback";
XBT_DEBUG("<loopback\tid=\"%s\"\tbw=\"%f\"/>", tmp_link.c_str(), cluster->loopback_bw);
link.latency = cluster->loopback_lat;
link.policy = SURF_LINK_FATPIPE;
sg_platf_new_link(&link);
- linkUp = simgrid::surf::LinkImpl::byName(tmp_link);
- linkDown = simgrid::surf::LinkImpl::byName(tmp_link);
+ linkUp = simgrid::kernel::resource::LinkImpl::byName(tmp_link);
+ linkDown = simgrid::kernel::resource::LinkImpl::byName(tmp_link);
auto* as_cluster = static_cast<ClusterZone*>(current_as);
as_cluster->private_links_.insert({as_cluster->node_pos(rankId), {linkUp, linkDown}});
link.latency = 0;
link.policy = SURF_LINK_SHARED;
sg_platf_new_link(&link);
- linkDown = simgrid::surf::LinkImpl::byName(tmp_link);
+ linkDown = simgrid::kernel::resource::LinkImpl::byName(tmp_link);
linkUp = linkDown;
current_as->private_links_.insert({current_as->node_pos_with_loopback(rankId), {linkUp, linkDown}});
}
XBT_DEBUG("<link\tid=\"%s\" bw=\"%f\" lat=\"%f\"/>", link.id.c_str(), cluster->bb_bw, cluster->bb_lat);
sg_platf_new_link(&link);
- routing_cluster_add_backbone(simgrid::surf::LinkImpl::byName(link.id));
+ routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl::byName(link.id));
}
XBT_DEBUG("</AS>");
delete cluster->radicals;
}
-void routing_cluster_add_backbone(simgrid::surf::LinkImpl* bb)
+void routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl* bb)
{
simgrid::kernel::routing::ClusterZone* cluster =
dynamic_cast<simgrid::kernel::routing::ClusterZone*>(current_routing);
xbt_assert(dynamic_cast<simgrid::kernel::routing::ClusterZone*>(current_routing),
"Only hosts from Cluster and Vivaldi ASes can get an host_link.");
- simgrid::surf::LinkImpl* linkUp = simgrid::surf::LinkImpl::byName(hostlink->link_up);
- simgrid::surf::LinkImpl* linkDown = simgrid::surf::LinkImpl::byName(hostlink->link_down);
+ simgrid::kernel::resource::LinkImpl* linkUp = simgrid::kernel::resource::LinkImpl::byName(hostlink->link_up);
+ simgrid::kernel::resource::LinkImpl* linkDown = simgrid::kernel::resource::LinkImpl::byName(hostlink->link_down);
xbt_assert(linkUp, "Link '%s' not found!", hostlink->link_up.c_str());
xbt_assert(linkDown, "Link '%s' not found!", hostlink->link_down.c_str());
NetPoint* dst = nullptr;
NetPoint* gw_src = nullptr;
NetPoint* gw_dst = nullptr;
- std::vector<simgrid::surf::LinkImpl*> link_list;
+ std::vector<simgrid::kernel::resource::LinkImpl*> link_list;
};
enum class ClusterTopology { DRAGONFLY = 3, FAT_TREE = 2, FLAT = 1, TORUS = 0 };
extern "C" {
/********** Routing **********/
-void routing_cluster_add_backbone(simgrid::surf::LinkImpl* bb);
+void routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl* bb);
/*** END of the parsing cruft ***/
XBT_PUBLIC void sg_platf_begin(); // Start a new platform
#include "simgrid_dtd.c"
static const char* surf_parsed_filename; // Currently parsed file (for the error messages)
-std::vector<simgrid::surf::LinkImpl*> parsed_link_list; /* temporary store of current list link of a route */
+std::vector<simgrid::kernel::resource::LinkImpl*>
+ parsed_link_list; /* temporary store of current list link of a route */
/*
* Helping functions
void STag_surfxml_link___ctn()
{
- simgrid::surf::LinkImpl* link = nullptr;
+ simgrid::kernel::resource::LinkImpl* link = nullptr;
switch (A_surfxml_link___ctn_direction) {
case AU_surfxml_link___ctn_direction:
case A_surfxml_link___ctn_direction_NONE:
- link = simgrid::surf::LinkImpl::byName(A_surfxml_link___ctn_id);
+ link = simgrid::kernel::resource::LinkImpl::byName(A_surfxml_link___ctn_id);
break;
case A_surfxml_link___ctn_direction_UP:
- link = simgrid::surf::LinkImpl::byName(std::string(A_surfxml_link___ctn_id) + "_UP");
+ link = simgrid::kernel::resource::LinkImpl::byName(std::string(A_surfxml_link___ctn_id) + "_UP");
break;
case A_surfxml_link___ctn_direction_DOWN:
- link = simgrid::surf::LinkImpl::byName(std::string(A_surfxml_link___ctn_id) + "_DOWN");
+ link = simgrid::kernel::resource::LinkImpl::byName(std::string(A_surfxml_link___ctn_id) + "_DOWN");
break;
default:
surf_parse_error(std::string("Invalid direction for link ") + A_surfxml_link___ctn_id);
link.policy = SURF_LINK_SHARED;
sg_platf_new_link(&link);
- routing_cluster_add_backbone(simgrid::surf::LinkImpl::byName(A_surfxml_backbone_id));
+ routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl::byName(A_surfxml_backbone_id));
}
void STag_surfxml_route(){
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<simgrid::surf::LinkImpl*> route;
+ std::vector<simgrid::kernel::resource::LinkImpl*> route;
simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint;
simgrid::kernel::routing::NetZoneImpl::get_global_route(netcardSrc, netcardDst, route, nullptr);
if (not route.empty()) {
for (auto const& netcardDst : netcardList) { // to router
if (netcardDst->is_router()) {
std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->get_cname(), netcardDst->get_cname());
- std::vector<simgrid::surf::LinkImpl*> route;
+ std::vector<simgrid::kernel::resource::LinkImpl*> route;
simgrid::kernel::routing::NetZoneImpl::get_global_route(netcardSrc, netcardDst, route, nullptr);
for (auto const& link : route)
std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
for (auto const& value2 : netcardList) { // to router
if (value2->is_router()) {
std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->get_cname(), value2->get_cname());
- std::vector<simgrid::surf::LinkImpl*> route;
+ std::vector<simgrid::kernel::resource::LinkImpl*> route;
simgrid::kernel::routing::NetZoneImpl::get_global_route(value1, value2, route, nullptr);
for (auto const& link : route)
std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host
simgrid::s4u::Host* host2 = hosts[it_dst];
std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->get_cname(), host2->get_cname());
- std::vector<simgrid::surf::LinkImpl*> route;
+ std::vector<simgrid::kernel::resource::LinkImpl*> route;
simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint;
simgrid::kernel::routing::NetZoneImpl::get_global_route(value1, netcardDst, route, nullptr);
for (auto const& link : route)