-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the bug that some functions do not populate the Version field, resulting in failure of the call. #130
base: main
Are you sure you want to change the base?
Conversation
…ed a value(must be nvmlProcessDetailList_v1) when calling the underlying nvmlDeviceGetRunningProcessDetailList function.
pkg/nvml/nvml.go
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be set here. This is generated code. It needs to be set in the wrapper passed into this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to add logic to set the version in file "device.go"? I noticed from nvml.h that nvmlProcessDetailList_v1 is actually calculated by the macro definition (size_of(nvmlProcessDetailList_v1_t) | (1 << 24)), and it looks like we need to define some constants to hold such kind of values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagine it can be done the same as here: https://github.com/NVIDIA/go-nvml/blob/main/pkg/nvml/device.go#L826
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ingenious way, I reworked my submission as in code :-)
…ed a value(must be nvmlEccSramErrorStatus_v1) when calling the underlying nvmlDeviceGetSramEccErrorStatus function.
…sulting in failure of the call.
Fix the bug that the Version field of ProcessDetailList is not assigned a value(must be nvmlProcessDetailList_v1) when calling the underlying nvmlDeviceGetRunningProcessDetailList function.
If the value is not populated (default is 0), the function will return nvmlReturn_t=25(Argument version mismatch)