Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
another bunch of new implicit conversions
authorSUTER Frederic <frederic.suter@cc.in2p3.fr>
Sat, 4 Sep 2021 10:20:23 +0000 (12:20 +0200)
committerSUTER Frederic <frederic.suter@cc.in2p3.fr>
Sat, 4 Sep 2021 10:20:23 +0000 (12:20 +0200)
14 files changed:
examples/smpi/energy/energy.c
include/simgrid/host.h
include/simgrid/kernel/routing/ClusterZone.hpp
include/simgrid/kernel/routing/DijkstraZone.hpp
include/simgrid/kernel/routing/StarZone.hpp
include/simgrid/kernel/routing/TorusZone.hpp
include/simgrid/s4u/NetZone.hpp
src/instr/instr_platform.cpp
src/kernel/routing/ClusterZone.cpp
src/kernel/routing/DijkstraZone.cpp
src/kernel/routing/DragonflyZone.cpp
src/kernel/routing/TorusZone.cpp
src/plugins/host_dvfs.cpp
src/s4u/s4u_Host.cpp

index 9a733c9..08f2998 100644 (file)
@@ -15,7 +15,6 @@
 int main(int argc, char *argv[])
 {
   int rank;
-  unsigned long i;
   char buf[1024];
 
   int err = MPI_Init(&argc, &argv);
@@ -42,7 +41,7 @@ int main(int argc, char *argv[])
     sz -= x;
   } else
     sz = 0;
