summaryrefslogtreecommitdiff
path: root/opendc-compute
diff options
context:
space:
mode:
authorDante Niewenhuis <d.niewenhuis@hotmail.com>2024-10-29 10:52:38 +0100
committerGitHub <noreply@github.com>2024-10-29 10:52:38 +0100
commit2325c62377e7c94e768a22807e107a9714626bfc (patch)
treea9aa8288c753714ba5c50146e08810c0a479f479 /opendc-compute
parent5a365dbc068f2a8cdfa9813c39cc84bb30e15637 (diff)
Updated all floats to Doubles (#257)
* Updated tests Changed all floats into doubles to have consistency over the whole framework Made a small update to the multiplexer to better push through supply and demand Fixed small typo Updated M3SA paths. fixed merge conflicts 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. * Updated test memory
Diffstat (limited to 'opendc-compute')
-rw-r--r--opendc-compute/opendc-compute-carbon/src/main/kotlin/org/opendc/compute/carbon/CarbonTrace.kt8
-rw-r--r--opendc-compute/opendc-compute-carbon/src/main/kotlin/org/opendc/compute/carbon/CarbonTraceLoader.kt4
-rw-r--r--opendc-compute/opendc-compute-failure/src/main/kotlin/org/opendc/compute/failure/hostfault/StartStopHostFault.kt2
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/host/HostModel.java2
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/telemetry/GuestCpuStats.java6
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/telemetry/HostCpuStats.java8
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/telemetry/HostSystemStats.java4
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/ComputeMetricReader.kt60
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/HostInfo.kt2
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/HostTableReader.kt16
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/TaskTableReader.kt2
-rw-r--r--opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt2
-rw-r--r--opendc-compute/opendc-compute-workload/src/main/kotlin/org/opendc/compute/workload/ComputeWorkloadLoader.kt2
13 files changed, 58 insertions, 60 deletions
diff --git a/opendc-compute/opendc-compute-carbon/src/main/kotlin/org/opendc/compute/carbon/CarbonTrace.kt b/opendc-compute/opendc-compute-carbon/src/main/kotlin/org/opendc/compute/carbon/CarbonTrace.kt
index 6eb7a762..2ba3e4e3 100644
--- a/opendc-compute/opendc-compute-carbon/src/main/kotlin/org/opendc/compute/carbon/CarbonTrace.kt
+++ b/opendc-compute/opendc-compute-carbon/src/main/kotlin/org/opendc/compute/carbon/CarbonTrace.kt
@@ -40,7 +40,7 @@ import java.time.Instant
public data class CarbonFragment(
var startTime: Long,
var endTime: Long,
- var carbonIntensity: Float,
+ var carbonIntensity: Double,
) {
init {
require(endTime > startTime) {
@@ -67,7 +67,7 @@ public class CarbonTrace(reports: List<CarbonFragment>? = null) {
return index < numberOfReports
}
- public fun getCarbonIntensity(timestamp: Instant): Float {
+ public fun getCarbonIntensity(timestamp: Instant): Double {
return getCarbonIntensity(timestamp.toEpochMilli())
}
@@ -79,9 +79,9 @@ public class CarbonTrace(reports: List<CarbonFragment>? = null) {
* @param timestamp
* @return The carbon intensity at the given timestamp in gCO2/kWh
*/
- public fun getCarbonIntensity(timestamp: Long): Float {
+ public fun getCarbonIntensity(timestamp: Long): Double {
if (reports == null) {
- return 0.0f
+ return 0.0
}
var currentFragment: CarbonFragment
diff --git a/opendc-compute/opendc-compute-carbon/src/main/kotlin/org/opendc/compute/carbon/CarbonTraceLoader.kt b/opendc-compute/opendc-compute-carbon/src/main/kotlin/org/opendc/compute/carbon/CarbonTraceLoader.kt
index 12340adf..b66aedf9 100644
--- a/opendc-compute/opendc-compute-carbon/src/main/kotlin/org/opendc/compute/carbon/CarbonTraceLoader.kt
+++ b/opendc-compute/opendc-compute-carbon/src/main/kotlin/org/opendc/compute/carbon/CarbonTraceLoader.kt
@@ -56,7 +56,7 @@ public class CarbonTraceLoader {
try {
while (reader.nextRow()) {
val startTime = reader.getInstant(startTimeCol)!!
- val carbonIntensity = reader.getFloat(carbonIntensityCol)
+ val carbonIntensity = reader.getDouble(carbonIntensityCol)
builder.add(startTime, carbonIntensity)
}
@@ -106,7 +106,7 @@ public class CarbonTraceLoader {
*/
fun add(
startTime: Instant,
- carbonIntensity: Float,
+ carbonIntensity: Double,
) {
fragments.add(
CarbonFragment(startTime.toEpochMilli(), Long.MAX_VALUE, carbonIntensity),
diff --git a/opendc-compute/opendc-compute-failure/src/main/kotlin/org/opendc/compute/failure/hostfault/StartStopHostFault.kt b/opendc-compute/opendc-compute-failure/src/main/kotlin/org/opendc/compute/failure/hostfault/StartStopHostFault.kt
index c7ddc5b5..06fad3e6 100644
--- a/opendc-compute/opendc-compute-failure/src/main/kotlin/org/opendc/compute/failure/hostfault/StartStopHostFault.kt
+++ b/opendc-compute/opendc-compute-failure/src/main/kotlin/org/opendc/compute/failure/hostfault/StartStopHostFault.kt
@@ -48,8 +48,6 @@ public class StartStopHostFault(
for ((task, snapshot) in tasks.zip(snapshots)) {
client.rescheduleTask(task, snapshot)
}
-
- print("test")
}
delay(faultDuration)
diff --git a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/host/HostModel.java b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/host/HostModel.java
index 96236c5c..1ea73ea6 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/host/HostModel.java
+++ b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/host/HostModel.java
@@ -29,4 +29,4 @@ package org.opendc.compute.simulator.host;
* @param coreCount The number of logical processing cores available for this host.
* @param memoryCapacity The amount of memory available for this host in MB.
*/
-public record HostModel(float cpuCapacity, int coreCount, long memoryCapacity) {}
+public record HostModel(double cpuCapacity, int coreCount, long memoryCapacity) {}
diff --git a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/telemetry/GuestCpuStats.java b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/telemetry/GuestCpuStats.java
index ea37f5f2..97202104 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/telemetry/GuestCpuStats.java
+++ b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/telemetry/GuestCpuStats.java
@@ -38,6 +38,6 @@ public record GuestCpuStats(
long idleTime,
long stealTime,
long lostTime,
- float capacity,
- float usage,
- float utilization) {}
+ double capacity,
+ double usage,
+ double utilization) {}
diff --git a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/telemetry/HostCpuStats.java b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/telemetry/HostCpuStats.java
index 3f2aab78..4817690a 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/telemetry/HostCpuStats.java
+++ b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/telemetry/HostCpuStats.java
@@ -40,7 +40,7 @@ public record HostCpuStats(
long idleTime,
long stealTime,
long lostTime,
- float capacity,
- float demand,
- float usage,
- float utilization) {}
+ double capacity,
+ double demand,
+ double usage,
+ double utilization) {}
diff --git a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/telemetry/HostSystemStats.java b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/telemetry/HostSystemStats.java
index 353e62fa..aa292797 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/telemetry/HostSystemStats.java
+++ b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/telemetry/HostSystemStats.java
@@ -42,8 +42,8 @@ public record HostSystemStats(
Duration uptime,
Duration downtime,
Instant bootTime,
- float powerDraw,
- float energyUsage,
+ double powerDraw,
+ double energyUsage,
int guestsTerminated,
int guestsRunning,
int guestsError,
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/ComputeMetricReader.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/ComputeMetricReader.kt
index d5fb991d..c84b2a3f 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/ComputeMetricReader.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/ComputeMetricReader.kt
@@ -340,21 +340,21 @@ public class ComputeMetricReader(
get() = _guestsInvalid
private var _guestsInvalid = 0
- override val cpuLimit: Float
+ override val cpuLimit: Double
get() = _cpuLimit
- private var _cpuLimit = 0.0f
+ private var _cpuLimit = 0.0
- override val cpuUsage: Float
+ override val cpuUsage: Double
get() = _cpuUsage
- private var _cpuUsage = 0.0f
+ private var _cpuUsage = 0.0
- override val cpuDemand: Float
+ override val cpuDemand: Double
get() = _cpuDemand
- private var _cpuDemand = 0.0f
+ private var _cpuDemand = 0.0
- override val cpuUtilization: Float
+ override val cpuUtilization: Double
get() = _cpuUtilization
- private var _cpuUtilization = 0.0f
+ private var _cpuUtilization = 0.0
override val cpuActiveTime: Long
get() = _cpuActiveTime - previousCpuActiveTime
@@ -376,22 +376,22 @@ public class ComputeMetricReader(
private var _cpuLostTime = 0L
private var previousCpuLostTime = 0L
- override val powerDraw: Float
+ override val powerDraw: Double
get() = _powerDraw
- private var _powerDraw = 0.0f
+ private var _powerDraw = 0.0
- override val energyUsage: Float
+ override val energyUsage: Double
get() = _energyUsage - previousEnergyUsage
- private var _energyUsage = 0.0f
- private var previousEnergyUsage = 0.0f
+ private var _energyUsage = 0.0
+ private var previousEnergyUsage = 0.0
- override val carbonIntensity: Float
+ override val carbonIntensity: Double
get() = _carbonIntensity
- private var _carbonIntensity = 0.0f
+ private var _carbonIntensity = 0.0
- override val carbonEmission: Float
+ override val carbonEmission: Double
get() = _carbonEmission
- private var _carbonEmission = 0.0f
+ private var _carbonEmission = 0.0
override val uptime: Long
get() = _uptime - previousUptime
@@ -437,7 +437,7 @@ public class ComputeMetricReader(
_energyUsage = hostSysStats.energyUsage
_carbonIntensity = carbonTrace.getCarbonIntensity(timestampAbsolute)
- _carbonEmission = carbonIntensity * (energyUsage / 3600000.0f) // convert energy usage from J to kWh
+ _carbonEmission = carbonIntensity * (energyUsage / 3600000.0) // convert energy usage from J to kWh
_uptime = hostSysStats.uptime.toMillis()
_downtime = hostSysStats.downtime.toMillis()
_bootTime = hostSysStats.bootTime
@@ -462,15 +462,15 @@ public class ComputeMetricReader(
_guestsError = 0
_guestsInvalid = 0
- _cpuLimit = 0.0f
- _cpuUsage = 0.0f
- _cpuDemand = 0.0f
- _cpuUtilization = 0.0f
+ _cpuLimit = 0.0
+ _cpuUsage = 0.0
+ _cpuDemand = 0.0
+ _cpuUtilization = 0.0
- _powerDraw = 0.0f
- _energyUsage = 0.0f
- _carbonIntensity = 0.0f
- _carbonEmission = 0.0f
+ _powerDraw = 0.0
+ _energyUsage = 0.0
+ _carbonIntensity = 0.0
+ _carbonEmission = 0.0
}
}
@@ -569,9 +569,9 @@ public class ComputeMetricReader(
get() = _finishTime
private var _finishTime: Instant? = null
- override val cpuLimit: Float
+ override val cpuLimit: Double
get() = _cpuLimit
- private var _cpuLimit = 0.0f
+ private var _cpuLimit = 0.0
override val cpuActiveTime: Long
get() = _cpuActiveTime - previousCpuActiveTime
@@ -625,7 +625,7 @@ public class ComputeMetricReader(
_timestamp = now
_timestampAbsolute = now + startTime
- _cpuLimit = cpuStats?.capacity ?: 0.0f
+ _cpuLimit = cpuStats?.capacity ?: 0.0
_cpuActiveTime = cpuStats?.activeTime ?: 0
_cpuIdleTime = cpuStats?.idleTime ?: 0
_cpuStealTime = cpuStats?.stealTime ?: 0
@@ -658,7 +658,7 @@ public class ComputeMetricReader(
previousCpuLostTime = _cpuLostTime
_host = null
- _cpuLimit = 0.0f
+ _cpuLimit = 0.0
}
}
}
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/HostInfo.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/HostInfo.kt
index 1f1b9522..0220971b 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/HostInfo.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/HostInfo.kt
@@ -30,6 +30,6 @@ public data class HostInfo(
val name: String,
val arch: String,
val coreCount: Int,
- val coreSpeed: Float,
+ val coreSpeed: Double,
val memCapacity: Long,
)
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/HostTableReader.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/HostTableReader.kt
index 5f09e7f5..a5a862ce 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/HostTableReader.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/HostTableReader.kt
@@ -71,22 +71,22 @@ public interface HostTableReader : Exportable {
/**
* The capacity of the CPUs in the host (in MHz).
*/
- public val cpuLimit: Float
+ public val cpuLimit: Double
/**
* The usage of all CPUs in the host (in MHz).
*/
- public val cpuUsage: Float
+ public val cpuUsage: Double
/**
* The demand of all vCPUs of the guests (in MHz)
*/
- public val cpuDemand: Float
+ public val cpuDemand: Double
/**
* The CPU utilization of the host.
*/
- public val cpuUtilization: Float
+ public val cpuUtilization: Double
/**
* The duration (in ms) that a CPU was active in the host.
@@ -111,22 +111,22 @@ public interface HostTableReader : Exportable {
/**
* The current power draw of the host in W.
*/
- public val powerDraw: Float
+ public val powerDraw: Double
/**
* The total energy consumption of the host since last sample in J.
*/
- public val energyUsage: Float
+ public val energyUsage: Double
/**
* The current carbon intensity of the host in gCO2 / kW.
*/
- public val carbonIntensity: Float
+ public val carbonIntensity: Double
/**
* The current carbon emission since the last deadline in g.
*/
- public val carbonEmission: Float
+ public val carbonEmission: Double
/**
* The uptime of the host since last time in ms.
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/TaskTableReader.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/TaskTableReader.kt
index bc6a4edd..825019e8 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/TaskTableReader.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/TaskTableReader.kt
@@ -93,7 +93,7 @@ public interface TaskTableReader : Exportable {
/**
* The capacity of the CPUs of Host on which the task is running (in MHz).
*/
- public val cpuLimit: Float
+ public val cpuLimit: Double
/**
* The duration (in seconds) that a CPU was active in the task.
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 9e637b1b..3329f19c 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
@@ -122,7 +122,7 @@ private fun HostJSONSpec.toHostSpecs(
CpuModel(
globalCoreId++,
cpu.coreCount,
- cpu.coreSpeed.toMHz().toFloat(),
+ cpu.coreSpeed.toMHz(),
)
}
diff --git a/opendc-compute/opendc-compute-workload/src/main/kotlin/org/opendc/compute/workload/ComputeWorkloadLoader.kt b/opendc-compute/opendc-compute-workload/src/main/kotlin/org/opendc/compute/workload/ComputeWorkloadLoader.kt
index f22bc1d1..786ed82f 100644
--- a/opendc-compute/opendc-compute-workload/src/main/kotlin/org/opendc/compute/workload/ComputeWorkloadLoader.kt
+++ b/opendc-compute/opendc-compute-workload/src/main/kotlin/org/opendc/compute/workload/ComputeWorkloadLoader.kt
@@ -217,7 +217,7 @@ public class ComputeWorkloadLoader(
usage: Double,
cores: Int,
) {
- totalLoad += (usage * duration.toMillis()) / 1000.0 // avg MHz * duration = MFLOPs
+ totalLoad += (usage * duration.toMillis()) / 1000 // avg MHz * duration = MFLOPs
builder.add(duration.toMillis(), usage, cores)
}