summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-topology/src
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-compute/opendc-compute-topology/src
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-compute/opendc-compute-topology/src')
-rw-r--r--opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt15
1 files changed, 10 insertions, 5 deletions
diff --git a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt
index d4d4bfe3..e0fba34f 100644
--- a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt
+++ b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt
@@ -29,10 +29,9 @@ import org.opendc.compute.topology.specs.HostJSONSpec
import org.opendc.compute.topology.specs.HostSpec
import org.opendc.compute.topology.specs.TopologySpec
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.ProcessingNode
-import org.opendc.simulator.compute.model.ProcessingUnit
import org.opendc.simulator.compute.power.getPowerModel
import java.io.File
import java.io.InputStream
@@ -119,14 +118,20 @@ private fun HostJSONSpec.toHostSpecs(
clusterId: Int,
random: RandomGenerator,
): HostSpec {
- val unknownProcessingNode = ProcessingNode("unknown", "unknown", "unknown", cpu.coreCount)
- val units = List(cpu.count) { ProcessingUnit(unknownProcessingNode, globalCoreId++, cpu.coreSpeed.toMHz()) }
+ val units =
+ List(cpu.count) {
+ Cpu(
+ globalCoreId++,
+ cpu.coreCount,
+ cpu.coreSpeed.toMHz(),
+ )
+ }
val unknownMemoryUnit = MemoryUnit(memory.vendor, memory.modelName, memory.memorySpeed.toMHz(), memory.memorySize.toMiB().toLong())
val machineModel =
MachineModel(
units,
- listOf(unknownMemoryUnit),
+ unknownMemoryUnit,
)
val powerModel =