Skip to content

Commit 9dd02d5

Browse files
committed
include gpu memory
1 parent 3cb9dca commit 9dd02d5

File tree

4 files changed

+24
-20
lines changed

4 files changed

+24
-20
lines changed

v1/instancetype.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,14 @@ func MakeGenericInstanceTypeIDFromInstance(instance Instance) InstanceTypeID {
114114
}
115115

116116
type GPU struct {
117-
Count int32
118-
Memory units.Base2Bytes
119-
MemoryDetails string // "", "HBM", "GDDR", "DDR", etc.
120-
NetworkDetails string // "PCIe", "SXM4", "SXM5", etc.
121-
Manufacturer Manufacturer
122-
Name string
123-
Type string
117+
Count int32
118+
Memory units.Base2Bytes // TODO: deprecate in favor of MemoryByteValue
119+
MemoryByteValue ByteValue
120+
MemoryDetails string // "", "HBM", "GDDR", "DDR", etc.
121+
NetworkDetails string // "PCIe", "SXM4", "SXM5", etc.
122+
Manufacturer Manufacturer
123+
Name string
124+
Type string
124125
}
125126

126127
type InstanceTypeQuota struct {

v1/providers/lambdalabs/instancetype.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ func parseGPUFromDescription(input string) (v1.GPU, error) {
128128
memoryStr := memoryMatch[1]
129129
memoryGiB, _ := strconv.Atoi(memoryStr)
130130
gpu.Memory = units.GiB * units.Base2Bytes(memoryGiB)
131+
gpu.MemoryByteValue = v1.NewByteValue(int32(memoryGiB), v1.Gibibyte)
131132

132133
// Extract the network details
133134
networkRegex := regexp.MustCompile(`(\w+\s?)+\)`)

v1/providers/launchpad/instancetype.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,13 @@ func launchpadGpusToGpus(lpGpus []openapi.InstanceTypeGpu) []v1.GPU {
259259
gpus := make([]v1.GPU, len(lpGpus))
260260
for i, gp := range lpGpus {
261261
gpus[i] = v1.GPU{
262-
Name: strings.ToUpper(gp.Family),
263-
Manufacturer: v1.GetManufacturer(gp.Manufacturer),
264-
Count: gp.Count,
265-
Memory: gbToBytes(gp.MemoryGb),
266-
NetworkDetails: string(gp.InterconnectionType),
267-
Type: strings.ToUpper(gp.Model),
262+
Name: strings.ToUpper(gp.Family),
263+
Manufacturer: v1.GetManufacturer(gp.Manufacturer),
264+
Count: gp.Count,
265+
Memory: gbToBytes(gp.MemoryGb),
266+
MemoryByteValue: v1.NewByteValue(gp.MemoryGb, v1.Gigabyte),
267+
NetworkDetails: string(gp.InterconnectionType),
268+
Type: strings.ToUpper(gp.Model),
268269
}
269270
}
270271
return gpus

v1/providers/shadeform/instancetype.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,14 @@ func (c *ShadeformClient) convertShadeformInstanceTypeToV1InstanceType(shadeform
232232
MemoryByteValue: v1.NewByteValue(shadeformInstanceType.Configuration.MemoryInGb, v1.Gigabyte),
233233
SupportedGPUs: []v1.GPU{
234234
{
235-
Count: shadeformInstanceType.Configuration.NumGpus,
236-
Memory: units.Base2Bytes(shadeformInstanceType.Configuration.VramPerGpuInGb) * units.GiB,
237-
MemoryDetails: "",
238-
NetworkDetails: shadeformInstanceType.Configuration.Interconnect,
239-
Manufacturer: gpuManufacturer,
240-
Name: gpuName,
241-
Type: shadeformInstanceType.Configuration.GpuType,
235+
Count: shadeformInstanceType.Configuration.NumGpus,
236+
Memory: units.Base2Bytes(shadeformInstanceType.Configuration.VramPerGpuInGb) * units.GiB,
237+
MemoryByteValue: v1.NewByteValue(shadeformInstanceType.Configuration.VramPerGpuInGb, v1.Gigabyte),
238+
MemoryDetails: "",
239+
NetworkDetails: shadeformInstanceType.Configuration.Interconnect,
240+
Manufacturer: gpuManufacturer,
241+
Name: gpuName,
242+
Type: shadeformInstanceType.Configuration.GpuType,
242243
},
243244
},
244245
SupportedStorage: []v1.Storage{ // TODO: add storage (look in configuration)

0 commit comments

Comments
 (0)