namespace surf {
class Resource;
class Cpu;
- class NetCard;
class Link;
}
+ namespace routing {
+ class NetCard;
+ }
namespace trace_mgr {
class trace;
class future_evt_set;
typedef simgrid::s4u::Mailbox simgrid_Mailbox;
typedef simgrid::simix::Synchro simix_Synchro;
typedef simgrid::surf::Cpu surf_Cpu;
-typedef simgrid::surf::NetCard surf_NetCard;
+typedef simgrid::routing::NetCard routing_NetCard;
typedef simgrid::surf::Link Link;
typedef simgrid::surf::Resource surf_Resource;
typedef simgrid::trace_mgr::trace tmgr_Trace;
typedef struct simgrid_Mailbox simgrid_Mailbox;
typedef struct simix_Synchro simix_Synchro;
typedef struct surf_Cpu surf_Cpu;
-typedef struct surf_NetCard surf_NetCard;
+typedef struct routing_NetCard routing_NetCard;
typedef struct surf_Resource surf_Resource;
typedef struct Link Link;
typedef struct Trace tmgr_Trace;
typedef simix_Synchro *smx_synchro_t;
typedef surf_Cpu *surf_cpu_t;
-typedef surf_NetCard *sg_netcard_t;
+typedef routing_NetCard *sg_netcard_t;
typedef surf_Resource *sg_resource_t;
// Types which are in fact dictelmt:
namespace simgrid {
namespace surf {
- class AsImpl;
class Link;
+}
+namespace routing {
+ class AsImpl;
class NetCard;
}
namespace s4u {
*/
XBT_PUBLIC_CLASS As {
protected:
- friend simgrid::surf::AsImpl;
+ friend simgrid::routing::AsImpl;
explicit As(const char *name);
virtual ~As();
As *father_ = nullptr; // FIXME: hide me
public:
/* Add content to the AS, at parsing time. It should be sealed afterward. */
- virtual int addComponent(surf::NetCard *elm); /* A host, a router or an AS, whatever */
+ virtual int addComponent(routing::NetCard *elm); /* A host, a router or an AS, whatever */
virtual void addRoute(sg_platf_route_cbarg_t route);
void addBypassRoute(sg_platf_route_cbarg_t e_route);
/** DO NOT USE DIRECTLY (@todo: these should be protected, once our code is clean) */
surf::Cpu *pimpl_cpu = nullptr;
/** DO NOT USE DIRECTLY (@todo: these should be protected, once our code is clean) */
- surf::NetCard *pimpl_netcard = nullptr;
+ routing::NetCard *pimpl_netcard = nullptr;
public:
/*** Called on each newly created object */
class Action;
class ActionLmm;
class StorageActionLmm;
+}
+namespace routing {
class RoutingPlatf;
}
}
typedef simgrid::surf::Action surf_Action;
typedef simgrid::surf::ActionLmm surf_ActionLmm;
typedef simgrid::surf::StorageActionLmm surf_StorageActionLmm;
-typedef simgrid::surf::RoutingPlatf surf_RoutingPlatf;
+typedef simgrid::routing::RoutingPlatf surf_RoutingPlatf;
#else
xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t), nullptr);
for (unsigned int index = 0; index < xbt_dynar_length(vertices_); index++) {
- simgrid::surf::NetCard *card = xbt_dynar_get_as(vertices_, index, simgrid::surf::NetCard*);
+ simgrid::routing::NetCard *card = xbt_dynar_get_as(vertices_, index, simgrid::routing::NetCard*);
simgrid::s4u::Host *host = simgrid::s4u::Host::by_name_or_null(card->name());
if (host!=nullptr)
xbt_dynar_push(res, &host);
return res;
}
- int As::addComponent(surf::NetCard *elm) {
- xbt_dynar_push_as(vertices_, surf::NetCard*, elm);
+ int As::addComponent(routing::NetCard *elm) {
+ xbt_dynar_push_as(vertices_, routing::NetCard*, elm);
return xbt_dynar_length(vertices_)-1;
}
* Note that a router is created, easing the interconnexion with the rest of the world. */
namespace simgrid {
-namespace surf {
+namespace routing {
AsCluster::AsCluster(const char*name)
: AsImpl(name)
{}
/* 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_ROUTING_CLUSTER_HPP_
-#define SURF_ROUTING_CLUSTER_HPP_
+#ifndef SIMGRID_ROUTING_CLUSTER_HPP_
+#define SIMGRID_ROUTING_CLUSTER_HPP_
#include "src/surf/AsImpl.hpp"
namespace simgrid {
-namespace surf {
+namespace routing {
class XBT_PRIVATE AsCluster: public AsImpl {
public:
}
}
-#endif /* SURF_ROUTING_CLUSTER_HPP_ */
+#endif /* SIMGRID_ROUTING_CLUSTER_HPP_ */
-
-
-
-
namespace simgrid {
-namespace surf {
+namespace routing {
AsClusterDragonfly::AsClusterDragonfly(const char*name)
: AsCluster(name) {
#include "src/surf/AsCluster.hpp"
namespace simgrid {
- namespace surf {
+ namespace routing {
class XBT_PRIVATE DragonflyRouter {
unsigned int group_;
unsigned int chassis_;
unsigned int blade_;
- Link** blueLinks_=NULL;
- Link** blackLinks_=NULL;
- Link** greenLinks_=NULL;
- Link** myNodes_=NULL;
+ surf::Link** blueLinks_=NULL;
+ surf::Link** blackLinks_=NULL;
+ surf::Link** greenLinks_=NULL;
+ surf::Link** myNodes_=NULL;
DragonflyRouter(int i, int j, int k);
~DragonflyRouter();
};
* is also not realistic, as blue level can use more links than a single
* Aries can handle, thus it should use several routers.
*/
-class XBT_PRIVATE AsClusterDragonfly:public simgrid::surf::AsCluster {
+class XBT_PRIVATE AsClusterDragonfly
+ : public AsCluster {
public:
explicit AsClusterDragonfly(const char*name);
~AsClusterDragonfly() override;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_fat_tree, surf, "Routing for fat trees");
namespace simgrid {
-namespace surf {
+namespace routing {
AsClusterFatTree::AsClusterFatTree(const char*name)
: AsCluster(name)
/* 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_ROUTING_CLUSTER_FAT_TREE_HPP_
-#define SURF_ROUTING_CLUSTER_FAT_TREE_HPP_
+#ifndef SIMGRID_ROUTING_CLUSTER_FAT_TREE_HPP_
+#define SIMGRID_ROUTING_CLUSTER_FAT_TREE_HPP_
#include "src/surf/AsCluster.hpp"
namespace simgrid {
-namespace surf {
+namespace routing {
class XBT_PRIVATE FatTreeLink;
namespace simgrid {
- namespace surf {
+ namespace routing {
AsClusterTorus::AsClusterTorus(const char*name)
: AsCluster(name) {
}
#include "src/surf/AsCluster.hpp"
namespace simgrid {
- namespace surf {
+ namespace routing {
- class XBT_PRIVATE AsClusterTorus:public simgrid::surf::AsCluster {
+ class XBT_PRIVATE AsClusterTorus : public simgrid::routing::AsCluster {
public:
explicit AsClusterTorus(const char*name);
~AsClusterTorus() override;
/* Utility functions */
namespace simgrid {
-namespace surf {
+namespace routing {
void AsDijkstra::seal()
{
xbt_node_t node = nullptr;
} s_route_cache_element_t, *route_cache_element_t;
namespace simgrid {
-namespace surf {
+namespace routing {
/***********
* Classes *
#define TO_FLOYD_LINK(i,j) (linkTable_)[(i)+(j)*table_size]
namespace simgrid {
-namespace surf {
+namespace routing {
AsFloyd::AsFloyd(const char*name)
: AsRoutedGraph(name)
#include "src/surf/AsRoutedGraph.hpp"
namespace simgrid {
-namespace surf {
+namespace routing {
/** Floyd routing data: slow initialization, fast lookup, lesser memory requirements, shortest path routing only */
class XBT_PRIVATE AsFloyd: public AsRoutedGraph {
#define TO_ROUTE_FULL(i,j) routingTable_[(i)+(j)*table_size]
namespace simgrid {
-namespace surf {
+namespace routing {
AsFull::AsFull(const char*name)
: AsRoutedGraph(name)
{
/* 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_ROUTING_FULL_HPP_
-#define SURF_ROUTING_FULL_HPP_
+#ifndef SIMGRID_ROUTING_FULL_HPP_
+#define SIMGRID_ROUTING_FULL_HPP_
#include "src/surf/AsRoutedGraph.hpp"
namespace simgrid {
-namespace surf {
+namespace routing {
/** Full routing: fast, large memory requirements, fully expressive */
class XBT_PRIVATE AsFull: public AsRoutedGraph {
}
}
-#endif /* SURF_ROUTING_FULL_HPP_ */
+#endif /* SIMGRID_ROUTING_FULL_HPP_ */
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(AsImpl,surf, "Implementation of S4U autonomous systems");
namespace simgrid {
- namespace surf {
+ namespace routing {
AsImpl::AsImpl(const char *name)
: As(name)
/* PRECONDITION: this is the common ancestor of src and dst */
- std::vector<surf::Link*> *AsImpl::getBypassRoute(surf::NetCard *src, surf::NetCard *dst)
+ std::vector<surf::Link*> *AsImpl::getBypassRoute(routing::NetCard *src, routing::NetCard *dst)
{
// If never set a bypass route return nullptr without any further computations
XBT_DEBUG("generic_get_bypassroute from %s to %s", src->name(), dst->name());
* \param links Where to store the links and the gw information
* \param latency If not nullptr, the latency of all links will be added in it
*/
- void AsImpl::getRouteRecursive(surf::NetCard *src, surf::NetCard *dst,
+ void AsImpl::getRouteRecursive(routing::NetCard *src, routing::NetCard *dst,
/* OUT */ std::vector<surf::Link*> * links, double *latency)
{
s_sg_platf_route_cbarg_t route;
#include "src/surf/xml/platf_private.hpp" // FIXME: kill sg_platf_route_cbarg_t to remove that UGLY include
namespace simgrid {
-namespace surf {
+namespace routing {
class RoutingPlatf; // FIXME: KILLME
/** @brief Autonomous Systems
* In SimGrid, there is a hierarchy of ASes, with a unique root AS (that you can retrieve from the s4u::Engine).
*/
XBT_PUBLIC_CLASS AsImpl : public s4u::As {
- friend simgrid::surf::RoutingPlatf;
+ friend simgrid::routing::RoutingPlatf;
protected:
explicit AsImpl(const char *name);
~AsImpl() override;
* @param into Container into which the traversed links should be pushed
* @param latency Accumulator in which the latencies should be added (caller must set it to 0)
*/
- virtual void getRouteAndLatency(surf::NetCard *src, surf::NetCard *dst, sg_platf_route_cbarg_t into, double *latency)=0;
+ virtual void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency)=0;
/** @brief retrieves the list of all routes of size 1 (of type src x dst x Link) */
virtual xbt_dynar_t getOneLinkRoutes();
- std::vector<surf::Link*> *getBypassRoute(surf::NetCard *src, surf::NetCard *dst);
+ std::vector<surf::Link*> *getBypassRoute(routing::NetCard *src, routing::NetCard *dst);
virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)=0;
- static void getRouteRecursive(surf::NetCard *src, surf::NetCard *dst, /* OUT */ std::vector<surf::Link*> * links, double *latency);
+ static void getRouteRecursive(routing::NetCard *src, routing::NetCard *dst, /* OUT */ std::vector<surf::Link*> * links, double *latency);
enum class RoutingMode {
};
/* FIXME: protect the following fields once the construction madness is sorted out */
RoutingMode hierarchy_ = RoutingMode::unset;
- surf::NetCard *netcard_ = nullptr; // Our representative in the father AS
+ routing::NetCard *netcard_ = nullptr; // Our representative in the father AS
};
}}; // Namespace simgrid::s4u
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_none, surf, "Routing part of surf");
namespace simgrid {
-namespace surf {
+namespace routing {
AsNone::AsNone(const char*name)
: AsImpl(name)
{}
#include "src/surf/AsImpl.hpp"
namespace simgrid {
-namespace surf {
+namespace routing {
/** No specific routing. Mainly useful with the constant network model */
class XBT_PRIVATE AsNone : public AsImpl {
}
namespace simgrid {
-namespace surf {
+namespace routing {
AsRoutedGraph::AsRoutedGraph(const char*name)
: AsImpl(name)
}
namespace simgrid {
-namespace surf {
+namespace routing {
xbt_dynar_t AsRoutedGraph::getOneLinkRoutes()
{
/* 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_ROUTING_GENERIC_HPP_
-#define SURF_ROUTING_GENERIC_HPP_
+#ifndef SIMGRID_ROUTING_GENERIC_HPP_
+#define SIMGRID_ROUTING_GENERIC_HPP_
#include "src/surf/AsImpl.hpp"
namespace simgrid {
-namespace surf {
+namespace routing {
class XBT_PRIVATE AsRoutedGraph : public AsImpl {
public:
}
}
-#endif /* SURF_ROUTING_GENERIC_HPP_ */
+#endif /* SIMGRID_ROUTING_GENERIC_HPP_ */
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_vivaldi, surf, "Routing part of surf");
namespace simgrid {
-namespace surf {
+namespace routing {
static inline double euclidean_dist_comp(int index, xbt_dynar_t src, xbt_dynar_t dst) {
double src_coord = xbt_dynar_get_as(src, index, double);
double dst_coord = xbt_dynar_get_as(dst, index, double);
#include "src/surf/AsCluster.hpp"
namespace simgrid {
-namespace surf {
+namespace routing {
/* This derivates from cluster because each host has a private link */
class XBT_PRIVATE AsVivaldi: public AsCluster {
/*********
* Model *
*********/
-HostImpl *HostModel::createHost(const char *name, NetCard *netElm, Cpu *cpu){
+HostImpl *HostModel::createHost(const char *name, routing::NetCard *netElm, Cpu *cpu){
xbt_dynar_t storageList = (xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL);
HostImpl *host = new simgrid::surf::HostImpl(surf_host_model, name, storageList, cpu);
HostModel() : Model() {}
~HostModel() override {}
- HostImpl *createHost(const char *name, NetCard *net, Cpu *cpu);
+ HostImpl *createHost(const char *name, routing::NetCard *net, Cpu *cpu);
virtual void adjustWeightOfDummyCpuActions();
virtual Action *executeParallelTask(int host_nb, sg_host_t *host_list,
xbt_dict_cursor_t cursor = nullptr;
char *edge_name;
- static_cast<simgrid::surf::AsImpl*>(as)->getGraph(graph, nodes, edges);
+ static_cast<simgrid::routing::AsImpl*>(as)->getGraph(graph, nodes, edges);
xbt_dict_foreach(edges,cursor,edge_name,edge) {
linkContainers(
PJ_container_get((const char*) edge->src->data),
}
}
- static_cast<simgrid::surf::AsImpl*>(as)->getGraph(graph, nodes, edges);
+ static_cast<simgrid::routing::AsImpl*>(as)->getGraph(graph, nodes, edges);
}
xbt_graph_t instr_routing_platform_graph (void)
}
}
-Action *NetworkCm02Model::communicate(NetCard *src, NetCard *dst, double size, double rate)
+Action *NetworkCm02Model::communicate(routing::NetCard *src, routing::NetCard *dst, double size, double rate)
{
int failed = 0;
double bandwidth_bound;
xbt_dict_t properties) override;
void updateActionsStateLazy(double now, double delta) override;
void updateActionsStateFull(double now, double delta) override;
- Action *communicate(NetCard *src, NetCard *dst, double size, double rate) override;
+ Action *communicate(routing::NetCard *src, routing::NetCard *dst, double size, double rate) override;
bool next_occuring_event_isIdempotent() override;
virtual void gapAppend(double size, const Link* link, NetworkAction* action);
protected:
* Action *
**********/
class NetworkCm02Action : public NetworkAction {
- friend Action *NetworkCm02Model::communicate(NetCard *src, NetCard *dst, double size, double rate);
+ friend Action *NetworkCm02Model::communicate(routing::NetCard *src, routing::NetCard *dst, double size, double rate);
friend NetworkSmpiModel;
public:
NetworkCm02Action(Model *model, double cost, bool failed)
}
}
- Action *NetworkConstantModel::communicate(NetCard *src, NetCard *dst, double size, double rate)
+ Action *NetworkConstantModel::communicate(routing::NetCard *src, routing::NetCard *dst, double size, double rate)
{
NetworkConstantAction *action = new NetworkConstantAction(this, size, sg_latency_factor);
NetworkConstantModel() : NetworkModel() { };
~NetworkConstantModel() override;
- Action *communicate(NetCard *src, NetCard *dst, double size, double rate) override;
+ Action *communicate(routing::NetCard *src, routing::NetCard *dst, double size, double rate) override;
double next_occuring_event(double now) override;
bool next_occuring_event_isIdempotent() override {return true;}
void updateActionsState(double now, double delta) override;
static void IB_action_init_callback(
- simgrid::surf::NetworkAction *action, simgrid::surf::NetCard *src, simgrid::surf::NetCard *dst)
+ simgrid::surf::NetworkAction *action, simgrid::routing::NetCard *src, simgrid::routing::NetCard *dst)
{
simgrid::surf::NetworkIBModel* ibModel = (simgrid::surf::NetworkIBModel*)surf_network_model;
simgrid::xbt::signal<void(simgrid::surf::Link*)> Link::onStateChange;
simgrid::xbt::signal<void(simgrid::surf::NetworkAction*, simgrid::surf::Action::State, simgrid::surf::Action::State)> networkActionStateChangedCallbacks;
- simgrid::xbt::signal<void(simgrid::surf::NetworkAction*, simgrid::surf::NetCard *src, simgrid::surf::NetCard *dst)> Link::onCommunicate;
+ simgrid::xbt::signal<void(simgrid::surf::NetworkAction*, simgrid::routing::NetCard *src, simgrid::routing::NetCard *dst)> Link::onCommunicate;
}
}
* unlimited.
* @return The action representing the communication
*/
- virtual Action *communicate(NetCard *src, NetCard *dst, double size, double rate)=0;
+ virtual Action *communicate(routing::NetCard *src, routing::NetCard *dst, double size, double rate)=0;
/** @brief Function pointer to the function to use to solve the lmm_system_t
*
/** @brief Callback signal fired when a communication starts
* Signature: `void(NetworkAction *action, RoutingEdge *src, RoutingEdge *dst)` */
- static simgrid::xbt::signal<void(simgrid::surf::NetworkAction*, simgrid::surf::NetCard *src, simgrid::surf::NetCard *dst)> onCommunicate;
+ static simgrid::xbt::signal<void(simgrid::surf::NetworkAction*, simgrid::routing::NetCard *src, simgrid::routing::NetCard *dst)> onCommunicate;
host.extension_set(NS3_EXTENSION_ID, ns3host);
}
-static void ns3_add_netcard(simgrid::surf::NetCard* netcard)
+static void ns3_add_netcard(simgrid::routing::NetCard* netcard)
{
const char* id = netcard->name();
xbt_free(host_list);
}
-Action *NetworkL07Model::communicate(NetCard *src, NetCard *dst, double size, double rate)
+Action *NetworkL07Model::communicate(routing::NetCard *src, routing::NetCard *dst, double size, double rate)
{
sg_host_t*host_list = xbt_new0(sg_host_t, 2);
double *flops_amount = xbt_new0(double, 2);
e_surf_link_sharing_policy_t policy,
xbt_dict_t properties) override;
- Action *communicate(NetCard *src, NetCard *dst, double size, double rate) override;
+ Action *communicate(routing::NetCard *src, routing::NetCard *dst, double size, double rate) override;
bool next_occuring_event_isIdempotent() override {return true;}
HostL07Model *p_hostModel;
int unref() override;
- std::vector<NetCard*> * p_netcardList = new std::vector<NetCard*>();
+ std::vector<routing::NetCard*> * p_netcardList = new std::vector<routing::NetCard*>();
double *p_computationAmount;
double *p_communicationAmount;
double m_latency;
/** The current AS in the parsing */
-static simgrid::surf::AsImpl *current_routing = nullptr;
-static simgrid::surf::AsImpl* routing_get_current()
+static simgrid::routing::AsImpl *current_routing = nullptr;
+static simgrid::routing::AsImpl* routing_get_current()
{
return current_routing;
}
{
xbt_assert(sg_host_by_name(host->id) == nullptr, "Refusing to create a second host named '%s'.", host->id);
- simgrid::surf::AsImpl* current_routing = routing_get_current();
- if (current_routing->hierarchy_ == simgrid::surf::AsImpl::RoutingMode::unset)
- current_routing->hierarchy_ = simgrid::surf::AsImpl::RoutingMode::base;
+ simgrid::routing::AsImpl* current_routing = routing_get_current();
+ if (current_routing->hierarchy_ == simgrid::routing::AsImpl::RoutingMode::unset)
+ current_routing->hierarchy_ = simgrid::routing::AsImpl::RoutingMode::base;
- simgrid::surf::NetCard *netcard =
- new simgrid::surf::NetCardImpl(host->id, simgrid::surf::NetCard::Type::Host, current_routing);
+ simgrid::routing::NetCard *netcard =
+ new simgrid::routing::NetCardImpl(host->id, simgrid::routing::NetCard::Type::Host, current_routing);
sg_host_t h = simgrid::s4u::Host::by_name_or_create(host->id);
h->pimpl_netcard = netcard;
/** @brief Add a "router" to the network element list */
void sg_platf_new_router(sg_platf_router_cbarg_t router)
{
- simgrid::surf::AsImpl* current_routing = routing_get_current();
+ simgrid::routing::AsImpl* current_routing = routing_get_current();
- if (current_routing->hierarchy_ == simgrid::surf::AsImpl::RoutingMode::unset)
- current_routing->hierarchy_ = simgrid::surf::AsImpl::RoutingMode::base;
+ if (current_routing->hierarchy_ == simgrid::routing::AsImpl::RoutingMode::unset)
+ current_routing->hierarchy_ = simgrid::routing::AsImpl::RoutingMode::base;
xbt_assert(nullptr == xbt_lib_get_or_null(as_router_lib, router->id, ROUTING_ASR_LEVEL),
"Refusing to create a router named '%s': this name already describes a node.", router->id);
- simgrid::surf::NetCard* netcard =
- new simgrid::surf::NetCardImpl(router->id, simgrid::surf::NetCard::Type::Router, current_routing);
+ simgrid::routing::NetCard* netcard =
+ new simgrid::routing::NetCardImpl(router->id, simgrid::routing::NetCard::Type::Router, current_routing);
xbt_lib_set(as_router_lib, router->id, ROUTING_ASR_LEVEL, netcard);
XBT_DEBUG("Router '%s' has the id %d", router->id, netcard->id());
void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
{
- using simgrid::surf::AsCluster;
- using simgrid::surf::AsClusterTorus;
- using simgrid::surf::AsClusterDragonfly;
- using simgrid::surf::AsClusterFatTree;
+ using simgrid::routing::AsCluster;
+ using simgrid::routing::AsClusterTorus;
+ using simgrid::routing::AsClusterFatTree;
+ using simgrid::routing::AsCluster;
+ using simgrid::routing::AsClusterTorus;
+ using simgrid::routing::AsClusterDragonfly;
+ using simgrid::routing::AsClusterFatTree;
int rankId=0;
break;
}
sg_platf_new_AS_begin(&AS);
- simgrid::surf::AsCluster *current_as = static_cast<AsCluster*>(routing_get_current());
+ simgrid::routing::AsCluster *current_as = static_cast<AsCluster*>(routing_get_current());
current_as->parse_specific_arguments(cluster);
if(cluster->loopback_bw!=0 || cluster->loopback_lat!=0){
if (!router.id || !strcmp(router.id, ""))
router.id = newid = bprintf("%s%s_router%s", cluster->prefix, cluster->id, cluster->suffix);
sg_platf_new_router(&router);
- current_as->router_ = (simgrid::surf::NetCard*) xbt_lib_get_or_null(as_router_lib, router.id, ROUTING_ASR_LEVEL);
+ current_as->router_ = (simgrid::routing::NetCard*) xbt_lib_get_or_null(as_router_lib, router.id, ROUTING_ASR_LEVEL);
free(newid);
//Make the backbone
simgrid::surf::on_cluster(cluster);
}
void routing_cluster_add_backbone(simgrid::surf::Link* bb) {
- simgrid::surf::AsCluster *cluster = dynamic_cast<simgrid::surf::AsCluster*>(current_routing);
+ simgrid::routing::AsCluster *cluster = dynamic_cast<simgrid::routing::AsCluster*>(current_routing);
xbt_assert(cluster, "Only hosts from Cluster can get a backbone.");
xbt_assert(nullptr == cluster->backbone_, "Cluster %s already has a backbone link!", cluster->name());
void sg_platf_new_peer(sg_platf_peer_cbarg_t peer)
{
- using simgrid::surf::NetCard;
- using simgrid::surf::AsCluster;
+ using simgrid::routing::NetCard;
+ using simgrid::routing::AsCluster;
char *host_id = bprintf("peer_%s", peer->id);
char *router_id = bprintf("router_%s", peer->id);
/* search the routing model */
- simgrid::surf::AsImpl *new_as = nullptr;
+ simgrid::routing::AsImpl *new_as = nullptr;
switch(AS->routing){
- case A_surfxml_AS_routing_Cluster: new_as = new simgrid::surf::AsCluster(AS->id); break;
- case A_surfxml_AS_routing_ClusterTorus: new_as = new simgrid::surf::AsClusterTorus(AS->id); break;
- case A_surfxml_AS_routing_ClusterDragonfly: new_as = new simgrid::surf::AsClusterDragonfly(AS->id); break;
- case A_surfxml_AS_routing_ClusterFatTree: new_as = new simgrid::surf::AsClusterFatTree(AS->id); break;
- case A_surfxml_AS_routing_Dijkstra: new_as = new simgrid::surf::AsDijkstra(AS->id, 0); break;
- case A_surfxml_AS_routing_DijkstraCache: new_as = new simgrid::surf::AsDijkstra(AS->id, 1); break;
- case A_surfxml_AS_routing_Floyd: new_as = new simgrid::surf::AsFloyd(AS->id); break;
- case A_surfxml_AS_routing_Full: new_as = new simgrid::surf::AsFull(AS->id); break;
- case A_surfxml_AS_routing_None: new_as = new simgrid::surf::AsNone(AS->id); break;
- case A_surfxml_AS_routing_Vivaldi: new_as = new simgrid::surf::AsVivaldi(AS->id); break;
+ case A_surfxml_AS_routing_Cluster: new_as = new simgrid::routing::AsCluster(AS->id); break;
+ case A_surfxml_AS_routing_ClusterDragonfly: new_as = new simgrid::routing::AsClusterDragonfly(AS->id); break;
+ case A_surfxml_AS_routing_ClusterTorus: new_as = new simgrid::routing::AsClusterTorus(AS->id); break;
+ case A_surfxml_AS_routing_ClusterFatTree: new_as = new simgrid::routing::AsClusterFatTree(AS->id); break;
+ case A_surfxml_AS_routing_Dijkstra: new_as = new simgrid::routing::AsDijkstra(AS->id, 0); break;
+ case A_surfxml_AS_routing_DijkstraCache: new_as = new simgrid::routing::AsDijkstra(AS->id, 1); break;
+ case A_surfxml_AS_routing_Floyd: new_as = new simgrid::routing::AsFloyd(AS->id); break;
+ case A_surfxml_AS_routing_Full: new_as = new simgrid::routing::AsFull(AS->id); break;
+ case A_surfxml_AS_routing_None: new_as = new simgrid::routing::AsNone(AS->id); break;
+ case A_surfxml_AS_routing_Vivaldi: new_as = new simgrid::routing::AsVivaldi(AS->id); break;
default: xbt_die("Not a valid model!"); break;
}
/* make a new routing component */
- simgrid::surf::NetCard *netcard = new simgrid::surf::NetCardImpl(new_as->name(), simgrid::surf::NetCard::Type::As, current_routing);
+ simgrid::routing::NetCard *netcard = new simgrid::routing::NetCardImpl(new_as->name(), simgrid::routing::NetCard::Type::As, current_routing);
if (current_routing == nullptr && routing_platf->root_ == nullptr) { /* it is the first one */
routing_platf->root_ = new_as;
/* it is a part of the tree */
new_as->father_ = current_routing;
/* set the father behavior */
- if (current_routing->hierarchy_ == simgrid::surf::AsImpl::RoutingMode::unset)
- current_routing->hierarchy_ = simgrid::surf::AsImpl::RoutingMode::recursive;
+ if (current_routing->hierarchy_ == simgrid::routing::AsImpl::RoutingMode::unset)
+ current_routing->hierarchy_ = simgrid::routing::AsImpl::RoutingMode::recursive;
/* add to the sons dictionary */
xbt_dict_set(current_routing->children(), AS->id, (void *) new_as, nullptr);
} else {
current_routing = new_as;
current_routing->netcard_ = netcard;
- simgrid::surf::asCreatedCallbacks(new_as);
+ simgrid::routing::asCreatedCallbacks(new_as);
if (TRACE_is_enabled())
sg_instr_AS_begin(AS);
{
xbt_assert(current_routing, "Cannot seal the current AS: none under construction");
current_routing->seal();
- current_routing = static_cast<simgrid::surf::AsImpl*>(current_routing->father());
+ current_routing = static_cast<simgrid::routing::AsImpl*>(current_routing->father());
if (TRACE_is_enabled())
sg_instr_AS_end();
/** @brief Add a link connecting an host to the rest of its AS (which must be cluster or vivaldi) */
void sg_platf_new_hostlink(sg_platf_host_link_cbarg_t hostlink)
{
- simgrid::surf::NetCard *netcard = sg_host_by_name(hostlink->id)->pimpl_netcard;
+ simgrid::routing::NetCard *netcard = sg_host_by_name(hostlink->id)->pimpl_netcard;
xbt_assert(netcard, "Host '%s' not found!", hostlink->id);
- xbt_assert(dynamic_cast<simgrid::surf::AsCluster*>(current_routing),
+ xbt_assert(dynamic_cast<simgrid::routing::AsCluster*>(current_routing),
"Only hosts from Cluster and Vivaldi ASes can get an host_link.");
s_surf_parsing_link_up_down_t link_up_down;
xbt_assert(link_up_down.linkDown, "Link '%s' not found!",hostlink->link_down);
// If dynar is is greater than netcard id and if the host_link is already defined
- auto as_cluster = static_cast<simgrid::surf::AsCluster*>(current_routing);
+ auto as_cluster = static_cast<simgrid::routing::AsCluster*>(current_routing);
if((int)xbt_dynar_length(as_cluster->privateLinks_) > netcard->id() &&
xbt_dynar_get_as(as_cluster->privateLinks_, netcard->id(), void*))
surf_parse_error("Host_link for '%s' is already defined!",hostlink->id);
XBT_DEBUG("Add routing levels");
ROUTING_PROP_ASR_LEVEL = xbt_lib_add_level(as_router_lib, nullptr);
ROUTING_ASR_LEVEL = xbt_lib_add_level(as_router_lib, [](void* p) {
- delete static_cast<simgrid::surf::NetCard*>(p);
+ delete static_cast<simgrid::routing::NetCard*>(p);
});
XBT_DEBUG("Add SURF levels");
-/* Copyright (c) 2009-2011, 2013-2015. The SimGrid Team.
+/* Copyright (c) 2009-2011, 2013-2016. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route, surf, "Routing part of surf");
namespace simgrid {
-namespace surf {
+namespace routing {
/* Callbacks */
- simgrid::xbt::signal<void(simgrid::surf::NetCard*)> netcardCreatedCallbacks;
+ simgrid::xbt::signal<void(simgrid::routing::NetCard*)> netcardCreatedCallbacks;
simgrid::xbt::signal<void(simgrid::s4u::As*)> asCreatedCallbacks;
-}} // namespace simgrid::surf
+}} // namespace simgrid::routing
/**
* @ingroup SURF_build_api
*
* Netcards are the thing that connect host or routers to the network
*/
-simgrid::surf::NetCard *sg_netcard_by_name_or_null(const char *name)
+simgrid::routing::NetCard *sg_netcard_by_name_or_null(const char *name)
{
sg_host_t h = sg_host_by_name(name);
- simgrid::surf::NetCard *netcard = h==nullptr ? nullptr: h->pimpl_netcard;
+ simgrid::routing::NetCard *netcard = h==nullptr ? nullptr: h->pimpl_netcard;
if (!netcard)
- netcard = (simgrid::surf::NetCard*) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL);
+ netcard = (simgrid::routing::NetCard*) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL);
return netcard;
}
/* Global vars */
-simgrid::surf::RoutingPlatf *routing_platf = nullptr;
+simgrid::routing::RoutingPlatf *routing_platf = nullptr;
void sg_platf_new_trace(sg_platf_trace_cbarg_t trace)
}
namespace simgrid {
-namespace surf {
+namespace routing {
/**
* \brief Find a route between hosts
AsImpl::getRouteRecursive(src, dst, route, latency);
}
-static xbt_dynar_t _recursiveGetOneLinkRoutes(surf::AsImpl *as)
+static xbt_dynar_t _recursiveGetOneLinkRoutes(AsImpl *as)
{
xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f);
/** @brief create the root AS */
void routing_model_create(Link *loopback)
{
- routing_platf = new simgrid::surf::RoutingPlatf(loopback);
+ routing_platf = new simgrid::routing::RoutingPlatf(loopback);
}
/* ************************************************************************** */
xbt_lib_cursor_t cursor;
char *key;
void **data;
- simgrid::surf::NetCard *host_elm;
+ simgrid::routing::NetCard *host_elm;
xbt_lib_foreach(storage_lib, cursor, key, data) {
if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != nullptr) {
simgrid::surf::Storage *storage = static_cast<simgrid::surf::Storage*>(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
delete routing_platf;
}
-simgrid::surf::RoutingPlatf::RoutingPlatf(simgrid::surf::Link *loopback)
+simgrid::routing::RoutingPlatf::RoutingPlatf(simgrid::surf::Link *loopback)
: loopback_(loopback)
{
}
-simgrid::surf::RoutingPlatf::~RoutingPlatf()
+simgrid::routing::RoutingPlatf::~RoutingPlatf()
{
delete root_;
}
SG_END_DECL()
namespace simgrid {
-namespace surf {
+namespace routing {
XBT_PUBLIC_DATA(simgrid::xbt::signal<void(s4u::As*)>) asCreatedCallbacks;
XBT_PUBLIC_DATA(simgrid::xbt::signal<void(NetCard*)>) netcardCreatedCallbacks;
{
if (containingAS != nullptr)
id_ = containingAS->addComponent(this);
- simgrid::surf::netcardCreatedCallbacks(this);
+ simgrid::routing::netcardCreatedCallbacks(this);
}
~NetCardImpl() { xbt_free(name_);};
-/* Copyright (c) 2008-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2008-2016. 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. */
printf("Host number: %zu, link number: %d, elmts number: %d\n", sg_host_count(), sg_link_count(), size);
xbt_dict_foreach(host_list, cursor, key, data) {
- simgrid::surf::NetCard * nc = sg_netcard_by_name_or_null(key);
+ simgrid::routing::NetCard * nc = sg_netcard_by_name_or_null(key);
printf(" - Seen: \"%s\". Type: %s\n", key, nc->isRouter() ? "router" : (nc->isAS()?"AS":"host"));
}
xbt_lib_foreach(as_router_lib, cursor, key, data) {
- simgrid::surf::NetCard * nc = sg_netcard_by_name_or_null(key);
+ simgrid::routing::NetCard * nc = sg_netcard_by_name_or_null(key);
printf(" - Seen: \"%s\". Type: %s\n", key, nc->isRouter() ? "router" : (nc->isAS()?"AS":"host"));
}