NetPoint* router_ = nullptr;
bool has_limiter_ = false;
bool has_loopback_ = false;
- unsigned int num_links_per_node_ = 1; /* may be 1 (if only a private link), 2 or 3 (if limiter and loopback) */
+ unsigned long num_links_per_node_ = 1; /* may be 1 (if only a private link), 2 or 3 (if limiter and loopback) */
s4u::Link::SharingPolicy link_sharing_policy_; //!< cluster links: sharing policy
double link_bw_; //!< cluster links: bandwidth
double link_lat_; //!< cluster links: latency
protected:
- void set_num_links_per_node(unsigned int num) { num_links_per_node_ = num; }
+ void set_num_links_per_node(unsigned long num) { num_links_per_node_ = num; }
resource::LinkImpl* get_uplink_from(unsigned int position) const { return private_links_.at(position).first; }
resource::LinkImpl* get_downlink_to(unsigned int position) const { return private_links_.at(position).second; }
class XBT_PRIVATE FloydZone : public RoutedZone {
/* vars to compute the Floyd algorithm. */
std::vector<std::vector<int>> predecessor_table_;
- std::vector<std::vector<double>> cost_table_;
+ std::vector<std::vector<unsigned long>> cost_table_;
std::vector<std::vector<std::unique_ptr<Route>>> link_table_;
void init_tables(unsigned int table_size);
XBT_ATTRIB_DEPRECATED_v330("Please use sg_link_get_data()") XBT_PUBLIC void* sg_link_data(const_sg_link_t link);
XBT_ATTRIB_DEPRECATED_v330("Please use sg_link_set_data()") XBT_PUBLIC
void sg_link_data_set(sg_link_t link, void* data);
-XBT_PUBLIC int sg_link_count();
+XBT_PUBLIC size_t sg_link_count();
XBT_PUBLIC sg_link_t* sg_link_list();
SG_END_DECL
kernel::routing::NetPoint* get_netpoint() const { return pimpl_netpoint_; }
- int get_actor_count() const;
+ size_t get_actor_count() const;
std::vector<ActorPtr> get_all_actors() const;
/** Turns that host on if it was previously off
#include "surf/surf.hpp"
#include "xbt/string.hpp"
-#include <cfloat>
+#include <climits>
#include <queue>
#include <vector>
public:
explicit GraphNodeData(int id) : id_(id) {}
int id_;
- int graph_id_ = -1; /* used for caching internal graph id's */
+ unsigned long graph_id_ = UINT_MAX; /* used for caching internal graph id's */
};
void DijkstraZone::route_graph_delete(xbt_graph_t g)
const s_xbt_node_t* src_elm = node_map_search(src_id);
const s_xbt_node_t* dst_elm = node_map_search(dst_id);
- int src_node_id = static_cast<GraphNodeData*>(xbt_graph_node_get_data(src_elm))->graph_id_;
- int dst_node_id = static_cast<GraphNodeData*>(xbt_graph_node_get_data(dst_elm))->graph_id_;
+ unsigned int src_node_id = static_cast<GraphNodeData*>(xbt_graph_node_get_data(src_elm))->graph_id_;
+ unsigned int dst_node_id = static_cast<GraphNodeData*>(xbt_graph_node_get_data(dst_elm))->graph_id_;
/* if the src and dst are the same */
if (src_node_id == dst_node_id) {
std::vector<int>& pred_arr = elm.first->second;
if (elm.second) { /* new element was inserted (not cached mode, or cache miss) */
- int nr_nodes = xbt_dynar_length(nodes);
- std::vector<double> cost_arr(nr_nodes); /* link cost from src to other hosts */
+ unsigned long nr_nodes = xbt_dynar_length(nodes);
+ std::vector<unsigned long> cost_arr(nr_nodes); /* link cost from src to other hosts */
pred_arr.resize(nr_nodes); /* predecessors in path from src */
using Qelt = std::pair<double, int>;
std::priority_queue<Qelt, std::vector<Qelt>, std::greater<>> pqueue;
/* initialize */
- cost_arr[src_node_id] = 0.0;
+ cost_arr[src_node_id] = 0;
- for (int i = 0; i < nr_nodes; i++) {
+ for (unsigned long i = 0; i < nr_nodes; i++) {
if (i != src_node_id) {
- cost_arr[i] = DBL_MAX;
+ cost_arr[i] = ULONG_MAX;
}
pred_arr[i] = 0;
const GraphNodeData* data = static_cast<GraphNodeData*>(xbt_graph_node_get_data(u_node));
int u_id = data->graph_id_;
const Route* tmp_e_route = static_cast<Route*>(xbt_graph_edge_get_data(edge));
- int cost_v_u = tmp_e_route->link_list_.size(); /* count of links, old model assume 1 */
+ unsigned long cost_v_u = tmp_e_route->link_list_.size(); /* count of links, old model assume 1 */
if (cost_v_u + cost_arr[v_id] < cost_arr[u_id]) {
pred_arr[u_id] = v_id;
NetPoint* gw_src = nullptr;
NetPoint* first_gw = nullptr;
- for (int v = dst_node_id; v != src_node_id; v = pred_arr[v]) {
+ for (unsigned int v = dst_node_id; v != src_node_id; v = pred_arr[v]) {
const s_xbt_node_t* node_pred_v = xbt_dynar_get_as(nodes, pred_arr[v], xbt_node_t);
const s_xbt_node_t* node_v = xbt_dynar_get_as(nodes, v, xbt_node_t);
const s_xbt_edge_t* edge = xbt_graph_get_edge(route_graph_.get(), node_pred_v, node_v);
#include "surf/surf.hpp"
#include "xbt/string.hpp"
-#include <cfloat>
-#include <limits>
+#include <climits>
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_floyd, surf, "Routing part of surf");
link_table_.resize(table_size);
predecessor_table_.resize(table_size);
for (auto& cost : cost_table_)
- cost.resize(table_size, DBL_MAX); /* link cost from host to host */
+ cost.resize(table_size, ULONG_MAX); /* link cost from host to host */
for (auto& link : link_table_)
link.resize(table_size); /* actual link between src and dst */
for (auto& predecessor : predecessor_table_)
for (unsigned int c = 0; c < table_size; c++) {
for (unsigned int a = 0; a < table_size; a++) {
for (unsigned int b = 0; b < table_size; b++) {
- if (cost_table_[a][c] < DBL_MAX && cost_table_[c][b] < DBL_MAX &&
- (fabs(cost_table_[a][b] - DBL_MAX) < std::numeric_limits<double>::epsilon() ||
- (cost_table_[a][c] + cost_table_[c][b] < cost_table_[a][b]))) {
+ if (cost_table_[a][c] < ULONG_MAX && cost_table_[c][b] < ULONG_MAX &&
+ (cost_table_[a][b] == ULONG_MAX || (cost_table_[a][c] + cost_table_[c][b] < cost_table_[a][b]))) {
cost_table_[a][b] = cost_table_[a][c] + cost_table_[c][b];
predecessor_table_[a][b] = predecessor_table_[c][b];
}
* Arrays that hold the coordinates of the current node and the target; comparing the values at the i-th position of
* both arrays, we can easily assess whether we need to route into this dimension or not.
*/
- const unsigned int dsize = dimensions_.size();
+ const unsigned long dsize = dimensions_.size();
std::vector<unsigned int> myCoords(dsize);
std::vector<unsigned int> targetCoords(dsize);
unsigned int dim_size_product = 1;
- for (unsigned i = 0; i < dsize; i++) {
+ for (unsigned long i = 0; i < dsize; i++) {
unsigned 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;
const char* local_max_pstate_config = host_->get_property(cfg_max_pstate.get_name());
if (local_max_pstate_config != nullptr) {
- max_pstate = std::stod(local_max_pstate_config);
+ max_pstate = std::stoi(local_max_pstate_config);
}
xbt_assert(max_pstate <= host_->get_pstate_count() - 1, "Value for max_pstate too large!");
xbt_assert(min_pstate <= max_pstate, "min_pstate is larger than max_pstate!");
*/
// Load is now < freq_up_threshold; exclude pstate 0 (the fastest)
// because pstate 0 can only be selected if load > freq_up_threshold_
- int new_pstate = get_max_pstate() - load * (get_max_pstate() + 1);
+ int new_pstate = static_cast<int>(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);
}
/** @brief Returns how many actors (daemonized or not) have been launched on this host */
-int Host::get_actor_count() const
+size_t Host::get_actor_count() const
{
return pimpl_->get_actor_count();
}
sg_link_set_data(link, data);
}
-int sg_link_count()
+size_t sg_link_count()
{
return simgrid::s4u::Engine::get_instance()->get_link_count();
}
{
simgrid::s4u::Engine::get_instance()->load_platform(platform_file);
- XBT_DEBUG("Host number: %zu, link number: %d", sg_host_count(), sg_link_count());
+ XBT_DEBUG("Host number: %zu, link number: %zu", sg_host_count(), sg_link_count());
#if SIMGRID_HAVE_JEDULE
jedule_sd_init();
#endif