SimGrid
3.18
Versatile Simulation of Distributed Systems
|
Describes how to use the energy plugin.
This is the energy plugin, enabling to account not only for computation time, but also for the dissipated energy in the simulated platform.
To activate this plugin, first call sg_host_energy_plugin_init() before your MSG_init(), and then use MSG_host_get_consumed_energy() to retrieve the consumption of a given host.
When the host is on, this energy consumption naturally depends on both the current CPU load and the host energy profile. According to our measurements, the consumption is somehow linear in the amount of cores at full speed, with an abnormality when all the cores are idle. The full details are in our scientific paper on that topic.
As a result, our energy model takes 4 parameters:
Here is an example of XML declaration:
This example gives the following parameters: Off is 10 Watts; Idle is 100 Watts; OneCore is 120 Watts and AllCores is 200 Watts. This is enough to compute the consumption as a function of the amount of loaded cores:
#Cores loaded | Consumption | Explanation |
---|---|---|
0 | 100 Watts | Idle value |
1 | 120 Watts | OneCore value |
2 | 147 Watts | linear extrapolation between OneCore and AllCores |
3 | 173 Watts | linear extrapolation between OneCore and AllCores |
4 | 200 Watts | AllCores value |
This is impossible in SimGrid because we recompute everything each time that the CPU starts or stops doing something. So if a core is at load 50% over a period, it means that it is at load 100% half of the time and at load 0% the rest of the time, and our model holds.
In this case, the parameters OneCore and AllCores are obviously the same. Actually, SimGrid expect an energetic profile formatted as 'Idle:Running' for mono-cores hosts. If you insist on passing 3 parameters in this case, then you must have the same value for OneCore and AllCores.
If your host has several DVFS levels (several pstates), then you should give the energetic profile of each pstate level:
This encodes the following values
pstate | Performance | Idle | OneCore | AllCores |
---|---|---|---|---|
0 | 100 Mflop/s | 95 Watts | 120 Watts | 200 Watts |
1 | 50 Mflop/s | 93 Watts | 115 Watts | 170 Watts |
2 | 20 Mflop/s | 90 Watts | 110 Watts | 150 Watts |
To change the pstate of a given CPU, use the following functions: MSG_host_get_nb_pstates(), simgrid::s4u::Host::setPstate(), MSG_host_get_power_peak_at().
This model cannot be more accurate than your instantiation: with the default values, your result will not be accurate at all. You can still get accurate energy prediction, provided that you carefully instantiate the model. The first step is to ensure that your timing prediction match perfectly. But this is only the first step of the path, and you really want to read this paper to see all what you need to do before you can get accurate energy predictions.
Functions | |
void | sg_host_energy_plugin_init () |
Enable host energy plugin. More... | |
void | sg_host_energy_update_all () |
updates the consumption of all hosts More... | |
double | sg_host_get_consumed_energy (sg_host_t host) |
Returns the total energy consumed by the host so far (in Joules) More... | |
double | sg_host_get_wattmin_at (sg_host_t host, int pstate) |
Get the amount of watt dissipated at the given pstate when the host is idling. More... | |
double | sg_host_get_wattmax_at (sg_host_t host, int pstate) |
Returns the amount of watt dissipated at the given pstate when the host burns CPU at 100%. More... | |
double | sg_host_get_current_consumption (sg_host_t host) |
Returns the current consumption of the host. More... | |
double | sg_link_get_consumed_energy (sg_link_t link) |
Returns the total energy consumed by the link so far (in Joules) More... | |
void sg_host_energy_plugin_init | ( | ) |
Enable host energy plugin.
Enable energy plugin to get joules consumption of each cpu. Call this function before MSG_init().
void sg_host_energy_update_all | ( | ) |
updates the consumption of all hosts
After this call, sg_host_get_consumed_energy() will not interrupt your process (until after the next clock update).
double sg_host_get_consumed_energy | ( | sg_host_t | host | ) |
Returns the total energy consumed by the host so far (in Joules)
Please note that since the consumption is lazily updated, it may require a simcall to update it. The result is that the actor requesting this value will be interrupted, the value will be updated in kernel mode before returning the control to the requesting actor.
double sg_host_get_wattmin_at | ( | sg_host_t | host, |
int | pstate | ||
) |
Get the amount of watt dissipated at the given pstate when the host is idling.
double sg_host_get_wattmax_at | ( | sg_host_t | host, |
int | pstate | ||
) |
Returns the amount of watt dissipated at the given pstate when the host burns CPU at 100%.
double sg_host_get_current_consumption | ( | sg_host_t | host | ) |
Returns the current consumption of the host.
double sg_link_get_consumed_energy | ( | sg_link_t | link | ) |
Returns the total energy consumed by the link so far (in Joules)
Please note that since the consumption is lazily updated, it may require a simcall to update it. The result is that the actor requesting this value will be interrupted, the value will be updated in kernel mode before returning the control to the requesting actor.