class Action;
class Model;
class Resource;
+class NetworkModel;
class TraceEvent;
class LinkImpl;
class NetworkAction;
class ClusterZone : public NetZoneImpl {
public:
- explicit ClusterZone(NetZoneImpl* father, std::string name);
+ explicit ClusterZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
void get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
*/
class XBT_PRIVATE DijkstraZone : public RoutedZone {
public:
- DijkstraZone(NetZoneImpl* father, std::string name, bool cached);
+ DijkstraZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel, bool cached);
void seal() override;
~DijkstraZone() override;
*/
class XBT_PUBLIC DragonflyZone : public ClusterZone {
public:
- explicit DragonflyZone(NetZoneImpl* father, std::string name);
+ explicit DragonflyZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
~DragonflyZone() override;
// void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override;
void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
class XBT_PRIVATE EmptyZone : public NetZoneImpl {
public:
- explicit EmptyZone(NetZoneImpl* father, std::string name);
+ explicit EmptyZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
~EmptyZone() override;
void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override
*/
class XBT_PRIVATE FatTreeZone : public ClusterZone {
public:
- explicit FatTreeZone(NetZoneImpl* father, std::string name);
+ explicit FatTreeZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
~FatTreeZone() override;
void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
*/
class XBT_PRIVATE FloydZone : public RoutedZone {
public:
- explicit FloydZone(NetZoneImpl* father, std::string name);
+ explicit FloydZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
~FloydZone() override;
void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
*/
class XBT_PRIVATE FullZone : public RoutedZone {
public:
- explicit FullZone(NetZoneImpl* father, std::string name);
+ explicit FullZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
void seal() override;
~FullZone() override;
friend simgrid::kernel::EngineImpl; // it destroys netRoot_
protected:
- explicit NetZoneImpl(NetZoneImpl* father, std::string name);
+ explicit NetZoneImpl(NetZoneImpl* father, std::string name, resource::NetworkModel* network_model);
virtual ~NetZoneImpl();
public:
bool get_bypass_route(routing::NetPoint* src, routing::NetPoint* dst,
/* OUT */ std::vector<resource::LinkImpl*>& links, double* latency);
+public:
+ resource::NetworkModel* network_model_;
+
private:
s4u::NetZone piface_;
class XBT_PRIVATE RoutedZone : public NetZoneImpl {
public:
- explicit RoutedZone(NetZoneImpl* father, std::string name);
+ explicit RoutedZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
void get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
std::map<std::string, xbt_edge_t>* edges) override;
class XBT_PRIVATE TorusZone : public ClusterZone {
public:
- explicit TorusZone(NetZoneImpl* father, std::string name);
+ explicit TorusZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
void create_links_for_node(ClusterCreationArgs* cluster, int id, int rank, unsigned int position) override;
void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
void parse_specific_arguments(ClusterCreationArgs* cluster) override;
class XBT_PRIVATE VivaldiZone : public ClusterZone {
public:
- explicit VivaldiZone(NetZoneImpl* father, std::string name);
+ explicit VivaldiZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
void set_peer_link(NetPoint* netpoint, double bw_in, double bw_out, std::string coord);
void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
namespace simgrid {
namespace kernel {
namespace routing {
-ClusterZone::ClusterZone(NetZoneImpl* father, std::string name) : NetZoneImpl(father, name) {}
+ClusterZone::ClusterZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+ : NetZoneImpl(father, name, netmodel)
+{
+}
void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
{
int graph_id_ = -1; /* used for caching internal graph id's */
};
-DijkstraZone::DijkstraZone(NetZoneImpl* father, std::string name, bool cached)
- : RoutedZone(father, name), cached_(cached)
+DijkstraZone::DijkstraZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel, bool cached)
+ : RoutedZone(father, name, netmodel), cached_(cached)
{
}
namespace kernel {
namespace routing {
-DragonflyZone::DragonflyZone(NetZoneImpl* father, std::string name) : ClusterZone(father, name) {}
+DragonflyZone::DragonflyZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+ : ClusterZone(father, name, netmodel)
+{
+}
DragonflyZone::~DragonflyZone()
{
namespace kernel {
namespace routing {
-EmptyZone::EmptyZone(NetZoneImpl* father, std::string name) : NetZoneImpl(father, name) {}
+EmptyZone::EmptyZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+ : NetZoneImpl(father, name, netmodel)
+{
+}
EmptyZone::~EmptyZone() = default;
namespace kernel {
namespace routing {
-FatTreeZone::FatTreeZone(NetZoneImpl* father, std::string name) : ClusterZone(father, name)
+FatTreeZone::FatTreeZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+ : ClusterZone(father, name, netmodel)
{
XBT_DEBUG("Creating a new fat tree.");
}
namespace kernel {
namespace routing {
-FloydZone::FloydZone(NetZoneImpl* father, std::string name) : RoutedZone(father, name)
+FloydZone::FloydZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+ : RoutedZone(father, name, netmodel)
{
predecessor_table_ = nullptr;
cost_table_ = nullptr;
namespace simgrid {
namespace kernel {
namespace routing {
-FullZone::FullZone(NetZoneImpl* father, std::string name) : RoutedZone(father, name) {}
+FullZone::FullZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+ : RoutedZone(father, name, netmodel)
+{
+}
void FullZone::seal()
{
std::vector<resource::LinkImpl*> links;
};
-NetZoneImpl::NetZoneImpl(NetZoneImpl* father, std::string name) : piface_(this), father_(father), name_(name)
+NetZoneImpl::NetZoneImpl(NetZoneImpl* father, std::string name, resource::NetworkModel* network_model)
+ : network_model_(network_model), piface_(this), father_(father), name_(name)
{
xbt_assert(nullptr == simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(name.c_str()),
"Refusing to create a second NetZone called '%s'.", name.c_str());
namespace kernel {
namespace routing {
-RoutedZone::RoutedZone(NetZoneImpl* father, std::string name) : NetZoneImpl(father, name) {}
+RoutedZone::RoutedZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+ : NetZoneImpl(father, name, netmodel)
+{
+}
void RoutedZone::get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
std::map<std::string, xbt_edge_t>* edges)
namespace simgrid {
namespace kernel {
namespace routing {
-TorusZone::TorusZone(NetZoneImpl* father, std::string name) : ClusterZone(father, name) {}
+TorusZone::TorusZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+ : ClusterZone(father, name, netmodel)
+{
+}
void TorusZone::create_links_for_node(ClusterCreationArgs* cluster, int id, int rank, unsigned int position)
{
return &coords->coords;
}
-VivaldiZone::VivaldiZone(NetZoneImpl* father, std::string name) : ClusterZone(father, name) {}
+VivaldiZone::VivaldiZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+ : ClusterZone(father, name, netmodel)
+{
+}
void VivaldiZone::set_peer_link(NetPoint* netpoint, double bw_in, double bw_out, std::string coord)
{
/* search the routing model */
simgrid::kernel::routing::NetZoneImpl* new_zone = nullptr;
+ simgrid::kernel::resource::NetworkModel* netmodel =
+ current_routing == nullptr ? surf_network_model : current_routing->network_model_;
switch (zone->routing) {
case A_surfxml_AS_routing_Cluster:
- new_zone = new simgrid::kernel::routing::ClusterZone(current_routing, zone->id);
+ new_zone = new simgrid::kernel::routing::ClusterZone(current_routing, zone->id, netmodel);
break;
case A_surfxml_AS_routing_ClusterDragonfly:
- new_zone = new simgrid::kernel::routing::DragonflyZone(current_routing, zone->id);
+ new_zone = new simgrid::kernel::routing::DragonflyZone(current_routing, zone->id, netmodel);
break;
case A_surfxml_AS_routing_ClusterTorus:
- new_zone = new simgrid::kernel::routing::TorusZone(current_routing, zone->id);
+ new_zone = new simgrid::kernel::routing::TorusZone(current_routing, zone->id, netmodel);
break;
case A_surfxml_AS_routing_ClusterFatTree:
- new_zone = new simgrid::kernel::routing::FatTreeZone(current_routing, zone->id);
+ new_zone = new simgrid::kernel::routing::FatTreeZone(current_routing, zone->id, netmodel);
break;
case A_surfxml_AS_routing_Dijkstra:
- new_zone = new simgrid::kernel::routing::DijkstraZone(current_routing, zone->id, false);
+ new_zone = new simgrid::kernel::routing::DijkstraZone(current_routing, zone->id, netmodel, false);
break;
case A_surfxml_AS_routing_DijkstraCache:
- new_zone = new simgrid::kernel::routing::DijkstraZone(current_routing, zone->id, true);
+ new_zone = new simgrid::kernel::routing::DijkstraZone(current_routing, zone->id, netmodel, true);
break;
case A_surfxml_AS_routing_Floyd:
- new_zone = new simgrid::kernel::routing::FloydZone(current_routing, zone->id);
+ new_zone = new simgrid::kernel::routing::FloydZone(current_routing, zone->id, netmodel);
break;
case A_surfxml_AS_routing_Full:
- new_zone = new simgrid::kernel::routing::FullZone(current_routing, zone->id);
+ new_zone = new simgrid::kernel::routing::FullZone(current_routing, zone->id, netmodel);
break;
case A_surfxml_AS_routing_None:
- new_zone = new simgrid::kernel::routing::EmptyZone(current_routing, zone->id);
+ new_zone = new simgrid::kernel::routing::EmptyZone(current_routing, zone->id, netmodel);
break;
case A_surfxml_AS_routing_Vivaldi:
- new_zone = new simgrid::kernel::routing::VivaldiZone(current_routing, zone->id);
+ new_zone = new simgrid::kernel::routing::VivaldiZone(current_routing, zone->id, netmodel);
break;
default:
xbt_die("Not a valid model!");