From da71bc2bff398d70e76e2eb68f3fd78f2deece74 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Thu, 1 Sep 2022 14:06:25 +0200 Subject: [PATCH] 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 --- go.mod | 2 +- go.sum | 4 ++-- vendor/github.com/NVIDIA/go-nvml/pkg/nvml/device.go | 6 +++--- vendor/github.com/NVIDIA/go-nvml/pkg/nvml/init.go | 12 ++---------- vendor/modules.txt | 2 +- 5 files changed, 9 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index 8bae3b8..226edad 100644 --- a/go.mod +++ b/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 ) diff --git a/go.sum b/go.sum index 79e80c2..744c506 100644 --- a/go.sum +++ b/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= diff --git a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/device.go b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/device.go index 546261c..b0eb68d 100644 --- a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/device.go +++ b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/device.go @@ -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 } diff --git a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/init.go b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/init.go index 0a77d22..1572f81 100644 --- a/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/init.go +++ b/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/init.go @@ -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 diff --git a/vendor/modules.txt b/vendor/modules.txt index a194258..991cb71 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -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