Add config to select GPU index - #143
Open
osimarr wants to merge 3 commits into
Open
Conversation
The order of the drm minor may not match the order of the cards on sysfs. When enumerating AMD GPUs, the minor number plays a better role.
In multiple GPU scenarios, let the user decide which one to collect data.
Bowen951209
reviewed
Apr 10, 2026
Comment on lines
+32
to
40
| pub fn new(gpu_index: u8) -> Result<Self> { | ||
| let modules = procfs::modules()?; | ||
|
|
||
| if modules.contains_key("nvidia") { | ||
| return Ok(Self::Nvml(Box::new(Nvml::init()?))); | ||
| } | ||
| if modules.contains_key("amdgpu") { | ||
| return Ok(Self::Amd(Box::new(AmdSysFS::init()?))); | ||
| return Ok(Self::Amd(Box::new(AmdSysFS::init(gpu_index)?))); | ||
| } |
Contributor
There was a problem hiding this comment.
If you have both NVIDIA and AMD cards, this will always return NVIDIA instance.
Contributor
|
I think this is duplicated of #127. |
This file contains hidden or 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
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.
This pull request adds support for selecting which GPU to monitor by index, improving multi-GPU system compatibility. It introduces a new
gpu_indexconfiguration option, updates both AMD and NVIDIA backends to respect this index, and exposes the GPU index in formatting fields and outputs.I have AMD GPU and tested my changes on it. But I need somebody with NVIDIA to do the same.