SimGrid  3.16
Versatile Simulation of Distributed Systems
Energy Plugin

Detailed Description

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:

<host id="HostA" power="100.0Mf" cores="4">
<prop id="watt_per_state" value="100.0:120.0:200.0" />
<prop id="watt_off" value="10" />
</host>

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 loadedConsumptionExplanation
0100 WattsIdle value
1120 WattsOneCore value
2147 Wattslinear extrapolation between OneCore and AllCores
3173 Wattslinear extrapolation between OneCore and AllCores
4200 WattsAllCores value

What if a given core is only at load 50%?

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.

What if the host has only one core?

In this case, the parameters OneCore and AllCores are obviously the same. Actually, SimGrid expect an energetic profile formated 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.

<host id="HostC" power="100.0Mf" cores="1">
<prop id="watt_per_state" value="95.0:200.0" /> <!-- we may have used '95:200:200' instead -->
<prop id="watt_off" value="10" />
</host>

How does DVFS interact with the host energy model?

If your host has several DVFS levels (several pstates), then you should give the energetic profile of each pstate level:

<host id="HostC" power="100.0Mf,50.0Mf,20.0Mf" cores="4">
<prop id="watt_per_state" value="95.0:120.0:200.0, 93.0:115.0:170.0, 90.0:110.0:150.0" />
<prop id="watt_off" value="10" />
</host>

This encodes the following values

pstatePerformanceIdleOneCoreAllCores
0100 Mflop/s95 Watts120 Watts200 Watts
150 Mflop/s93 Watts115 Watts170 Watts
220 Mflop/s90 Watts110 Watts150 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().

How accurate are these models?

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.

To activate this plugin, first call MSG_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.

As a result, our energy model takes 4 parameters:

Here is an example of XML declaration:

<host id="HostA" power="100.0Mf" cores="4">
<prop id="watt_per_state" value="100.0:120.0:200.0" />
<prop id="watt_off" value="10" />
</host>

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 loadedConsumptionExplanation
0100 WattsIdle value
1120 WattsOneCore value
2147 Wattslinear extrapolation between OneCore and AllCores
3173 Wattslinear extrapolation between OneCore and AllCores
4200 WattsAllCores value

What if a given core is only at load 50%?

Well, that's 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 the model holds.

What if the host has only one core?

In this case, the parameters OneCore and AllCores are obviously the same. Actually, SimGrid expect an energetic profile formated 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.

<host id="HostC" power="100.0Mf" cores="1">
<prop id="watt_per_state" value="95.0:200.0" /> <!-- we may have used '95:200:200' instead -->
<prop id="watt_off" value="10" />
</host>

How does DVFS interact with the energy model?

If your host has several DVFS levels (several pstates), then you should give the energetic profile of each pstate level:

<host id="HostC" power="100.0Mf,50.0Mf,20.0Mf" cores="4">
<prop id="watt_per_state" value="95.0:120.0:200.0, 93.0:115.0:170.0, 90.0:110.0:150.0" />
<prop id="watt_off" value="10" />
</host>

This encodes the following values

pstatePerformanceIdleOneCoreAllCores
0100 Mflop/s95 Watts120 Watts200 Watts
150 Mflop/s93 Watts115 Watts170 Watts
220 Mflop/s90 Watts110 Watts150 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().

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...
 

Function Documentation

◆ sg_host_energy_plugin_init()

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().

◆ sg_host_energy_update_all()

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).

◆ sg_host_get_consumed_energy()

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.

◆ sg_host_get_wattmin_at()

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.

◆ sg_host_get_wattmax_at()

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%.

◆ sg_host_get_current_consumption()

double sg_host_get_current_consumption ( sg_host_t  host)

Returns the current consumption of the host.