-
Notifications
You must be signed in to change notification settings - Fork 283
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
Add pynvml compatibility by monkey-patching #143
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit adds unit tests for #107, where legacy and supported nvidia-drivers would behave differently on process-relatd APIs (e.g., nvmlDeviceGetComputeRunningProcesses_v2). Note: As already pointed out in #107, this test (and gpustat's process information) fails with nvidia-ml-py > 11.495.46 breaking the backward compatibility.
pynvml 11.510.69 has broken the backward compatibility by removing `nvml.nvmlDeviceGetComputeRunningProcesses_v2` which is replaced by v3 APIs (`nvml.nvmlDeviceGetComputeRunningProcesses_v3`), but this function does not exist for old nvidia drivers less than 510.39.01. Therefore we pinned pynvml version at 11.495.46 in gpustat v1.0 (#107), but we actually have to use recent pynvml versions for "latest" or modern NVIDIA drivers. To make compute/graphics process information work correctly when a combination of old nvidia drivers (`< 510.39`) AND `pynvml >= 11.510.69` is used, we need to monkey-patch pynvml functions in our custom manner such that, for instance, when v3 API is introduced, we can simply fallback to v2 APIs to retrieve the process information.
nvmlDeviceGetMemoryInfo_v2 was added in driver 510.39.01, but breaking the v1 API with no backward compatibility. A corresponding version of pynvml (11.510.69+) is needed to use the v2 API, in order to get the correct memory usage information in nvidia drivers 510.39 or higher. Fixes #141.
To fix #141,
|
wookayin
added a commit
that referenced
this pull request
Dec 1, 2022
wookayin
added a commit
that referenced
this pull request
Dec 1, 2022
XuehaiPan
reviewed
Dec 2, 2022
8 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The purpose of this PR is to relax the strict pynvml requirement (
<= 11.495.46
) introduced in #107.pynvml 11.510.69 has broken the backward compatibility by removing
nvml.nvmlDeviceGetComputeRunningProcesses_v2
which is replaced by v3 APIs (nvml.nvmlDeviceGetComputeRunningProcesses_v3
), but this function does not exist for old nvidia drivers less than 510.39.01.Therefore we pinned pynvml version at 11.495.46 in gpustat v1.0 (#107), but we actually have to use recent pynvml versions for "latest" or modern NVIDIA drivers. To make compute/graphics process information work correctly when a combination of old nvidia drivers (
< 510.39
) ANDpynvml >= 11.510.69
is used, we need to monkey-patch pynvml functions in our custom manner such that, for instance, when v3 API is introduced, we can simply fallback to v2 APIs to retrieve the process information.