mirror of
https://github.com/clearml/go-nvlib
synced 2025-03-30 15:27:15 +00:00
Merge branch 'fix-visit-on-older-drivers' into 'main'
Check if device is MIG Capable when visiting MIG devices See merge request nvidia/cloud-native/go-nvlib!40
This commit is contained in:
commit
649703f6b3
@ -188,6 +188,14 @@ func (d *device) IsMigEnabled() (bool, error) {
|
||||
|
||||
// VisitMigDevices walks a top-level device and invokes a callback function for each MIG device configured on it
|
||||
func (d *device) VisitMigDevices(visit func(int, MigDevice) error) error {
|
||||
capable, err := d.IsMigCapable()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error checking if GPU is MIG capable: %v", err)
|
||||
}
|
||||
if !capable {
|
||||
return nil
|
||||
}
|
||||
|
||||
count, ret := nvml.Device(d).GetMaxMigDeviceCount()
|
||||
if ret != nvml.SUCCESS {
|
||||
return fmt.Errorf("error getting max MIG device count: %v", ret)
|
||||
|
Loading…
Reference in New Issue
Block a user