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[])
* 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)
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);
}
}
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;
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);
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);
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_) +
}
/* 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);
};
// 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);
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;
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;
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] &&
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;
}
}
/** @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();
}