Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

xxsoul
Copy link

@xxsoul xxsoul commented Sep 19, 2024

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)

…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
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Contributor

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

Copy link
Author

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.
@xxsoul xxsoul changed the title Fix the bug when calling the underlying nvmlDeviceGetRunningProcessDetailList function Fix the bug that some functions do not populate the Version field, resulting in failure of the call. Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants