Skip to content

Commit

Permalink
Merge pull request #43 from NVIDIA/update-type-regex
Browse files Browse the repository at this point in the history
Update vGPU type regex to account for the RTX*-Ada GPU product string
  • Loading branch information
cdesiniotis authored Jul 1, 2024
2 parents ef58059 + c01735e commit 95d589b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions pkg/types/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ func TestParseVGPUType(t *testing.T) {
"bogus",
false,
},
{
"Valid RTX6000-Ada-2Q",
"RTX6000-Ada-2Q",
true,
},
}

for _, tc := range testCases {
Expand Down Expand Up @@ -218,6 +223,13 @@ func TestVGPUConfigAssertValid(t *testing.T) {
},
false,
},
{
"Valid config - RTX Ada device",
map[string]int{
"RTX6000-Ada-2Q": 24,
},
true,
},
}

for _, tc := range testCases {
Expand Down
2 changes: 1 addition & 1 deletion pkg/types/vgpu_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const (
// timeSlicedRegex represents the format for a time-sliced, vGPU type name.
// It embeds the GPU type, framebuffer size in GB, and a letter representing the 'series'.
// Note: The framebuffer size can be '0' to represent 512MB (i.e. M60-0Q).
timeSlicedRegex = "^(?P<GPU>[A-Z0-9]+)-(?P<GB>0|[1-9][0-9]*)(?P<S>A|B|C|Q)$"
timeSlicedRegex = "^(?P<GPU>[A-Z0-9]+(-([a-zA-Z]+))*)-(?P<GB>0|[1-9][0-9]*)(?P<S>A|B|C|Q)$"
// migBackedRegex represents the format for a MIG-backed, vGPU type name.
// In addition to embedding all of the fields from 'timeSlicedRegex', it also
// contains the number of GPU instances and any additional attributes (i.e. media extensions).
Expand Down

0 comments on commit 95d589b

Please sign in to comment.