Update go-nvml dependency

This updates go-nvml to include fixes for getting devices by UUID
and to remove the panic from calls to Init and Shutdown.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2022-09-01 14:06:25 +02:00
parent 9175bde20b
commit da71bc2bff
5 changed files with 9 additions and 17 deletions

2
go.mod
View File

@ -3,6 +3,6 @@ module gitlab.com/nvidia/cloud-native/go-nvlib
go 1.16
require (
github.com/NVIDIA/go-nvml v0.11.6-0.0.20220614115128-31f8b89eb740
github.com/NVIDIA/go-nvml v0.11.6-0.0.20220823120812-7e2082095e82
github.com/stretchr/testify v1.7.0
)

4
go.sum
View File

@ -1,5 +1,5 @@
github.com/NVIDIA/go-nvml v0.11.6-0.0.20220614115128-31f8b89eb740 h1:eOqFxx5XKIcw4U0YTIndTWWFCIJvuagS+v8IaM7XvBU=
github.com/NVIDIA/go-nvml v0.11.6-0.0.20220614115128-31f8b89eb740/go.mod h1:hy7HYeQy335x6nEss0Ne3PYqleRa6Ct+VKD9RQ4nyFs=
github.com/NVIDIA/go-nvml v0.11.6-0.0.20220823120812-7e2082095e82 h1:x751Xx1tdxkiA/sdkv2J769n21UbYKzVOpe9S/h1M3k=
github.com/NVIDIA/go-nvml v0.11.6-0.0.20220823120812-7e2082095e82/go.mod h1:hy7HYeQy335x6nEss0Ne3PYqleRa6Ct+VKD9RQ4nyFs=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

View File

@ -38,21 +38,21 @@ func DeviceGetHandleByIndex(Index int) (Device, Return) {
// nvml.DeviceGetHandleBySerial()
func DeviceGetHandleBySerial(Serial string) (Device, Return) {
var Device Device
ret := nvmlDeviceGetHandleBySerial(Serial, &Device)
ret := nvmlDeviceGetHandleBySerial(Serial + string(rune(0)), &Device)
return Device, ret
}
// nvml.DeviceGetHandleByUUID()
func DeviceGetHandleByUUID(Uuid string) (Device, Return) {
var Device Device
ret := nvmlDeviceGetHandleByUUID(Uuid, &Device)
ret := nvmlDeviceGetHandleByUUID(Uuid + string(rune(0)), &Device)
return Device, ret
}
// nvml.DeviceGetHandleByPciBusId()
func DeviceGetHandleByPciBusId(PciBusId string) (Device, Return) {
var Device Device
ret := nvmlDeviceGetHandleByPciBusId(PciBusId, &Device)
ret := nvmlDeviceGetHandleByPciBusId(PciBusId + string(rune(0)), &Device)
return Device, ret
}

View File

@ -32,13 +32,9 @@ var nvml *dl.DynamicLibrary
// nvml.Init()
func Init() Return {
lib := dl.New(nvmlLibraryName, nvmlLibraryLoadFlags)
if lib == nil {
panic(fmt.Sprintf("error instantiating DynamicLibrary for %s", nvmlLibraryName))
}
err := lib.Open()
if err != nil {
panic(fmt.Sprintf("error opening %s: %v", nvmlLibraryName, err))
return ERROR_LIBRARY_NOT_FOUND
}
nvml = lib
@ -50,13 +46,9 @@ func Init() Return {
// nvml.InitWithFlags()
func InitWithFlags(Flags uint32) Return {
lib := dl.New(nvmlLibraryName, nvmlLibraryLoadFlags)
if lib == nil {
panic(fmt.Sprintf("error instantiating DynamicLibrary for %s", nvmlLibraryName))
}
err := lib.Open()
if err != nil {
panic(fmt.Sprintf("error opening %s: %v", nvmlLibraryName, err))
return ERROR_LIBRARY_NOT_FOUND
}
nvml = lib

2
vendor/modules.txt vendored
View File

@ -1,4 +1,4 @@
# github.com/NVIDIA/go-nvml v0.11.6-0.0.20220614115128-31f8b89eb740
# github.com/NVIDIA/go-nvml v0.11.6-0.0.20220823120812-7e2082095e82
## explicit
github.com/NVIDIA/go-nvml/pkg/dl
github.com/NVIDIA/go-nvml/pkg/nvml