summaryrefslogtreecommitdiff
path: root/opendc-simulator/opendc-simulator-flow/src/main/java/org
diff options
context:
space:
mode:
authorNiels Thiele <noleu66@posteo.net>2025-09-15 15:34:38 +0200
committerGitHub <noreply@github.com>2025-09-15 15:34:38 +0200
commita735f1768677fc996da77b239819c55dcd623f5e (patch)
tree703237990dc7d178a7600c2795fbc32d2cd12aa8 /opendc-simulator/opendc-simulator-flow/src/main/java/org
parent5f539debbe18c9cf5c6c159c098f02f1d239f324 (diff)
Implements fixes to run m100 traces with GPUs (#362)
* Updated output format to reduce size * using sum of gpu capacities instead of single max * passing provisioned GPU cores to host view * fix supply update trigger * fixing floating point error, leading to negative demand * fixing double mismatch, due to floating point in precision * adding additional check if demand can be satisfied in the simple way * adds workload invalidation if remaining duration for all resources is 0 * invalidating flow distributors after demand update * spotless apply * updating tests * exporting power consumption of compute resources directly from gpu instead of PSU * using big decimal to avoid floating point in-precision * rolls back to pass-through version of PSU, before GPU implementation * places flowdistributor between PSU and compute resources * adds check to avoid null exception if supply is pushed without demand * fixing task id type * Adds memorizing GPU scheduler * adds boundary for negative remaining work * implemented tests for GPU scheduler filter * Revert "Updated output format to reduce size" This reverts commit 7171de8e0512a863df4962f64560ac7bad1fb48d. * spotless aply --------- Co-authored-by: DanteNiewenhuis <d.niewenhuis@hotmail.com>
Diffstat (limited to 'opendc-simulator/opendc-simulator-flow/src/main/java/org')
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/FlowDistributor.java8
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/BestEffortFlowDistributor.java3
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/EqualShareFlowDistributor.java2
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/FirstFitPolicyFlowDistributor.java1
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/FixedShareFlowDistributor.java6
5 files changed, 15 insertions, 5 deletions
diff --git a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/FlowDistributor.java b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/FlowDistributor.java
index 501bbf10..5cfd16ba 100644
--- a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/FlowDistributor.java
+++ b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/FlowDistributor.java
@@ -60,6 +60,7 @@ public abstract class FlowDistributor extends FlowNode implements FlowSupplier,
protected Double totalIncomingSupply = 0.0; // The total supply provided by the suppliers
protected boolean outgoingDemandUpdateNeeded = false;
+ protected boolean outgoingSupplyUpdateNeeded = false;
protected Set<Integer> updatedDemands =
new HashSet<>(); // Array of consumers that updated their demand in this cycle
@@ -142,6 +143,9 @@ public abstract class FlowDistributor extends FlowNode implements FlowSupplier,
}
this.totalIncomingDemand -= consumerEdge.getDemand();
+ if (this.totalIncomingDemand < 0) {
+ this.totalIncomingDemand = 0.0;
+ }
// Remove idx from consumers that updated their demands
this.updatedDemands.remove(idx);
@@ -204,6 +208,9 @@ public abstract class FlowDistributor extends FlowNode implements FlowSupplier,
incomingDemands.set(idx, newDemand);
// only update the total supply if the new supply is different from the previous one
this.totalIncomingDemand += (newDemand - prevDemand);
+ if (totalIncomingDemand < 0) {
+ this.totalIncomingDemand = 0.0;
+ }
this.updatedDemands.add(idx);
@@ -230,6 +237,7 @@ public abstract class FlowDistributor extends FlowNode implements FlowSupplier,
// only update the total supply if the new supply is different from the previous one
this.totalIncomingSupply += (newSupply - prevSupply);
+ this.outgoingSupplyUpdateNeeded = true;
this.invalidate();
}
diff --git a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/BestEffortFlowDistributor.java b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/BestEffortFlowDistributor.java
index 4a13beb2..703aca35 100644
--- a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/BestEffortFlowDistributor.java
+++ b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/BestEffortFlowDistributor.java
@@ -148,6 +148,7 @@ public class BestEffortFlowDistributor extends FlowDistributor {
}
}
+ this.outgoingSupplyUpdateNeeded = false;
this.updatedDemands.clear();
}
@@ -264,7 +265,7 @@ public class BestEffortFlowDistributor extends FlowDistributor {
}
// Update supplies if needed
- if (!this.outgoingSupplies.isEmpty() || updateNeeded) {
+ if (this.outgoingSupplyUpdateNeeded || updateNeeded) {
this.updateOutgoingSupplies();
}
diff --git a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/EqualShareFlowDistributor.java b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/EqualShareFlowDistributor.java
index f58164cf..87ed7ca2 100644
--- a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/EqualShareFlowDistributor.java
+++ b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/EqualShareFlowDistributor.java
@@ -54,6 +54,8 @@ public class EqualShareFlowDistributor extends FlowDistributor {
}
this.outgoingDemandUpdateNeeded = false;
+ this.updatedDemands.clear();
+ this.invalidate();
}
/**
diff --git a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/FirstFitPolicyFlowDistributor.java b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/FirstFitPolicyFlowDistributor.java
index c0a8cd13..9ab24d9f 100644
--- a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/FirstFitPolicyFlowDistributor.java
+++ b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/FirstFitPolicyFlowDistributor.java
@@ -74,6 +74,7 @@ public class FirstFitPolicyFlowDistributor extends FlowDistributor {
}
this.outgoingDemandUpdateNeeded = false;
+ this.invalidate();
}
/**
diff --git a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/FixedShareFlowDistributor.java b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/FixedShareFlowDistributor.java
index 4c0a84d1..f22ea9fb 100644
--- a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/FixedShareFlowDistributor.java
+++ b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/FixedShareFlowDistributor.java
@@ -112,9 +112,6 @@ public class FixedShareFlowDistributor extends FlowDistributor {
} else {
double[] supplies = distributeSupply(this.incomingDemands, this.outgoingSupplies, this.totalIncomingSupply);
for (FlowEdge consumerEdge : this.consumerEdges) {
- if (supplies[consumerIndex] <= 0.0) {
- continue;
- }
this.pushOutgoingSupply(consumerEdge, this.fixedShare);
}
}
@@ -123,7 +120,8 @@ public class FixedShareFlowDistributor extends FlowDistributor {
public double[] distributeSupply(ArrayList<Double> demands, ArrayList<Double> currentSupply, double totalSupply) {
double[] supplies = new double[this.consumerEdges.size()];
- if (this.consumerEdges.size() < this.supplierEdges.size()) {
+ if (this.consumerEdges.size() < this.supplierEdges.size()
+ && this.fixedShare * this.consumerEdges.size() <= totalSupply) {
for (FlowEdge consumerEdge : this.consumerEdges) {
supplies[consumerEdge.getConsumerIndex()] = this.fixedShare;
}