From 5a365dbc068f2a8cdfa9813c39cc84bb30e15637 Mon Sep 17 00:00:00 2001 From: Dante Niewenhuis Date: Fri, 25 Oct 2024 13:32:41 +0200 Subject: Rewrote the FlowEngine (#256) * Removed unused components. Updated tests. Improved checkpointing model Improved model, started with SimPowerSource implemented FailureModels and Checkpointing First working version midway commit first update All simulation are now run with a single CPU and single MemoryUnit. multi CPUs are combined into one. This is for performance and explainability. * fixed merge conflicts * Updated M3SA paths. * Fixed small typo --- .../main/kotlin/org/opendc/simulator/compute/Coroutines.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'opendc-simulator/opendc-simulator-compute/src/main/kotlin') diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/Coroutines.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/Coroutines.kt index 63af2048..ad69a3d6 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/Coroutines.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/Coroutines.kt @@ -23,12 +23,13 @@ package org.opendc.simulator.compute import kotlinx.coroutines.suspendCancellableCoroutine -import org.opendc.simulator.compute.workload.SimWorkload +import org.opendc.simulator.compute.machine.SimMachine +import org.opendc.simulator.compute.workload.TraceWorkload import kotlin.coroutines.resume import kotlin.coroutines.resumeWithException /** - * Run the specified [SimWorkload] on this machine and suspend execution util [workload] has finished. + * Run the specified [SimWorkloadNew] on this machine and suspend execution util [workload] has finished. * * @param workload The workload to start on the machine. * @param meta The metadata to pass to the workload. @@ -36,13 +37,13 @@ import kotlin.coroutines.resumeWithException * @throws IllegalStateException if a workload is already active on the machine or if the machine is closed. */ public suspend fun SimMachine.runWorkload( - workload: SimWorkload, + workload: TraceWorkload, meta: Map = emptyMap(), ) { return suspendCancellableCoroutine { cont -> - cont.invokeOnCancellation { this@runWorkload.cancel() } + cont.invokeOnCancellation { this@runWorkload.shutdown() } - startWorkload(workload, meta) { cause -> + startWorkload(workload) { cause -> if (cause != null) cont.resumeWithException(cause) else cont.resume(Unit) } } -- cgit v1.2.3