{
}
-void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat)
+void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
{
XBT_VERB("cluster getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id());
xbt_assert(not privateLinks_.empty(),
public:
explicit ClusterZone(NetZone* father, std::string name);
- void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
+ void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
void getGraph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
std::map<std::string, xbt_edge_t>* edges) override;
static void graph_node_data_free(void* n)
{
- graph_node_data_t data = static_cast<graph_node_data_t>(n);
- delete data;
+ delete static_cast<graph_node_data_t>(n);
}
static void graph_edge_data_free(void* e)
{
- sg_platf_route_cbarg_t e_route = static_cast<sg_platf_route_cbarg_t>(e);
- delete e_route;
+ delete static_cast<RouteCreationArgs*>(e);
}
/* Utility functions */
}
if (not found) {
- sg_platf_route_cbarg_t e_route = new s_sg_platf_route_cbarg_t;
+ RouteCreationArgs* e_route = new RouteCreationArgs();
e_route->link_list.push_back(surf_network_model->loopback_);
xbt_graph_new_edge(routeGraph_, node, node, e_route);
}
/* Parsing */
-void DijkstraZone::newRoute(int src_id, int dst_id, sg_platf_route_cbarg_t e_route)
+void DijkstraZone::newRoute(int src_id, int dst_id, RouteCreationArgs* e_route)
{
XBT_DEBUG("Load Route from \"%d\" to \"%d\"", src_id, dst_id);
xbt_node_t src = nullptr;
xbt_graph_new_edge(routeGraph_, src, dst, e_route);
}
-void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat)
+void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
{
getRouteCheckParams(src, dst);
int src_id = src->id();
if (edge == nullptr)
THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getCname(), dst->getCname());
- sg_platf_route_cbarg_t e_route = static_cast<sg_platf_route_cbarg_t>(xbt_graph_edge_get_data(edge));
+ RouteCreationArgs* e_route = static_cast<RouteCreationArgs*>(xbt_graph_edge_get_data(edge));
for (auto const& link : e_route->link_list) {
route->link_list.insert(route->link_list.begin(), link);
xbt_node_t u_node = xbt_graph_edge_get_target(edge);
graph_node_data_t data = static_cast<graph_node_data_t>(xbt_graph_node_get_data(u_node));
int u_id = data->graph_id;
- sg_platf_route_cbarg_t tmp_e_route = static_cast<sg_platf_route_cbarg_t>(xbt_graph_edge_get_data(edge));
+ RouteCreationArgs* tmp_e_route = static_cast<RouteCreationArgs*>(xbt_graph_edge_get_data(edge));
int cost_v_u = tmp_e_route->link_list.size(); /* count of links, old model assume 1 */
if (cost_v_u + cost_arr[v_id] < cost_arr[u_id]) {
if (edge == nullptr)
THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getCname(), dst->getCname());
- sg_platf_route_cbarg_t e_route = static_cast<sg_platf_route_cbarg_t>(xbt_graph_edge_get_data(edge));
+ RouteCreationArgs* e_route = static_cast<RouteCreationArgs*>(xbt_graph_edge_get_data(edge));
NetPoint* prev_gw_src = gw_src;
gw_src = e_route->gw_src;
* nodes */
/* Add the route to the base */
- sg_platf_route_cbarg_t e_route = newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 1);
+ RouteCreationArgs* e_route = newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 1);
newRoute(src->id(), dst->id(), e_route);
// Symmetrical YES
gw_src = gw_dst;
gw_dst = gw_tmp;
}
- sg_platf_route_cbarg_t link_route_back =
+ RouteCreationArgs* link_route_back =
newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 0);
newRoute(dst->id(), src->id(), link_route_back);
}
~DijkstraZone() override;
xbt_node_t routeGraphNewNode(int id, int graph_id);
xbt_node_t nodeMapSearch(int id);
- void newRoute(int src_id, int dst_id, sg_platf_route_cbarg_t e_route);
+ void newRoute(int src_id, int dst_id, RouteCreationArgs* e_route);
/* For each vertex (node) already in the graph,
* make sure it also has a loopback link; this loopback
* can potentially already be in the graph, and in that
* After this function returns, any node in the graph
* will have a loopback attached to it.
*/
- void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) override;
+ void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) override;
void addRoute(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical) override;
}
}
-void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* latency)
+void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* latency)
{
// Minimal routing version.
// TODO : non-minimal random one, and adaptive ?
explicit DragonflyZone(NetZone* father, std::string name);
~DragonflyZone() override;
// void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override;
- void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
+ void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
void parse_specific_arguments(ClusterCreationArgs* cluster) override;
void seal() override;
void generateRouters();
explicit EmptyZone(NetZone* father, std::string name);
~EmptyZone() override;
- void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override
+ void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override
{
/* There can't be route in an Empty zone */
}
return true;
}
-void FatTreeZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency)
+void FatTreeZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency)
{
if (dst->isRouter() || src->isRouter())
public:
explicit FatTreeZone(NetZone* father, std::string name);
~FatTreeZone() override;
- void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
+ void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
/** \brief Generate the fat tree
*
delete[] costTable_;
}
-void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat)
+void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
{
unsigned int table_size = getTableSize();
getRouteCheckParams(src, dst);
/* create a result route */
- std::vector<sg_platf_route_cbarg_t> route_stack;
+ std::vector<RouteCreationArgs*> route_stack;
unsigned int cur = dst->id();
do {
int pred = TO_FLOYD_PRED(src->id(), cur);
sg_netpoint_t prev_dst_gw = nullptr;
while (not route_stack.empty()) {
- sg_platf_route_cbarg_t e_route = route_stack.back();
+ RouteCreationArgs* e_route = route_stack.back();
route_stack.pop_back();
if (hierarchy_ == RoutingMode::recursive && prev_dst_gw != nullptr &&
prev_dst_gw->getCname() != e_route->gw_src->getCname()) {
/* Create Cost, Predecessor and Link tables */
costTable_ = new double[table_size * table_size]; /* link cost from host to host */
predecessorTable_ = new int[table_size * table_size]; /* predecessor host numbers */
- linkTable_ = new sg_platf_route_cbarg_t[table_size * table_size]; /* actual link between src and dst */
+ linkTable_ = new RouteCreationArgs*[table_size * table_size]; /* actual link between src and dst */
/* Initialize costs and predecessors */
for (unsigned int i = 0; i < table_size; i++)
/* Create Cost, Predecessor and Link tables */
costTable_ = new double[table_size * table_size]; /* link cost from host to host */
predecessorTable_ = new int[table_size * table_size]; /* predecessor host numbers */
- linkTable_ = new sg_platf_route_cbarg_t[table_size * table_size]; /* actual link between src and dst */
+ linkTable_ = new RouteCreationArgs*[table_size * table_size]; /* actual link between src and dst */
/* Initialize costs and predecessors */
for (unsigned int i = 0; i < table_size; i++)
/* Add the loopback if needed */
if (surf_network_model->loopback_ && hierarchy_ == RoutingMode::base) {
for (unsigned int i = 0; i < table_size; i++) {
- sg_platf_route_cbarg_t e_route = TO_FLOYD_LINK(i, i);
+ RouteCreationArgs* e_route = TO_FLOYD_LINK(i, i);
if (not e_route) {
- e_route = new s_sg_platf_route_cbarg_t;
- e_route->gw_src = nullptr;
- e_route->gw_dst = nullptr;
+ e_route = new RouteCreationArgs();
e_route->link_list.push_back(surf_network_model->loopback_);
TO_FLOYD_LINK(i, i) = e_route;
TO_FLOYD_PRED(i, i) = i;
explicit FloydZone(NetZone* father, std::string name);
~FloydZone() override;
- void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
+ void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
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) override;
/* vars to compute the Floyd algorithm. */
int* predecessorTable_;
double* costTable_;
- sg_platf_route_cbarg_t* linkTable_;
+ RouteCreationArgs** linkTable_;
};
}
}
/* Create table if needed */
if (not routingTable_)
- routingTable_ = new sg_platf_route_cbarg_t[table_size * table_size]();
+ routingTable_ = new RouteCreationArgs*[table_size * table_size]();
/* Add the loopback if needed */
if (surf_network_model->loopback_ && hierarchy_ == RoutingMode::base) {
for (unsigned int i = 0; i < table_size; i++) {
- sg_platf_route_cbarg_t e_route = TO_ROUTE_FULL(i, i);
+ RouteCreationArgs* e_route = TO_ROUTE_FULL(i, i);
if (not e_route) {
- e_route = new s_sg_platf_route_cbarg_t;
- e_route->gw_src = nullptr;
- e_route->gw_dst = nullptr;
+ e_route = new RouteCreationArgs();
e_route->link_list.push_back(surf_network_model->loopback_);
TO_ROUTE_FULL(i, i) = e_route;
}
}
}
-void FullZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t res, double* lat)
+void FullZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* res, double* lat)
{
XBT_DEBUG("full getLocalRoute from %s[%u] to %s[%u]", src->getCname(), src->id(), dst->getCname(), dst->id());
unsigned int table_size = getTableSize();
- sg_platf_route_cbarg_t e_route = TO_ROUTE_FULL(src->id(), dst->id());
+ RouteCreationArgs* e_route = TO_ROUTE_FULL(src->id(), dst->id());
if (e_route != nullptr) {
res->gw_src = e_route->gw_src;
unsigned int table_size = getTableSize();
if (not routingTable_)
- routingTable_ = new sg_platf_route_cbarg_t[table_size * table_size]();
+ routingTable_ = new RouteCreationArgs*[table_size * table_size]();
/* Check that the route does not already exist */
if (gw_dst) // inter-zone route (to adapt the error message, if any)
void seal() override;
~FullZone() override;
- void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
+ void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
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) override;
- sg_platf_route_cbarg_t* routingTable_ = nullptr;
+ RouteCreationArgs** routingTable_ = nullptr;
};
}
}
void NetZoneImpl::getGlobalRoute(routing::NetPoint* src, routing::NetPoint* dst,
/* OUT */ std::vector<surf::LinkImpl*>& links, double* latency)
{
- s_sg_platf_route_cbarg_t route;
+ RouteCreationArgs route;
XBT_DEBUG("Resolve route from '%s' to '%s'", src->getCname(), dst->getCname());
* @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(NetPoint * src, NetPoint * dst, sg_platf_route_cbarg_t into, double* latency) = 0;
+ virtual void getLocalRoute(NetPoint * src, NetPoint * dst, RouteCreationArgs * 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::NetPoint * src, routing::NetPoint * dst,
if (my_src == my_dst)
continue;
- sg_platf_route_cbarg_t route = new s_sg_platf_route_cbarg_t;
+ RouteCreationArgs* route = new RouteCreationArgs();
getLocalRoute(my_src, my_dst, route, nullptr);
/* ************************************************************************** */
/* ************************* GENERIC AUX FUNCTIONS ************************** */
/* change a route containing link names into a route containing link entities */
-sg_platf_route_cbarg_t RoutedZone::newExtendedRoute(RoutingMode hierarchy, NetPoint* src, NetPoint* dst,
- NetPoint* gw_src, NetPoint* gw_dst,
- std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical,
- bool change_order)
+RouteCreationArgs* RoutedZone::newExtendedRoute(RoutingMode hierarchy, NetPoint* src, NetPoint* dst, NetPoint* gw_src,
+ NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
+ bool symmetrical, bool change_order)
{
- sg_platf_route_cbarg_t result = new s_sg_platf_route_cbarg_t;
+ RouteCreationArgs* result = new RouteCreationArgs();
xbt_assert(hierarchy == RoutingMode::base || hierarchy == RoutingMode::recursive,
"The hierarchy of this netzone is neither BASIC nor RECURSIVE, I'm lost here.");
void getGraph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
std::map<std::string, xbt_edge_t>* edges) override;
- virtual sg_platf_route_cbarg_t newExtendedRoute(RoutingMode hierarchy, NetPoint* src, NetPoint* dst, NetPoint* gw_src,
- NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
- bool symmetrical, bool change_order);
+ virtual RouteCreationArgs* newExtendedRoute(RoutingMode hierarchy, NetPoint* src, NetPoint* dst, NetPoint* gw_src,
+ NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
+ bool symmetrical, bool change_order);
protected:
void getRouteCheckParams(NetPoint* src, NetPoint* dst);
}
}
-void TorusZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat)
+void TorusZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
{
XBT_VERB("torus getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id());
public:
explicit TorusZone(NetZone* father, std::string name);
void create_links_for_node(ClusterCreationArgs* cluster, int id, int rank, unsigned int position) override;
- void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
+ void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
void parse_specific_arguments(ClusterCreationArgs* cluster) override;
private:
privateLinks_.insert({netpoint->id(), {linkUp, linkDown}});
}
-void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat)
+void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
{
XBT_DEBUG("vivaldi getLocalRoute from '%s'[%u] '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id());
explicit VivaldiZone(NetZone* father, std::string name);
void setPeerLink(NetPoint* netpoint, double bw_in, double bw_out, std::string coord);
- void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
+ void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
};
namespace vivaldi {
mount_list.insert({mount->name, simgrid::surf::StorageImpl::byName(mount->storageId.c_str())});
}
-void sg_platf_new_route(sg_platf_route_cbarg_t route)
+void sg_platf_new_route(RouteCreationArgs* route)
{
routing_get_current()->addRoute(route->src, route->dst, route->gw_src, route->gw_dst, route->link_list,
route->symmetrical);
}
-void sg_platf_new_bypassRoute(sg_platf_route_cbarg_t bypassRoute)
+void sg_platf_new_bypassRoute(RouteCreationArgs* bypassRoute)
{
routing_get_current()->addBypassRoute(bypassRoute->src, bypassRoute->dst, bypassRoute->gw_src, bypassRoute->gw_dst,
bypassRoute->link_list, bypassRoute->symmetrical);
tmgr_trace_t state_trace;
};
-struct s_sg_platf_route_cbarg_t {
+class RouteCreationArgs {
+public:
bool symmetrical = false;
sg_netpoint_t src = nullptr;
sg_netpoint_t dst = nullptr;
sg_netpoint_t gw_dst = nullptr;
std::vector<simgrid::surf::LinkImpl*> link_list;
};
-typedef s_sg_platf_route_cbarg_t* sg_platf_route_cbarg_t;
class ClusterCreationArgs {
public:
XBT_PUBLIC(simgrid::kernel::routing::NetPoint*) // Add a router to the current Zone
sg_platf_new_router(std::string, const char* coords);
-XBT_PUBLIC(void) sg_platf_new_route (sg_platf_route_cbarg_t route); // Add a route
-XBT_PUBLIC(void) sg_platf_new_bypassRoute (sg_platf_route_cbarg_t bypassroute); // Add a bypassRoute
+XBT_PUBLIC(void) sg_platf_new_route(RouteCreationArgs* route); // Add a route
+XBT_PUBLIC(void) sg_platf_new_bypassRoute(RouteCreationArgs* bypassroute); // Add a bypassRoute
XBT_PUBLIC(void) sg_platf_new_trace(TraceCreationArgs* trace);
}
void ETag_surfxml_route(){
- s_sg_platf_route_cbarg_t route;
+ RouteCreationArgs route;
route.src = sg_netpoint_by_name_or_null(A_surfxml_route_src); // tested to not be nullptr in start tag
route.dst = sg_netpoint_by_name_or_null(A_surfxml_route_dst); // tested to not be nullptr in start tag
}
void ETag_surfxml_zoneRoute()
{
- s_sg_platf_route_cbarg_t ASroute;
+ RouteCreationArgs ASroute;
ASroute.src = sg_netpoint_by_name_or_null(A_surfxml_zoneRoute_src); // tested to not be nullptr in start tag
ASroute.dst = sg_netpoint_by_name_or_null(A_surfxml_zoneRoute_dst); // tested to not be nullptr in start tag
}
void ETag_surfxml_bypassRoute(){
- s_sg_platf_route_cbarg_t route;
+ RouteCreationArgs route;
route.src = sg_netpoint_by_name_or_null(A_surfxml_bypassRoute_src); // tested to not be nullptr in start tag
route.dst = sg_netpoint_by_name_or_null(A_surfxml_bypassRoute_dst); // tested to not be nullptr in start tag
}
void ETag_surfxml_bypassZoneRoute()
{
- s_sg_platf_route_cbarg_t ASroute;
+ RouteCreationArgs ASroute;
ASroute.src = sg_netpoint_by_name_or_null(A_surfxml_bypassZoneRoute_src);
ASroute.dst = sg_netpoint_by_name_or_null(A_surfxml_bypassZoneRoute_dst);