Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
yet another bunch of int -> unsigned long
[simgrid.git] / src / kernel / routing / DragonflyZone.cpp
index 4096ba8..2512b4f 100644 (file)
@@ -20,7 +20,7 @@ namespace routing {
 
 DragonflyZone::DragonflyZone(const std::string& name) : ClusterBase(name) {}
 
-DragonflyZone::Coords DragonflyZone::rankId_to_coords(int rankId) const
+DragonflyZone::Coords DragonflyZone::rankId_to_coords(unsigned long rankId) const
 {
   // coords : group, chassis, blade, node
   Coords coords;
@@ -150,7 +150,7 @@ void DragonflyZone::build_upper_levels(const s4u::ClusterCallbacks& set_callback
 
 void DragonflyZone::generate_routers(const s4u::ClusterCallbacks& set_callbacks)
 {
-  int id = 0;
+  unsigned long id = 2 * num_groups_ * num_chassis_per_group_ * num_blades_per_chassis_ * num_nodes_per_blade_;
   /* get limiter for this router */
   auto get_limiter = [this, &id, &set_callbacks](unsigned int i, unsigned int j,
                                                  unsigned int k) -> resource::LinkImpl* {
@@ -166,7 +166,7 @@ void DragonflyZone::generate_routers(const s4u::ClusterCallbacks& set_callbacks)
     return limiter;
   };
 
-  routers_.reserve(num_groups_ * num_chassis_per_group_ * num_blades_per_chassis_);
+  routers_.reserve(static_cast<size_t>(num_groups_) * num_chassis_per_group_ * num_blades_per_chassis_);
   for (unsigned int i = 0; i < num_groups_; i++) {
     for (unsigned int j = 0; j < num_chassis_per_group_; j++) {
       for (unsigned int k = 0; k < num_blades_per_chassis_; k++) {
@@ -206,7 +206,7 @@ void DragonflyZone::generate_links()
   // Links from routers to their local nodes.
   for (unsigned int i = 0; i < numRouters; i++) {
     // allocate structures
-    routers_[i].my_nodes_.resize(num_links_per_link_ * num_nodes_per_blade_);
+    routers_[i].my_nodes_.resize(static_cast<size_t>(num_links_per_link_) * num_nodes_per_blade_);
     routers_[i].green_links_.resize(num_blades_per_chassis_);
     routers_[i].black_links_.resize(num_chassis_per_group_);
 
@@ -284,7 +284,7 @@ void DragonflyZone::get_local_route(const NetPoint* src, const NetPoint* dst, Ro
   if (dst->is_router() || src->is_router())
     return;
 
-  XBT_VERB("dragonfly getLocalRoute from '%s'[%u] to '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(),
+  XBT_VERB("dragonfly getLocalRoute from '%s'[%lu] to '%s'[%lu]", src->get_cname(), src->id(), dst->get_cname(),
            dst->id());
 
   if ((src->id() == dst->id()) && has_loopback()) {
@@ -312,7 +312,8 @@ void DragonflyZone::get_local_route(const NetPoint* src, const NetPoint* dst, Ro
   }
 
   // node->router local link
-  add_link_latency(route->link_list_, myRouter->my_nodes_[myCoords.node * num_links_per_link_], latency);
+  add_link_latency(route->link_list_, myRouter->my_nodes_[static_cast<size_t>(myCoords.node) * num_links_per_link_],
+                   latency);
 
   if (targetRouter != myRouter) {
     // are we on a different group ?
@@ -421,8 +422,8 @@ NetZone* create_dragonfly_zone(const std::string& name, const NetZone* parent, c
   zone->set_link_characteristics(bandwidth, latency, sharing_policy);
 
   /* populating it */
-  std::vector<unsigned int> dimensions = {params.groups.first, params.chassis.first, params.routers.first,
-                                          params.nodes};
+  std::vector<unsigned long> dimensions = {params.groups.first, params.chassis.first, params.routers.first,
+                                           params.nodes};
   int tot_elements                     = std::accumulate(dimensions.begin(), dimensions.end(), 1, std::multiplies<>());
   for (int i = 0; i < tot_elements; i++) {
     kernel::routing::NetPoint* netpoint;
@@ -431,7 +432,6 @@ NetZone* create_dragonfly_zone(const std::string& name, const NetZone* parent, c
     zone->fill_leaf_from_cb(i, dimensions, set_callbacks, &netpoint, &loopback, &limiter);
   }
   zone->build_upper_levels(set_callbacks);
-
   return zone->get_iface();
 }
 } // namespace s4u