Skip to content

Commit b416704

Browse files
committed
Use info.IsIntegratedGPUName
Signed-off-by: Evan Lezar <[email protected]>
1 parent 4b21c9a commit b416704

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

pkg/nvcdi/lib-csv.go

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ import (
2020
"fmt"
2121
"slices"
2222
"strconv"
23-
"strings"
2423

2524
"tags.cncf.io/container-device-interface/pkg/cdi"
2625
"tags.cncf.io/container-device-interface/specs-go"
2726

2827
"github.com/NVIDIA/go-nvlib/pkg/nvlib/device"
28+
"github.com/NVIDIA/go-nvlib/pkg/nvlib/info"
2929
"github.com/NVIDIA/go-nvml/pkg/nvml"
3030
"github.com/google/uuid"
3131

@@ -307,7 +307,7 @@ func isIntegratedGPU(d nvml.Device) (bool, error) {
307307
if ret != nvml.SUCCESS {
308308
return false, fmt.Errorf("failed to get device name: %v", ret)
309309
}
310-
return isIntegratedGPUName(name), nil
310+
return info.IsIntegratedGPUName(name), nil
311311
}
312312
if ret != nvml.SUCCESS {
313313
return false, fmt.Errorf("failed to get PCI info: %v", ret)
@@ -321,18 +321,3 @@ func isIntegratedGPU(d nvml.Device) (bool, error) {
321321
}
322322
return pciInfo.Device == 0, nil
323323
}
324-
325-
// isIntegratedGPUName returns true if the specified device name is associated
326-
// with a known iGPU.
327-
//
328-
// TODO: Consider making go-nvlib/pkg/nvlib/info/isIntegratedGPUName public
329-
// instead.
330-
func isIntegratedGPUName(name string) bool {
331-
if strings.Contains(name, "(nvgpu)") {
332-
return true
333-
}
334-
if strings.Contains(name, "NVIDIA Thor") {
335-
return true
336-
}
337-
return false
338-
}

0 commit comments

Comments
 (0)