summaryrefslogtreecommitdiff
path: root/opendc-experiments/opendc-experiments-tf20/src/test
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-tf20/src/test
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-tf20/src/test')
-rw-r--r--opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/TensorFlowTest.kt14
-rw-r--r--opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/core/SimTFDeviceTest.kt4
2 files changed, 9 insertions, 9 deletions
diff --git a/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/TensorFlowTest.kt b/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/TensorFlowTest.kt
index c4698058..32f72686 100644
--- a/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/TensorFlowTest.kt
+++ b/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/TensorFlowTest.kt
@@ -29,7 +29,7 @@ import org.opendc.experiments.tf20.core.SimTFDevice
import org.opendc.experiments.tf20.distribute.MirroredStrategy
import org.opendc.experiments.tf20.distribute.OneDeviceStrategy
import org.opendc.experiments.tf20.util.MLEnvironmentReader
-import org.opendc.simulator.compute.power.LinearPowerModel
+import org.opendc.simulator.compute.power.CpuPowerModels
import org.opendc.simulator.kotlin.runSimulation
import java.util.UUID
@@ -52,7 +52,7 @@ class TensorFlowTest {
clock,
def.model.cpus[0],
def.model.memory[0],
- LinearPowerModel(250.0, 60.0)
+ CpuPowerModels.linear(250.0, 60.0)
)
val strategy = OneDeviceStrategy(device)
val batchSize = 32
@@ -87,7 +87,7 @@ class TensorFlowTest {
clock,
def.model.cpus[0],
def.model.memory[0],
- LinearPowerModel(250.0, 60.0)
+ CpuPowerModels.linear(250.0, 60.0)
)
val strategy = OneDeviceStrategy(device)
val batchSize = 128
@@ -102,8 +102,8 @@ class TensorFlowTest {
val stats = device.getDeviceStats()
assertAll(
- { assertEquals(176230322904, clock.millis()) },
- { assertEquals(4.4057580726E10, stats.energyUsage) }
+ { assertEquals(176230328513, clock.millis()) },
+ { assertEquals(4.405758212825E10, stats.energyUsage) }
)
}
@@ -122,7 +122,7 @@ class TensorFlowTest {
clock,
def.model.cpus[0],
def.model.memory[0],
- LinearPowerModel(250.0, 60.0)
+ CpuPowerModels.linear(250.0, 60.0)
)
val deviceB = SimTFDevice(
@@ -132,7 +132,7 @@ class TensorFlowTest {
clock,
def.model.cpus[0],
def.model.memory[0],
- LinearPowerModel(250.0, 60.0)
+ CpuPowerModels.linear(250.0, 60.0)
)
val strategy = MirroredStrategy(listOf(deviceA, deviceB))
diff --git a/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/core/SimTFDeviceTest.kt b/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/core/SimTFDeviceTest.kt
index 85d63e9b..910cbcc9 100644
--- a/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/core/SimTFDeviceTest.kt
+++ b/opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/core/SimTFDeviceTest.kt
@@ -30,7 +30,7 @@ import org.junit.jupiter.api.Test
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.CpuPowerModels
import org.opendc.simulator.kotlin.runSimulation
import java.util.UUID
@@ -51,7 +51,7 @@ internal class SimTFDeviceTest {
clock,
pu,
memory,
- LinearPowerModel(250.0, 100.0)
+ CpuPowerModels.linear(250.0, 100.0)
)
// Load 1 GiB into GPU memory