double workload = 100E6;
simgrid::s4u::Host* host = simgrid::s4u::this_actor::get_host();
- int nb = host->get_pstate_count();
- XBT_INFO("Count of Processor states=%d", nb);
+ unsigned long nb = host->get_pstate_count();
+ XBT_INFO("Count of Processor states=%lu", nb);
XBT_INFO("Current power peak=%f", host->get_speed());
// Verify that the default pstate is set to 0
host = simgrid::s4u::Host::by_name_or_null("MyHost2");
- XBT_INFO("Count of Processor states=%d", host->get_pstate_count());
+ XBT_INFO("Count of Processor states=%lu", host->get_pstate_count());
XBT_INFO("Current power peak=%f", host->get_speed());
return 0;
*
* @param host host to test
*/
-XBT_PUBLIC int sg_host_get_nb_pstates(const_sg_host_t host);
+XBT_PUBLIC unsigned long sg_host_get_nb_pstates(const_sg_host_t host);
XBT_PUBLIC int sg_host_get_pstate(const_sg_host_t host);
XBT_PUBLIC void sg_host_set_pstate(sg_host_t host, int pstate);
void seal();
/** @brief Check if netpoint is a member of this NetZone or some of the childrens */
bool is_component_recursive(const NetPoint* netpoint) const;
- virtual int add_component(kernel::routing::NetPoint* elm); /* A host, a router or a netzone, whatever */
- virtual void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
- kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+ virtual unsigned long add_component(NetPoint* elm); /* A host, a router or a netzone, whatever */
+ virtual void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
const std::vector<s4u::LinkInRoute>& link_list, bool symmetrical);
/** @brief Set parent of this Netzone */
void set_parent(NetZoneImpl* parent);
* @param links Accumulator in which all traversed links should be pushed (caller must empty it)
* @param latency Accumulator in which the latencies should be added (caller must set it to 0)
*/
- static void get_global_route(const routing::NetPoint* src, const routing::NetPoint* dst,
+ static void get_global_route(const NetPoint* src, const NetPoint* dst,
/* OUT */ std::vector<resource::LinkImpl*>& links, double* latency);
/** @brief Similar to get_global_route but get the NetZones traversed by route */
- static void get_global_route_with_netzones(const routing::NetPoint* src, const routing::NetPoint* dst,
+ static void get_global_route_with_netzones(const NetPoint* src, const NetPoint* dst,
/* OUT */ std::vector<resource::LinkImpl*>& links, double* latency,
std::unordered_set<NetZoneImpl*>& netzones);
std::map<std::string, xbt_edge_t, std::less<>>* edges) = 0;
/*** Called on each newly created regular route (not on bypass routes) */
- static xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
- kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- std::vector<kernel::resource::LinkImpl*> const& link_list)>
+ static xbt::signal<void(bool symmetrical, NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
+ std::vector<resource::LinkImpl*> const& link_list)>
on_route_creation; // XBT_ATTRIB_DEPRECATED_v332 : should be an internal signal used by NS3.. if necessary,
// callback shouldn't use LinkImpl*
std::shared_ptr<resource::CpuModel> cpu_model_vm_;
std::shared_ptr<resource::CpuModel> cpu_model_pm_;
std::shared_ptr<resource::DiskModel> disk_model_;
- std::shared_ptr<simgrid::surf::HostModel> host_model_;
+ std::shared_ptr<surf::HostModel> host_model_;
/** @brief Perform sealing procedure for derived classes, if necessary */
virtual void do_seal()
{ /* obviously nothing to do by default */
* There is really no limit on the hosts involved. In particular, the actor does not have to be on one of the involved
* hosts.
*/
- static CommPtr sendto_async(Host* from, Host* to, double simulated_size_in_bytes);
+ static CommPtr sendto_async(Host* from, Host* to, uint64_t simulated_size_in_bytes);
/** Do a blocking communication between two arbitrary hosts.
*
* This starts a blocking communication right away, bypassing the mailbox and actors mechanism.
* The calling actor is blocked until the end of the communication; there is really no limit on the hosts involved.
* In particular, the actor does not have to be on one of the involved hosts. Enjoy the comfort of the simulator :)
*/
- static void sendto(Host* from, Host* to, double simulated_size_in_bytes);
+ static void sendto(Host* from, Host* to, uint64_t simulated_size_in_bytes);
static xbt::signal<void(Comm const&, bool is_sender)> on_start;
static xbt::signal<void(Comm const&)> on_completion;
* :cpp:func:`simgrid::s4u::Comm::set_src_data_size`).
* @endrst
*/
- CommPtr set_payload_size(double bytes);
+ CommPtr set_payload_size(uint64_t bytes);
/** Specify the data to send and its size (not to be mixed with set_payload_size())
*
*/
double get_load() const;
- int get_pstate_count() const;
+ unsigned long get_pstate_count() const;
int get_pstate() const;
double get_pstate_speed(int pstate_index) const;
Host* set_pstate(int pstate_index);
return (new NetPoint(name, NetPoint::Type::Router))->set_englobing_zone(this);
}
-int NetZoneImpl::add_component(NetPoint* elm)
+
+unsigned long NetZoneImpl::add_component(NetPoint* elm)
{
vertices_.push_back(elm);
return vertices_.size() - 1; // The rank of the newly created object
* linkOffset describes the offset where the link we want to use is stored(+1 is added because each node has a link
* from itself to itself, which can only be the case if src->m_id == dst->m_id -- see above for this special case)
*/
- unsigned int linkOffset = (dsize + 1) * src->id();
+ 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();
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 %u", current_node,
+ XBT_DEBUG("torus_get_route_and_latency - current_node: %u, next_node: %u, linkOffset is %lu", current_node,
next_node, linkOffset);
break;
}
class Governor {
simgrid::s4u::Host* const host_;
double sampling_rate_;
- int min_pstate = cfg_min_pstate; //< Never use a pstate less than this one
- int max_pstate = cfg_max_pstate; //< Never use a pstate larger than this one
+ unsigned long min_pstate = cfg_min_pstate; //< Never use a pstate less than this one
+ unsigned long max_pstate = cfg_max_pstate; //< Never use a pstate larger than this one
public:
explicit Governor(simgrid::s4u::Host* ptr)
}
const char* local_min_pstate_config = host_->get_property(cfg_min_pstate.get_name());
if (local_min_pstate_config != nullptr) {
- min_pstate = std::stoi(local_min_pstate_config);
+ min_pstate = std::stoul(local_min_pstate_config);
}
const char* local_max_pstate_config = host_->get_property(cfg_max_pstate.get_name());
if (local_max_pstate_config != nullptr) {
- max_pstate = std::stoi(local_max_pstate_config);
+ max_pstate = std::stoul(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!");
- xbt_assert(0 <= min_pstate, "min_pstate is negative!");
}
virtual void update() = 0;
bool is_initialized = rates[task_id][best_pstate] != 0;
rates[task_id][best_pstate] = computed_flops / comp_timer;
if (not is_initialized) {
- for (int i = 1; i < get_host()->get_pstate_count(); i++) {
+ for (unsigned long i = 1; i < get_host()->get_pstate_count(); i++) {
rates[task_id][i] = rates[task_id][0] * (get_host()->get_pstate_speed(i) / get_host()->get_speed());
}
}
boost::split(all_power_values, all_power_values_str, boost::is_any_of(","));
XBT_DEBUG("%s: power properties: %s", host_->get_cname(), all_power_values_str);
- xbt_assert(all_power_values.size() == (unsigned)host_->get_pstate_count(),
- "Invalid XML file. Found %zu energetic profiles for %d pstates", all_power_values.size(),
+ xbt_assert(all_power_values.size() == host_->get_pstate_count(),
+ "Invalid XML file. Found %zu energetic profiles for %lu pstates", all_power_values.size(),
host_->get_pstate_count());
int i = 0;
// Create a VCPU for this VM
std::vector<double> speeds;
- for (int i = 0; i < physical_host->get_pstate_count(); i++)
+ for (unsigned long i = 0; i < physical_host->get_pstate_count(); i++)
speeds.push_back(physical_host->get_pstate_speed(i));
physical_host->get_netpoint()
dst_buff_size_ = size;
return this;
}
-CommPtr Comm::set_payload_size(double bytes)
+CommPtr Comm::set_payload_size(uint64_t bytes)
{
Activity::set_remaining(bytes);
return this;
return res;
}
-CommPtr Comm::sendto_async(Host* from, Host* to, double simulated_size_in_bytes)
+CommPtr Comm::sendto_async(Host* from, Host* to, uint64_t simulated_size_in_bytes)
{
auto res = Comm::sendto_init(from, to)->set_payload_size(simulated_size_in_bytes);
res->vetoable_start();
return res;
}
-void Comm::sendto(Host* from, Host* to, double simulated_size_in_bytes)
+void Comm::sendto(Host* from, Host* to, uint64_t simulated_size_in_bytes)
{
sendto_async(from, to, simulated_size_in_bytes)->wait();
}
return this->pimpl_cpu_->is_on();
}
-int Host::get_pstate_count() const
+unsigned long Host::get_pstate_count() const
{
return this->pimpl_cpu_->get_pstate_count();
}
*
* See also @ref plugin_host_energy.
*/
-int sg_host_get_nb_pstates(const_sg_host_t host)
+unsigned long sg_host_get_nb_pstates(const_sg_host_t host)
{
return host->get_pstate_count();
}
/** @brief Get the peak processor speed (in flops/s), at the specified pstate */
virtual double get_pstate_peak_speed(int pstate_index) const;
- virtual int get_pstate_count() const { return speed_per_pstate_.size(); }
+ virtual unsigned long get_pstate_count() const { return speed_per_pstate_.size(); }
virtual int get_pstate() const { return pstate_; }
virtual CpuImpl* set_pstate(int pstate_index);
{
double integral = 0;
double time = 0;
- unsigned nb_points = profile->get_event_list().size() + 1;
+ unsigned long nb_points = profile->get_event_list().size() + 1;
time_points_.reserve(nb_points);
integral_.reserve(nb_points);
for (auto const& val : profile->get_event_list()) {
{
double integral = 0;
double a_aux = a;
- int ind = binary_search(time_points_, a);
+ long ind = binary_search(time_points_, a);
integral += integral_[ind];
- XBT_DEBUG("a %f ind %d integral %f ind + 1 %f ind %f time +1 %f time %f", a, ind, integral, integral_[ind + 1],
+ XBT_DEBUG("a %f ind %ld integral %f ind + 1 %f ind %f time +1 %f time %f", a, ind, integral, integral_[ind + 1],
integral_[ind], time_points_[ind + 1], time_points_[ind]);
double_update(&a_aux, time_points_[ind], sg_maxmin_precision * sg_surf_precision);
if (a_aux > 0)
double CpuTiProfile::solve_simple(double a, double amount) const
{
double integral_a = integrate_simple_point(a);
- int ind = binary_search(integral_, integral_a + amount);
+ long ind = binary_search(integral_, integral_a + amount);
double time = time_points_[ind];
time += (integral_a + amount - integral_[ind]) /
((integral_[ind + 1] - integral_[ind]) / (time_points_[ind + 1] - time_points_[ind]));
double CpuTiTmgr::get_power_scale(double a) const
{
double reduced_a = a - floor(a / last_time_) * last_time_;
- int point = CpuTiProfile::binary_search(profile_->time_points_, reduced_a);
+ long point = CpuTiProfile::binary_search(profile_->time_points_, reduced_a);
kernel::profile::DatedValue val = speed_profile_->get_event_list().at(point);
return val.value_;
}
* @param a Value to search
* @return Index of point
*/
-int CpuTiProfile::binary_search(const std::vector<double>& array, double a)
+long CpuTiProfile::binary_search(const std::vector<double>& array, double a)
{
if (array[0] > a)
return 0;
std::vector<double> time_points_;
std::vector<double> integral_;
- static int binary_search(const std::vector<double>& array, double a);
+ static long binary_search(const std::vector<double>& array, double a);
};
class CpuTiTmgr {