From 57ebc8a1c6779d7e7276754838e83f1c026cceb9 Mon Sep 17 00:00:00 2001 From: Hongyu <39747921+HongyuHe@users.noreply.github.com> Date: Fri, 26 Mar 2021 15:47:14 +0100 Subject: simulator: Extract hardware power values to a separate file (#105) This change enables the use of the interpolation model testing on the results of the SPEC benchmark. --- .../compute/power/MachinePowerModelTest.kt | 26 +++++++++++++++++-- .../src/test/resources/spec_machines.yml | 29 ++++++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 simulator/opendc-simulator/opendc-simulator-compute/src/test/resources/spec_machines.yml (limited to 'simulator/opendc-simulator/opendc-simulator-compute/src/test') diff --git a/simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/MachinePowerModelTest.kt b/simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/MachinePowerModelTest.kt index 9fdd0363..13bb3668 100644 --- a/simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/MachinePowerModelTest.kt +++ b/simulator/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/MachinePowerModelTest.kt @@ -1,9 +1,10 @@ package org.opendc.simulator.compute.power -import io.mockk.* import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.flow.* +import org.junit.jupiter.api.Assertions.assertAll import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.MethodSource @@ -36,6 +37,27 @@ internal class MachinePowerModelTest { assertEquals(0.0, computedPowerConsumption) } + @Test + fun `compute power draw by the SPEC benchmark model`() { + val powerModel = InterpolationPowerModel("IBMx3550M3_XeonX5675") + + assertAll( + { assertThrows { powerModel.computeCpuPower(-1.3) } }, + { assertThrows { powerModel.computeCpuPower(1.3) } }, + ) + + assertAll( + { assertEquals(58.4, powerModel.computeCpuPower(0.0)) }, + { assertEquals(58.4 + (98 - 58.4) / 5, powerModel.computeCpuPower(0.02)) }, + { assertEquals(98.0, powerModel.computeCpuPower(0.1)) }, + { assertEquals(140.0, powerModel.computeCpuPower(0.5)) }, + { assertEquals(189.0, powerModel.computeCpuPower(0.8)) }, + { assertEquals(189.0 + 0.7 * 10 * (205 - 189) / 10, powerModel.computeCpuPower(0.87)) }, + { assertEquals(205.0, powerModel.computeCpuPower(0.9)) }, + { assertEquals(222.0, powerModel.computeCpuPower(1.0)) }, + ) + } + @Suppress("unused") private companion object { @JvmStatic diff --git a/simulator/opendc-simulator/opendc-simulator-compute/src/test/resources/spec_machines.yml b/simulator/opendc-simulator/opendc-simulator-compute/src/test/resources/spec_machines.yml new file mode 100644 index 00000000..d51cba80 --- /dev/null +++ b/simulator/opendc-simulator/opendc-simulator-compute/src/test/resources/spec_machines.yml @@ -0,0 +1,29 @@ +--- +# The power model of an IBM server x3550 (2 x [Xeon X5675 3067 MHz, 6 cores], 16GB).
+# +# http://www.spec.org/power_ssj2008/results/res2011q2/power_ssj2008-20110406-00368.html +IBMx3550M3_XeonX5675: [58.4, 98.0, 109.0, 118.0, 128.0, 140.0, 153.0, 170.0, 189.0, 205.0, 222.0] + # The power model of an IBM server x3550 (2 x [Xeon X5670 2933 MHz, 6 cores], 12GB).
+ # + # http://www.spec.org/power_ssj2008/results/res2010q2/power_ssj2008-20100315-00239.html +IBMx3550M3_XeonX5670: [66.0, 107.0, 120.0, 131.0, 143.0, 156.0, 173.0, 191.0, 211.0, 229.0, 247.0] + # the power model of an IBM server x3250 (1 x [Xeon X3480 3067 MHz, 4 cores], 8GB).
+ # + # http://www.spec.org/power_ssj2008/results/res2010q4/power_ssj2008-20101001-00297.html +IBMx3250M3_XeonX3480: [42.3, 46.7, 49.7, 55.4, 61.8, 69.3, 76.1, 87.0, 96.1, 106.0, 113.0] + # The power model of an IBM server x3250 (1 x [Xeon X3470 2933 MHz, 4 cores], 8GB).
+ # + # http://www.spec.org/power_ssj2008/results/res2009q4/power_ssj2008-20091104-00213.html +IBMx3250M3_XeonX3470: [41.6, 46.7, 52.3, 57.9, 65.4, 73.0, 80.7, 89.5, 99.6, 105.0, 113.0] + # The power model of an HP ProLiant ML110 G5 (1 x [Xeon 3075 2660 MHz, 2 cores], 4GB).
+ # + # http://www.spec.org/power_ssj2008/results/res2011q1/power_ssj2008-20110124-00339.html +HPProLiantMl110G5_Xeon3075: [93.7, 97.0, 101.0, 105.0, 110.0, 116.0, 121.0, 125.0, 129.0, 133.0, 135.0] + # The power model of an HP ProLiant ML110 G4 (1 x [Xeon 3040 1860 MHz, 2 cores], 4GB).
+ # + # http://www.spec.org/power_ssj2008/results/res2011q1/power_ssj2008-20110127-00342.html +HPProLiantMl110G4_Xeon3040: [86.0, 89.4, 92.6, 96.0, 99.5, 102.0, 106.0, 108.0, 112.0, 114.0, 117.0] + # The power model of an HP ProLiant ML110 G3 (1 x [Pentium D930 3000 MHz, 2 cores], 4GB).
+ # + # http://www.spec.org/power_ssj2008/results/res2011q1/power_ssj2008-20110127-00342.html +HPProLiantMl110G3_PentiumD930: [105.0, 112.0, 118.0, 125.0, 131.0, 137.0, 147.0, 153.0, 157.0, 164.0, 169.0] -- cgit v1.2.3