From: SUTER Frederic Date: Sat, 4 Sep 2021 10:20:23 +0000 (+0200) Subject: another bunch of new implicit conversions X-Git-Tag: v3.29~111 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/6985b5de45eda7769cd98891461948ae298eb8c3 another bunch of new implicit conversions --- diff --git a/examples/smpi/energy/energy.c b/examples/smpi/energy/energy.c index 9a733c9669..08f2998422 100644 --- a/examples/smpi/energy/energy.c +++ b/examples/smpi/energy/energy.c @@ -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())); diff --git a/include/simgrid/host.h b/include/simgrid/host.h index 77d361712f..f77f9102cd 100644 --- a/include/simgrid/host.h +++ b/include/simgrid/host.h @@ -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); diff --git a/include/simgrid/kernel/routing/ClusterZone.hpp b/include/simgrid/kernel/routing/ClusterZone.hpp index 86ac407989..7944122757 100644 --- a/include/simgrid/kernel/routing/ClusterZone.hpp +++ b/include/simgrid/kernel/routing/ClusterZone.hpp @@ -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& dimensions, + void fill_leaf_from_cb(unsigned long position, const std::vector& 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); } diff --git a/include/simgrid/kernel/routing/DijkstraZone.hpp b/include/simgrid/kernel/routing/DijkstraZone.hpp index 98af529eea..419f2d90f5 100644 --- a/include/simgrid/kernel/routing/DijkstraZone.hpp +++ b/include/simgrid/kernel/routing/DijkstraZone.hpp @@ -26,13 +26,13 @@ class XBT_PRIVATE DijkstraZone : public RoutedZone { std::unique_ptr route_graph_{ xbt_graph_new_graph(1, nullptr), &DijkstraZone::route_graph_delete}; - std::map graph_node_map_; + std::map graph_node_map_; bool cached_; - std::map> route_cache_; + std::map> 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: diff --git a/include/simgrid/kernel/routing/StarZone.hpp b/include/simgrid/kernel/routing/StarZone.hpp index 2b030c5da6..9327c3b8ac 100644 --- a/include/simgrid/kernel/routing/StarZone.hpp +++ b/include/simgrid/kernel/routing/StarZone.hpp @@ -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 routes_; + std::unordered_map routes_; }; } // namespace routing } // namespace kernel diff --git a/include/simgrid/kernel/routing/TorusZone.hpp b/include/simgrid/kernel/routing/TorusZone.hpp index 25b429004e..2335bbfe72 100644 --- a/include/simgrid/kernel/routing/TorusZone.hpp +++ b/include/simgrid/kernel/routing/TorusZone.hpp @@ -20,16 +20,16 @@ namespace routing { */ class XBT_PRIVATE TorusZone : public ClusterBase { - std::vector dimensions_; + std::vector 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& dimensions); + void set_topology(const std::vector& dimensions); /** @brief Convert topology parameters from string to vector of uint */ - static std::vector parse_topo_parameters(const std::string& topo_parameters); + static std::vector parse_topo_parameters(const std::string& topo_parameters); }; } // namespace routing diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index c9625fad9c..76491671b8 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -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& dimensions, + const std::vector& dimensions, const ClusterCallbacks& set_callbacks, double bandwidth, double latency, Link::SharingPolicy sharing_policy); diff --git a/src/instr/instr_platform.cpp b/src/instr/instr_platform.cpp index de15eee6c6..81e64bb7d9 100644 --- a/src/instr/instr_platform.cpp +++ b/src/instr/instr_platform.cpp @@ -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); } diff --git a/src/kernel/routing/ClusterZone.cpp b/src/kernel/routing/ClusterZone.cpp index 5b3027866b..6cb3575468 100644 --- a/src/kernel/routing/ClusterZone.cpp +++ b/src/kernel/routing/ClusterZone.cpp @@ -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& dimensions, +void ClusterBase::fill_leaf_from_cb(unsigned long position, const std::vector& 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::vectoris_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::vectorid()), {loopback->get_impl(), loopback->get_impl()}); *lb_link = loopback; @@ -111,7 +111,7 @@ void ClusterBase::fill_leaf_from_cb(unsigned int position, const std::vectorid()), {limiter->get_impl(), limiter->get_impl()}); *limiter_link = limiter; diff --git a/src/kernel/routing/DijkstraZone.cpp b/src/kernel/routing/DijkstraZone.cpp index 740b69af56..d47dc4d769 100644 --- a/src/kernel/routing/DijkstraZone.cpp +++ b/src/kernel/routing/DijkstraZone.cpp @@ -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); diff --git a/src/kernel/routing/DragonflyZone.cpp b/src/kernel/routing/DragonflyZone.cpp index 54970fe6ef..8e674525bd 100644 --- a/src/kernel/routing/DragonflyZone.cpp +++ b/src/kernel/routing/DragonflyZone.cpp @@ -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 dimensions = {params.groups.first, params.chassis.first, params.routers.first, - params.nodes}; + std::vector 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; diff --git a/src/kernel/routing/TorusZone.cpp b/src/kernel/routing/TorusZone.cpp index 033df68114..ca8c430ad0 100644 --- a/src/kernel/routing/TorusZone.cpp +++ b/src/kernel/routing/TorusZone.cpp @@ -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 TorusZone::parse_topo_parameters(const std::string& topo_parameters) +std::vector TorusZone::parse_topo_parameters(const std::string& topo_parameters) { std::vector dimensions_str; boost::split(dimensions_str, topo_parameters, boost::is_any_of(",")); - std::vector dimensions; + std::vector 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 TorusZone::parse_topo_parameters(const std::string& to return dimensions; } -void TorusZone::set_topology(const std::vector& dimensions) +void TorusZone::set_topology(const std::vector& 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& dimensions, +NetZone* create_torus_zone(const std::string& name, const NetZone* parent, const std::vector& dimensions, const ClusterCallbacks& set_callbacks, double bandwidth, double latency, Link::SharingPolicy sharing_policy) { diff --git a/src/plugins/host_dvfs.cpp b/src/plugins/host_dvfs.cpp index cd54f15831..85ed693c7b 100644 --- a/src/plugins/host_dvfs.cpp +++ b/src/plugins/host_dvfs.cpp @@ -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(get_max_pstate() - load * (get_max_pstate() + 1)); + unsigned long new_pstate = static_cast(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> 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() diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index b9a3b7a93f..f8be7d0ab6 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -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); }