summaryrefslogtreecommitdiff
path: root/opendc-experiments/opendc-experiments-tf20/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-10-05 14:44:43 +0200
committerGitHub <noreply@github.com>2022-10-05 14:44:43 +0200
commitc2047d09b27b0c05f5c203509dde524e17d3b729 (patch)
tree3903d8aed5e87850c92e1b2dce8379ea99bdfa6d /opendc-experiments/opendc-experiments-tf20/src
parentec3b5b462c1b8296ba18a3872f56d569fa70e45b (diff)
parentbe176910eb870209576326ffaad8bf21241fccbd (diff)
merge: Extract scheduler from simulation coroutine dispatcher (#106)
This pull request extracts the scheduler from the `SimulationCoroutineDispatcher` into a separate `SimulationScheduler` class which allows users to re-use the scheduler between different coroutine dispatchers. We implement the `SimulationScheduler` in Java, removing the explicit dependency on Kotlin or `kotlinx-coroutines`. The scheduler uses a separate specialized priority queue implementation that eliminates allocation in the hot path of the simulator. ## Implementation Notes :hammer_and_pick: * Add Java-based simulator core * Use SimulationScheduler in coroutine dispatcher * Rename runBlockingSimulation to runSimulation ## External Dependencies :four_leaf_clover: * N/A ## Breaking API Changes :warning: * The Kotlin API for simulation has been moved to `org.opendc.simulator.kotlin`. * `runBlockingSImulation` renamed to `runSimulation`
Diffstat (limited to 'opendc-experiments/opendc-experiments-tf20/src')
-rw-r--r--opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/TensorFlowTest.kt8
-rw-r--r--opendc-experiments/opendc-experiments-tf20/src/test/kotlin/org/opendc/experiments/tf20/core/SimTFDeviceTest.kt4
2 files changed, 6 insertions, 6 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 328f1326..eee8b730 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
@@ -30,7 +30,7 @@ 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.core.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
import java.util.*
/**
@@ -41,7 +41,7 @@ class TensorFlowTest {
* Smoke test that tests the capabilities of the TensorFlow application model in OpenDC.
*/
@Test
- fun testSmokeAlexNet() = runBlockingSimulation {
+ fun testSmokeAlexNet() = runSimulation {
val envInput = checkNotNull(TensorFlowTest::class.java.getResourceAsStream("/kth.json"))
val def = MLEnvironmentReader().readEnvironment(envInput).first()
@@ -71,7 +71,7 @@ class TensorFlowTest {
* Smoke test that tests the capabilities of the TensorFlow application model in OpenDC.
*/
@Test
- fun testSmokeVGG() = runBlockingSimulation {
+ fun testSmokeVGG() = runSimulation {
val envInput = checkNotNull(TensorFlowTest::class.java.getResourceAsStream("/kth.json"))
val def = MLEnvironmentReader().readEnvironment(envInput).first()
@@ -101,7 +101,7 @@ class TensorFlowTest {
* Smoke test that tests the capabilities of the TensorFlow application model in OpenDC.
*/
@Test
- fun testSmokeDistribute() = runBlockingSimulation {
+ fun testSmokeDistribute() = runSimulation {
val envInput = checkNotNull(TensorFlowTest::class.java.getResourceAsStream("/kth.json"))
val def = MLEnvironmentReader().readEnvironment(envInput).first()
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 051d5730..966ca5ef 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
@@ -31,7 +31,7 @@ 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.core.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
import java.util.*
/**
@@ -39,7 +39,7 @@ import java.util.*
*/
internal class SimTFDeviceTest {
@Test
- fun testSmoke() = runBlockingSimulation {
+ fun testSmoke() = runSimulation {
val puNode = ProcessingNode("NVIDIA", "Tesla V100", "unknown", 1)
val pu = ProcessingUnit(puNode, 0, 960 * 1230.0)
val memory = MemoryUnit("NVIDIA", "Tesla V100", 877.0, 32_000)