Well, that should've been a division of doubles.
I also fixed the tesh tests.
> [0.000000] [rank 1] Pstates: 3; Powers: 100000000, 50000000, 20000000
> [0.000000] [rank 0] Current pstate: 0; Current power: 100000000
> [0.000000] [rank 1] Current pstate: 0; Current power: 100000000
-> [10.000000] [rank 0] Energy consumed: 2000 Joules.
-> [10.000000] [rank 1] Energy consumed: 2000 Joules.
+> [10.000000] [rank 0] Energy consumed: 1200 Joules.
+> [10.000000] [rank 1] Energy consumed: 1200 Joules.
> [10.000000] [rank 0] Current pstate: 1; Current power: 50000000
> [10.000000] [rank 1] Current pstate: 1; Current power: 50000000
-> [30.000000] [rank 0] Energy consumed: 5400 Joules.
-> [30.000000] [rank 1] Energy consumed: 5400 Joules.
+> [30.000000] [rank 0] Energy consumed: 3400 Joules.
+> [30.000000] [rank 1] Energy consumed: 3400 Joules.
> [30.000000] [rank 0] Current pstate: 2; Current power: 20000000
> [30.000000] [rank 1] Current pstate: 2; Current power: 20000000
-> [80.000000] [rank 0] Energy consumed: 12900 Joules.
-> [80.000000] [rank 1] Energy consumed: 12900 Joules.
-> [80.000000] [surf_energy/INFO] Total energy of host MyHost1: 12900.000000 Joules
-> [80.000000] [surf_energy/INFO] Total energy of host MyHost2: 12900.000000 Joules
+> [80.000000] [rank 0] Energy consumed: 8650 Joules.
+> [80.000000] [rank 1] Energy consumed: 8650 Joules.
+> [80.000000] [surf_energy/INFO] Total energy of host MyHost1: 8650.000000 Joules
+> [80.000000] [surf_energy/INFO] Total energy of host MyHost2: 8650.000000 Joules
> [80.000000] [surf_energy/INFO] Total energy of host MyHost3: 8000.000000 Joules
> [ 0.0000000000000000 ] [rank 1 ] Power: 20000000.000000000
> [ 0.0000000000000000 ] [rank 0 ] Current pstate: 0 ; Current power: 100000000.00000000
> [ 0.0000000000000000 ] [rank 1 ] Current pstate: 0 ; Current power: 100000000.00000000
-> [ 10.000000000000000 ] [rank 0 ] Energy consumed (Joules): 2000.0000000000000
-> [ 10.000000000000000 ] [rank 1 ] Energy consumed (Joules): 2000.0000000000000
+> [ 10.000000000000000 ] [rank 0 ] Energy consumed (Joules): 1200.0000000000000
+> [ 10.000000000000000 ] [rank 1 ] Energy consumed (Joules): 1200.0000000000000
> [ 10.000000000000000 ] [rank 0 ] Current pstate: 1 ; Current power: 50000000.000000000
> [ 10.000000000000000 ] [rank 1 ] Current pstate: 1 ; Current power: 50000000.000000000
-> [ 30.000000000000000 ] [rank 0 ] Energy consumed (Joules): 5400.0000000000000
-> [ 30.000000000000000 ] [rank 1 ] Energy consumed (Joules): 5400.0000000000000
+> [ 30.000000000000000 ] [rank 0 ] Energy consumed (Joules): 3400.0000000000000
+> [ 30.000000000000000 ] [rank 1 ] Energy consumed (Joules): 3400.0000000000000
> [ 30.000000000000000 ] [rank 0 ] Current pstate: 2 ; Current power: 20000000.000000000
> [ 30.000000000000000 ] [rank 1 ] Current pstate: 2 ; Current power: 20000000.000000000
-> [ 80.000000000000000 ] [rank 0 ] Energy consumed (Joules): 12900.000000000000
-> [ 80.000000000000000 ] [rank 1 ] Energy consumed (Joules): 12900.000000000000
-> [80.000000] [surf_energy/INFO] Total energy of host MyHost1: 12900.000000 Joules
-> [80.000000] [surf_energy/INFO] Total energy of host MyHost2: 12900.000000 Joules
+> [ 80.000000000000000 ] [rank 0 ] Energy consumed (Joules): 8650.0000000000000
+> [ 80.000000000000000 ] [rank 1 ] Energy consumed (Joules): 8650.0000000000000
+> [80.000000] [surf_energy/INFO] Total energy of host MyHost1: 8650.000000 Joules
+> [80.000000] [surf_energy/INFO] Total energy of host MyHost2: 8650.000000 Joules
> [80.000000] [surf_energy/INFO] Total energy of host MyHost3: 8000.000000 Joules
> [ 0.0000000000000000 ] [rank 1 ] Power: 20000000.000000000
> [ 0.0000000000000000 ] [rank 0 ] Current pstate: 0 ; Current power: 100000000.00000000
> [ 0.0000000000000000 ] [rank 1 ] Current pstate: 0 ; Current power: 100000000.00000000
-> [ 10.000000000000000 ] [rank 0 ] Energy consumed (Joules): 2000.0000000000000
-> [ 10.000000000000000 ] [rank 1 ] Energy consumed (Joules): 2000.0000000000000
+> [ 10.000000000000000 ] [rank 0 ] Energy consumed (Joules): 1200.0000000000000
+> [ 10.000000000000000 ] [rank 1 ] Energy consumed (Joules): 1200.0000000000000
> [ 10.000000000000000 ] [rank 0 ] Current pstate: 1 ; Current power: 50000000.000000000
> [ 10.000000000000000 ] [rank 1 ] Current pstate: 1 ; Current power: 50000000.000000000
-> [ 30.000000000000000 ] [rank 0 ] Energy consumed (Joules): 5400.0000000000000
-> [ 30.000000000000000 ] [rank 1 ] Energy consumed (Joules): 5400.0000000000000
+> [ 30.000000000000000 ] [rank 0 ] Energy consumed (Joules): 3400.0000000000000
+> [ 30.000000000000000 ] [rank 1 ] Energy consumed (Joules): 3400.0000000000000
> [ 30.000000000000000 ] [rank 0 ] Current pstate: 2 ; Current power: 20000000.000000000
> [ 30.000000000000000 ] [rank 1 ] Current pstate: 2 ; Current power: 20000000.000000000
-> [ 80.000000000000000 ] [rank 0 ] Energy consumed (Joules): 12900.000000000000
-> [ 80.000000000000000 ] [rank 1 ] Energy consumed (Joules): 12900.000000000000
-> [80.000000] [surf_energy/INFO] Total energy of host MyHost1: 12900.000000 Joules
-> [80.000000] [surf_energy/INFO] Total energy of host MyHost2: 12900.000000 Joules
+> [ 80.000000000000000 ] [rank 0 ] Energy consumed (Joules): 8650.0000000000000
+> [ 80.000000000000000 ] [rank 1 ] Energy consumed (Joules): 8650.0000000000000
+> [80.000000] [surf_energy/INFO] Total energy of host MyHost1: 8650.000000 Joules
+> [80.000000] [surf_energy/INFO] Total energy of host MyHost2: 8650.000000 Joules
> [80.000000] [surf_energy/INFO] Total energy of host MyHost3: 8000.000000 Joules
*/
double power_slope;
int coreCount = host->coreCount();
+ double coreReciprocal = static_cast<double>(1) / static_cast<double>(coreCount);
if (coreCount > 1)
- power_slope = (max_power - min_power) / (1 - 1 / coreCount);
+ power_slope = (max_power - min_power) / (1 - coreReciprocal);
else
power_slope = 0; // Should be 0, since max_power == min_power (in this case)
- current_power = min_power + (cpu_load - (1 / coreCount)) * power_slope;
+ current_power = min_power + (cpu_load - coreReciprocal) * power_slope;
}
else { /* Our machine is idle, take the dedicated value! */
current_power = range.idle;