Skip to content

Commit c498f16

Browse files
committed
Use info.IsIntegratedGPUName
Signed-off-by: Evan Lezar <[email protected]>
1 parent 10ba8ba commit c498f16

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

@@ -303,7 +303,7 @@ func isIntegratedGPU(d nvml.Device) (bool, error) {
303303
if ret != nvml.SUCCESS {
304304
return false, fmt.Errorf("failed to get device name: %v", ret)
305305
}
306-
return isIntegratedGPUName(name), nil
306+
return info.IsIntegratedGPUName(name), nil
307307
}
308308
if ret != nvml.SUCCESS {
309309
return false, fmt.Errorf("failed to get PCI info: %v", ret)
@@ -317,18 +317,3 @@ func isIntegratedGPU(d nvml.Device) (bool, error) {
317317
}
318318
return pciInfo.Device == 0, nil
319319
}
320-
321-
// isIntegratedGPUName returns true if the specified device name is associated
322-
// with a known iGPU.
323-
//
324-
// TODO: Consider making go-nvlib/pkg/nvlib/info/isIntegratedGPUName public
325-
// instead.
326-
func isIntegratedGPUName(name string) bool {
327-
if strings.Contains(name, "(nvgpu)") {
328-
return true
329-
}
330-
if strings.Contains(name, "NVIDIA Thor") {
331-
return true
332-
}
333-
return false
334-
}

0 commit comments

Comments
 (0)