summaryrefslogtreecommitdiff
path: root/opendc-experiments/opendc-experiments-tf20/src/main
diff options
context:
space:
mode:
authorDante Niewenhuis <d.niewenhuis@hotmail.com>2024-09-16 11:29:26 +0200
committerGitHub <noreply@github.com>2024-09-16 11:29:26 +0200
commit4a010c6b9e033314a2624a0756dcdc7f17010d9d (patch)
tree70dc26e98cf8421eb5db7f62cf63d4ea2399c505 /opendc-experiments/opendc-experiments-tf20/src/main
parent5047e4a25a0814f96852882f02c4017e1d5f81e7 (diff)
All simulation are now run with a single CPU and single MemoryUnit. multi CPUs are combined into one. This is for performance and explainability. (#255)
Diffstat (limited to 'opendc-experiments/opendc-experiments-tf20/src/main')
-rw-r--r--opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt8
-rw-r--r--opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/util/MLEnvironmentReader.kt57
2 files changed, 39 insertions, 26 deletions
diff --git a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt
index 1a99cedf..11e010ec 100644
--- a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt
+++ b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt
@@ -29,9 +29,9 @@ import org.opendc.simulator.compute.SimBareMetalMachine
import org.opendc.simulator.compute.SimMachine
import org.opendc.simulator.compute.SimMachineContext
import org.opendc.simulator.compute.SimPsuFactories
+import org.opendc.simulator.compute.model.Cpu
import org.opendc.simulator.compute.model.MachineModel
import org.opendc.simulator.compute.model.MemoryUnit
-import org.opendc.simulator.compute.model.ProcessingUnit
import org.opendc.simulator.compute.power.CpuPowerModel
import org.opendc.simulator.compute.workload.SimWorkload
import org.opendc.simulator.flow2.FlowEngine
@@ -52,7 +52,7 @@ public class SimTFDevice(
override val uid: UUID,
override val isGpu: Boolean,
dispatcher: Dispatcher,
- pu: ProcessingUnit,
+ pu: Cpu,
private val memory: MemoryUnit,
powerModel: CpuPowerModel,
) : TFDevice {
@@ -62,7 +62,7 @@ public class SimTFDevice(
private val machine =
SimBareMetalMachine.create(
FlowEngine.create(dispatcher).newGraph(),
- MachineModel(listOf(pu), listOf(memory)),
+ MachineModel(pu, memory),
SimPsuFactories.simple(powerModel),
)
@@ -108,7 +108,7 @@ public class SimTFDevice(
output = stage.getOutlet("out")
lastPull = ctx.graph.engine.clock.millis()
- ctx.graph.connect(output, ctx.cpus[0].input)
+ ctx.graph.connect(output, ctx.cpu.input)
}
override fun onStop(ctx: SimMachineContext) {
diff --git a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/util/MLEnvironmentReader.kt b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/util/MLEnvironmentReader.kt
index 077bcc04..34b4bc7b 100644
--- a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/util/MLEnvironmentReader.kt
+++ b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/util/MLEnvironmentReader.kt
@@ -25,10 +25,9 @@ package org.opendc.experiments.tf20.util
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
+import org.opendc.simulator.compute.model.Cpu
import org.opendc.simulator.compute.model.MachineModel
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.CpuPowerModels
import java.io.InputStream
import java.util.UUID
@@ -54,36 +53,50 @@ public class MLEnvironmentReader {
var maxPower = 350.0
var minPower = 200.0
val cores =
- machine.cpus.flatMap { id ->
+ machine.cpus.map { id ->
when (id) {
1 -> {
// ref: https://www.guru3d.com/articles-pages/nvidia-geforce-gtx-titan-x-review,8.html#:~:text=GeForce%20GTX%20Titan%20X%20%2D%20On,power%20supply%20unit%20as%20minimum.
- maxPower = 334.0
- minPower = 90.0
- val node = ProcessingNode("NVidia", "TITAN X", "Pascal", 4992)
- List(node.coreCount) { ProcessingUnit(node, it, 824.0) }
+ Cpu(
+ 0,
+ 4992,
+ 824.0,
+ "NVidia",
+ "TITAN X",
+ "Pascal",
+ )
}
2 -> {
// ref: https://www.microway.com/hpc-tech-tips/nvidia-tesla-p100-pci-e-16gb-gpu-accelerator-pascal-gp100-close/
- maxPower = 250.0
- minPower = 125.0
- val node = ProcessingNode("NVIDIA", "Tesla P100", "Pascal", 3584)
- List(node.coreCount) { ProcessingUnit(node, it, 1190.0) }
+ Cpu(
+ 0,
+ 3584,
+ 1190.0,
+ "NVIDIA",
+ "Tesla P100",
+ "Pascal",
+ )
}
3 -> {
// ref: https://www.anandtech.com/show/10923/openpower-saga-tyans-1u-power8-gt75/7
- minPower = 84.0
- maxPower = 135.0
- val node = ProcessingNode("Intel", "E5-2690v3 Haswell24", "amd64", 24)
- isGpuFlag = false
- List(node.coreCount) { ProcessingUnit(node, it, 3498.0) }
+ Cpu(
+ 0,
+ 24,
+ 3498.0,
+ "Intel",
+ "E5-2690v3 Haswell24",
+ "amd64",
+ )
}
4 -> {
- minPower = 130.0
- maxPower = 190.0
- val node = ProcessingNode("IBM", "POWER8", "RISC", 10)
- isGpuFlag = false
- List(node.coreCount) { ProcessingUnit(node, it, 143000.0) } // 28600.0 3690
+ Cpu(
+ 0,
+ 10,
+ 143000.0,
+ "IBM",
+ "POWER8",
+ "RISC",
+ )
}
else -> throw IllegalArgumentException("The cpu id $id is not recognized")
}
@@ -103,7 +116,7 @@ public class MLEnvironmentReader {
UUID(0, counter.toLong()),
"node-${counter++}",
mapOf("gpu" to isGpuFlag),
- MachineModel(cores, memories),
+ MachineModel(cores, memories[0]),
CpuPowerModels.linear(maxPower, minPower),
)
}