summaryrefslogtreecommitdiff
path: root/opendc-simulator
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-06-16 11:08:14 +0200
committerGitHub <noreply@github.com>2022-06-16 11:08:14 +0200
commit8eab5895dcf21b4a3f585c62db14c9a049c81d98 (patch)
treeb2b698d85f7397ef67485d52128a9390f40f7252 /opendc-simulator
parentd146814bbbb86bfcb19ccb94250424703e9179e5 (diff)
parent282f199e6f16350123a915b06faff62ca82be91b (diff)
merge: Fix distributed strategy for TensorFlow experiment (#89)
This pull request fixes an issue where the distributed strategies for the TensorFlow experiments did not work correctly. ## Implementation Notes :hammer_and_pick: * Limit growth rate for trace construction * Derive device statistics directly from SimMachine * Always recompute power usage when a `SImBareMetalMachine` converges * Add a test case for `MirroredStrategy`
Diffstat (limited to 'opendc-simulator')
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt3
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt3
2 files changed, 4 insertions, 2 deletions
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt
index 68792c72..63a82e78 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt
@@ -91,8 +91,9 @@ public class SimBareMetalMachine(
if (duration > 0) {
// Compute the power and energy usage of the machine
computeEnergyUsage(now)
- _powerUsage = powerDriverLogic.computePower()
}
+
+ _powerUsage = powerDriverLogic.computePower()
}
init {
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt
index 207e8579..6b820e5d 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt
+++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt
@@ -55,6 +55,7 @@ public class SimTrace(
/**
* Construct a [SimTrace] with the specified fragments.
*/
+ @JvmStatic
public fun ofFragments(fragments: List<SimTraceFragment>): SimTrace {
val size = fragments.size
val usageCol = DoubleArray(size)
@@ -180,7 +181,7 @@ public class SimTrace(
*/
private fun grow() {
val arraySize = usageCol.size
- val newSize = arraySize * 2
+ val newSize = arraySize + (arraySize shr 1)
usageCol = usageCol.copyOf(newSize)
timestampCol = timestampCol.copyOf(newSize)