Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
unsigned long-ing
authorSUTER Frederic <frederic.suter@cc.in2p3.fr>
Mon, 6 Sep 2021 06:48:20 +0000 (08:48 +0200)
committerSUTER Frederic <frederic.suter@cc.in2p3.fr>
Mon, 6 Sep 2021 06:48:20 +0000 (08:48 +0200)
examples/cpp/energy-boot/s4u-energy-boot.cpp
examples/cpp/engine-filtering/s4u-engine-filtering.cpp
examples/cpp/routing-get-clusters/s4u-routing-get-clusters.cpp
include/simgrid/kernel/routing/ClusterZone.hpp
include/simgrid/kernel/routing/DragonflyZone.hpp
include/simgrid/s4u/Host.hpp
src/kernel/routing/DragonflyZone.cpp
src/kernel/routing/FatTreeZone.cpp
src/kernel/routing/TorusZone.cpp
src/s4u/s4u_Host.cpp

index 39f3179..ac01774 100644 (file)
@@ -69,32 +69,30 @@ static void simulate_shutdown(simgrid::s4u::Host* host)
   host->turn_off();
 }
 
-static int monitor()
+static void monitor()
 {
   simgrid::s4u::Host* host1 = simgrid::s4u::Host::by_name("MyHost1");
 
-  XBT_INFO("Initial pstate: %d; Energy dissipated so far:%.0E J", host1->get_pstate(),
+  XBT_INFO("Initial pstate: %lu; Energy dissipated so far:%.0E J", host1->get_pstate(),
            sg_host_get_consumed_energy(host1));
 
   XBT_INFO("Sleep for 10 seconds");
   simgrid::s4u::this_actor::sleep_for(10);
-  XBT_INFO("Done sleeping. Current pstate: %d; Energy dissipated so far: %.2f J", host1->get_pstate(),
+  XBT_INFO("Done sleeping. Current pstate: %lu; Energy dissipated so far: %.2f J", host1->get_pstate(),
            sg_host_get_consumed_energy(host1));
 
   simulate_shutdown(host1);
-  XBT_INFO("Host1 is now OFF. Current pstate: %d; Energy dissipated so far: %.2f J", host1->get_pstate(),
+  XBT_INFO("Host1 is now OFF. Current pstate: %lu; Energy dissipated so far: %.2f J", host1->get_pstate(),
            sg_host_get_consumed_energy(host1));
 
   XBT_INFO("Sleep for 10 seconds");
   simgrid::s4u::this_actor::sleep_for(10);
-  XBT_INFO("Done sleeping. Current pstate: %d; Energy dissipated so far: %.2f J", host1->get_pstate(),
+  XBT_INFO("Done sleeping. Current pstate: %lu; Energy dissipated so far: %.2f J", host1->get_pstate(),
            sg_host_get_consumed_energy(host1));
 
   simulate_bootup(host1);
-  XBT_INFO("Host1 is now ON again. Current pstate: %d; Energy dissipated so far: %.2f J", host1->get_pstate(),
+  XBT_INFO("Host1 is now ON again. Current pstate: %lu; Energy dissipated so far: %.2f J", host1->get_pstate(),
            sg_host_get_consumed_energy(host1));
-
-  return 0;
 }
 
 int main(int argc, char* argv[])
index ea90567..ac510a6 100644 (file)
@@ -36,7 +36,7 @@ public:
  * Then, it allows one to easily retrieve the hosts which frequency changed since the functor creation.
  */
 class FrequencyChanged {
-  std::map<simgrid::s4u::Host*, int> host_list;
+  std::map<simgrid::s4u::Host*, unsigned long> host_list;
 
 public:
   explicit FrequencyChanged(const simgrid::s4u::Engine& e)
index 660f1eb..09f693d 100644 (file)
@@ -31,7 +31,7 @@ int main(int argc, char* argv[])
     XBT_INFO("%s' dragonfly topology:", d->get_cname());
     for (int i = 0; i < d->get_host_count(); i++) {
       const simgrid::kernel::routing::DragonflyZone::Coords coords = d->rankId_to_coords(i);
-      XBT_INFO("   %d: (%u, %u, %u, %u)", i, coords.group, coords.chassis, coords.blade, coords.node);
+      XBT_INFO("   %d: (%lu, %lu, %lu, %lu)", i, coords.group, coords.chassis, coords.blade, coords.node);
     }
   }
 
index 1dd04ac..8ed8894 100644 (file)
@@ -88,8 +88,8 @@ protected:
 class XBT_PRIVATE ClusterBase : public ClusterZone {
   /* We use a map instead of a std::vector here because that's a sparse vector. Some values may not exist */
   /* The pair is {link_up, link_down} */
-  std::unordered_map<unsigned int, std::pair<resource::LinkImpl*, resource::LinkImpl*>> private_links_;
-  std::unordered_map<unsigned int, NetPoint*> gateways_; //!< list of gateways for leafs (if they're netzones)
+  std::unordered_map<unsigned long, std::pair<resource::LinkImpl*, resource::LinkImpl*>> private_links_;
+  std::unordered_map<unsigned long, NetPoint*> gateways_; //!< list of gateways for leafs (if they're netzones)
   resource::LinkImpl* backbone_     = nullptr;
   NetPoint* router_                 = nullptr;
   bool has_limiter_                 = false;
index 22604f0..7c3411b 100644 (file)
@@ -65,10 +65,10 @@ public:
 class XBT_PUBLIC DragonflyZone : public ClusterBase {
 public:
   struct Coords {
-    unsigned group;
-    unsigned chassis;
-    unsigned blade;
-    unsigned node;
+    unsigned long group;
+    unsigned long chassis;
+    unsigned long blade;
+    unsigned long node;
   };
 
   explicit DragonflyZone(const std::string& name);
index cd0797a..88d7d36 100644 (file)
@@ -188,7 +188,7 @@ public:
   double get_load() const;
 
   unsigned long get_pstate_count() const;
-  int get_pstate() const;
+  unsigned long get_pstate() const;
   double get_pstate_speed(unsigned long pstate_index) const;
   Host* set_pstate(unsigned long pstate_index);
   Host* set_coordinates(const std::string& coords);
index 2512b4f..d301c5b 100644 (file)
@@ -296,9 +296,9 @@ void DragonflyZone::get_local_route(const NetPoint* src, const NetPoint* dst, Ro
 
   const auto myCoords     = rankId_to_coords(src->id());
   const auto targetCoords = rankId_to_coords(dst->id());
-  XBT_DEBUG("src : %u group, %u chassis, %u blade, %u node", myCoords.group, myCoords.chassis, myCoords.blade,
+  XBT_DEBUG("src : %lu group, %lu chassis, %lu blade, %lu node", myCoords.group, myCoords.chassis, myCoords.blade,
             myCoords.node);
-  XBT_DEBUG("dst : %u group, %u chassis, %u blade, %u node", targetCoords.group, targetCoords.chassis,
+  XBT_DEBUG("dst : %lu group, %lu chassis, %lu blade, %lu node", targetCoords.group, targetCoords.chassis,
             targetCoords.blade, targetCoords.node);
 
   DragonflyRouter* myRouter      = &routers_[myCoords.group * (num_chassis_per_group_ * num_blades_per_chassis_) +
index ee43020..8f62513 100644 (file)
@@ -248,7 +248,7 @@ void FatTreeZone::generate_switches(const s4u::ClusterCallbacks& set_callbacks)
   }
 
   /* get limiter for this router */
-  auto get_limiter = [this, &set_callbacks](unsigned int i, unsigned int j, int id) -> resource::LinkImpl* {
+  auto get_limiter = [this, &set_callbacks](unsigned long i, unsigned long j, long id) -> resource::LinkImpl* {
     kernel::resource::LinkImpl* limiter = nullptr;
     if (set_callbacks.limiter) {
       const auto* s4u_link = set_callbacks.limiter(get_iface(), {i + 1, j}, id);
@@ -260,8 +260,8 @@ void FatTreeZone::generate_switches(const s4u::ClusterCallbacks& set_callbacks)
   };
   // Create the switches
   unsigned long k = 2 * nodes_.size();
-  for (unsigned int i = 0; i < this->levels_; i++) {
-    for (unsigned int j = 0; j < this->nodes_by_level_[i + 1]; j++) {
+  for (unsigned long i = 0; i < this->levels_; i++) {
+    for (unsigned long j = 0; j < this->nodes_by_level_[i + 1]; j++) {
       k--;
       auto newNode = std::make_shared<FatTreeNode>(k, i + 1, j, get_limiter(i, j, k), nullptr);
       XBT_DEBUG("We create the switch %d(%u,%u)", newNode->id, newNode->level, newNode->position);
index ce370db..f96b1ec 100644 (file)
@@ -30,9 +30,9 @@ void TorusZone::create_torus_links(unsigned long id, int rank, unsigned long pos
         dimensions_[j]; // which dimension are we currently in?
                         // we need to iterate over all dimensions and create all links there
     // The other node the link connects
-    int neighbor_rank_id = ((rank / dim_product) % current_dimension == current_dimension - 1)
-                               ? rank - (current_dimension - 1) * dim_product
-                               : rank + dim_product;
+    unsigned long neighbor_rank_id = ((rank / dim_product) % current_dimension == current_dimension - 1)
+                                         ? rank - (current_dimension - 1) * dim_product
+                                         : rank + dim_product;
     // name of neighbor is not right for non contiguous cluster radicals (as id != rank in this case)
     std::string link_id = get_name() + "_link_from_" + std::to_string(id) + "_to_" + std::to_string(neighbor_rank_id);
     const s4u::Link* linkup;
@@ -106,7 +106,7 @@ void TorusZone::get_local_route(const NetPoint* src, const NetPoint* dst, Route*
   std::vector<unsigned int> targetCoords(dsize);
   unsigned int dim_size_product = 1;
   for (unsigned long i = 0; i < dsize; i++) {
-    unsigned cur_dim_size = dimensions_[i];
+    unsigned long cur_dim_size = dimensions_[i];
     myCoords[i]           = (src->id() / dim_size_product) % cur_dim_size;
     targetCoords[i]       = (dst->id() / dim_size_product) % cur_dim_size;
     dim_size_product *= cur_dim_size;
@@ -119,12 +119,12 @@ void TorusZone::get_local_route(const NetPoint* src, const NetPoint* dst, Route*
   unsigned long linkOffset = (dsize + 1) * src->id();
 
   bool use_lnk_up = false; // Is this link of the form "cur -> next" or "next -> cur"? false means: next -> cur
-  unsigned int current_node = src->id();
+  unsigned long current_node = src->id();
   while (current_node != dst->id()) {
     unsigned int next_node   = 0;
     unsigned int dim_product = 1; // First, we will route in x-dimension
     for (unsigned j = 0; j < dsize; j++) {
-      const unsigned cur_dim = dimensions_[j];
+      const unsigned long cur_dim = dimensions_[j];
       // current_node/dim_product = position in current dimension
       if ((current_node / dim_product) % cur_dim != (dst->id() / dim_product) % cur_dim) {
         if ((targetCoords[j] > myCoords[j] &&
@@ -150,7 +150,7 @@ void TorusZone::get_local_route(const NetPoint* src, const NetPoint* dst, Route*
           linkOffset = node_pos_with_loopback_limiter(next_node) + j;
           use_lnk_up = false;
         }
-        XBT_DEBUG("torus_get_route_and_latency - current_node: %u, next_node: %u, linkOffset is %lu", current_node,
+        XBT_DEBUG("torus_get_route_and_latency - current_node: %lu, next_node: %u, linkOffset is %lu", current_node,
                   next_node, linkOffset);
         break;
       }
index f8be7d0..e3f77fa 100644 (file)
@@ -321,7 +321,7 @@ Host* Host::set_pstate(unsigned long pstate_index)
 }
 
 /** @brief Retrieve the pstate at which the host is currently running */
-int Host::get_pstate() const
+unsigned long Host::get_pstate() const
 {
   return this->pimpl_cpu_->get_pstate();
 }