diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2022-09-01 14:38:34 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2022-10-21 22:13:04 +0200 |
| commit | 44215bd668c5fa3efe2f57fc577824478b00af57 (patch) | |
| tree | b933228e5e5748716351dc9ce031b4840f254428 /opendc-experiments/opendc-experiments-capelin/src/main | |
| parent | c1f67a872e2d7ce63ac96f8ca80cbe8b25c62e3b (diff) | |
refactor(sim/compute): Re-implement using flow2
This change re-implements the OpenDC compute simulator framework using
the new flow2 framework for modelling multi-edge flow networks. The
re-implementation is written in Java and focusses on performance and
clean API surface.
Diffstat (limited to 'opendc-experiments/opendc-experiments-capelin/src/main')
| -rw-r--r-- | opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt index 08d4a7e0..0b4cafa6 100644 --- a/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt +++ b/opendc-experiments/opendc-experiments-capelin/src/main/kotlin/org/opendc/experiments/capelin/topology/TopologyFactories.kt @@ -25,13 +25,13 @@ package org.opendc.experiments.capelin.topology import org.opendc.experiments.compute.topology.HostSpec +import org.opendc.simulator.compute.SimPsuFactories 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.LinearPowerModel -import org.opendc.simulator.compute.power.PowerModel -import org.opendc.simulator.compute.power.SimplePowerDriver +import org.opendc.simulator.compute.power.CpuPowerModel +import org.opendc.simulator.compute.power.CpuPowerModels import java.io.File import java.io.InputStream import java.util.Random @@ -48,7 +48,7 @@ private val reader = ClusterSpecReader() */ fun clusterTopology( file: File, - powerModel: PowerModel = LinearPowerModel(350.0, idlePower = 200.0), + powerModel: CpuPowerModel = CpuPowerModels.linear(350.0, 200.0), random: Random = Random(0) ): List<HostSpec> { return clusterTopology(reader.read(file), powerModel, random) @@ -59,7 +59,7 @@ fun clusterTopology( */ fun clusterTopology( input: InputStream, - powerModel: PowerModel = LinearPowerModel(350.0, idlePower = 200.0), + powerModel: CpuPowerModel = CpuPowerModels.linear(350.0, 200.0), random: Random = Random(0) ): List<HostSpec> { return clusterTopology(reader.read(input), powerModel, random) @@ -68,14 +68,14 @@ fun clusterTopology( /** * Construct a topology from the given list of [clusters]. */ -fun clusterTopology(clusters: List<ClusterSpec>, powerModel: PowerModel, random: Random = Random(0)): List<HostSpec> { +fun clusterTopology(clusters: List<ClusterSpec>, powerModel: CpuPowerModel, random: Random = Random(0)): List<HostSpec> { return clusters.flatMap { it.toHostSpecs(random, powerModel) } } /** * Helper method to convert a [ClusterSpec] into a list of [HostSpec]s. */ -private fun ClusterSpec.toHostSpecs(random: Random, powerModel: PowerModel): List<HostSpec> { +private fun ClusterSpec.toHostSpecs(random: Random, powerModel: CpuPowerModel): List<HostSpec> { val cpuSpeed = cpuSpeed val memoryPerHost = memCapacityPerHost.roundToLong() @@ -92,7 +92,7 @@ private fun ClusterSpec.toHostSpecs(random: Random, powerModel: PowerModel): Lis "node-$name-$it", mapOf("cluster" to id), machineModel, - SimplePowerDriver(powerModel) + SimPsuFactories.simple(powerModel) ) } } |
