diff options
author | Ola Aunronning <olaa@yahooinc.com> | 2023-09-20 10:29:33 +0200 |
---|---|---|
committer | Ola Aunronning <olaa@yahooinc.com> | 2023-09-20 10:29:40 +0200 |
commit | 12d9f02f05555b27a4f936b28c11f618eddabae3 (patch) | |
tree | e6765fc768cd5d2ce137521cbb19c9c91b926ae7 | |
parent | f56f814436a4b866b326b47446a487faeba10f11 (diff) |
Fix GpuResources::plus
2 files changed, 4 insertions, 9 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 a431dd61b0d..ae5b64ee013 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,7 +144,9 @@ public class NodeResources { public static GpuResources getDefault() { return zero; } public GpuResources plus(GpuResources other) { - return new GpuResources(this.count + other.count, this.memoryGb + other.memoryGb); + var thisMem = this.count() * this.memoryGb(); + var otherMem = other.count() * other.memoryGb(); + return new NodeResources.GpuResources(1, thisMem + otherMem); } public GpuResources minus(GpuResources other) { diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceSnapshot.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceSnapshot.java index d637559f1f5..b3a91767465 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceSnapshot.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/resource/ResourceSnapshot.java @@ -120,13 +120,6 @@ public class ResourceSnapshot { NodeResources.DiskSpeed.any, NodeResources.StorageType.any, a.architecture() == NodeResources.Architecture.any ? b.architecture() : a.architecture(), - addGpu(a.gpuResources(), b.gpuResources())); - } - - private static NodeResources.GpuResources addGpu(NodeResources.GpuResources a, NodeResources.GpuResources b) { - // we don't really care about "count" in this context, so we just reduce everything down to billable GB - var aMem = a.count() * b.memoryGb(); - var bMem = b.count() * b.memoryGb(); - return new NodeResources.GpuResources(1, aMem + bMem); + a.gpuResources().plus(b.gpuResources())); } } |