Skip to content

Commit bd37b68

Browse files
authored
Helper machine_type parity with task (#718)
1 parent fd4a940 commit bd37b68

File tree

3 files changed

+46
-23
lines changed

3 files changed

+46
-23
lines changed

iterative/aws/provider.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -486,17 +486,19 @@ func GetAvailabilityZone(region string) string {
486486
}
487487

488488
func getInstanceType(instanceType string, instanceGPU string) string {
489-
instanceTypes := make(map[string]string)
490-
instanceTypes["m"] = "m5.2xlarge"
491-
instanceTypes["l"] = "m5.8xlarge"
492-
instanceTypes["xl"] = "m5.16xlarge"
493-
instanceTypes["m+k80"] = "p2.xlarge"
494-
instanceTypes["l+k80"] = "p2.8xlarge"
495-
instanceTypes["xl+k80"] = "p2.16xlarge"
496-
instanceTypes["m+v100"] = "p3.xlarge"
497-
instanceTypes["l+v100"] = "p3.8xlarge"
498-
instanceTypes["xl+v100"] = "p3.16xlarge"
499-
489+
instanceTypes := map[string]string{
490+
"s": "t2.micro",
491+
"m": "m5.2xlarge",
492+
"l": "m5.8xlarge",
493+
"xl": "m5.16xlarge",
494+
"m+t4": "g4dn.xlarge",
495+
"m+k80": "p2.xlarge",
496+
"l+k80": "p2.8xlarge",
497+
"xl+k80": "p2.16xlarge",
498+
"m+v100": "p3.xlarge",
499+
"l+v100": "p3.8xlarge",
500+
"xl+v100": "p3.16xlarge",
501+
}
500502
if val, ok := instanceTypes[instanceType+"+"+instanceGPU]; ok {
501503
return val
502504
} else if val, ok := instanceTypes[instanceType]; ok && instanceGPU == "" {

iterative/azure/provider.go

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ func ResourceMachineCreate(ctx context.Context, d *schema.ResourceData, m interf
206206

207207
vmClient, _ := getVMClient(subscriptionID)
208208
vmSettings := compute.VirtualMachine{
209-
Tags: metadata,
209+
Tags: metadata,
210210
Location: to.StringPtr(region),
211211
VirtualMachineProperties: &compute.VirtualMachineProperties{
212212
HardwareProfile: &compute.HardwareProfile{
@@ -256,7 +256,7 @@ func ResourceMachineCreate(ctx context.Context, d *schema.ResourceData, m interf
256256
},
257257
},
258258
}
259-
259+
260260
if userAssignedIdentities != nil {
261261
vmSettings.Identity = &compute.VirtualMachineIdentity{
262262
UserAssignedIdentities: userAssignedIdentities,
@@ -414,16 +414,19 @@ func GetRegion(region string) string {
414414
}
415415

416416
func getInstanceType(instanceType string, instanceGPU string) string {
417-
instanceTypes := make(map[string]string)
418-
instanceTypes["m"] = "Standard_F8s_v2"
419-
instanceTypes["l"] = "Standard_F32s_v2"
420-
instanceTypes["xl"] = "Standard_F64s_v2"
421-
instanceTypes["m+k80"] = "Standard_NC6"
422-
instanceTypes["l+k80"] = "Standard_NC12"
423-
instanceTypes["xl+k80"] = "Standard_NC24"
424-
instanceTypes["m+v100"] = "Standard_NC6s_v3"
425-
instanceTypes["l+v100"] = "Standard_NC12s_v3"
426-
instanceTypes["xl+v100"] = "Standard_NC24s_v3"
417+
instanceTypes := map[string]string{
418+
"s": "Standard_B1s",
419+
"m": "Standard_F8s_v2",
420+
"l": "Standard_F32s_v2",
421+
"xl": "Standard_F64s_v2",
422+
"m+t4": "Standard_NC4as_T4_v3",
423+
"m+k80": "Standard_NC6",
424+
"l+k80": "Standard_NC12",
425+
"xl+k80": "Standard_NC24",
426+
"m+v100": "Standard_NC6s_v3",
427+
"l+v100": "Standard_NC12s_v3",
428+
"xl+v100": "Standard_NC24s_v3",
429+
}
427430

428431
if val, ok := instanceTypes[instanceType+"+"+instanceGPU]; ok {
429432
return val

iterative/gcp/provider.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,15 @@ func getRegion(region string) string {
439439

440440
func getInstanceType(instanceType string, instanceGPU string) (map[string]map[string]string, error) {
441441
instanceTypes := make(map[string]map[string]map[string]string)
442+
instanceTypes["s"] = map[string]map[string]string{
443+
"accelerator": {
444+
"count": "0",
445+
"type": "",
446+
},
447+
"machine": {
448+
"type": "g1-small",
449+
},
450+
}
442451
instanceTypes["m"] = map[string]map[string]string{
443452
"accelerator": {
444453
"count": "0",
@@ -466,6 +475,15 @@ func getInstanceType(instanceType string, instanceGPU string) (map[string]map[st
466475
"type": "n2-custom-64-262144",
467476
},
468477
}
478+
instanceTypes["m+t4"] = map[string]map[string]string{
479+
"accelerator": {
480+
"count": "1",
481+
"type": "nvidia-tesla-t4",
482+
},
483+
"machine": {
484+
"type": "n1-standard-4",
485+
},
486+
}
469487
instanceTypes["m+k80"] = map[string]map[string]string{
470488
"accelerator": {
471489
"count": "1",

0 commit comments

Comments
 (0)