(gpuConfig?: VmmTypes.IGpuConfig)
| 375 | })); |
| 376 | |
| 377 | function deriveGpuSelection(gpuConfig?: VmmTypes.IGpuConfig) { |
| 378 | if (!gpuConfig) { |
| 379 | return { attachAll: false, selected: [] as string[] }; |
| 380 | } |
| 381 | if (gpuConfig.attach_mode === 'all') { |
| 382 | return { attachAll: true, selected: [] as string[] }; |
| 383 | } |
| 384 | return { |
| 385 | attachAll: false, |
| 386 | selected: (gpuConfig.gpus || []).map((gpu) => gpu.slot).filter(Boolean) as string[], |
| 387 | }; |
| 388 | } |
| 389 | |
| 390 | function recordError(context: string, err: unknown) { |
| 391 | console.error(context, err); |