Skip to content

Commit 7cd00ae

Browse files
committed
fix gpu added multiple times in the benchmark env
1 parent 60601c6 commit 7cd00ae

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/components/c2d/compute_engine_docker.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,19 @@ export class C2DEngineDocker extends C2DEngine {
189189
const ramGB = this.physicalLimits.get('ram') || 0
190190
const physicalDiskGB = this.physicalLimits.get('disk') || 0
191191

192-
const gpuResources: ComputeResource[] = []
192+
const gpuMap = new Map<string, ComputeResource>()
193193
for (const env of envConfig.environments) {
194194
if (env.resources) {
195195
for (const res of env.resources) {
196196
if (res.id !== 'cpu' && res.id !== 'ram' && res.id !== 'disk') {
197-
gpuResources.push(res)
197+
if (!gpuMap.has(res.id)) {
198+
gpuMap.set(res.id, res)
199+
}
198200
}
199201
}
200202
}
201203
}
204+
const gpuResources: ComputeResource[] = Array.from(gpuMap.values())
202205

203206
const benchmarkPrices: ComputeResourcesPricingInfo[] = gpuResources.map((gpu) => ({
204207
id: gpu.id,

0 commit comments

Comments
 (0)