Skip to content

Commit 44ef648

Browse files
committed
feat(azure/data): add GPU capability to VM SKU filter
- Add GPUs int32 field to virtualMachine struct - Parse 'GPUs' capability from Azure Resource SKU capabilities - Filter out non-GPU VMs in filterCPUsAndMemory when ComputeRequest.GPUs > 0
1 parent 7c5d50d commit 44ef648

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

pkg/provider/azure/data/compute-request.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ type virtualMachine struct {
109109
// Spot capable
110110
LowPriorityCapable bool
111111
MaxResourceVolumeMB int32
112+
GPUs int32
112113
// IaaS or PaaS
113114
VMDeploymentTypes []string
114115
// Fast SSD
@@ -219,6 +220,12 @@ func resourceSKUToVirtualMachine(res *armcompute.ResourceSKU) *virtualMachine {
219220
return nil
220221
}
221222
vm.MaxResourceVolumeMB = int32(disk)
223+
case "GPUs":
224+
gpus, err := strconv.ParseInt(*capability.Value, 10, 32)
225+
if err != nil {
226+
return nil
227+
}
228+
vm.GPUs = int32(gpus)
222229
case "VMDeploymentTypes":
223230
vm.VMDeploymentTypes = strings.Split(*capability.Value, ",")
224231
default:
@@ -241,6 +248,9 @@ func filterCPUsAndMemory(args *cr.ComputeRequestArgs) filterFunc {
241248
if args.NestedVirt && !vm.nestedVirtSupported() {
242249
return
243250
}
251+
if args.GPUs > 0 && vm.GPUs < args.GPUs {
252+
return
253+
}
244254
if vm.VCPUs >= args.CPUs &&
245255
vm.Memory >= args.MemoryGib &&
246256
vm.Arch == args.Arch.String() &&

0 commit comments

Comments
 (0)