From: Martin Quinson Date: Mon, 10 Oct 2016 12:49:41 +0000 (+0200) Subject: Merge branches, and adapt the new code to the new refactoring. X-Git-Tag: v3_14~350 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/c8017d49035c1ccdcd6b49f09162a4836b8d45a8?hp=bd7708d5f81722d60f78bcf7dd0481d6a8e58a92 Merge branches, and adapt the new code to the new refactoring. --- diff --git a/examples/msg/energy-consumption/energy-consumption.tesh b/examples/msg/energy-consumption/energy-consumption.tesh index 3666ed1e78..8977b21259 100644 --- a/examples/msg/energy-consumption/energy-consumption.tesh +++ b/examples/msg/energy-consumption/energy-consumption.tesh @@ -8,15 +8,15 @@ $ $SG_TEST_EXENV energy-consumption/energy-consumption$EXEEXT ${srcdir:=.}/../pl > [ 0.000000] (1:dvfs_test@MyHost1) Sleep for 10 seconds > [ 10.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=1E+08; Energy dissipated=1000.00 J > [ 10.000000] (1:dvfs_test@MyHost1) Run a task of 1E+08 flops -> [ 11.000000] (1:dvfs_test@MyHost1) Task done (duration: 1.00 s). Current peak speed=1E+08 flop/s; Current consumption: from 120W to 200W depending on load; Energy dissipated=1200 J +> [ 11.000000] (1:dvfs_test@MyHost1) Task done (duration: 1.00 s). Current peak speed=1E+08 flop/s; Current consumption: from 120W to 200W depending on load; Energy dissipated=1120 J > [ 11.000000] (1:dvfs_test@MyHost1) ========= Requesting pstate 2 (speed should be of 2E+07 flop/s and is of 2E+07 flop/s) > [ 11.000000] (1:dvfs_test@MyHost1) Run a task of 1E+08 flops -> [ 16.000000] (1:dvfs_test@MyHost1) Task done (duration: 5.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=1950 J +> [ 16.000000] (1:dvfs_test@MyHost1) Task done (duration: 5.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=1645 J > [ 16.000000] (1:dvfs_test@MyHost1) Sleep for 4 seconds -> [ 20.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 4.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=2310 J +> [ 20.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 4.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=2005 J > [ 20.000000] (1:dvfs_test@MyHost1) Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated 2000 J so far. -> [ 30.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=3210 J +> [ 30.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=2905 J > [ 30.000000] (0:maestro@) Total simulation time: 30.00 -> [ 30.000000] (0:maestro@) Total energy of host MyHost1: 3210.000000 Joules +> [ 30.000000] (0:maestro@) Total energy of host MyHost1: 2905.000000 Joules > [ 30.000000] (0:maestro@) Total energy of host MyHost2: 2100.000000 Joules > [ 30.000000] (0:maestro@) Total energy of host MyHost3: 3000.000000 Joules diff --git a/examples/msg/energy-ptask/energy-ptask.tesh b/examples/msg/energy-ptask/energy-ptask.tesh index ffbc944041..2bfd392fb2 100644 --- a/examples/msg/energy-ptask/energy-ptask.tesh +++ b/examples/msg/energy-ptask/energy-ptask.tesh @@ -8,6 +8,6 @@ $ $SG_TEST_EXENV energy-ptask/energy-ptask$EXEEXT ${srcdir:=.}/../platforms/ener > [310.000000] (1:test@MyHost1) Finally, trick the ptask to do a 'remote execution', on host MyHost2 > [320.000000] (1:test@MyHost1) Goodbye now! > [320.000000] (0:maestro@) Simulation done. -> [320.000000] (0:maestro@) Total energy of host MyHost1: 39800.000000 Joules -> [320.000000] (0:maestro@) Total energy of host MyHost2: 40800.000000 Joules -> [320.000000] (0:maestro@) Total energy of host MyHost3: 39800.000000 Joules +> [320.000000] (0:maestro@) Total energy of host MyHost1: 38200.000000 Joules +> [320.000000] (0:maestro@) Total energy of host MyHost2: 38400.000000 Joules +> [320.000000] (0:maestro@) Total energy of host MyHost3: 38200.000000 Joules diff --git a/examples/msg/energy-vm/energy-vm.tesh b/examples/msg/energy-vm/energy-vm.tesh index 314ce3a0ef..ab2e86bf03 100644 --- a/examples/msg/energy-vm/energy-vm.tesh +++ b/examples/msg/energy-vm/energy-vm.tesh @@ -16,6 +16,6 @@ $ $SG_TEST_EXENV energy-vm/energy-vm$EXEEXT ${srcdir:=.}/../platforms/energy_pla > [ 6.000000] (6:p31@vm_host3) This worker is done. > [ 6.000000] (7:p32@vm_host3) This worker is done. > [ 10.000000] (0:maestro@) Total simulation time: 10.00; All hosts must have the exact same energy consumption. -> [ 10.000000] (0:maestro@) Total energy of host MyHost1: 1600.000000 Joules -> [ 10.000000] (0:maestro@) Total energy of host MyHost2: 1600.000000 Joules -> [ 10.000000] (0:maestro@) Total energy of host MyHost3: 1600.000000 Joules +> [ 10.000000] (0:maestro@) Total energy of host MyHost1: 1120.000000 Joules +> [ 10.000000] (0:maestro@) Total energy of host MyHost2: 1120.000000 Joules +> [ 10.000000] (0:maestro@) Total energy of host MyHost3: 1120.000000 Joules diff --git a/src/surf/plugins/energy.cpp b/src/surf/plugins/energy.cpp index c3b623d929..82248cd160 100644 --- a/src/surf/plugins/energy.cpp +++ b/src/surf/plugins/energy.cpp @@ -153,8 +153,25 @@ double HostEnergy::getCurrentWattsValue(double cpu_load) if (cpu_load > 0) { /* Something is going on, the machine is not idle */ double min_power = range.min; double max_power = range.max; - double power_slope = max_power - min_power; - current_power = min_power + cpu_load * power_slope; + + /** + * The min_power states how much we consume when only one single + * core is working. This means that when cpu_load == 1/coreCount, then + * current_power == min_power. + * + * The maximum must be reached when all cores are working (but 1 core was + * already accounted for by min_power) + * i.e., we need min_power + (maxCpuLoad-1/coreCount)*power_slope == max_power + * (maxCpuLoad is by definition 1) + */ + double power_slope; + int coreCount = host->coreCount(); + if (coreCount > 1) + power_slope = (max_power - min_power) / (1 - 1 / coreCount); + 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; } else { /* Our machine is idle, take the dedicated value! */ current_power = range.idle;