int main(int argc, char *argv[])
{
int rank;
- unsigned long i;
char buf[1024];
int err = MPI_Init(&argc, &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;
}
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()));
/** @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);
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);
}
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:
/** @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
*/
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
* @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);
// 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);
}
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)
{
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());
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;
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;
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 */
};
}
}
-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);
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;
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);
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;
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
}
}
-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.
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;
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)
{
*/
// 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);
#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
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()
* @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);
}