From cbf6a26bd57554fe8306c367baaa5cb7801553ff Mon Sep 17 00:00:00 2001 From: xxsoul Date: Thu, 19 Sep 2024 17:32:20 +0800 Subject: [PATCH 1/3] Fix the bug that the Version field of ProcessDetailList is not assigned a value(must be nvmlProcessDetailList_v1) when calling the underlying nvmlDeviceGetRunningProcessDetailList function. --- pkg/nvml/nvml.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/nvml/nvml.go b/pkg/nvml/nvml.go index 6ba290c..50c10c8 100644 --- a/pkg/nvml/nvml.go +++ b/pkg/nvml/nvml.go @@ -1224,6 +1224,7 @@ func nvmlDeviceGetMPSComputeRunningProcesses_v3(nvmlDevice nvmlDevice, InfoCount // nvmlDeviceGetRunningProcessDetailList function as declared in nvml/nvml.h func nvmlDeviceGetRunningProcessDetailList(nvmlDevice nvmlDevice, Plist *ProcessDetailList) Return { cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown + Plist.Version = C.nvmlProcessDetailList_v1 cPlist, _ := (*C.nvmlProcessDetailList_t)(unsafe.Pointer(Plist)), cgoAllocsUnknown __ret := C.nvmlDeviceGetRunningProcessDetailList(cnvmlDevice, cPlist) __v := (Return)(__ret) From 4ebc14b20752b7355af72d999eb7a304ab60c276 Mon Sep 17 00:00:00 2001 From: xxsoul Date: Thu, 19 Sep 2024 19:27:27 +0800 Subject: [PATCH 2/3] Fix the bug that the Version field of EccSramErrorStatusis not assigned a value(must be nvmlEccSramErrorStatus_v1) when calling the underlying nvmlDeviceGetSramEccErrorStatus function. --- pkg/nvml/nvml.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/nvml/nvml.go b/pkg/nvml/nvml.go index 50c10c8..869197f 100644 --- a/pkg/nvml/nvml.go +++ b/pkg/nvml/nvml.go @@ -3100,6 +3100,7 @@ func nvmlDeviceSetPowerManagementLimit_v2(nvmlDevice nvmlDevice, PowerValue *Pow // nvmlDeviceGetSramEccErrorStatus function as declared in nvml/nvml.h func nvmlDeviceGetSramEccErrorStatus(nvmlDevice nvmlDevice, Status *EccSramErrorStatus) Return { cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown + Status.Version = C.nvmlEccSramErrorStatus_v1 cStatus, _ := (*C.nvmlEccSramErrorStatus_t)(unsafe.Pointer(Status)), cgoAllocsUnknown __ret := C.nvmlDeviceGetSramEccErrorStatus(cnvmlDevice, cStatus) __v := (Return)(__ret) From e4bb61084e87ce3c5efefaf54522572bc918963d Mon Sep 17 00:00:00 2001 From: xxsoul Date: Mon, 23 Sep 2024 10:28:32 +0800 Subject: [PATCH 3/3] Fix the bug that some functions do not populate the Version field, resulting in failure of the call. --- pkg/nvml/device.go | 2 ++ pkg/nvml/nvml.go | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/nvml/device.go b/pkg/nvml/device.go index ac778e5..356fbb1 100644 --- a/pkg/nvml/device.go +++ b/pkg/nvml/device.go @@ -2808,6 +2808,7 @@ func (l *library) DeviceGetRunningProcessDetailList(device Device) (ProcessDetai func (device nvmlDevice) GetRunningProcessDetailList() (ProcessDetailList, Return) { var plist ProcessDetailList + plist.Version = STRUCT_VERSION(plist, 1) ret := nvmlDeviceGetRunningProcessDetailList(device, &plist) return plist, ret } @@ -3052,6 +3053,7 @@ func (l *library) DeviceGetSramEccErrorStatus(device Device) (EccSramErrorStatus func (device nvmlDevice) GetSramEccErrorStatus() (EccSramErrorStatus, Return) { var status EccSramErrorStatus + status.Version = STRUCT_VERSION(status, 1) ret := nvmlDeviceGetSramEccErrorStatus(device, &status) return status, ret } diff --git a/pkg/nvml/nvml.go b/pkg/nvml/nvml.go index 869197f..6ba290c 100644 --- a/pkg/nvml/nvml.go +++ b/pkg/nvml/nvml.go @@ -1224,7 +1224,6 @@ func nvmlDeviceGetMPSComputeRunningProcesses_v3(nvmlDevice nvmlDevice, InfoCount // nvmlDeviceGetRunningProcessDetailList function as declared in nvml/nvml.h func nvmlDeviceGetRunningProcessDetailList(nvmlDevice nvmlDevice, Plist *ProcessDetailList) Return { cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown - Plist.Version = C.nvmlProcessDetailList_v1 cPlist, _ := (*C.nvmlProcessDetailList_t)(unsafe.Pointer(Plist)), cgoAllocsUnknown __ret := C.nvmlDeviceGetRunningProcessDetailList(cnvmlDevice, cPlist) __v := (Return)(__ret) @@ -3100,7 +3099,6 @@ func nvmlDeviceSetPowerManagementLimit_v2(nvmlDevice nvmlDevice, PowerValue *Pow // nvmlDeviceGetSramEccErrorStatus function as declared in nvml/nvml.h func nvmlDeviceGetSramEccErrorStatus(nvmlDevice nvmlDevice, Status *EccSramErrorStatus) Return { cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown - Status.Version = C.nvmlEccSramErrorStatus_v1 cStatus, _ := (*C.nvmlEccSramErrorStatus_t)(unsafe.Pointer(Status)), cgoAllocsUnknown __ret := C.nvmlDeviceGetSramEccErrorStatus(cnvmlDevice, cStatus) __v := (Return)(__ret)