summaryrefslogtreecommitdiffstats
path: root/config-provisioning
diff options
context:
space:
mode:
authorOla Aunronning <olaa@yahooinc.com>2023-09-20 11:45:46 +0200
committerOla Aunronning <olaa@yahooinc.com>2023-09-20 11:45:46 +0200
commite25bef15919124ccad19736f9ced8a06e14222a0 (patch)
treec255b243627ce2c0bbf58f3affc7d42e897173e0 /config-provisioning
parente87678f04fe3d0df67c226e0a8ef1ce0a4a4b4d3 (diff)
Consider 'zero' GpuResources when accumulating
Diffstat (limited to 'config-provisioning')
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java2
1 files changed, 2 insertions, 0 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java
index f9e6da14493..0d21b155571 100644
--- a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java
+++ b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java
@@ -144,12 +144,14 @@ public class NodeResources {
public static GpuResources getDefault() { return zero; }
public GpuResources plus(GpuResources other) {
+ if (other.isZero()) return this;
var thisMem = this.count() * this.memoryGb();
var otherMem = other.count() * other.memoryGb();
return new NodeResources.GpuResources(1, thisMem + otherMem);
}
public GpuResources minus(GpuResources other) {
+ if (other.isZero()) return this;
var thisMem = this.count() * this.memoryGb();
var otherMem = other.count() * other.memoryGb();
return new NodeResources.GpuResources(1, thisMem - otherMem);