summaryrefslogtreecommitdiff
path: root/opendc-experiments/opendc-experiments-capelin/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-10-21 22:32:05 +0200
committerGitHub <noreply@github.com>2022-10-21 22:32:05 +0200
commitfa7fdbb0126ea465130961dc37c4ef2d6feb36e9 (patch)
tree9cd46dd7970870b78990d6c35e8e2759d7cf5a13 /opendc-experiments/opendc-experiments-capelin/src
parent29beb50018cf2ad87b252c6c080f8c5de4600349 (diff)
parent290e1fe14460d91e4703e55ac5f05dbe7b4505f7 (diff)
merge: Implement multi-flow stages in simulator (#110)
This pull request introduces the new `flow2` multi-flow simulator into the OpenDC codebase and adjust all existing modules to make use of this new simulator. The new simulator models flow as a network of components, which can each receive flow from (potentially) multiple other components. In the previous simulator, the framework itself supported only single flows between components and required re-implementation of many components to support multiplexing flows. Initial benchmarks show performance improvements in the range 2x–4x for large scale experiments such as the Capelin benchmarks. ## Implementation Notes :hammer_and_pick: * Add support for multi-flow stages * Support flow transformations * Add forwarding flow multiplexer * Expose metrics on FlowMultiplexer * Re-implement network sim using flow2 * Re-implement power sim using flow2 * Re-implement compute sim using flow2 * Optimize workload implementation of SimTrace * Remove old flow simulator * Add log4j-core dependency ## External Dependencies :four_leaf_clover: * N/A ## Breaking API Changes :warning: * Removal of the `org.opendc.simulator.flow` package. You should now use the new flow simulator located in `org.opendc.simulator.flow2`. * `PowerModel` interface is replaced by the `CpuPowerModel` interface. * `PowerDriver` interface is replaced by the `SimPsu` and `SimPsuFactory` interfaces. * Removal of `SimTraceWorkload`. Instead, create a workload from a `SimTrace` using `createWorkload(offset)`. * `ScalingGovernor` has been split in a `ScalingGovernor` and `ScalingGovernorFactory`. * All modules in `opendc-simulator` are now written in Java. This means that default parameters are not supported anymore for these modules.
Diffstat (limited to 'opendc-experiments/opendc-experiments-capelin/src')
-rw-r--r--opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt16
-rw-r--r--opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt26
2 files changed, 21 insertions, 21 deletions
diff --git a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt
index 08d4a7e0..0b4cafa6 100644
--- a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt
+++ b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt
@@ -25,13 +25,13 @@
package org.opendc.experiments.capelin.topology
import org.opendc.experiments.compute.topology.HostSpec
+import org.opendc.simulator.compute.SimPsuFactories
import org.opendc.simulator.compute.model.MachineModel
import org.opendc.simulator.compute.model.MemoryUnit
import org.opendc.simulator.compute.model.ProcessingNode
import org.opendc.simulator.compute.model.ProcessingUnit
-import org.opendc.simulator.compute.power.LinearPowerModel
-import org.opendc.simulator.compute.power.PowerModel
-import org.opendc.simulator.compute.power.SimplePowerDriver
+import org.opendc.simulator.compute.power.CpuPowerModel
+import org.opendc.simulator.compute.power.CpuPowerModels
import java.io.File
import java.io.InputStream
import java.util.Random
@@ -48,7 +48,7 @@ private val reader = ClusterSpecReader()
*/
fun clusterTopology(
file: File,
- powerModel: PowerModel = LinearPowerModel(350.0, idlePower = 200.0),
+ powerModel: CpuPowerModel = CpuPowerModels.linear(350.0, 200.0),
random: Random = Random(0)
): List<HostSpec> {
return clusterTopology(reader.read(file), powerModel, random)
@@ -59,7 +59,7 @@ fun clusterTopology(
*/
fun clusterTopology(
input: InputStream,
- powerModel: PowerModel = LinearPowerModel(350.0, idlePower = 200.0),
+ powerModel: CpuPowerModel = CpuPowerModels.linear(350.0, 200.0),
random: Random = Random(0)
): List<HostSpec> {
return clusterTopology(reader.read(input), powerModel, random)
@@ -68,14 +68,14 @@ fun clusterTopology(
/**
* Construct a topology from the given list of [clusters].
*/
-fun clusterTopology(clusters: List<ClusterSpec>, powerModel: PowerModel, random: Random = Random(0)): List<HostSpec> {
+fun clusterTopology(clusters: List<ClusterSpec>, powerModel: CpuPowerModel, random: Random = Random(0)): List<HostSpec> {
return clusters.flatMap { it.toHostSpecs(random, powerModel) }
}
/**
* Helper method to convert a [ClusterSpec] into a list of [HostSpec]s.
*/
-private fun ClusterSpec.toHostSpecs(random: Random, powerModel: PowerModel): List<HostSpec> {
+private fun ClusterSpec.toHostSpecs(random: Random, powerModel: CpuPowerModel): List<HostSpec> {
val cpuSpeed = cpuSpeed
val memoryPerHost = memCapacityPerHost.roundToLong()
@@ -92,7 +92,7 @@ private fun ClusterSpec.toHostSpecs(random: Random, powerModel: PowerModel): Lis
"node-$name-$it",
mapOf("cluster" to id),
machineModel,
- SimplePowerDriver(powerModel)
+ SimPsuFactories.simple(powerModel)
)
}
}
diff --git a/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt b/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt
index 70363b6c..47058caa 100644
--- a/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt
+++ b/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt
@@ -120,11 +120,11 @@ class CapelinIntegrationTest {
{ assertEquals(0, monitor.serversActive, "All VMs should finish after a run") },
{ assertEquals(0, monitor.attemptsFailure, "No VM should be unscheduled") },
{ assertEquals(0, monitor.serversPending, "No VM should not be in the queue") },
- { assertEquals(223393683, monitor.idleTime) { "Incorrect idle time" } },
- { assertEquals(66977508, monitor.activeTime) { "Incorrect active time" } },
- { assertEquals(3160381, monitor.stealTime) { "Incorrect steal time" } },
+ { assertEquals(223394204, monitor.idleTime) { "Incorrect idle time" } },
+ { assertEquals(66976984, monitor.activeTime) { "Incorrect active time" } },
+ { assertEquals(3160316, monitor.stealTime) { "Incorrect steal time" } },
{ assertEquals(0, monitor.lostTime) { "Incorrect lost time" } },
- { assertEquals(5.840939264814157E9, monitor.energyUsage, 0.01) { "Incorrect power draw" } }
+ { assertEquals(5.84093E9, monitor.energyUsage, 1E4) { "Incorrect power draw" } }
)
}
@@ -160,11 +160,11 @@ class CapelinIntegrationTest {
// Note that these values have been verified beforehand
assertAll(
- { assertEquals(10999592, monitor.idleTime) { "Idle time incorrect" } },
- { assertEquals(9741207, monitor.activeTime) { "Active time incorrect" } },
+ { assertEquals(10999504, monitor.idleTime) { "Idle time incorrect" } },
+ { assertEquals(9741294, monitor.activeTime) { "Active time incorrect" } },
{ assertEquals(0, monitor.stealTime) { "Steal time incorrect" } },
{ assertEquals(0, monitor.lostTime) { "Lost time incorrect" } },
- { assertEquals(7.011676470304312E8, monitor.energyUsage, 0.01) { "Incorrect power draw" } }
+ { assertEquals(7.0116E8, monitor.energyUsage, 1E4) { "Incorrect power draw" } }
)
}
@@ -199,10 +199,10 @@ class CapelinIntegrationTest {
// Note that these values have been verified beforehand
assertAll(
- { assertEquals(6028050, monitor.idleTime) { "Idle time incorrect" } },
- { assertEquals(14712749, monitor.activeTime) { "Active time incorrect" } },
- { assertEquals(12532907, monitor.stealTime) { "Steal time incorrect" } },
- { assertEquals(470593, monitor.lostTime) { "Lost time incorrect" } }
+ { assertEquals(6027979, monitor.idleTime) { "Idle time incorrect" } },
+ { assertEquals(14712820, monitor.activeTime) { "Active time incorrect" } },
+ { assertEquals(12532979, monitor.stealTime) { "Steal time incorrect" } },
+ { assertEquals(445913, monitor.lostTime) { "Lost time incorrect" } }
)
}
@@ -229,8 +229,8 @@ class CapelinIntegrationTest {
// Note that these values have been verified beforehand
assertAll(
- { assertEquals(10085158, monitor.idleTime) { "Idle time incorrect" } },
- { assertEquals(8539158, monitor.activeTime) { "Active time incorrect" } },
+ { assertEquals(10085103, monitor.idleTime) { "Idle time incorrect" } },
+ { assertEquals(8539212, monitor.activeTime) { "Active time incorrect" } },
{ assertEquals(0, monitor.stealTime) { "Steal time incorrect" } },
{ assertEquals(0, monitor.lostTime) { "Lost time incorrect" } },
{ assertEquals(2328039558, monitor.uptime) { "Uptime incorrect" } }