Skip to content

Commit

Permalink
Helper machine_type parity with task (#718)
Browse files Browse the repository at this point in the history
  • Loading branch information
dacbd authored Nov 15, 2022
1 parent fd4a940 commit bd37b68
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 23 deletions.
24 changes: 13 additions & 11 deletions iterative/aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,17 +486,19 @@ func GetAvailabilityZone(region string) string {
}

func getInstanceType(instanceType string, instanceGPU string) string {
instanceTypes := make(map[string]string)
instanceTypes["m"] = "m5.2xlarge"
instanceTypes["l"] = "m5.8xlarge"
instanceTypes["xl"] = "m5.16xlarge"
instanceTypes["m+k80"] = "p2.xlarge"
instanceTypes["l+k80"] = "p2.8xlarge"
instanceTypes["xl+k80"] = "p2.16xlarge"
instanceTypes["m+v100"] = "p3.xlarge"
instanceTypes["l+v100"] = "p3.8xlarge"
instanceTypes["xl+v100"] = "p3.16xlarge"

instanceTypes := map[string]string{
"s": "t2.micro",
"m": "m5.2xlarge",
"l": "m5.8xlarge",
"xl": "m5.16xlarge",
"m+t4": "g4dn.xlarge",
"m+k80": "p2.xlarge",
"l+k80": "p2.8xlarge",
"xl+k80": "p2.16xlarge",
"m+v100": "p3.xlarge",
"l+v100": "p3.8xlarge",
"xl+v100": "p3.16xlarge",
}
if val, ok := instanceTypes[instanceType+"+"+instanceGPU]; ok {
return val
} else if val, ok := instanceTypes[instanceType]; ok && instanceGPU == "" {
Expand Down
27 changes: 15 additions & 12 deletions iterative/azure/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func ResourceMachineCreate(ctx context.Context, d *schema.ResourceData, m interf

vmClient, _ := getVMClient(subscriptionID)
vmSettings := compute.VirtualMachine{
Tags: metadata,
Tags: metadata,
Location: to.StringPtr(region),
VirtualMachineProperties: &compute.VirtualMachineProperties{
HardwareProfile: &compute.HardwareProfile{
Expand Down Expand Up @@ -256,7 +256,7 @@ func ResourceMachineCreate(ctx context.Context, d *schema.ResourceData, m interf
},
},
}

if userAssignedIdentities != nil {
vmSettings.Identity = &compute.VirtualMachineIdentity{
UserAssignedIdentities: userAssignedIdentities,
Expand Down Expand Up @@ -414,16 +414,19 @@ func GetRegion(region string) string {
}

func getInstanceType(instanceType string, instanceGPU string) string {
instanceTypes := make(map[string]string)
instanceTypes["m"] = "Standard_F8s_v2"
instanceTypes["l"] = "Standard_F32s_v2"
instanceTypes["xl"] = "Standard_F64s_v2"
instanceTypes["m+k80"] = "Standard_NC6"
instanceTypes["l+k80"] = "Standard_NC12"
instanceTypes["xl+k80"] = "Standard_NC24"
instanceTypes["m+v100"] = "Standard_NC6s_v3"
instanceTypes["l+v100"] = "Standard_NC12s_v3"
instanceTypes["xl+v100"] = "Standard_NC24s_v3"
instanceTypes := map[string]string{
"s": "Standard_B1s",
"m": "Standard_F8s_v2",
"l": "Standard_F32s_v2",
"xl": "Standard_F64s_v2",
"m+t4": "Standard_NC4as_T4_v3",
"m+k80": "Standard_NC6",
"l+k80": "Standard_NC12",
"xl+k80": "Standard_NC24",
"m+v100": "Standard_NC6s_v3",
"l+v100": "Standard_NC12s_v3",
"xl+v100": "Standard_NC24s_v3",
}

if val, ok := instanceTypes[instanceType+"+"+instanceGPU]; ok {
return val
Expand Down
18 changes: 18 additions & 0 deletions iterative/gcp/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,15 @@ func getRegion(region string) string {

func getInstanceType(instanceType string, instanceGPU string) (map[string]map[string]string, error) {
instanceTypes := make(map[string]map[string]map[string]string)
instanceTypes["s"] = map[string]map[string]string{
"accelerator": {
"count": "0",
"type": "",
},
"machine": {
"type": "g1-small",
},
}
instanceTypes["m"] = map[string]map[string]string{
"accelerator": {
"count": "0",
Expand Down Expand Up @@ -466,6 +475,15 @@ func getInstanceType(instanceType string, instanceGPU string) (map[string]map[st
"type": "n2-custom-64-262144",
},
}
instanceTypes["m+t4"] = map[string]map[string]string{
"accelerator": {
"count": "1",
"type": "nvidia-tesla-t4",
},
"machine": {
"type": "n1-standard-4",
},
}
instanceTypes["m+k80"] = map[string]map[string]string{
"accelerator": {
"count": "1",
Expand Down

0 comments on commit bd37b68

Please sign in to comment.