Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Give a p_netcard to simgrid::Host instead of relying on extensions for that
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 29 Dec 2015 14:54:43 +0000 (15:54 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 29 Dec 2015 15:25:39 +0000 (16:25 +0100)
23 files changed:
.cproject
include/simgrid/Host.hpp
include/simgrid/host.h
include/simgrid/platf.h
include/simgrid/simdag.h
src/instr/instr_interface.cpp
src/instr/instr_paje_containers.cpp
src/simgrid/host.cpp
src/surf/host_clm03.cpp
src/surf/host_ptask_L07.cpp
src/surf/host_ptask_L07.hpp
src/surf/sg_platf.cpp
src/surf/surf_c_bindings.cpp
src/surf/surf_routing.cpp
src/surf/surf_routing.hpp
src/surf/surf_routing_dijkstra.cpp
src/surf/surf_routing_floyd.cpp
src/surf/surf_routing_full.cpp
src/surf/surf_routing_generic.cpp
src/surf/surfxml_parse.c
src/surf/vm_hl13.cpp
teshsuite/simdag/platforms/CMakeLists.txt
teshsuite/simdag/platforms/flatifier.cpp [moved from teshsuite/simdag/platforms/flatifier.c with 89% similarity]

index 65f4132..ebbd921 100644 (file)
--- a/.cproject
+++ b/.cproject
@@ -18,7 +18,7 @@
                                        <folderInfo id="cdt.managedbuild.toolchain.gnu.base.1011977604.157358594" name="/" resourcePath="">
                                                <toolChain id="cdt.managedbuild.toolchain.gnu.base.368132295" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
                                                        <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.1122260779" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
-                                                       <builder id="cdt.managedbuild.target.gnu.builder.base.1747533038" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.base"/>
+                                                       <builder buildPath="${workspace_loc:/simgrid}/build/simple" id="cdt.managedbuild.target.gnu.builder.base.1747533038" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.base"/>
                                                        <tool id="cdt.managedbuild.tool.gnu.archiver.base.374652938" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
                                                        <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.738159103" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
                                                                <option id="gnu.cpp.compiler.option.include.paths.216814103" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
index 6e102c2..2810c16 100644 (file)
 namespace simgrid {
 
 XBT_PUBLIC_CLASS Host :
-       public simgrid::xbt::Extendable<Host> {
+public simgrid::xbt::Extendable<Host> {
 
-       public:
-       surf::Cpu *p_cpu;
+public:
+         surf::Cpu     *p_cpu = nullptr;
+         surf::NetCard *p_netcard = nullptr;
 
 private:
-  simgrid::xbt::string name_;
+  simgrid::xbt::string name_ = "noname";
 public:
   Host(std::string const& name);
   ~Host();
index 387eea2..87abdf2 100644 (file)
@@ -51,12 +51,6 @@ XBT_PUBLIC(smx_host_priv_t) sg_host_simix(sg_host_t host);
 XBT_PUBLIC(void) sg_host_simix_set(sg_host_t host, smx_host_priv_t priv);
 XBT_PUBLIC(void) sg_host_simix_destroy(sg_host_t host);
 
-// ========== RoutingEdge ============
-XBT_PUBLIC(sg_netcard_t) sg_host_edge(sg_host_t host);
-XBT_PUBLIC(void) sg_host_edge_set(sg_host_t host, sg_netcard_t edge);
-XBT_PUBLIC(void) sg_host_edge_destroy(sg_host_t host, int do_callback);
-
-
 // Module initializer. Won't survive the conversion to C++. Hopefully.
 XBT_PUBLIC(void) sg_host_init(void);
 
index d340ed8..c080e77 100644 (file)
@@ -19,7 +19,7 @@ static inline char* sg_storage_name(sg_storage_t storage) {
   return storage->key;
 }
 
-XBT_PUBLIC(sg_netcard_t) sg_routing_edge_by_name_or_null(const char *name);
+XBT_PUBLIC(sg_netcard_t) sg_netcard_by_name_or_null(const char *name);
 
 XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_file(const char *filename);
 XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_string(const char *id,
@@ -55,7 +55,7 @@ XBT_PUBLIC(void) sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS); // Begin descrip
 XBT_PUBLIC(void) sg_platf_new_AS_end(void);                            // 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
-XBT_PUBLIC(void) sg_platf_new_host_link(sg_platf_host_link_cbarg_t h); // Add an host_link to the currently described AS
+XBT_PUBLIC(void) sg_platf_new_netcard(sg_platf_host_link_cbarg_t h); // Add an host_link to the currently described AS
 XBT_PUBLIC(void) sg_platf_new_router (sg_platf_router_cbarg_t router); // Add a router  to the currently described AS
 XBT_PUBLIC(void) sg_platf_new_link   (sg_platf_link_cbarg_t link);     // Add a link    to the currently described AS
 XBT_PUBLIC(void) sg_platf_new_peer   (sg_platf_peer_cbarg_t peer);     // Add a peer    to the currently described AS
index 07a18c2..573d411 100644 (file)
@@ -332,7 +332,7 @@ XBT_PUBLIC(int) SD_task_dependency_exists(SD_task_t src, SD_task_t dst);
 /** @defgroup SD_simulation Simulation
  *  @brief Functions for creating the environment and launching the simulation
  *
- *  This section describes the functions for initialising SimDag, launching
+ *  This section describes the functions for initializing SimDag, launching
  *  the simulation and exiting SimDag.
  *
  *  @{
@@ -352,7 +352,8 @@ XBT_PUBLIC(void) uniq_transfer_task_name(SD_task_t task);
 
 /** @} */
 
+SG_END_DECL()
+
 #include "simgrid/instr.h"
 
-SG_END_DECL()
 #endif
index f4f8c4e..290bd88 100644 (file)
@@ -364,10 +364,10 @@ static void instr_user_srcdst_variable(double time,
                               InstrUserVariable what)
 {
   xbt_dynar_t route=NULL;
-  sg_netcard_t src_elm = sg_routing_edge_by_name_or_null(src);
+  sg_netcard_t src_elm = sg_netcard_by_name_or_null(src);
   if(!src_elm) xbt_die("Element '%s' not found!",src);
 
-  sg_netcard_t dst_elm = sg_routing_edge_by_name_or_null(dst);
+  sg_netcard_t dst_elm = sg_netcard_by_name_or_null(dst);
   if(!dst_elm) xbt_die("Element '%s' not found!",dst);
 
   routing_get_route_and_latency (src_elm, dst_elm, &route,NULL);
index e5d3c36..3ce483c 100644 (file)
@@ -60,7 +60,7 @@ container_t PJ_container_new (const char *name, e_container_types kind, containe
   //Search for network_element_t
   switch (kind){
     case INSTR_HOST:
-      newContainer->net_elm = sg_host_edge(sg_host);
+      newContainer->net_elm = sg_host->p_netcard;
       if(!newContainer->net_elm) xbt_die("Element '%s' not found",name);
       break;
     case INSTR_ROUTER:
index 56c7873..002e68c 100644 (file)
@@ -124,17 +124,6 @@ void sg_host_simix_destroy(sg_host_t host) {
   host->extension_set(SIMIX_HOST_LEVEL, nullptr);
 }
 
-// ========== RoutingEdge ============
-surf_NetCard *sg_host_edge(sg_host_t host) {
-       return (surf_NetCard*) host->extension(ROUTING_HOST_LEVEL);
-}
-void sg_host_edge_set(sg_host_t host, surf_NetCard *edge) {
-  host->extension_set(ROUTING_HOST_LEVEL, edge);
-}
-void sg_host_edge_destroy(sg_host_t host, int do_callback) {
-  host->extension_set(ROUTING_HOST_LEVEL, nullptr, do_callback);
-}
-
 // =========== user-level functions ===============
 // ================================================
 double sg_host_get_speed(sg_host_t host){
index d74a419..0f01846 100644 (file)
@@ -84,8 +84,8 @@ Action *HostCLM03Model::executeParallelTask(int host_nb,
     action = surf_host_execute(host_list[0],flops_amount[0]);
   } else if ((host_nb == 1)
            && (cost_or_zero(flops_amount, 0) == 0.0)) {
-    action = surf_network_model->communicate(sg_host_edge(host_list[0]),
-                                                sg_host_edge(host_list[0]),
+    action = surf_network_model->communicate(host_list[0]->p_netcard,
+                                                host_list[0]->p_netcard,
                                                                                         bytes_amount[0], rate);
   } else if ((host_nb == 2)
              && (cost_or_zero(flops_amount, 0) == 0.0)
@@ -100,8 +100,8 @@ Action *HostCLM03Model::executeParallelTask(int host_nb,
       }
     }
     if (nb == 1){
-      action = surf_network_model->communicate(sg_host_edge(host_list[0]),
-                                                  sg_host_edge(host_list[1]),
+      action = surf_network_model->communicate(host_list[0]->p_netcard,
+                                                  host_list[1]->p_netcard,
                                                                                           value, rate);
     }
   } else
index 5563153..943d715 100644 (file)
@@ -199,9 +199,9 @@ L07Action::L07Action(Model *model, int host_nb,
 
   xbt_dict_t ptask_parallel_task_link_set = xbt_dict_new_homogeneous(NULL);
 
-  this->p_edgeList->reserve(host_nb);
+  this->p_netcardList->reserve(host_nb);
   for (int i = 0; i<host_nb; i++)
-         this->p_edgeList->push_back(sg_host_edge(host_list[i]));
+         this->p_netcardList->push_back(host_list[i]->p_netcard);
 
   /* Compute the number of affected resources... */
   for (int i = 0; i < host_nb; i++) {
@@ -214,7 +214,7 @@ L07Action::L07Action(Model *model, int host_nb,
         void *_link;
         LinkL07 *link;
 
-        routing_platf->getRouteAndLatency((*this->p_edgeList)[i], (*this->p_edgeList)[j],
+        routing_platf->getRouteAndLatency((*this->p_netcardList)[i], (*this->p_netcardList)[j],
                                                  &route, &lat);
         latency = MAX(latency, lat);
 
@@ -260,7 +260,7 @@ L07Action::L07Action(Model *model, int host_nb,
       if (bytes_amount[i * host_nb + j] == 0.0)
         continue;
 
-      routing_platf->getRouteAndLatency((*this->p_edgeList)[i], (*this->p_edgeList)[j],
+      routing_platf->getRouteAndLatency((*this->p_netcardList)[i], (*this->p_netcardList)[j],
                                            &route, NULL);
 
       xbt_dynar_foreach(route, cpt, _link) {
@@ -563,7 +563,7 @@ void L07Action::updateBound()
   double lat_bound = -1.0;
   int i, j;
 
-  int hostNb = p_edgeList->size();
+  int hostNb = p_netcardList->size();
 
   for (i = 0; i < hostNb; i++) {
     for (j = 0; j < hostNb; j++) {
@@ -571,7 +571,7 @@ void L07Action::updateBound()
 
       if (p_communicationAmount[i * hostNb + j] > 0) {
         double lat = 0.0;
-        routing_platf->getRouteAndLatency((*p_edgeList)[i], (*p_edgeList)[j],
+        routing_platf->getRouteAndLatency((*p_netcardList)[i], (*p_netcardList)[j],
                                                          &route, &lat);
 
         lat_current = MAX(lat_current, lat * p_communicationAmount[i * hostNb + j]);
index 4db4ea2..89ab7c8 100644 (file)
@@ -157,7 +157,7 @@ public:
   void setPriority(double priority) override;
   double getRemains() override;
 
-  std::vector<NetCard*> * p_edgeList = new std::vector<NetCard*>();
+  std::vector<NetCard*> * p_netcardList = new std::vector<NetCard*>();
   double *p_computationAmount;
   double *p_communicationAmount;
   double m_latency;
index 7d72227..a178aa7 100644 (file)
@@ -88,7 +88,7 @@ void sg_platf_new_router(sg_platf_router_cbarg_t router)
              "Reading a router, processing unit \"%s\" already exists",
              router->id);
 
-  simgrid::surf::NetCard *info = new simgrid::surf::RoutingEdgeImpl(
+  simgrid::surf::NetCard *info = new simgrid::surf::NetCardImpl(
     xbt_strdup(router->id), -1, SURF_NETWORK_ELEMENT_ROUTER, current_routing);
   info->setId(current_routing->parsePU(info));
   xbt_lib_set(as_router_lib, router->id, ROUTING_ASR_LEVEL, (void *) info);
index 5214c36..d317546 100644 (file)
@@ -236,7 +236,7 @@ void surf_vm_model_create(const char *name, sg_host_t ind_phys_host){
 }
 
 surf_action_t surf_network_model_communicate(surf_network_model_t model, sg_host_t src, sg_host_t dst, double size, double rate){
-  return model->communicate(sg_host_edge(src), sg_host_edge(dst), size, rate);
+  return model->communicate(src->p_netcard, dst->p_netcard, size, rate);
 }
 
 const char *surf_resource_name(surf_cpp_resource_t resource){
@@ -385,19 +385,9 @@ void surf_host_set_params(sg_host_t host, vm_params_t params){
   get_casted_host(host)->setParams(params);
 }
 
-void surf_vm_destroy(sg_host_t resource){
-  /* We deregister objects from host_lib, without invoking the freeing callback
-   * of each level.
-   *
-   * Do not call xbt_lib_remove() here. It deletes all levels of the key,
-   * including MSG_HOST_LEVEL and others. We should unregister only what we know.
-   */
-  resource->p_cpu = nullptr; // FIXME: memleaking?
-  sg_host_edge_destroy(resource,1);
-  resource->extension_set<simgrid::surf::Host>(nullptr);
-
-  /* TODO: comment out when VM storage is implemented. */
-  // host->extension_set(SURF_STORAGE_LEVEL, nullptr);
+void surf_vm_destroy(sg_host_t vm){
+  vm->p_cpu = nullptr;
+  delete vm->p_netcard;
 }
 
 void surf_vm_suspend(sg_host_t vm){
index 14ea442..a64fd47 100644 (file)
@@ -52,14 +52,14 @@ int ROUTING_PROP_ASR_LEVEL;     //Where the properties are stored
 static xbt_dict_t random_value = NULL;
 
 
-/** @brief Retrieve a routing edge from its name
+/** @brief Retrieve a netcard from its name
  *
- * Routing edges are either host and routers, whatever
+ * Netcards are the thing that connect host or routers to the network
  */
-simgrid::surf::NetCard *sg_routing_edge_by_name_or_null(const char *name)
+simgrid::surf::NetCard *sg_netcard_by_name_or_null(const char *name)
 {
   sg_host_t h = sg_host_by_name(name);
-  simgrid::surf::NetCard *net_elm = h==NULL?NULL: sg_host_edge(h);
+  simgrid::surf::NetCard *net_elm = h==NULL?NULL: h->p_netcard;
   if (!net_elm)
        net_elm = (simgrid::surf::NetCard*) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL);
   return net_elm;
@@ -80,8 +80,6 @@ simgrid::surf::As* routing_get_current()
   return current_routing;
 }
 
-// static void routing_parse_Srandom(void);        /* random bypass */
-
 static void routing_parse_postparse(void);
 
 /* this lines are only for replace use like index in the model table */
@@ -124,30 +122,31 @@ struct s_model_type routing_models[] = {
 };
 
 /**
- * \brief Add a "host_link" to the network element list
+ * \brief Add a netcard connecting an host to the network element list
+ * FIXME: integrate into host constructor
  */
-void sg_platf_new_host_link(sg_platf_host_link_cbarg_t host)
+void sg_platf_new_netcard(sg_platf_host_link_cbarg_t netcard)
 {
-  simgrid::surf::NetCard *info = sg_host_edge(sg_host_by_name(host->id));
-  xbt_assert(info, "Host '%s' not found!", host->id);
+  simgrid::surf::NetCard *info = sg_host_by_name(netcard->id)->p_netcard;
+  xbt_assert(info, "Host '%s' not found!", netcard->id);
   xbt_assert(current_routing->p_modelDesc == &routing_models[SURF_MODEL_CLUSTER] ||
       current_routing->p_modelDesc == &routing_models[SURF_MODEL_VIVALDI],
       "You have to be in model Cluster to use tag host_link!");
 
   s_surf_parsing_link_up_down_t link_up_down;
-  link_up_down.link_up = Link::byName(host->link_up);
-  link_up_down.link_down = Link::byName(host->link_down);
+  link_up_down.link_up = Link::byName(netcard->link_up);
+  link_up_down.link_down = Link::byName(netcard->link_down);
 
-  xbt_assert(link_up_down.link_up, "Link '%s' not found!",host->link_up);
-  xbt_assert(link_up_down.link_down, "Link '%s' not found!",host->link_down);
+  xbt_assert(link_up_down.link_up, "Link '%s' not found!",netcard->link_up);
+  xbt_assert(link_up_down.link_down, "Link '%s' not found!",netcard->link_down);
 
   if(!current_routing->p_linkUpDownList)
     current_routing->p_linkUpDownList = xbt_dynar_new(sizeof(s_surf_parsing_link_up_down_t),NULL);
 
-  // If dynar is is greater than edge id and if the host_link is already defined
+  // If dynar is is greater than netcard id and if the host_link is already defined
   if((int)xbt_dynar_length(current_routing->p_linkUpDownList) > info->getId() &&
       xbt_dynar_get_as(current_routing->p_linkUpDownList, info->getId(), void*))
-       surf_parse_error("Host_link for '%s' is already defined!",host->id);
+       surf_parse_error("Host_link for '%s' is already defined!",netcard->id);
 
   XBT_DEBUG("Push Host_link for host '%s' to position %d", info->getName(), info->getId());
   xbt_dynar_set_as(current_routing->p_linkUpDownList, info->getId(), s_surf_parsing_link_up_down_t, link_up_down);
@@ -164,16 +163,16 @@ simgrid::surf::NetCard *routing_add_host(
   xbt_assert(!sg_host_by_name(host->id),
                     "Reading a host, processing unit \"%s\" already exists", host->id);
 
-  simgrid::surf::NetCard *routingEdge =
-    new simgrid::surf::RoutingEdgeImpl(xbt_strdup(host->id),
+  simgrid::surf::NetCard *netcard =
+    new simgrid::surf::NetCardImpl(xbt_strdup(host->id),
                                                    -1,
                                                    SURF_NETWORK_ELEMENT_HOST,
                                                    current_routing);
-  routingEdge->setId(current_routing->parsePU(routingEdge));
+  netcard->setId(current_routing->parsePU(netcard));
   sg_host_t h = sg_host_by_name_or_create(host->id);
-  sg_host_edge_set(h, routingEdge);
-  XBT_DEBUG("Having set name '%s' id '%d'", host->id, routingEdge->getId());
-  simgrid::surf::routingEdgeCreatedCallbacks(routingEdge);
+  h->p_netcard = netcard;
+  XBT_DEBUG("Having set name '%s' id '%d'", host->id, netcard->getId());
+  simgrid::surf::routingEdgeCreatedCallbacks(netcard);
 
   if(mount_list){
     xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, (void *) mount_list);
@@ -199,7 +198,7 @@ simgrid::surf::NetCard *routing_add_host(
     XBT_DEBUG("Having set host coordinates for '%s'",host->id);
   }
 
-  return routingEdge;
+  return netcard;
 }
 
 /**
@@ -316,7 +315,7 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS)
   new_as->p_name = xbt_strdup(AS->id);
 
   simgrid::surf::NetCard *info =
-    new simgrid::surf::RoutingEdgeImpl(xbt_strdup(new_as->p_name),
+    new simgrid::surf::NetCardImpl(xbt_strdup(new_as->p_name),
                                             -1,
                                             SURF_NETWORK_ELEMENT_AS,
                                             current_routing);
@@ -535,8 +534,8 @@ AS_t surf_platf_get_root(routing_platf_t platf){
   return platf->p_root;
 }
 
-e_surf_network_element_type_t surf_routing_edge_get_rc_type(sg_netcard_t edge){
-  return edge->getRcType();
+e_surf_network_element_type_t surf_routing_edge_get_rc_type(sg_netcard_t netcard){
+  return netcard->getRcType();
 }
 
 namespace simgrid {
@@ -554,7 +553,7 @@ namespace surf {
  * \pre route!=NULL
  *
  * walk through the routing components tree and find a route between hosts
- * by calling the differents "get_route" functions in each routing component.
+ * by calling each "get_route" function in each routing component.
  */
 void RoutingPlatf::getRouteAndLatency(
   simgrid::surf::NetCard *src, simgrid::surf::NetCard *dst,
@@ -602,7 +601,7 @@ xbt_dynar_t RoutingPlatf::recursiveGetOneLinkRoutes(As *rc)
 
 e_surf_network_element_type_t routing_get_network_element_type(const char *name)
 {
-  simgrid::surf::NetCard *rc = sg_routing_edge_by_name_or_null(name);
+  simgrid::surf::NetCard *rc = sg_netcard_by_name_or_null(name);
   if (rc)
     return rc->getRcType();
 
@@ -740,7 +739,7 @@ void sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet)
       host_link.id        = host_id;
       host_link.link_up   = link_up;
       host_link.link_down = link_down;
-      sg_platf_new_host_link(&host_link);
+      sg_platf_new_netcard(&host_link);
 
       free(host_id);
       free(link_id);
@@ -1081,7 +1080,7 @@ void sg_platf_new_peer(sg_platf_peer_cbarg_t peer)
   host_link.id        = host_id;
   host_link.link_up   = link_up;
   host_link.link_down = link_down;
-  sg_platf_new_host_link(&host_link);
+  sg_platf_new_netcard(&host_link);
 
   XBT_DEBUG("<router id=\"%s\"/>", router_id);
   s_sg_platf_router_cbarg_t router = SG_PLATF_ROUTER_INITIALIZER;
@@ -1232,7 +1231,7 @@ static void check_disk_attachment()
   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) != NULL) {
          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));
-         host_elm = sg_routing_edge_by_name_or_null(storage->p_attach);
+         host_elm = sg_netcard_by_name_or_null(storage->p_attach);
          if(!host_elm)
                  surf_parse_error("Unable to attach storage %s: host %s doesn't exist.", storage->getName(), storage->p_attach);
     }
index 0b6fb74..6ed29be 100644 (file)
@@ -100,11 +100,11 @@ public:
   virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0;
 };
 
-struct XBT_PRIVATE RoutingEdgeImpl : public NetCard {
+struct XBT_PRIVATE NetCardImpl : public NetCard {
 public:
-  RoutingEdgeImpl(char *name, int id, e_surf_network_element_type_t rcType, As *rcComponent)
+  NetCardImpl(char *name, int id, e_surf_network_element_type_t rcType, As *rcComponent)
   : p_rcComponent(rcComponent), p_rcType(rcType), m_id(id), p_name(name) {}
-  ~RoutingEdgeImpl() { xbt_free(p_name);};
+  ~NetCardImpl() { xbt_free(p_name);};
 
   int getId() {return m_id;}
   int *getIdPtr() {return &m_id;}
index cb0ac0d..31d603f 100644 (file)
@@ -483,8 +483,8 @@ void AsDijkstra::parseRoute(sg_platf_route_cbarg_t route)
 
   NetCard *src_net_elm, *dst_net_elm;
 
-  src_net_elm = sg_routing_edge_by_name_or_null(src);
-  dst_net_elm = sg_routing_edge_by_name_or_null(dst);
+  src_net_elm = sg_netcard_by_name_or_null(src);
+  dst_net_elm = sg_netcard_by_name_or_null(dst);
 
   xbt_assert(src_net_elm, "Network elements %s not found", src);
   xbt_assert(dst_net_elm, "Network elements %s not found", dst);
index 1c20aeb..58f4824 100644 (file)
@@ -154,8 +154,8 @@ void AsFloyd::parseRoute(sg_platf_route_cbarg_t route)
   int table_size = (int)xbt_dynar_length(p_indexNetworkElm);
   NetCard *src_net_elm, *dst_net_elm;
 
-  src_net_elm = sg_routing_edge_by_name_or_null(src);
-  dst_net_elm = sg_routing_edge_by_name_or_null(dst);
+  src_net_elm = sg_netcard_by_name_or_null(src);
+  dst_net_elm = sg_netcard_by_name_or_null(dst);
 
   xbt_assert(src_net_elm, "Network elements %s not found", src);
   xbt_assert(dst_net_elm, "Network elements %s not found", dst);
index da22330..20e0776 100644 (file)
@@ -146,8 +146,8 @@ void AsFull::parseRoute(sg_platf_route_cbarg_t route)
   char *src = (char*)(route->src);
   char *dst = (char*)(route->dst);
   NetCard *src_net_elm, *dst_net_elm;
-  src_net_elm = sg_routing_edge_by_name_or_null(src);
-  dst_net_elm = sg_routing_edge_by_name_or_null(dst);
+  src_net_elm = sg_netcard_by_name_or_null(src);
+  dst_net_elm = sg_netcard_by_name_or_null(dst);
 
   xbt_assert(src_net_elm, "Network elements %s not found", src);
   xbt_assert(dst_net_elm, "Network elements %s not found", dst);
index 8882b3a..1dc0d18 100644 (file)
@@ -449,7 +449,7 @@ As *AsGeneric::autonomousSystemExist(char *element)
 
 As *AsGeneric::processingUnitsExist(char *element)
 {
-  As *element_as = sg_host_edge(sg_host_by_name(element)) ->getRcComponent();
+  As *element_as = sg_host_by_name(element)->p_netcard ->getRcComponent();
   if (element_as == this)
     return element_as;
   return asExist(element_as);
index a26f8a1..6a81309 100644 (file)
@@ -490,7 +490,7 @@ void STag_surfxml_host___link(void){
   host_link.id        = A_surfxml_host___link_id;
   host_link.link_up   = A_surfxml_host___link_up;
   host_link.link_down = A_surfxml_host___link_down;
-  sg_platf_new_host_link(&host_link);
+  sg_platf_new_netcard(&host_link);
 }
 
 void STag_surfxml_router(void){
@@ -773,8 +773,8 @@ void ETag_surfxml_ASroute(void){
   ASroute.src = A_surfxml_ASroute_src;
   ASroute.dst = A_surfxml_ASroute_dst;
 
-  ASroute.gw_src = sg_routing_edge_by_name_or_null(A_surfxml_ASroute_gw___src);
-  ASroute.gw_dst = sg_routing_edge_by_name_or_null(A_surfxml_ASroute_gw___dst);
+  ASroute.gw_src = sg_netcard_by_name_or_null(A_surfxml_ASroute_gw___src);
+  ASroute.gw_dst = sg_netcard_by_name_or_null(A_surfxml_ASroute_gw___dst);
 
   if (A_surfxml_ASroute_gw___src && !ASroute.gw_src)
     surf_parse_error("gw_src=\"%s\" not found for ASroute from \"%s\" to \"%s\"",
@@ -823,8 +823,8 @@ void ETag_surfxml_bypassASroute(void){
   ASroute.link_list   = parsed_link_list;
   ASroute.symmetrical = FALSE;
 
-  ASroute.gw_src = sg_routing_edge_by_name_or_null(A_surfxml_bypassASroute_gw___src);
-  ASroute.gw_dst = sg_routing_edge_by_name_or_null(A_surfxml_bypassASroute_gw___dst);
+  ASroute.gw_src = sg_netcard_by_name_or_null(A_surfxml_bypassASroute_gw___src);
+  ASroute.gw_dst = sg_netcard_by_name_or_null(A_surfxml_bypassASroute_gw___dst);
 
   sg_platf_new_bypassASroute(&ASroute);
   parsed_link_list = NULL;
index 173c26d..3310186 100644 (file)
@@ -176,9 +176,9 @@ VMHL13::VMHL13(VMModel *model, const char* name, xbt_dict_t props, sg_host_t hos
    * from the VM name, we have to make sure that the system does not call the
    * free callback for the network resource object. The network resource object
    * is still used by the physical machine. */
-  p_netElm = new RoutingEdgeWrapper(sg_host_edge(host_PM));
+  p_netElm = new RoutingEdgeWrapper(host_PM->p_netcard);
   sg_host_t host = sg_host_by_name_or_create(name);
-  sg_host_edge_set(host, p_netElm);
+  host->p_netcard = p_netElm;
 
   p_currentState = SURF_VM_STATE_CREATED;
 
@@ -278,15 +278,15 @@ void VMHL13::migrate(sg_host_t host_dest)
 
    /* update net_elm with that of the destination physical host */
    NetCard *old_net_elm = p_netElm;
-   NetCard *new_net_elm = new RoutingEdgeWrapper(sg_host_edge(sg_host_by_name(pm_name_dst)));
+   NetCard *new_net_elm = new RoutingEdgeWrapper(sg_host_by_name(pm_name_dst)->p_netcard);
    xbt_assert(new_net_elm);
 
    /* Unregister the current net_elm from host_lib. Do not call the free callback. */
-   sg_host_edge_destroy(sg_host_by_name(vm_name), 0);
+   sg_host_by_name(vm_name)->p_netcard = nullptr;
 
    /* Then, resister the new one. */
    p_netElm = new_net_elm;
-   sg_host_edge_set(sg_host_by_name(vm_name), p_netElm);
+   sg_host_by_name(vm_name)->p_netcard = p_netElm;
 
    p_hostPM = host_dest;
 
index c54438b..4f65a87 100644 (file)
@@ -2,7 +2,7 @@ set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
 
 add_executable(basic_parsing_test basic_parsing_test.c)
 add_executable(is_router_test is_router_test.c)
-add_executable(flatifier flatifier.c)
+add_executable(flatifier flatifier.cpp)
 add_executable(basic_tracing basic_tracing.c)
 add_executable(basic_link_test basic_link_test.c)
 
similarity index 89%
rename from teshsuite/simdag/platforms/flatifier.c
rename to teshsuite/simdag/platforms/flatifier.cpp
index 462f159..4a2fd86 100644 (file)
@@ -86,7 +86,7 @@ static void create_environment(xbt_os_timer_t parse_time, const char *platformFi
 int main(int argc, char **argv)
 {
   char *platformFile = NULL;
-  int totalHosts, totalLinks;
+  unsigned int totalHosts, totalLinks;
   int timings=0;
   int downgrade = 0;
   int version = 3;
@@ -163,7 +163,7 @@ int main(int argc, char **argv)
 
     // Routers
     xbt_lib_foreach(as_router_lib, cursor_src, key, value1) {
-      if(surf_routing_edge_get_rc_type(xbt_lib_get_or_null(as_router_lib, key,
+      if(surf_routing_edge_get_rc_type((sg_netcard_t)xbt_lib_get_or_null(as_router_lib, key,
           ROUTING_ASR_LEVEL)) == SURF_NETWORK_ELEMENT_ROUTER)
       {
         printf("  <router id=\"%s\"/>\n",key);
@@ -193,20 +193,20 @@ int main(int argc, char **argv)
     sg_host_t host1, host2;
     xbt_dict_foreach(host_list, cursor_src, src, host1) // Routes from host
     {
-      value1 = sg_host_edge(sg_host_by_name(src));
+      value1 = sg_host_by_name(src)->p_netcard;
       xbt_dict_foreach(host_list, cursor_dst, dst, host2) //to host
       {
         printf("  <route src=\"%s\" dst=\"%s\">\n  "
             ,src
             ,dst);
         xbt_dynar_t route=NULL;
-        value2 = sg_host_edge(sg_host_by_name(dst));
+        value2 = sg_host_by_name(dst)->p_netcard;
         routing_get_route_and_latency(value1, value2, &route,NULL);
         for(i=0;i<xbt_dynar_length(route) ;i++)
         {
           void *link = xbt_dynar_get_as(route,i,void *);
 
-          char *link_name = xbt_strdup(surf_resource_name(link));
+          char *link_name = xbt_strdup(surf_resource_name((surf_cpp_resource_t)link));
           printf("<%s id=\"%s\"/>",link_ctn,link_name);
           free(link_name);
         }
@@ -219,13 +219,13 @@ int main(int argc, char **argv)
               ,src
               ,dst);
           xbt_dynar_t route=NULL;
-          value2 = xbt_lib_get_or_null(as_router_lib,dst,ROUTING_ASR_LEVEL);
+          value2 = (sg_netcard_t)xbt_lib_get_or_null(as_router_lib,dst,ROUTING_ASR_LEVEL);
           routing_get_route_and_latency((sg_netcard_t)value1,(sg_netcard_t)value2,&route,NULL);
           for(i=0;i<xbt_dynar_length(route) ;i++)
           {
             void *link = xbt_dynar_get_as(route,i,void *);
 
-            char *link_name = xbt_strdup(surf_resource_name(link));
+            char *link_name = xbt_strdup(surf_resource_name((surf_cpp_resource_t)link));
             printf("<%s id=\"%s\"/>",link_ctn,link_name);
             free(link_name);
           }
@@ -236,7 +236,7 @@ int main(int argc, char **argv)
 
     xbt_lib_foreach(as_router_lib, cursor_src, src, value1) // Routes from router
     {
-      value1 = xbt_lib_get_or_null(as_router_lib,src,ROUTING_ASR_LEVEL);
+      value1 = (sg_netcard_t)xbt_lib_get_or_null(as_router_lib,src,ROUTING_ASR_LEVEL);
       if(routing_get_network_element_type(src) == SURF_NETWORK_ELEMENT_ROUTER){
         xbt_lib_foreach(as_router_lib, cursor_dst, dst, value2) //to router
           {
@@ -245,13 +245,13 @@ int main(int argc, char **argv)
                 ,src
                 ,dst);
             xbt_dynar_t route=NULL;
-            value2 = xbt_lib_get_or_null(as_router_lib,dst,ROUTING_ASR_LEVEL);
+            value2 = (sg_netcard_t)xbt_lib_get_or_null(as_router_lib,dst,ROUTING_ASR_LEVEL);
             routing_get_route_and_latency((sg_netcard_t)value1,(sg_netcard_t)value2,&route,NULL);
             for(i=0;i<xbt_dynar_length(route) ;i++)
             {
               void *link = xbt_dynar_get_as(route,i,void *);
 
-              char *link_name = xbt_strdup(surf_resource_name(link));
+              char *link_name = xbt_strdup(surf_resource_name((surf_cpp_resource_t)link));
               printf("<%s id=\"%s\"/>",link_ctn,link_name);
               free(link_name);
             }
@@ -263,13 +263,13 @@ int main(int argc, char **argv)
           printf("  <route src=\"%s\" dst=\"%s\">\n  "
               ,src, dst);
           xbt_dynar_t route=NULL;
-          value2 = sg_host_edge(sg_host_by_name(dst));
+          value2 = sg_host_by_name(dst)->p_netcard;
           routing_get_route_and_latency((sg_netcard_t)value1,(sg_netcard_t)value2,&route, NULL);
           for(i=0;i<xbt_dynar_length(route) ;i++)
           {
             void *link = xbt_dynar_get_as(route,i,void *);
 
-            char *link_name = xbt_strdup(surf_resource_name(link));
+            char *link_name = xbt_strdup(surf_resource_name((surf_cpp_resource_t)link));
             printf("<%s id=\"%s\"/>",link_ctn,link_name);
             free(link_name);
           }