MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / configGpu

Function configGpu

vmm/ui/src/composables/useVmManager.ts:399–419  ·  view source on GitHub ↗
(form: { attachAllGpus: boolean; selectedGpus: string[] }, isUpdate: boolean = false)

Source from the content-addressed store, hash-verified

397 }
398
399 function configGpu(form: { attachAllGpus: boolean; selectedGpus: string[] }, isUpdate: boolean = false): VmmTypes.IGpuConfig | undefined {
400 if (form.attachAllGpus) {
401 return { attach_mode: 'all' };
402 }
403 // For updates, always return a config when GPUs are being explicitly updated
404 // Empty array means no GPUs should be attached
405 if (isUpdate) {
406 return {
407 attach_mode: 'listed',
408 gpus: (form.selectedGpus || []).map((slot: string) => ({ slot })),
409 };
410 }
411 // For creation, return undefined if no GPUs are selected
412 if (form.selectedGpus && form.selectedGpus.length > 0) {
413 return {
414 attach_mode: 'listed',
415 gpus: form.selectedGpus.map((slot: string) => ({ slot })),
416 };
417 }
418 return undefined;
419 }
420
421type CreateVmPayloadSource = {
422 name: string;

Callers 2

createVmFunction · 0.85
updateVMFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected