namespace simgrid {
namespace s4u {
- class As;
- class Host;
- class Mailbox;
+ class NetZone;
+ class Host;
+ class Mailbox;
}
namespace kernel {
namespace activity {
}
}
-typedef simgrid::s4u::As simgrid_As;
+typedef simgrid::s4u::NetZone simgrid_NetZone;
typedef simgrid::s4u::Host simgrid_Host;
typedef simgrid::kernel::activity::ActivityImpl kernel_Activity;
typedef simgrid::kernel::routing::NetCard routing_NetCard;
#else
-typedef struct simgrid_As simgrid_As;
+typedef struct simgrid_NetZone simgrid_NetZone;
typedef struct simgrid_Host simgrid_Host;
typedef struct kernel_Activity kernel_Activity;
typedef struct surf_Cpu surf_Cpu;
typedef struct simix_Host *smx_host_priv_t;
#endif
-typedef simgrid_As *AS_t;
+typedef simgrid_NetZone* NetZone_t;
typedef simgrid_Host* sg_host_t;
typedef kernel_Activity *smx_activity_t;
SG_BEGIN_DECL()
-/* ************************* Autonomous System ****************************** */
-typedef simgrid_As *msg_as_t;
+/* *************************** Network Zones ******************************** */
+typedef simgrid_NetZone* msg_as_t;
/* ******************************** Host ************************************ */
namespace simgrid {
namespace surf {
- class Link;
+class Link;
}
namespace kernel {
- namespace routing {
- class AsImpl;
- class NetCard;
- }
+namespace routing {
+class NetZoneImpl;
+class NetCard;
+}
}
namespace s4u {
* An AS is a network container, in charge of routing information between elements (hosts) and to the nearby ASes.
* In SimGrid, there is a hierarchy of ASes, with a unique root AS (that you can retrieve from the s4u::Engine).
*/
-XBT_PUBLIC_CLASS As {
+XBT_PUBLIC_CLASS NetZone
+{
protected:
- friend simgrid::kernel::routing::AsImpl;
+ friend simgrid::kernel::routing::NetZoneImpl;
+
+ explicit NetZone(NetZone * father, const char* name);
+ virtual ~NetZone();
- explicit As(As * father, const char* name);
- virtual ~As();
-
public:
/** @brief Seal your AS once you're done adding content, and before routing stuff through it */
virtual void seal();
- char *name();
- As *father();;
+ char* name();
+ NetZone* father();
+ ;
xbt_dict_t children(); // Sub AS
xbt_dynar_t hosts(); // my content as a dynar
public:
/* Add content to the AS, at parsing time. It should be sealed afterward. */
- virtual int addComponent(kernel::routing::NetCard *elm); /* A host, a router or an AS, whatever */
+ virtual int addComponent(kernel::routing::NetCard * elm); /* A host, a router or an AS, whatever */
virtual void addRoute(sg_platf_route_cbarg_t route);
virtual void addBypassRoute(sg_platf_route_cbarg_t e_route) = 0;
onRouteCreation;
protected:
- std::vector<kernel::routing::NetCard*> vertices_; // our content, as known to our graph routing algorithm (maps vertexId -> vertex)
+ std::vector<kernel::routing::NetCard*>
+ vertices_; // our content, as known to our graph routing algorithm (maps vertexId -> vertex)
private:
- As* father_ = nullptr;
- char* name_ = nullptr;
+ NetZone* father_ = nullptr;
+ char* name_ = nullptr;
bool sealed_ = false; // We cannot add more content when sealed
- xbt_dict_t children_ = xbt_dict_new_homogeneous(nullptr); // sub-ASes
+ xbt_dict_t children_ = xbt_dict_new_homogeneous(nullptr); // sub-ASes
};
-
-}}; // Namespace simgrid::s4u
+}
+}; // Namespace simgrid::s4u
#endif /* SIMGRID_S4U_AS_HPP */
static s4u::Engine *instance();
/** @brief Retrieve the root AS, containing all others */
- simgrid::s4u::As *rootAs();
+ simgrid::s4u::NetZone* rootAs();
/** @brief Retrieve the AS of the given name (or nullptr if not found) */
- simgrid::s4u::As *asByNameOrNull(const char *name);
+ simgrid::s4u::NetZone* asByNameOrNull(const char* name);
template<class F>
void registerFunction(const char* name)
s_sg_platf_AS_cbarg_t AS;
AS.id = id;
AS.routing = mode_int;
- simgrid::s4u::As *new_as = sg_platf_new_AS_begin(&AS);
+ simgrid::s4u::NetZone* new_as = sg_platf_new_AS_begin(&AS);
/* Build a Lua representation of the new AS on the stack */
lua_newtable(L);
- simgrid::s4u::As **lua_as = (simgrid::s4u::As **) lua_newuserdata(L, sizeof(simgrid::s4u::As *)); /* table userdatum */
+ simgrid::s4u::NetZone** lua_as =
+ (simgrid::s4u::NetZone**)lua_newuserdata(L, sizeof(simgrid::s4u::NetZone*)); /* table userdatum */
*lua_as = new_as;
luaL_getmetatable(L, PLATF_MODULE_NAME); /* table userdatum metatable */
lua_setmetatable(L, -2); /* table userdatum */
xbt_die("Element '%s' not found!",dst);
std::vector<Link*> route;
- simgrid::kernel::routing::AsImpl::getGlobalRoute(src_elm, dst_elm, &route, nullptr);
+ simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(src_elm, dst_elm, &route, nullptr);
for (auto link : route)
instr_user_variable (time, link->getName(), variable, father_type, value, what, nullptr, user_link_variables);
}
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "simgrid/jedule/jedule_events.hpp"
-#include "simgrid/jedule/jedule_platform.hpp"
-#include "simgrid/jedule/jedule.hpp"
-#include "simgrid/s4u/As.hpp"
+#include "simgrid/jedule/jedule.hpp"
+#include "simgrid/jedule/jedule_platform.hpp"
+#include "simgrid/s4u/NetZone.hpp"
#include "xbt/asserts.h"
#if HAVE_JEDULE
#include "simgrid/jedule/jedule.hpp"
#include "simgrid/jedule/jedule_platform.hpp"
-#include "simgrid/s4u/As.hpp"
-
+#include "simgrid/s4u/NetZone.hpp"
#include "xbt/asserts.h"
#include "xbt/dynar.h"
#include <algorithm>
#include "xbt/asserts.h"
#include "simgrid/jedule/jedule_sd_binding.h"
+
#include "simgrid/forward.h"
-#include "simgrid/s4u/As.hpp"
-#include "simgrid/s4u/engine.hpp"
-#include "simgrid/jedule/jedule.hpp"
#include "../../simdag/simdag_private.hpp"
+#include "simgrid/jedule/jedule.hpp"
+#include "simgrid/s4u/NetZone.hpp"
+#include "simgrid/s4u/engine.hpp"
#if HAVE_JEDULE
namespace simgrid {
namespace kernel {
namespace routing {
-class AsImpl;
+class NetZoneImpl;
}
class EngineImpl {
public:
EngineImpl();
virtual ~EngineImpl();
- kernel::routing::AsImpl* rootAs_ = nullptr;
+ kernel::routing::NetZoneImpl* rootAs_ = nullptr;
protected:
friend simgrid::s4u::Engine;
namespace simgrid {
namespace kernel {
namespace routing {
-AsCluster::AsCluster(As* father, const char* name) : AsImpl(father, name)
+ClusterZone::ClusterZone(NetZone* father, const char* name) : NetZoneImpl(father, name)
{
}
-void AsCluster::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat)
+void ClusterZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat)
{
XBT_VERB("cluster getLocalRoute from '%s'[%d] to '%s'[%d]", src->cname(), src->id(), dst->cname(), dst->id());
xbt_assert(!privateLinks_.empty(),
}
}
-void AsCluster::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
+void ClusterZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
{
xbt_assert(router_,
"Malformed cluster. This may be because your platform file is a hypergraph while it must be a graph.");
}
}
-void AsCluster::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int, int position)
+void ClusterZone::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int, int position)
{
char* link_id = bprintf("%s_link_%d", cluster->id, id);
namespace kernel {
namespace routing {
-class XBT_PRIVATE AsCluster : public AsImpl {
+class XBT_PRIVATE ClusterZone : public NetZoneImpl {
public:
- explicit AsCluster(As* father, const char* name);
+ explicit ClusterZone(NetZone* father, const char* name);
void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override;
void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override;
namespace simgrid {
namespace kernel {
namespace routing {
-void AsDijkstra::seal()
+void DijkstraZone::seal()
{
xbt_node_t node = nullptr;
unsigned int cursor2, cursor;
}
}
-xbt_node_t AsDijkstra::routeGraphNewNode(int id, int graph_id)
+xbt_node_t DijkstraZone::routeGraphNewNode(int id, int graph_id)
{
xbt_node_t node = nullptr;
graph_node_data_t data = nullptr;
return node;
}
-graph_node_map_element_t AsDijkstra::nodeMapSearch(int id)
+graph_node_map_element_t DijkstraZone::nodeMapSearch(int id)
{
return (graph_node_map_element_t)xbt_dict_get_or_null_ext(graphNodeMap_, (char*)(&id), sizeof(int));
}
/* Parsing */
-void AsDijkstra::newRoute(int src_id, int dst_id, sg_platf_route_cbarg_t e_route)
+void DijkstraZone::newRoute(int src_id, int dst_id, sg_platf_route_cbarg_t 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 AsDijkstra::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat)
+void DijkstraZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat)
{
getRouteCheckParams(src, dst);
int src_id = src->id();
xbt_free(pred_arr);
}
-AsDijkstra::~AsDijkstra()
+DijkstraZone::~DijkstraZone()
{
xbt_graph_free_graph(routeGraph_, &xbt_free_f, &graph_edge_data_free, &xbt_free_f);
xbt_dict_free(&graphNodeMap_);
/* Creation routing model functions */
-AsDijkstra::AsDijkstra(As* father, const char* name, bool cached) : AsRoutedGraph(father, name)
+DijkstraZone::DijkstraZone(NetZone* father, const char* name, bool cached) : RoutedZone(father, name)
{
if (cached)
routeCache_ = xbt_dict_new_homogeneous(&route_cache_elem_free);
}
-void AsDijkstra::addRoute(sg_platf_route_cbarg_t route)
+void DijkstraZone::addRoute(sg_platf_route_cbarg_t route)
{
NetCard* src = route->src;
NetCard* dst = route->dst;
***********/
/** Dijkstra routing data: fast initialization, slow lookup, small memory requirements, shortest path routing only */
-class XBT_PRIVATE AsDijkstra : public AsRoutedGraph {
+class XBT_PRIVATE DijkstraZone : public RoutedZone {
public:
- AsDijkstra(As* father, const char* name, bool cached);
+ DijkstraZone(NetZone* father, const char* name, bool cached);
void seal() override;
- ~AsDijkstra() override;
+ ~DijkstraZone() override;
xbt_node_t routeGraphNewNode(int id, int graph_id);
graph_node_map_element_t nodeMapSearch(int id);
void newRoute(int src_id, int dst_id, sg_platf_route_cbarg_t e_route);
namespace kernel {
namespace routing {
-AsClusterDragonfly::AsClusterDragonfly(As* father, const char* name) : AsCluster(father, name)
+DragonflyZone::DragonflyZone(NetZone* father, const char* name) : ClusterZone(father, name)
{
}
-AsClusterDragonfly::~AsClusterDragonfly()
+DragonflyZone::~DragonflyZone()
{
if (this->routers_ != nullptr) {
for (unsigned int i = 0; i < this->numGroups_ * this->numChassisPerGroup_ * this->numBladesPerChassis_; i++)
}
}
-unsigned int* AsClusterDragonfly::rankId_to_coords(int rankId)
+unsigned int* DragonflyZone::rankId_to_coords(int rankId)
{
// coords : group, chassis, blade, node
unsigned int* coords = (unsigned int*)malloc(4 * sizeof(unsigned int));
return coords;
}
-void AsClusterDragonfly::parse_specific_arguments(sg_platf_cluster_cbarg_t cluster)
+void DragonflyZone::parse_specific_arguments(sg_platf_cluster_cbarg_t cluster)
{
std::vector<std::string> parameters;
std::vector<std::string> tmp;
/*
* Generate the cluster once every node is created
*/
-void AsClusterDragonfly::seal()
+void DragonflyZone::seal()
{
if (this->numNodesPerBlade_ == 0) {
return;
xbt_free(blueLinks_);
}
-void AsClusterDragonfly::generateRouters()
+void DragonflyZone::generateRouters()
{
this->routers_ = static_cast<DragonflyRouter**>(xbt_malloc0(this->numGroups_ * this->numChassisPerGroup_ *
this->numBladesPerChassis_ * sizeof(DragonflyRouter*)));
}
}
-void AsClusterDragonfly::createLink(char* id, int numlinks, Link** linkup, Link** linkdown)
+void DragonflyZone::createLink(char* id, int numlinks, Link** linkup, Link** linkdown)
{
*linkup = nullptr;
*linkdown = nullptr;
free((void*)linkTemplate.id);
}
-void AsClusterDragonfly::generateLinks()
+void DragonflyZone::generateLinks()
{
static int uniqueId = 0;
}
}
-void AsClusterDragonfly::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* latency)
+void DragonflyZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* latency)
{
// Minimal routing version.
// TODO : non-minimal random one, and adaptive ?
* 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 AsCluster {
+class XBT_PRIVATE DragonflyZone : public ClusterZone {
public:
- explicit AsClusterDragonfly(As* father, const char* name);
- ~AsClusterDragonfly() override;
+ explicit DragonflyZone(NetZone* father, const char* name);
+ ~DragonflyZone() override;
// void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override;
void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override;
void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster) override;
namespace kernel {
namespace routing {
-AsNone::AsNone(As* father, const char* name) : AsImpl(father, name)
+EmptyZone::EmptyZone(NetZone* father, const char* name) : NetZoneImpl(father, name)
{
}
-AsNone::~AsNone() = default;
+EmptyZone::~EmptyZone() = default;
-void AsNone::getLocalRoute(NetCard* /*src*/, NetCard* /*dst*/, sg_platf_route_cbarg_t /*res*/, double* /*lat*/)
+void EmptyZone::getLocalRoute(NetCard* /*src*/, NetCard* /*dst*/, sg_platf_route_cbarg_t /*res*/, double* /*lat*/)
{
}
-void AsNone::getGraph(xbt_graph_t /*graph*/, xbt_dict_t /*nodes*/, xbt_dict_t /*edges*/)
+void EmptyZone::getGraph(xbt_graph_t /*graph*/, xbt_dict_t /*nodes*/, xbt_dict_t /*edges*/)
{
XBT_ERROR("No routing no graph");
}
namespace routing {
/** No specific routing. Mainly useful with the constant network model */
-class XBT_PRIVATE AsNone : public AsImpl {
+class XBT_PRIVATE EmptyZone : public NetZoneImpl {
public:
- explicit AsNone(As* father, const char* name);
- ~AsNone() override;
+ explicit EmptyZone(NetZone* father, const char* name);
+ ~EmptyZone() override;
void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override;
void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override;
namespace kernel {
namespace routing {
-AsClusterFatTree::AsClusterFatTree(As* father, const char* name) : AsCluster(father, name)
+FatTreeZone::FatTreeZone(NetZone* father, const char* name) : ClusterZone(father, name)
{
XBT_DEBUG("Creating a new fat tree.");
}
-AsClusterFatTree::~AsClusterFatTree()
+FatTreeZone::~FatTreeZone()
{
for (unsigned int i = 0; i < this->nodes_.size(); i++) {
delete this->nodes_[i];
}
}
-bool AsClusterFatTree::isInSubTree(FatTreeNode* root, FatTreeNode* node)
+bool FatTreeZone::isInSubTree(FatTreeNode* root, FatTreeNode* node)
{
XBT_DEBUG("Is %d(%u,%u) in the sub tree of %d(%u,%u) ?", node->id, node->level, node->position, root->id, root->level,
root->position);
return true;
}
-void AsClusterFatTree::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency)
+void FatTreeZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency)
{
if (dst->isRouter() || src->isRouter())
/* This function makes the assumption that parse_specific_arguments() and
* addNodes() have already been called
*/
-void AsClusterFatTree::seal()
+void FatTreeZone::seal()
{
if (this->levels_ == 0) {
return;
}
}
-int AsClusterFatTree::connectNodeToParents(FatTreeNode* node)
+int FatTreeZone::connectNodeToParents(FatTreeNode* node)
{
std::vector<FatTreeNode*>::iterator currentParentNode = this->nodes_.begin();
int connectionsNumber = 0;
return connectionsNumber;
}
-bool AsClusterFatTree::areRelated(FatTreeNode* parent, FatTreeNode* child)
+bool FatTreeZone::areRelated(FatTreeNode* parent, FatTreeNode* child)
{
std::stringstream msgBuffer;
return true;
}
-void AsClusterFatTree::generateSwitches()
+void FatTreeZone::generateSwitches()
{
XBT_DEBUG("Generating switches.");
this->nodesByLevel_.resize(this->levels_ + 1, 0);
}
}
-void AsClusterFatTree::generateLabels()
+void FatTreeZone::generateLabels()
{
XBT_DEBUG("Generating labels.");
// TODO : check if nodesByLevel and nodes are filled
}
}
-int AsClusterFatTree::getLevelPosition(const unsigned int level)
+int FatTreeZone::getLevelPosition(const unsigned int level)
{
xbt_assert(level <= this->levels_, "The impossible did happen. Yet again.");
int tempPosition = 0;
return tempPosition;
}
-void AsClusterFatTree::addProcessingNode(int id)
+void FatTreeZone::addProcessingNode(int id)
{
using std::make_pair;
static int position = 0;
this->nodes_.push_back(newNode);
}
-void AsClusterFatTree::addLink(FatTreeNode* parent, unsigned int parentPort, FatTreeNode* child, unsigned int childPort)
+void FatTreeZone::addLink(FatTreeNode* parent, unsigned int parentPort, FatTreeNode* child, unsigned int childPort)
{
FatTreeLink* newLink;
newLink = new FatTreeLink(this->cluster_, child, parent);
this->links_.push_back(newLink);
}
-void AsClusterFatTree::parse_specific_arguments(sg_platf_cluster_cbarg_t cluster)
+void FatTreeZone::parse_specific_arguments(sg_platf_cluster_cbarg_t cluster)
{
std::vector<std::string> parameters;
std::vector<std::string> tmp;
this->cluster_ = cluster;
}
-void AsClusterFatTree::generateDotFile(const std::string& filename) const
+void FatTreeZone::generateDotFile(const std::string& filename) const
{
std::ofstream file;
file.open(filename, std::ios::out | std::ios::trunc);
*
* Routing is made using a destination-mod-k scheme.
*/
-class XBT_PRIVATE AsClusterFatTree : public AsCluster {
+class XBT_PRIVATE FatTreeZone : public ClusterZone {
public:
- explicit AsClusterFatTree(As* father, const char* name);
- ~AsClusterFatTree() override;
+ explicit FatTreeZone(NetZone* father, const char* name);
+ ~FatTreeZone() override;
void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override;
/** \brief Generate the fat tree
namespace kernel {
namespace routing {
-AsFloyd::AsFloyd(As* father, const char* name) : AsRoutedGraph(father, name)
+FloydZone::FloydZone(NetZone* father, const char* name) : RoutedZone(father, name)
{
predecessorTable_ = nullptr;
costTable_ = nullptr;
linkTable_ = nullptr;
}
-AsFloyd::~AsFloyd()
+FloydZone::~FloydZone()
{
if (linkTable_ == nullptr) // Dealing with a parse error in the file?
return;
xbt_free(costTable_);
}
-void AsFloyd::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat)
+void FloydZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat)
{
size_t table_size = vertices_.size();
}
}
-void AsFloyd::addRoute(sg_platf_route_cbarg_t route)
+void FloydZone::addRoute(sg_platf_route_cbarg_t route)
{
/* set the size of table routing */
int table_size = static_cast<int>(vertices_.size());
}
}
-void AsFloyd::seal()
+void FloydZone::seal()
{
/* set the size of table routing */
size_t table_size = vertices_.size();
namespace routing {
/** Floyd routing data: slow initialization, fast lookup, lesser memory requirements, shortest path routing only */
-class XBT_PRIVATE AsFloyd : public AsRoutedGraph {
+class XBT_PRIVATE FloydZone : public RoutedZone {
public:
- explicit AsFloyd(As* father, const char* name);
- ~AsFloyd() override;
+ explicit FloydZone(NetZone* father, const char* name);
+ ~FloydZone() override;
void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override;
void addRoute(sg_platf_route_cbarg_t route) override;
namespace simgrid {
namespace kernel {
namespace routing {
-AsFull::AsFull(As* father, const char* name) : AsRoutedGraph(father, name)
+FullZone::FullZone(NetZone* father, const char* name) : RoutedZone(father, name)
{
}
-void AsFull::seal()
+void FullZone::seal()
{
int i;
sg_platf_route_cbarg_t e_route;
}
}
-AsFull::~AsFull()
+FullZone::~FullZone()
{
if (routingTable_) {
int table_size = static_cast<int>(vertices_.size());
}
}
-void AsFull::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t res, double* lat)
+void FullZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t res, double* lat)
{
XBT_DEBUG("full getLocalRoute from %s[%d] to %s[%d]", src->cname(), src->id(), dst->cname(), dst->id());
}
}
-void AsFull::addRoute(sg_platf_route_cbarg_t route)
+void FullZone::addRoute(sg_platf_route_cbarg_t route)
{
NetCard* src = route->src;
NetCard* dst = route->dst;
namespace routing {
/** Full routing: fast, large memory requirements, fully expressive */
-class XBT_PRIVATE AsFull : public AsRoutedGraph {
+class XBT_PRIVATE FullZone : public RoutedZone {
public:
- explicit AsFull(As* father, const char* name);
+ explicit FullZone(NetZone* father, const char* name);
void seal() override;
- ~AsFull() override;
+ ~FullZone() override;
void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override;
void addRoute(sg_platf_route_cbarg_t route) override;
public:
enum class Type { Host, Router, As };
- NetCard(std::string name, NetCard::Type componentType, AsImpl* containingAS)
+ NetCard(std::string name, NetCard::Type componentType, NetZoneImpl* containingAS)
: name_(name), componentType_(componentType), containingAS_(containingAS)
{
if (containingAS != nullptr)
std::string name() { return name_; }
const char* cname() { return name_.c_str(); }
// This is the AS in which I am
- AsImpl* containingAS() { return containingAS_; }
+ NetZoneImpl* containingAS() { return containingAS_; }
bool isAS() { return componentType_ == Type::As; }
bool isHost() { return componentType_ == Type::Host; }
unsigned int id_;
std::string name_;
NetCard::Type componentType_;
- AsImpl* containingAS_;
+ NetZoneImpl* containingAS_;
};
}
}
std::vector<Link*> links;
};
-AsImpl::AsImpl(As* father, const char* name) : As(father, name)
+NetZoneImpl::NetZoneImpl(NetZone* father, const char* name) : NetZone(father, name)
{
xbt_assert(nullptr == xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL),
"Refusing to create a second AS called '%s'.", name);
- netcard_ = new NetCard(name, NetCard::Type::As, static_cast<AsImpl*>(father));
+ netcard_ = new NetCard(name, NetCard::Type::As, static_cast<NetZoneImpl*>(father));
xbt_lib_set(as_router_lib, name, ROUTING_ASR_LEVEL, static_cast<void*>(netcard_));
XBT_DEBUG("AS '%s' created with the id '%d'", name, netcard_->id());
}
-AsImpl::~AsImpl()
+NetZoneImpl::~NetZoneImpl()
{
for (auto& kv : bypassRoutes_)
delete kv.second;
}
-simgrid::s4u::Host* AsImpl::createHost(const char* name, std::vector<double>* speedPerPstate, int coreAmount)
+simgrid::s4u::Host* NetZoneImpl::createHost(const char* name, std::vector<double>* speedPerPstate, int coreAmount)
{
simgrid::s4u::Host* res = new simgrid::s4u::Host(name);
return res;
}
-void AsImpl::addBypassRoute(sg_platf_route_cbarg_t e_route)
+void NetZoneImpl::addBypassRoute(sg_platf_route_cbarg_t e_route)
{
/* Argument validity checks */
if (e_route->gw_dst) {
* @endverbatim
*/
static void find_common_ancestors(NetCard* src, NetCard* dst,
- /* OUT */ AsImpl** common_ancestor, AsImpl** src_ancestor, AsImpl** dst_ancestor)
+ /* OUT */ NetZoneImpl** common_ancestor, NetZoneImpl** src_ancestor,
+ NetZoneImpl** dst_ancestor)
{
/* Deal with the easy base case */
if (src->containingAS() == dst->containingAS()) {
/* engage the full recursive search */
/* (1) find the path to root of src and dst*/
- AsImpl* src_as = src->containingAS();
- AsImpl* dst_as = dst->containingAS();
+ NetZoneImpl* src_as = src->containingAS();
+ NetZoneImpl* dst_as = dst->containingAS();
xbt_assert(src_as, "Host %s must be in an AS", src->cname());
xbt_assert(dst_as, "Host %s must be in an AS", dst->cname());
/* (2) find the path to the root routing component */
- std::vector<AsImpl*> path_src;
- AsImpl* current = src->containingAS();
+ std::vector<NetZoneImpl*> path_src;
+ NetZoneImpl* current = src->containingAS();
while (current != nullptr) {
path_src.push_back(current);
- current = static_cast<AsImpl*>(current->father());
+ current = static_cast<NetZoneImpl*>(current->father());
}
- std::vector<AsImpl*> path_dst;
+ std::vector<NetZoneImpl*> path_dst;
current = dst->containingAS();
while (current != nullptr) {
path_dst.push_back(current);
- current = static_cast<AsImpl*>(current->father());
+ current = static_cast<NetZoneImpl*>(current->father());
}
/* (3) find the common father.
*
* This works because all SimGrid platform have a unique root element (that is the last element of both paths).
*/
- AsImpl* father = nullptr; // the AS we dropped on the previous loop iteration
+ NetZoneImpl* father = nullptr; // the AS we dropped on the previous loop iteration
while (path_src.size() > 1 && path_dst.size() > 1 &&
path_src.at(path_src.size() - 1) == path_dst.at(path_dst.size() - 1)) {
father = path_src.at(path_src.size() - 1);
}
/* PRECONDITION: this is the common ancestor of src and dst */
-bool AsImpl::getBypassRoute(routing::NetCard* src, routing::NetCard* dst,
- /* OUT */ std::vector<surf::Link*>* links, double* latency)
+bool NetZoneImpl::getBypassRoute(routing::NetCard* src, routing::NetCard* dst,
+ /* OUT */ std::vector<surf::Link*>* links, double* latency)
{
// If never set a bypass route return nullptr without any further computations
if (bypassRoutes_.empty())
/* Engage recursive search */
/* (1) find the path to the root routing component */
- std::vector<AsImpl*> path_src;
- As* current = src->containingAS();
+ std::vector<NetZoneImpl*> path_src;
+ NetZone* current = src->containingAS();
while (current != nullptr) {
- path_src.push_back(static_cast<AsImpl*>(current));
+ path_src.push_back(static_cast<NetZoneImpl*>(current));
current = current->father_;
}
- std::vector<AsImpl*> path_dst;
+ std::vector<NetZoneImpl*> path_dst;
current = dst->containingAS();
while (current != nullptr) {
- path_dst.push_back(static_cast<AsImpl*>(current));
+ path_dst.push_back(static_cast<NetZoneImpl*>(current));
current = current->father_;
}
return false;
}
-void AsImpl::getGlobalRoute(routing::NetCard* src, routing::NetCard* dst,
- /* OUT */ std::vector<surf::Link*>* links, double* latency)
+void NetZoneImpl::getGlobalRoute(routing::NetCard* src, routing::NetCard* dst,
+ /* OUT */ std::vector<surf::Link*>* links, double* latency)
{
s_sg_platf_route_cbarg_t route;
memset(&route, 0, sizeof(route));
XBT_DEBUG("Resolve route from '%s' to '%s'", src->cname(), dst->cname());
/* Find how src and dst are interconnected */
- AsImpl *common_ancestor, *src_ancestor, *dst_ancestor;
+ NetZoneImpl *common_ancestor, *src_ancestor, *dst_ancestor;
find_common_ancestors(src, dst, &common_ancestor, &src_ancestor, &dst_ancestor);
XBT_DEBUG("elements_father: common ancestor '%s' src ancestor '%s' dst ancestor '%s'", common_ancestor->name(),
src_ancestor->name(), dst_ancestor->name());
#include "xbt/graph.h"
-#include "simgrid/s4u/As.hpp"
+#include "simgrid/s4u/NetZone.hpp"
#include "simgrid/s4u/forward.hpp"
#include "src/surf/xml/platf_private.hpp" // FIXME: kill sg_platf_route_cbarg_t to remove that UGLY include
* The algorithm for that is explained in http://hal.inria.fr/hal-00650233/
*
*/
-XBT_PUBLIC_CLASS AsImpl : public s4u::As
+XBT_PUBLIC_CLASS NetZoneImpl : public s4u::NetZone
{
friend simgrid::kernel::EngineImpl; // it destroys rootAs_
protected:
- explicit AsImpl(As * father, const char* name);
- virtual ~AsImpl();
+ explicit NetZoneImpl(NetZone * father, const char* name);
+ virtual ~NetZoneImpl();
public:
/** @brief Make an host within that AS */
namespace kernel {
namespace routing {
-AsRoutedGraph::AsRoutedGraph(As* father, const char* name) : AsImpl(father, name)
+RoutedZone::RoutedZone(NetZone* father, const char* name) : NetZoneImpl(father, name)
{
}
-void AsRoutedGraph::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
+void RoutedZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
{
for (auto my_src : vertices_) {
for (auto my_dst : vertices_) {
/* ************************************************************************** */
/* ************************* GENERIC AUX FUNCTIONS ************************** */
/* change a route containing link names into a route containing link entities */
-sg_platf_route_cbarg_t AsRoutedGraph::newExtendedRoute(RoutingMode hierarchy, sg_platf_route_cbarg_t routearg,
- int change_order)
+sg_platf_route_cbarg_t RoutedZone::newExtendedRoute(RoutingMode hierarchy, sg_platf_route_cbarg_t routearg,
+ int change_order)
{
sg_platf_route_cbarg_t result;
return result;
}
-void AsRoutedGraph::getRouteCheckParams(NetCard* src, NetCard* dst)
+void RoutedZone::getRouteCheckParams(NetCard* src, NetCard* dst)
{
xbt_assert(src, "Cannot find a route from nullptr to %s", dst->cname());
xbt_assert(dst, "Cannot find a route from %s to nullptr", src->cname());
- As* src_as = src->containingAS();
- As* dst_as = dst->containingAS();
+ NetZone* src_as = src->containingAS();
+ NetZone* dst_as = dst->containingAS();
xbt_assert(src_as == dst_as,
"Internal error: %s@%s and %s@%s are not in the same AS as expected. Please report that bug.",
"%s@%s). Please report that bug.",
src->cname(), dst->cname(), src_as->name(), dst_as->name(), name());
}
-void AsRoutedGraph::addRouteCheckParams(sg_platf_route_cbarg_t route)
+void RoutedZone::addRouteCheckParams(sg_platf_route_cbarg_t route)
{
NetCard* src = route->src;
NetCard* dst = route->dst;
namespace kernel {
namespace routing {
-class XBT_PRIVATE AsRoutedGraph : public AsImpl {
+class XBT_PRIVATE RoutedZone : public NetZoneImpl {
public:
- explicit AsRoutedGraph(As* father, const char* name);
+ explicit RoutedZone(NetZone* father, const char* name);
void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override;
virtual sg_platf_route_cbarg_t newExtendedRoute(RoutingMode hierarchy, sg_platf_route_cbarg_t routearg,
namespace simgrid {
namespace kernel {
namespace routing {
-AsClusterTorus::AsClusterTorus(As* father, const char* name) : AsCluster(father, name)
+TorusZone::TorusZone(NetZone* father, const char* name) : ClusterZone(father, name)
{
}
-AsClusterTorus::~AsClusterTorus()
+TorusZone::~TorusZone()
{
xbt_dynar_free(&dimensions_);
}
-void AsClusterTorus::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position)
+void TorusZone::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position)
{
char* link_id;
unsigned int j = 0;
rank++;
}
-void AsClusterTorus::parse_specific_arguments(sg_platf_cluster_cbarg_t cluster)
+void TorusZone::parse_specific_arguments(sg_platf_cluster_cbarg_t cluster)
{
unsigned int iter;
xbt_dynar_free(&dimensions);
}
-void AsClusterTorus::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat)
+void TorusZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat)
{
XBT_VERB("torus getLocalRoute from '%s'[%d] to '%s'[%d]", src->name().c_str(), src->id(), dst->name().c_str(),
namespace kernel {
namespace routing {
-class XBT_PRIVATE AsClusterTorus : public AsCluster {
+class XBT_PRIVATE TorusZone : public ClusterZone {
public:
- explicit AsClusterTorus(As* father, const char* name);
- ~AsClusterTorus() override;
+ explicit TorusZone(NetZone* father, const char* name);
+ ~TorusZone() override;
void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override;
void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override;
void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster) override;
(nc->isAS() ? "AS" : (nc->isHost() ? "Host" : "Router")), nc->cname(), nc);
return &coords->coords;
}
-AsVivaldi::AsVivaldi(As* father, const char* name) : AsCluster(father, name)
+VivaldiZone::VivaldiZone(NetZone* father, const char* name) : ClusterZone(father, name)
{
}
-void AsVivaldi::setPeerLink(NetCard* netcard, double bw_in, double bw_out, double latency, const char* coord)
+void VivaldiZone::setPeerLink(NetCard* netcard, double bw_in, double bw_out, double latency, const char* coord)
{
xbt_assert(netcard->containingAS() == this, "Cannot add a peer link to a netcard that is not in this AS");
free(link_down);
}
-void AsVivaldi::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat)
+void VivaldiZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat)
{
XBT_DEBUG("vivaldi getLocalRoute from '%s'[%d] '%s'[%d]", src->cname(), src->id(), dst->cname(), dst->id());
namespace routing {
/* This extends cluster because each host has a private link */
-class XBT_PRIVATE AsVivaldi : public AsCluster {
+class XBT_PRIVATE VivaldiZone : public ClusterZone {
public:
- explicit AsVivaldi(As* father, const char* name);
+ explicit VivaldiZone(NetZone* father, const char* name);
void setPeerLink(NetCard* netcard, double bw_in, double bw_out, double lat, const char* coord);
void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override;
#include "xbt/sysdep.h"
#include "xbt/log.h"
-#include "simgrid/s4u/As.hpp"
+#include "simgrid/s4u/NetZone.hpp"
#include "simgrid/s4u/engine.hpp"
#if HAVE_LUA
+++ /dev/null
-/* Copyright (c) 2006-2014. The SimGrid Team.
- * All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include <xbt/log.h>
-
-#include <simgrid/s4u/host.hpp>
-#include <simgrid/s4u/As.hpp>
-
-#include "src/kernel/routing/NetCard.hpp"
-#include "src/surf/network_interface.hpp" // Link FIXME: move to proper header
-#include "src/surf/surf_routing.hpp"
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_as,"S4U autonomous systems");
-
-namespace simgrid {
- namespace s4u {
-
- simgrid::xbt::signal<void(bool symmetrical, kernel::routing::NetCard* src, kernel::routing::NetCard* dst,
- kernel::routing::NetCard* gw_src, kernel::routing::NetCard* gw_dst,
- std::vector<Link*>* link_list)>
- As::onRouteCreation;
-
- As::As(As* father, const char* name) : father_(father), name_(xbt_strdup(name))
- {
- }
- void As::seal()
- {
- sealed_ = true;
- }
- As::~As()
- {
- xbt_dict_cursor_t cursor = nullptr;
- char* key;
- AS_t elem;
- xbt_dict_foreach(children_, cursor, key, elem) { delete (As*)elem; }
-
- xbt_dict_free(&children_);
- xbt_free(name_);
- }
-
- xbt_dict_t As::children()
- {
- return children_;
- }
- char* As::name()
- {
- return name_;
- }
- As* As::father()
- {
- return father_;
- }
-
- xbt_dynar_t As::hosts()
- {
- xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t), nullptr);
-
- for (auto card : vertices_) {
- 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(kernel::routing::NetCard* elm)
- {
- vertices_.push_back(elm);
- return vertices_.size() - 1; // The rank of the newly created object
- }
-
- void As::addRoute(sg_platf_route_cbarg_t /*route*/)
- {
- xbt_die("AS %s does not accept new routes (wrong class).", name_);
- }
-
-} }; // namespace simgrid::s4u
#include "instr/instr_interface.h"
#include "mc/mc.h"
-#include "simgrid/s4u/As.hpp"
#include "simgrid/s4u/Mailbox.hpp"
+#include "simgrid/s4u/NetZone.hpp"
#include "simgrid/s4u/engine.hpp"
#include "simgrid/s4u/host.hpp"
#include "simgrid/s4u/storage.hpp"
#include "simgrid/simix.h"
-#include "simgrid/simix.h"
#include "src/kernel/EngineImpl.hpp"
#include "src/kernel/routing/NetZoneImpl.hpp"
}
}
-s4u::As *Engine::rootAs()
+s4u::NetZone* Engine::rootAs()
{
return pimpl->rootAs_;
}
-static s4u::As *asByNameRecursive(s4u::As *current, const char *name)
+static s4u::NetZone* asByNameRecursive(s4u::NetZone* current, const char* name)
{
if(!strcmp(current->name(), name))
return current;
xbt_dict_cursor_t cursor = nullptr;
char *key;
- AS_t elem;
+ NetZone_t elem;
xbt_dict_foreach(current->children(), cursor, key, elem) {
- simgrid::s4u::As *tmp = asByNameRecursive(elem, name);
+ simgrid::s4u::NetZone* tmp = asByNameRecursive(elem, name);
if (tmp != nullptr )
return tmp;
}
}
/** @brief Retrieve the AS of the given name (or nullptr if not found) */
-As *Engine::asByNameOrNull(const char *name) {
+NetZone* Engine::asByNameOrNull(const char* name)
+{
return asByNameRecursive(rootAs(),name);
}
*/
void Host::routeTo(Host* dest, std::vector<Link*>* links, double* latency)
{
- simgrid::kernel::routing::AsImpl::getGlobalRoute(pimpl_netcard, dest->pimpl_netcard, links, latency);
+ simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(pimpl_netcard, dest->pimpl_netcard, links, latency);
if (XBT_LOG_ISENABLED(surf_route, xbt_log_priority_debug)) {
XBT_CDEBUG(surf_route, "Route from '%s' to '%s' (latency: %f):", cname(), dest->cname(),
(latency == nullptr ? -1 : *latency));
--- /dev/null
+/* Copyright (c) 2006-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. */
+
+#include "xbt/log.h"
+
+#include "simgrid/s4u/NetZone.hpp"
+#include "simgrid/s4u/host.hpp"
+#include "src/kernel/routing/NetCard.hpp"
+#include "src/surf/network_interface.hpp" // Link FIXME: move to proper header
+#include "src/surf/surf_routing.hpp"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_as, "S4U autonomous systems");
+
+namespace simgrid {
+namespace s4u {
+
+simgrid::xbt::signal<void(bool symmetrical, kernel::routing::NetCard* src, kernel::routing::NetCard* dst,
+ kernel::routing::NetCard* gw_src, kernel::routing::NetCard* gw_dst,
+ std::vector<Link*>* link_list)>
+ NetZone::onRouteCreation;
+
+NetZone::NetZone(NetZone* father, const char* name) : father_(father), name_(xbt_strdup(name))
+{
+}
+void NetZone::seal()
+{
+ sealed_ = true;
+}
+NetZone::~NetZone()
+{
+ xbt_dict_cursor_t cursor = nullptr;
+ char* key;
+ NetZone_t elem;
+ xbt_dict_foreach (children_, cursor, key, elem) {
+ delete (NetZone*)elem;
+ }
+
+ xbt_dict_free(&children_);
+ xbt_free(name_);
+}
+
+xbt_dict_t NetZone::children()
+{
+ return children_;
+}
+char* NetZone::name()
+{
+ return name_;
+}
+NetZone* NetZone::father()
+{
+ return father_;
+}
+
+xbt_dynar_t NetZone::hosts()
+{
+ xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t), nullptr);
+
+ for (auto card : vertices_) {
+ s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->name());
+ if (host != nullptr)
+ xbt_dynar_push(res, &host);
+ }
+ return res;
+}
+
+int NetZone::addComponent(kernel::routing::NetCard* elm)
+{
+ vertices_.push_back(elm);
+ return vertices_.size() - 1; // The rank of the newly created object
+}
+
+void NetZone::addRoute(sg_platf_route_cbarg_t /*route*/)
+{
+ xbt_die("NetZone '%s' does not accept new routes (wrong class).", name_);
+}
+}
+}; // namespace simgrid::s4u
XBT_DEBUG (" linkContainers %s <-> %s", src->name, dst->name);
}
-static void recursiveGraphExtraction (simgrid::s4u::As *as, container_t container, xbt_dict_t filter)
+static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t container, xbt_dict_t filter)
{
if (!TRACE_platform_topology()){
XBT_DEBUG("Graph extraction disabled by user.");
return;
}
- XBT_DEBUG ("Graph extraction for routing_component = %s", as->name());
- if (!xbt_dict_is_empty(as->children())){
+ XBT_DEBUG("Graph extraction for NetZone = %s", netzone->name());
+ if (!xbt_dict_is_empty(netzone->children())) {
xbt_dict_cursor_t cursor = nullptr;
- AS_t rc_son;
+ NetZone_t nz_son;
char *child_name;
//bottom-up recursion
- xbt_dict_foreach(as->children(), cursor, child_name, rc_son) {
- container_t child_container = (container_t) xbt_dict_get (container->children, rc_son->name());
- recursiveGraphExtraction (rc_son, child_container, filter);
+ xbt_dict_foreach (netzone->children(), cursor, child_name, nz_son) {
+ container_t child_container = (container_t)xbt_dict_get(container->children, nz_son->name());
+ recursiveGraphExtraction(nz_son, child_container, filter);
}
}
xbt_dict_cursor_t cursor = nullptr;
char *edge_name;
- static_cast<simgrid::kernel::routing::AsImpl*>(as)->getGraph(graph, nodes, edges);
+ static_cast<simgrid::kernel::routing::NetZoneImpl*>(netzone)->getGraph(graph, nodes, edges);
xbt_dict_foreach(edges,cursor,edge_name,edge) {
linkContainers(
PJ_container_get((const char*) edge->src->data),
#define GRAPHICATOR_SUPPORT_FUNCTIONS
-static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges,
- AS_t as, container_t container)
+static void recursiveXBTGraphExtraction(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges, NetZone_t netzone,
+ container_t container)
{
- if (!xbt_dict_is_empty(as->children())){
+ if (!xbt_dict_is_empty(netzone->children())) {
xbt_dict_cursor_t cursor = nullptr;
- AS_t as_child;
+ NetZone_t netzone_child;
char *child_name;
//bottom-up recursion
- xbt_dict_foreach(as->children(), cursor, child_name, as_child) {
- container_t child_container = (container_t) xbt_dict_get (
- container->children, as_child->name());
- recursiveXBTGraphExtraction (graph, nodes, edges, as_child, child_container);
+ xbt_dict_foreach (netzone->children(), cursor, child_name, netzone_child) {
+ container_t child_container = (container_t)xbt_dict_get(container->children, netzone_child->name());
+ recursiveXBTGraphExtraction(graph, nodes, edges, netzone_child, child_container);
}
}
- static_cast<simgrid::kernel::routing::AsImpl*>(as)->getGraph(graph, nodes, edges);
+ static_cast<simgrid::kernel::routing::NetZoneImpl*>(netzone)->getGraph(graph, nodes, edges);
}
xbt_graph_t instr_routing_platform_graph ()
#include <unordered_set>
-#include <xbt/config.hpp>
+#include "xbt/config.hpp"
#include "ns3/core-module.h"
#include "ns3/node.h"
#include "src/surf/HostImpl.hpp"
#include "src/surf/surf_private.h"
-#include "simgrid/s4u/As.hpp"
+#include "simgrid/s4u/NetZone.hpp"
#include "simgrid/s4u/engine.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ns3, surf, "Logging specific to the SURF network NS3 module");
simgrid::kernel::routing::NetCard::onCreation.connect(&netcardCreation_cb);
simgrid::surf::on_cluster.connect(&clusterCreation_cb);
simgrid::surf::on_postparse.connect(&postparse_cb);
- simgrid::s4u::As::onRouteCreation.connect(&routeCreation_cb);
+ simgrid::s4u::NetZone::onRouteCreation.connect(&routeCreation_cb);
LogComponentEnable("UdpEchoClientApplication", ns3::LOG_LEVEL_INFO);
LogComponentEnable("UdpEchoServerApplication", ns3::LOG_LEVEL_INFO);
static int surf_parse_models_setup_already_called = 0;
/** The current AS in the parsing */
-static simgrid::kernel::routing::AsImpl *current_routing = nullptr;
-static simgrid::kernel::routing::AsImpl *routing_get_current()
+static simgrid::kernel::routing::NetZoneImpl* current_routing = nullptr;
+static simgrid::kernel::routing::NetZoneImpl* routing_get_current()
{
return current_routing;
}
/** @brief Add a "router" to the network element list */
void sg_platf_new_router(sg_platf_router_cbarg_t router)
{
- simgrid::kernel::routing::AsImpl* current_routing = routing_get_current();
+ simgrid::kernel::routing::NetZoneImpl* current_routing = routing_get_current();
- if (current_routing->hierarchy_ == simgrid::kernel::routing::AsImpl::RoutingMode::unset)
- current_routing->hierarchy_ = simgrid::kernel::routing::AsImpl::RoutingMode::base;
+ if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
+ current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::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);
if (router->coord && strcmp(router->coord, ""))
new simgrid::kernel::routing::vivaldi::Coords(netcard, router->coord);
- auto cluster = dynamic_cast<simgrid::kernel::routing::AsCluster*>(current_routing);
+ auto cluster = dynamic_cast<simgrid::kernel::routing::ClusterZone*>(current_routing);
if(cluster != nullptr)
cluster->router_ = static_cast<simgrid::kernel::routing::NetCard*>(xbt_lib_get_or_null(as_router_lib, router->id, ROUTING_ASR_LEVEL));
void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
{
- using simgrid::kernel::routing::AsCluster;
- using simgrid::kernel::routing::AsClusterDragonfly;
- using simgrid::kernel::routing::AsClusterFatTree;
- using simgrid::kernel::routing::AsClusterTorus;
+ using simgrid::kernel::routing::ClusterZone;
+ using simgrid::kernel::routing::DragonflyZone;
+ using simgrid::kernel::routing::FatTreeZone;
+ using simgrid::kernel::routing::TorusZone;
int rankId=0;
break;
}
sg_platf_new_AS_begin(&AS);
- simgrid::kernel::routing::AsCluster *current_as = static_cast<AsCluster*>(routing_get_current());
+ simgrid::kernel::routing::ClusterZone* current_as = static_cast<ClusterZone*>(routing_get_current());
current_as->parse_specific_arguments(cluster);
if(cluster->loopback_bw!=0 || cluster->loopback_lat!=0){
linkDown = Link::byName(tmp_link);
free(tmp_link);
- auto as_cluster = static_cast<AsCluster*>(current_as);
+ auto as_cluster = static_cast<ClusterZone*>(current_as);
as_cluster->privateLinks_.insert({rankId * as_cluster->linkCountPerNode_, {linkUp, linkDown}});
}
//call the cluster function that adds the others links
if (cluster->topology == SURF_CLUSTER_FAT_TREE) {
- static_cast<AsClusterFatTree*>(current_as)->addProcessingNode(i);
+ static_cast<FatTreeZone*>(current_as)->addProcessingNode(i);
}
else {
current_as->create_links_for_node(cluster, i, rankId,
delete cluster->radicals;
}
void routing_cluster_add_backbone(simgrid::surf::Link* bb) {
- simgrid::kernel::routing::AsCluster *cluster = dynamic_cast<simgrid::kernel::routing::AsCluster*>(current_routing);
+ simgrid::kernel::routing::ClusterZone* cluster =
+ dynamic_cast<simgrid::kernel::routing::ClusterZone*>(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)
{
- simgrid::kernel::routing::AsVivaldi* as = dynamic_cast<simgrid::kernel::routing::AsVivaldi*>(current_routing);
+ simgrid::kernel::routing::VivaldiZone* as = dynamic_cast<simgrid::kernel::routing::VivaldiZone*>(current_routing);
xbt_assert(as, "<peer> tag can only be used in Vivaldi ASes");
std::vector<double> speedPerPstate;
*
* @param AS the parameters defining the AS to build.
*/
-simgrid::s4u::As * sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS)
+simgrid::s4u::NetZone* sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS)
{
if (!surf_parse_models_setup_already_called) {
/* Initialize the surf models. That must be done after we got all config, and before we need the models.
/* search the routing model */
- simgrid::kernel::routing::AsImpl *new_as = nullptr;
+ simgrid::kernel::routing::NetZoneImpl* new_as = nullptr;
switch(AS->routing){
case A_surfxml_AS_routing_Cluster:
- new_as = new simgrid::kernel::routing::AsCluster(current_routing, AS->id);
+ new_as = new simgrid::kernel::routing::ClusterZone(current_routing, AS->id);
break;
case A_surfxml_AS_routing_ClusterDragonfly:
- new_as = new simgrid::kernel::routing::AsClusterDragonfly(current_routing, AS->id);
+ new_as = new simgrid::kernel::routing::DragonflyZone(current_routing, AS->id);
break;
case A_surfxml_AS_routing_ClusterTorus:
- new_as = new simgrid::kernel::routing::AsClusterTorus(current_routing, AS->id);
+ new_as = new simgrid::kernel::routing::TorusZone(current_routing, AS->id);
break;
case A_surfxml_AS_routing_ClusterFatTree:
- new_as = new simgrid::kernel::routing::AsClusterFatTree(current_routing, AS->id);
+ new_as = new simgrid::kernel::routing::FatTreeZone(current_routing, AS->id);
break;
case A_surfxml_AS_routing_Dijkstra:
- new_as = new simgrid::kernel::routing::AsDijkstra(current_routing, AS->id, 0);
+ new_as = new simgrid::kernel::routing::DijkstraZone(current_routing, AS->id, 0);
break;
case A_surfxml_AS_routing_DijkstraCache:
- new_as = new simgrid::kernel::routing::AsDijkstra(current_routing, AS->id, 1);
+ new_as = new simgrid::kernel::routing::DijkstraZone(current_routing, AS->id, 1);
break;
case A_surfxml_AS_routing_Floyd:
- new_as = new simgrid::kernel::routing::AsFloyd(current_routing, AS->id);
+ new_as = new simgrid::kernel::routing::FloydZone(current_routing, AS->id);
break;
case A_surfxml_AS_routing_Full:
- new_as = new simgrid::kernel::routing::AsFull(current_routing, AS->id);
+ new_as = new simgrid::kernel::routing::FullZone(current_routing, AS->id);
break;
case A_surfxml_AS_routing_None:
- new_as = new simgrid::kernel::routing::AsNone(current_routing, AS->id);
+ new_as = new simgrid::kernel::routing::EmptyZone(current_routing, AS->id);
break;
case A_surfxml_AS_routing_Vivaldi:
- new_as = new simgrid::kernel::routing::AsVivaldi(current_routing, AS->id);
+ new_as = new simgrid::kernel::routing::VivaldiZone(current_routing, AS->id);
break;
default:
xbt_die("Not a valid model!");
} else {
/* set the father behavior */
- if (current_routing->hierarchy_ == simgrid::kernel::routing::AsImpl::RoutingMode::unset)
- current_routing->hierarchy_ = simgrid::kernel::routing::AsImpl::RoutingMode::recursive;
+ if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
+ current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::recursive;
/* add to the sons dictionary */
xbt_dict_set(current_routing->children(), AS->id, (void *) new_as, nullptr);
}
{
xbt_assert(current_routing, "Cannot seal the current AS: none under construction");
current_routing->seal();
- current_routing = static_cast<simgrid::kernel::routing::AsImpl*>(current_routing->father());
+ current_routing = static_cast<simgrid::kernel::routing::NetZoneImpl*>(current_routing->father());
if (TRACE_is_enabled())
sg_instr_AS_end();
{
simgrid::kernel::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::kernel::routing::AsCluster*>(current_routing),
- "Only hosts from Cluster and Vivaldi ASes can get an host_link.");
+ xbt_assert(dynamic_cast<simgrid::kernel::routing::ClusterZone*>(current_routing),
+ "Only hosts from Cluster and Vivaldi ASes can get an host_link.");
simgrid::surf::Link* linkUp = Link::byName(hostlink->link_up);
simgrid::surf::Link* linkDown = Link::byName(hostlink->link_down);
xbt_assert(linkUp, "Link '%s' not found!", hostlink->link_up);
xbt_assert(linkDown, "Link '%s' not found!", hostlink->link_down);
- auto as_cluster = static_cast<simgrid::kernel::routing::AsCluster*>(current_routing);
+ auto as_cluster = static_cast<simgrid::kernel::routing::ClusterZone*>(current_routing);
if (as_cluster->privateLinks_.find(netcard->id()) != as_cluster->privateLinks_.end())
surf_parse_error("Host_link for '%s' is already defined!",hostlink->id);
XBT_PUBLIC(void) storage_register_callbacks();
-XBT_PUBLIC(void) generic_get_graph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges, AS_t rc);
+XBT_PUBLIC(void) generic_get_graph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges, NetZone_t rc);
XBT_PRIVATE void parse_after_config();
/********** Tracing **********/
XBT_PUBLIC(void) sg_platf_begin(); // Start a new platform
XBT_PUBLIC(void) sg_platf_end(); // Finish the creation of the platform
-XBT_PUBLIC(simgrid::s4u::As*) sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS); // Begin description of new AS
+XBT_PUBLIC(simgrid::s4u::NetZone*) sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS); // Begin description of new AS
XBT_PUBLIC(void) sg_platf_new_AS_seal(); // That AS is fully described
XBT_PUBLIC(void) sg_platf_new_host (sg_platf_host_cbarg_t host); // Add an host to the currently described AS
host2 = hosts[it_dst];
std::vector<Link*> *route = new std::vector<Link*>();
value2 = host2->pimpl_netcard;
- simgrid::kernel::routing::AsImpl::getGlobalRoute(value1, value2, route, nullptr);
+ simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, value2, route, nullptr);
if (! route->empty()){
std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->cname(), host2->cname());
for (auto link: *route)
if(value2->isRouter()){
std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->cname(), dst);
std::vector<Link*> *route = new std::vector<Link*>();
- simgrid::kernel::routing::AsImpl::getGlobalRoute(value1, value2, route, nullptr);
+ simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, value2, route, nullptr);
for (auto link : *route)
std::printf("<link_ctn id=\"%s\"/>",link->getName());
delete route;
if(value2->isRouter()){
std::printf(" <route src=\"%s\" dst=\"%s\">\n ", src, dst);
std::vector<Link*> *route = new std::vector<Link*>();
- simgrid::kernel::routing::AsImpl::getGlobalRoute(value1, value2, route, nullptr);
+ simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, value2, route, nullptr);
for(auto link :*route)
std::printf("<link_ctn id=\"%s\"/>",link->getName());
delete route;
std::printf(" <route src=\"%s\" dst=\"%s\">\n ", src, host2->cname());
std::vector<Link*> *route = new std::vector<Link*>();
value2 = host2->pimpl_netcard;
- simgrid::kernel::routing::AsImpl::getGlobalRoute(value1, value2, route, nullptr);
+ simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, value2, route, nullptr);
for(auto link : *route)
std::printf("<link_ctn id=\"%s\"/>",link->getName());
delete route;
set(S4U_SRC
src/s4u/s4u_actor.cpp
- src/s4u/s4u_as.cpp
src/s4u/s4u_activity.cpp
+ src/s4u/s4u_conditionVariable.cpp
src/s4u/s4u_comm.cpp
src/s4u/s4u_engine.cpp
src/s4u/s4u_file.cpp
src/s4u/s4u_host.cpp
src/s4u/s4u_mailbox.cpp
src/s4u/s4u_mutex.cpp
- src/s4u/s4u_conditionVariable.cpp
+ src/s4u/s4u_netzone.cpp
src/s4u/s4u_storage.cpp
)
include/simgrid/s4u/forward.hpp
include/simgrid/s4u/Activity.hpp
include/simgrid/s4u/Actor.hpp
- include/simgrid/s4u/As.hpp
include/simgrid/s4u/comm.hpp
+ include/simgrid/s4u/conditionVariable.hpp
include/simgrid/s4u/engine.hpp
include/simgrid/s4u/file.hpp
include/simgrid/s4u/host.hpp
include/simgrid/s4u/Mailbox.hpp
include/simgrid/s4u/Mutex.hpp
- include/simgrid/s4u/conditionVariable.hpp
+ include/simgrid/s4u/NetZone.hpp
include/simgrid/s4u/storage.hpp
include/simgrid/s4u/VirtualMachine.hpp
include/simgrid/s4u.hpp