mirror of
https://github.com/clearml/go-nvlib
synced 2025-01-30 18:36:59 +00:00
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:
parent
9175bde20b
commit
da71bc2bff
2
go.mod
2
go.mod
@ -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
4
go.sum
@ -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=
|
||||
|
6
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/device.go
generated
vendored
6
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/device.go
generated
vendored
@ -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
|
||||
}
|
||||
|
||||
|
12
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/init.go
generated
vendored
12
vendor/github.com/NVIDIA/go-nvml/pkg/nvml/init.go
generated
vendored
@ -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
2
vendor/modules.txt
vendored
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user