-  for (i = 1; i < pstates; i++) {
+  for (unsigned long i = 1; i < pstates; i++) {
     x = snprintf(s, sz, ", %.0f", sg_host_get_pstate_speed(sg_host_self(), i));
     if (x < sz) {
       s += x;
@@ -52,7 +51,7 @@ int main(int argc, char *argv[])
   }
   fprintf(stderr, "%s%s\n", buf, (sz ? "" : " [...]"));
 
-  for (i = 0; i < pstates; i++) {
+  for (unsigned long i = 0; i < pstates; i++) {
     sg_host_set_pstate(sg_host_self(), i);
     fprintf(stderr, "[%.6f] [rank %d] Current pstate: %lu; Current power: %.0f\n", MPI_Wtime(), rank, i,
             sg_host_get_speed(sg_host_self()));
index 77d3617..f77f910 100644 (file)
@@ -64,7 +64,7 @@ XBT_PUBLIC void sg_host_get_disks(const_sg_host_t host, unsigned int* disk_count
 /** @brief Return the speed of the processor (in flop/s), regardless of the current load on the machine. */
 XBT_PUBLIC double sg_host_get_speed(const_sg_host_t host);
 XBT_ATTRIB_DEPRECATED_v330("Please use sg_host_get_speed()") XBT_PUBLIC double sg_host_speed(const_sg_host_t host);
-XBT_PUBLIC double sg_host_get_pstate_speed(const_sg_host_t host, int pstate_index);
+XBT_PUBLIC double sg_host_get_pstate_speed(const_sg_host_t host, unsigned long pstate_index);
 
 XBT_PUBLIC double sg_host_get_available_speed(const_sg_host_t host);
 
index 86ac407..7944122 100644 (file)
@@ -135,17 +135,17 @@ protected:
     THROW_UNIMPLEMENTED;
   };
 
-  unsigned int node_pos(int id) const { return id * num_links_per_node_; }
-  unsigned int node_pos_with_loopback(int id) const { return node_pos(id) + (has_loopback_ ? 1 : 0); }
+  unsigned long node_pos(unsigned long id) const { return id * num_links_per_node_; }
+  unsigned long node_pos_with_loopback(unsigned long id) const { return node_pos(id) + (has_loopback_ ? 1 : 0); }
 
 public:
   /** Fill the leaf retriving netpoint from a user's callback */
-  void fill_leaf_from_cb(unsigned int position, const std::vector<unsigned int>& dimensions,
+  void fill_leaf_from_cb(unsigned long position, const std::vector<unsigned long>& dimensions,
                          const s4u::ClusterCallbacks& set_callbacks, NetPoint** node_netpoint, s4u::Link** lb_link,
                          s4u::Link** limiter_link);
   /** @brief Set the characteristics of links inside a Cluster zone */
   virtual void set_link_characteristics(double bw, double lat, s4u::Link::SharingPolicy sharing_policy);
-  unsigned int node_pos_with_loopback_limiter(int id) const
+  unsigned long node_pos_with_loopback_limiter(unsigned long id) const
   {
     return node_pos_with_loopback(id) + (has_limiter_ ? 1 : 0);
   }
index 98af529..419f2d9 100644 (file)
@@ -26,13 +26,13 @@ class XBT_PRIVATE DijkstraZone : public RoutedZone {
 
   std::unique_ptr<s_xbt_graph_t, decltype(&DijkstraZone::route_graph_delete)> route_graph_{
       xbt_graph_new_graph(1, nullptr), &DijkstraZone::route_graph_delete};
-  std::map<int, xbt_node_t> graph_node_map_;
+  std::map<unsigned long, xbt_node_t> graph_node_map_;
   bool cached_;
-  std::map<int, std::vector<unsigned long>> route_cache_;
+  std::map<unsigned long, std::vector<unsigned long>> route_cache_;
 
-  xbt_node_t route_graph_new_node(int id);
-  xbt_node_t node_map_search(int id);
-  void new_edge(int src_id, int dst_id, Route* e_route);
+  xbt_node_t route_graph_new_node(unsigned long id);
+  xbt_node_t node_map_search(unsigned long id);
+  void new_edge(unsigned long src_id, unsigned long dst_id, Route* e_route);
   void do_seal() override;
 
 public:
index 2b030c5..9327c3b 100644 (file)
@@ -91,7 +91,7 @@ private:
   /** @brief Auxiliary methods to check params received in add_route method */
   void check_add_route_param(const NetPoint* src, const NetPoint* dst, const NetPoint* gw_src, const NetPoint* gw_dst,
                              bool symmetrical) const;
-  std::unordered_map<unsigned int, StarRoute> routes_;
+  std::unordered_map<unsigned long, StarRoute> routes_;
 };
 } // namespace routing
 } // namespace kernel
index 25b4290..2335bbf 100644 (file)
@@ -20,16 +20,16 @@ namespace routing {
  */
 
 class XBT_PRIVATE TorusZone : public ClusterBase {
-  std::vector<unsigned int> dimensions_;
+  std::vector<unsigned long> dimensions_;
 
 public:
   explicit TorusZone(const std::string& name) : ClusterBase(name){};
-  void create_torus_links(int id, int rank, unsigned int position);
+  void create_torus_links(int id, int rank, unsigned long position);
   void get_local_route(const NetPoint* src, const NetPoint* dst, Route* into, double* latency) override;
-  void set_topology(const std::vector<unsigned int>& dimensions);
+  void set_topology(const std::vector<unsigned long>& dimensions);
 
   /** @brief Convert topology parameters from string to vector of uint */
-  static std::vector<unsigned int> parse_topo_parameters(const std::string& topo_parameters);
+  static std::vector<unsigned long> parse_topo_parameters(const std::string& topo_parameters);
 };
 
 } // namespace routing
index c9625fa..7649167 100644 (file)
@@ -264,7 +264,7 @@ struct ClusterCallbacks {
  * @return Pointer to new netzone
  */
 XBT_PUBLIC NetZone* create_torus_zone(const std::string& name, const NetZone* parent,
-                                      const std::vector<unsigned int>& dimensions,
+                                      const std::vector<unsigned long>& dimensions,
                                       const ClusterCallbacks& set_callbacks, double bandwidth, double latency,
                                       Link::SharingPolicy sharing_policy);
 
index de15eee..81e64bb 100644 (file)
@@ -124,7 +124,7 @@ static void recursiveGraphExtraction(const simgrid::s4u::NetZone* netzone, const
 
   // bottom-up recursion
   for (auto const& nz_son : netzone->get_children()) {
-    simgrid::instr::Container* child_container = container->get_child_by_name(nz_son->get_name());
+    const simgrid::instr::Container* child_container = container->get_child_by_name(nz_son->get_name());
     recursiveGraphExtraction(nz_son, child_container, filter);
   }
 
index 5b30278..6cb3575 100644 (file)
@@ -62,7 +62,7 @@ NetPoint* ClusterBase::get_gateway(unsigned int position)
   return res;
 }
 
-void ClusterBase::fill_leaf_from_cb(unsigned int position, const std::vector<unsigned int>& dimensions,
+void ClusterBase::fill_leaf_from_cb(unsigned long position, const std::vector<unsigned long>& dimensions,
                                     const s4u::ClusterCallbacks& set_callbacks, NetPoint** node_netpoint,
                                     s4u::Link** lb_link, s4u::Link** limiter_link)
 {
@@ -90,10 +90,10 @@ void ClusterBase::fill_leaf_from_cb(unsigned int position, const std::vector<uns
   kernel::routing::NetPoint* gw       = nullptr;
   auto dims                           = index_to_dims(position);
   std::tie(netpoint, gw)              = set_callbacks.netpoint(get_iface(), dims, position);
-  xbt_assert(netpoint, "set_netpoint(elem=%u): Invalid netpoint (nullptr)", position);
+  xbt_assert(netpoint, "set_netpoint(elem=%lu): Invalid netpoint (nullptr)", position);
   if (netpoint->is_netzone()) {
     xbt_assert(gw && not gw->is_netzone(),
-               "set_netpoint(elem=%u): Netpoint (%s) is a netzone, but gateway (%s) is invalid", position,
+               "set_netpoint(elem=%lu): Netpoint (%s) is a netzone, but gateway (%s) is invalid", position,
                netpoint->get_cname(), gw ? gw->get_cname() : "nullptr");
   } else {
     xbt_assert(not gw, "set_netpoint: Netpoint (%s) isn't netzone, gateway must be nullptr", netpoint->get_cname());
@@ -103,7 +103,7 @@ void ClusterBase::fill_leaf_from_cb(unsigned int position, const std::vector<uns
 
   if (set_callbacks.loopback) {
     s4u::Link* loopback = set_callbacks.loopback(get_iface(), dims, position);
-    xbt_assert(loopback, "set_loopback: Invalid loopback link (nullptr) for element %u", position);
+    xbt_assert(loopback, "set_loopback: Invalid loopback link (nullptr) for element %lu", position);
     set_loopback();
     add_private_link_at(node_pos(netpoint->id()), {loopback->get_impl(), loopback->get_impl()});
     *lb_link = loopback;
@@ -111,7 +111,7 @@ void ClusterBase::fill_leaf_from_cb(unsigned int position, const std::vector<uns
 
   if (set_callbacks.limiter) {
     s4u::Link* limiter = set_callbacks.limiter(get_iface(), dims, position);
-    xbt_assert(limiter, "set_limiter: Invalid limiter link (nullptr) for element %u", position);
+    xbt_assert(limiter, "set_limiter: Invalid limiter link (nullptr) for element %lu", position);
     set_limiter();
     add_private_link_at(node_pos_with_loopback(netpoint->id()), {limiter->get_impl(), limiter->get_impl()});
     *limiter_link = limiter;
index 740b69a..d47dc4d 100644 (file)
@@ -21,8 +21,8 @@ namespace routing {
 
 class GraphNodeData {
 public:
-  explicit GraphNodeData(int id) : id_(id) {}
-  int id_;
+  explicit GraphNodeData(unsigned long id) : id_(id) {}
+  unsigned long id_;
   unsigned long graph_id_ = UINT_MAX; /* used for caching internal graph id's */
 };
 
@@ -68,7 +68,7 @@ void DijkstraZone::do_seal()
   }
 }
 
-xbt_node_t DijkstraZone::route_graph_new_node(int id)
+xbt_node_t DijkstraZone::route_graph_new_node(unsigned long id)
 {
   xbt_node_t node = xbt_graph_new_node(route_graph_.get(), new GraphNodeData(id));
   graph_node_map_.emplace(id, node);
@@ -76,7 +76,7 @@ xbt_node_t DijkstraZone::route_graph_new_node(int id)
   return node;
 }
 
-xbt_node_t DijkstraZone::node_map_search(int id)
+xbt_node_t DijkstraZone::node_map_search(unsigned long id)
 {
   auto ret = graph_node_map_.find(id);
   return ret == graph_node_map_.end() ? nullptr : ret->second;
@@ -218,9 +218,9 @@ void DijkstraZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, Net
              new_extended_route(get_hierarchy(), gw_dst, gw_src, get_link_list_impl(link_list, true), false));
 }
 
-void DijkstraZone::new_edge(int src_id, int dst_id, Route* route)
+void DijkstraZone::new_edge(unsigned long src_id, unsigned long dst_id, Route* route)
 {
-  XBT_DEBUG("Create Route from '%d' to '%d'", src_id, dst_id);
+  XBT_DEBUG("Create Route from '%lu' to '%lu'", src_id, dst_id);
 
   // Get the extremities, or create them if they don't exist yet
   xbt_node_t src = node_map_search(src_id);
index 54970fe..8e67452 100644 (file)
@@ -422,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;
index 033df68..ca8c430 100644 (file)
@@ -20,12 +20,12 @@ namespace simgrid {
 namespace kernel {
 namespace routing {
 
-void TorusZone::create_torus_links(int id, int rank, unsigned int position)
+void TorusZone::create_torus_links(int id, int rank, unsigned long position)
 {
   /* Create all links that exist in the torus. Each rank creates @a dimensions-1 links */
   int dim_product = 1; // Needed to calculate the next neighbor_id
 
-  for (unsigned int j = 0; j < dimensions_.size(); j++) {
+  for (unsigned long j = 0; j < dimensions_.size(); j++) {
     int current_dimension = 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
@@ -54,11 +54,11 @@ void TorusZone::create_torus_links(int id, int rank, unsigned int position)
   }
 }
 
-std::vector<unsigned int> TorusZone::parse_topo_parameters(const std::string& topo_parameters)
+std::vector<unsigned long> TorusZone::parse_topo_parameters(const std::string& topo_parameters)
 {
   std::vector<std::string> dimensions_str;
   boost::split(dimensions_str, topo_parameters, boost::is_any_of(","));
-  std::vector<unsigned int> dimensions;
+  std::vector<unsigned long> dimensions;
 
   /* We are in a torus cluster
    * Parse attribute dimensions="dim1,dim2,dim3,...,dimN" and save them into a vector.
@@ -70,7 +70,7 @@ std::vector<unsigned int> TorusZone::parse_topo_parameters(const std::string& to
   return dimensions;
 }
 
-void TorusZone::set_topology(const std::vector<unsigned int>& dimensions)
+void TorusZone::set_topology(const std::vector<unsigned long>& dimensions)
 {
   xbt_assert(not dimensions.empty(), "Torus dimensions cannot be empty");
   dimensions_ = dimensions;
@@ -184,7 +184,7 @@ void TorusZone::get_local_route(const NetPoint* src, const NetPoint* dst, Route*
 
 namespace s4u {
 
-NetZone* create_torus_zone(const std::string& name, const NetZone* parent, const std::vector<unsigned int>& dimensions,
+NetZone* create_torus_zone(const std::string& name, const NetZone* parent, const std::vector<unsigned long>& dimensions,
                            const ClusterCallbacks& set_callbacks, double bandwidth, double latency,
                            Link::SharingPolicy sharing_policy)
 {
index cd54f15..85ed693 100644 (file)
@@ -205,7 +205,7 @@ public:
        */
       // Load is now < freq_up_threshold; exclude pstate 0 (the fastest)
       // because pstate 0 can only be selected if load > freq_up_threshold_
-      unsigned long new_pstate = static_cast<int>(get_max_pstate() - load * (get_max_pstate() + 1));
+      unsigned long new_pstate = static_cast<unsigned long>(get_max_pstate() - load * (get_max_pstate() + 1));
       if (new_pstate < get_min_pstate())
         new_pstate = get_min_pstate();
       get_host()->set_pstate(new_pstate);
@@ -264,11 +264,10 @@ public:
 
 #if HAVE_SMPI
 class Adagio : public Governor {
-private:
-  int best_pstate     = 0;
-  double start_time   = 0;
-  double comp_counter = 0;
-  double comp_timer   = 0;
+  unsigned long best_pstate = 0;
+  double start_time         = 0;
+  double comp_counter       = 0;
+  double comp_timer         = 0;
 
   std::vector<std::vector<double>> rates; // Each host + all frequencies of that host
 
@@ -327,7 +326,7 @@ public:
     if (rates[task_id][best_pstate] == 0)
       best_pstate = 0;
     get_host()->set_pstate(best_pstate); // Load our schedule
-    XBT_DEBUG("Set pstate to %i", best_pstate);
+    XBT_DEBUG("Set pstate to %lu", best_pstate);
   }
 
   void post_task()
index b9a3b7a..f8be7d0 100644 (file)
@@ -513,7 +513,7 @@ double sg_host_speed(const_sg_host_t host) // XBT_ATTRIB_DEPRECATED_v330
  * @param pstate_index pstate to test
  * @return Returns the processor speed associated with pstate_index
  */
-double sg_host_get_pstate_speed(const_sg_host_t host, int pstate_index)
+double sg_host_get_pstate_speed(const_sg_host_t host, unsigned long pstate_index)
 {
   return host->get_pstate_speed(pstate_index);
 }