From 788c007599ac61a41460589f65454aac1857eb81 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Fri, 28 Oct 2022 11:55:41 +0200 Subject: refactor(sim/compute): Provide workload constructors in SimWorkloads This change introduces a new class SimWorkloads which provides construction methods for the standard workloads available in OpenDC. --- .../src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'opendc-experiments') diff --git a/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt b/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt index 4dc3a775..b622362a 100644 --- a/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt +++ b/opendc-experiments/opendc-experiments-workflow/src/main/kotlin/org/opendc/experiments/workflow/TraceHelpers.kt @@ -27,7 +27,7 @@ package org.opendc.experiments.workflow import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.delay import kotlinx.coroutines.launch -import org.opendc.simulator.compute.workload.SimFlopsWorkload +import org.opendc.simulator.compute.workload.SimWorkloads import org.opendc.trace.Trace import org.opendc.trace.conv.TABLE_TASKS import org.opendc.trace.conv.TASK_ALLOC_NCPUS @@ -74,7 +74,7 @@ public fun Trace.toJobs(): List { val submitTime = reader.getInstant(TASK_SUBMIT_TIME)!! val runtime = reader.getDuration(TASK_RUNTIME)!! val flops: Long = 4000 * runtime.seconds * grantedCpus - val workload = SimFlopsWorkload(flops, 1.0) + val workload = SimWorkloads.flops(flops, 1.0) val task = Task( UUID(0L, id), "", -- cgit v1.2.3 From d5aed4b1e6e5548728c5978e3b46d1472b62e791 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Mon, 17 Oct 2022 22:03:02 +0200 Subject: refactor(compute/sim): Use workload chaining for boot delay This change updates the implementation of `SimHost` to use workload chaining for modelling boot delays. Previously, this was implemented by sleeping 1 millisecond using Kotlin coroutines. With this change, we remove the need for coroutines and instead use the `SimDurationWorkload` to model the boot delay. In the future, we envision a user-supplied stochastic boot model to model the boot delay for VM instances. --- .../experiments/capelin/CapelinIntegrationTest.kt | 22 +++++++++++----------- .../experiments/compute/HostsProvisioningStep.kt | 1 - 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'opendc-experiments') 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 47058caa..77b0d09f 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,9 +120,9 @@ 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(223394204, monitor.idleTime) { "Incorrect idle time" } }, - { assertEquals(66976984, monitor.activeTime) { "Incorrect active time" } }, - { assertEquals(3160316, monitor.stealTime) { "Incorrect steal time" } }, + { assertEquals(223394101, monitor.idleTime) { "Incorrect idle time" } }, + { assertEquals(66977086, monitor.activeTime) { "Incorrect active time" } }, + { assertEquals(3160276, monitor.stealTime) { "Incorrect steal time" } }, { assertEquals(0, monitor.lostTime) { "Incorrect lost time" } }, { assertEquals(5.84093E9, monitor.energyUsage, 1E4) { "Incorrect power draw" } } ) @@ -160,8 +160,8 @@ class CapelinIntegrationTest { // Note that these values have been verified beforehand assertAll( - { assertEquals(10999504, monitor.idleTime) { "Idle time incorrect" } }, - { assertEquals(9741294, monitor.activeTime) { "Active time incorrect" } }, + { assertEquals(10999514, monitor.idleTime) { "Idle time incorrect" } }, + { assertEquals(9741285, monitor.activeTime) { "Active time incorrect" } }, { assertEquals(0, monitor.stealTime) { "Steal time incorrect" } }, { assertEquals(0, monitor.lostTime) { "Lost time incorrect" } }, { 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(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" } } + { assertEquals(6028018, monitor.idleTime) { "Idle time incorrect" } }, + { assertEquals(14712781, monitor.activeTime) { "Active time incorrect" } }, + { assertEquals(12532934, monitor.stealTime) { "Steal time incorrect" } }, + { assertEquals(424267, monitor.lostTime) { "Lost time incorrect" } } ) } @@ -229,8 +229,8 @@ class CapelinIntegrationTest { // Note that these values have been verified beforehand assertAll( - { assertEquals(10085103, monitor.idleTime) { "Idle time incorrect" } }, - { assertEquals(8539212, monitor.activeTime) { "Active time incorrect" } }, + { assertEquals(10085111, monitor.idleTime) { "Idle time incorrect" } }, + { assertEquals(8539204, 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" } } diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt index 292be929..16a57236 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt @@ -58,7 +58,6 @@ public class HostsProvisioningStep internal constructor( spec.uid, spec.name, spec.meta, - ctx.coroutineContext, graph, machine, hypervisor, -- cgit v1.2.3 From c6f2d16a20bfac466480c0e98341b08b12fc0772 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 18 Oct 2022 11:01:37 +0200 Subject: feat(compute/sim): Model host boot time This change updates `SimHost` to support modeling the time and resource consumption it takes to boot the host. The boot procedure is modeled as a `SimWorkload`. --- .../main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'opendc-experiments') diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt index 16a57236..e224fb84 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/HostsProvisioningStep.kt @@ -58,7 +58,7 @@ public class HostsProvisioningStep internal constructor( spec.uid, spec.name, spec.meta, - graph, + ctx.clock, machine, hypervisor, optimize = optimize -- cgit v1.2.3