summaryrefslogtreecommitdiffstats
path: root/config-provisioning/src
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2022-11-23 10:20:53 +0100
committerMartin Polden <mpolden@mpolden.no>2022-11-23 10:20:53 +0100
commit2536fce055383d26043590e9ef2bcc099948c9a8 (patch)
tree04aedb048e324cbd9838a01f6e3df78931144735 /config-provisioning/src
parente24e240f01de0c291eb62ab03718fbda6abdb1b2 (diff)
Allow negative GPU resources
Diffstat (limited to 'config-provisioning/src')
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java7
1 files changed, 3 insertions, 4 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 4071fdf4c2f..92513636eaf 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
@@ -126,8 +126,6 @@ public class NodeResources {
private static final GpuResources none = new GpuResources(0, 0);
public GpuResources {
- if (count < 0) throw new IllegalArgumentException("GPU count cannot be negative, got " + count);
- if (memoryGb < 0) throw new IllegalArgumentException("GPU memory cannot be negative, got " + memoryGb);
validate(memoryGb, "memory");
}
@@ -136,7 +134,8 @@ public class NodeResources {
}
private boolean lessThan(GpuResources other) {
- return totalMemory() < other.totalMemory();
+ return this.count < other.count ||
+ this.memoryGb < other.memoryGb;
}
public boolean isDefault() { return this.equals(getDefault()); }
@@ -372,7 +371,7 @@ public class NodeResources {
if ( !gpuResources.isDefault()) {
sb.append(", gpu count: ").append(gpuResources.count());
sb.append(", gpu memory: ");
- appendDouble(sb, memoryGb);
+ appendDouble(sb, gpuResources.memoryGb());
sb.append(" Gb");
}
sb.append(']');