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

Add gpu proc info #1276

Merged
merged 12 commits into from
Nov 20, 2023
Merged

Add gpu proc info #1276

merged 12 commits into from
Nov 20, 2023

Conversation

jamartin9
Copy link
Contributor

@jamartin9 jamartin9 commented Aug 18, 2023

Description

Consolidated gpu calls into data_harvester.

Changed config flag from enable_gpu_memory to enable_gpu.

Added GPU utilization to the cpu widget.

Added GPU process memory usage and utilization percentage to the proc widget. (enable by uncommenting the process column headers in the config file; not shown by default)
Added key binds for gpu process toggling C M (better defaults?)

Added GPU power usage to the battery widget. (linux only as windows returned 0 for me.)
Added bounds check to battery widget header (selected out of bounds if clicking across the top of battery widget from left->right; regardless of tabs).
Show battery widget header (for gpu name) when enable_gpu. (does gpu power usage belong in the battery widget?)
Added battery config/cli precedence

Added feature flag legacy-functions to nvml-wrapper

updated config file(s)
updated help text
updated docs

Screenshots:

linux basic:

linux-basic

linux:

linux

freebsd:

freebsd

windows basic:

win-basic

Issues

Maybe closes: #566 and #1291(disable temp with gpu flag) and #298 unless more information is desired (like fan speed for 272). Should there be a list of things still needed? (amd/intel gpus?)

NVML seems inconsistent at times. Linux/Windows results differed after driver updates. (maybe keep legacy-functions feature until issue 48 resolved in nvml-wrapper...)

Testing

Ran on windows(w/gpu), linux (w/gpu) and freebsd (no gpu)

  • Windows
  • macOS
  • Linux
  • FreeBSD

Checklist

  • Areas your change affects have been linted using rustfmt (cargo fmt)
  • The change has been tested and doesn't appear to cause any unintended breakage
  • Documentation has been added/updated if needed (README.md, help menu, doc pages, etc.)
  • The pull request passes the provided CI pipeline
  • There are no merge conflicts
  • If relevant, new tests were added (don't worry too much about coverage)

I did NOT test on macOS.

If any of the Issues should be addressed or a different approach used please let me know.

Feel free to close this PR if it is unwanted.

Consolidated gpu calls into `data_harvester`.

Changed config flag from `enable_gpu_memory` to `enable_gpu`.

Added GPU utilization to the cpu widget.

Added GPU process memory usage and utilization percentage to the proc widget.
Added key binds for gpu process toggling.

Added GPU power usage to the battery widget.
Added bounds check to battery widget header.
Show battery widget header when `gpu_enable`.

Added feature flag `legacy-functions` to `nvml-wrapper`.

updated config file(s).
updated help text.
updated docs.
@codecov
Copy link

codecov bot commented Aug 18, 2023

Codecov Report

Attention: 350 lines in your changes are missing coverage. Please review.

Comparison is base (7c14aa2) 31.82% compared to head (4177bc2) 31.57%.
Report is 2 commits behind head on master.

Files Patch % Lines
src/app/data_harvester/nvidia.rs 0.00% 97 Missing ⚠️
src/app/query.rs 0.00% 80 Missing ⚠️
src/app/data_harvester.rs 0.00% 33 Missing ⚠️
src/app.rs 0.00% 26 Missing ⚠️
src/app/data_harvester/processes/windows.rs 0.00% 22 Missing ⚠️
src/app/data_harvester/processes/linux.rs 0.00% 21 Missing ⚠️
src/widgets/process_table.rs 31.03% 20 Missing ⚠️
src/widgets/process_table/proc_widget_column.rs 0.00% 17 Missing ⚠️
src/widgets/process_table/proc_widget_data.rs 0.00% 17 Missing ⚠️
src/app/data_harvester/processes.rs 0.00% 6 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1276      +/-   ##
==========================================
- Coverage   31.82%   31.57%   -0.26%     
==========================================
  Files          98       97       -1     
  Lines       16674    16943     +269     
==========================================
+ Hits         5307     5349      +42     
- Misses      11367    11594     +227     
Flag Coverage Δ
macos-12 33.33% <15.19%> (-0.24%) ⬇️
ubuntu-latest 33.14% <14.36%> (-0.26%) ⬇️
windows-2019 33.36% <14.32%> (-0.29%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ClementTsang ClementTsang self-assigned this Aug 18, 2023
Copy link
Owner

@ClementTsang ClementTsang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for taking so long - been busy with some other stuff.

Generally, I like what is done and do want to merge this; adding GPU support has been something I've wanted for a while. However, I feel like there's a few areas where I would rather GPU information be displayed (at least by default) as a separate widget, like usage and power consumption.

Feel free to let me know if there's any areas you would like to see changes in the code to make that easier.

src/app/data_harvester.rs Outdated Show resolved Hide resolved
docs/content/usage/widgets/process.md Show resolved Hide resolved
src/app/data_harvester.rs Outdated Show resolved Hide resolved
src/app/data_harvester.rs Show resolved Hide resolved
src/app/data_harvester.rs Outdated Show resolved Hide resolved
src/app/query.rs Outdated Show resolved Hide resolved
@jamartin9
Copy link
Contributor Author

jamartin9 commented Aug 31, 2023

Thank you for your comments and feedback thus far.

Please take your time and apologizes for the large PR.

there's a few areas where I would rather GPU information be displayed (at least by default) as a separate widget, like usage and power consumption.

With removal of the power/util the only added information in this PR is for gpu procs. I have updated the description with the changes.

Feel free to let me know if there's any areas you would like to see changes in the code to make that easier.

I have not looked into adding widgets yet. My initial concern is screen space/layout in advanced mode (I mostly use basic mode).
I will probably not create a gpu widget right away; given that the new gpu widget will need to display graphs/time data for util, power, fan speed etc. (Hence the addition to the current displays.) The aesthetic choices should be made by someone more inclined to do so... (unless it is maybe just be one big graph of 0-100% with real values in the legend?)

@jamartin9 jamartin9 changed the title Add gpu util, power and procs. Add gpu info Aug 31, 2023
Remove GPU util from cpu widget
Remove GPU power from battery widget
Use reference for gpu widgets_to_harvest
Extract match arm to function for feature gate
@ClementTsang
Copy link
Owner

Sorry for the delay with reviewing this btw, been really with work/life for a bit - will get to looking at this in a bit.

@0re5ama
Copy link

0re5ama commented Nov 4, 2023

Any Progress on this?

@ClementTsang
Copy link
Owner

Sorry, just got back from a vacation 😅 , will look at this sometime this week.

Copy link
Owner

@ClementTsang ClementTsang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good to me, apologies for taking so long to review! Just a few comments/questions/nitpicks but bulk of it seems fine.

docs/content/configuration/config-file/processes.md Outdated Show resolved Hide resolved
src/app.rs Show resolved Hide resolved
src/app.rs Show resolved Hide resolved
src/app/data_harvester.rs Outdated Show resolved Hide resolved
src/app/data_harvester.rs Show resolved Hide resolved
src/app/data_harvester/processes/linux.rs Outdated Show resolved Hide resolved
src/app/data_harvester/temperature.rs Outdated Show resolved Hide resolved
src/args.rs Outdated Show resolved Hide resolved
src/options.rs Show resolved Hide resolved
src/widgets/process_table/proc_widget_column.rs Outdated Show resolved Hide resolved
adjust doc wordings
remove extra references
remove extra widget harvest checks
init proc gpu values
use convert_temp_unit for gpu temp
@jamartin9 jamartin9 changed the title Add gpu info Add gpu proc info Nov 19, 2023
Copy link
Owner

@ClementTsang ClementTsang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nitpicks, but otherwise looks good to me. Happy to merge if you don't have anything else to add in.

Comment on lines +94 to +96
ProcColumn::GpuMem => "GMEM",
#[cfg(feature = "gpu")]
ProcColumn::GpuMemPercent => "GMEM%",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit for consistency:

Suggested change
ProcColumn::GpuMem => "GMEM",
#[cfg(feature = "gpu")]
ProcColumn::GpuMemPercent => "GMEM%",
ProcColumn::GpuMem => "GMem",
#[cfg(feature = "gpu")]
ProcColumn::GpuMemPercent => "GMem%",

Comment on lines +119 to +122
#[cfg(feature = "gpu")]
ProcColumn::GpuMem => "GMEM",
#[cfg(feature = "gpu")]
ProcColumn::GpuMemPercent => "GMEM%",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here:

Suggested change
#[cfg(feature = "gpu")]
ProcColumn::GpuMem => "GMEM",
#[cfg(feature = "gpu")]
ProcColumn::GpuMemPercent => "GMEM%",
#[cfg(feature = "gpu")]
ProcColumn::GpuMem => "GMem",
#[cfg(feature = "gpu")]
ProcColumn::GpuMemPercent => "GMem%",

@@ -433,7 +433,7 @@ pub fn build_app(
use_cpu: used_widget_set.get(&Cpu).is_some() || used_widget_set.get(&BasicCpu).is_some(),
use_mem,
use_cache: use_mem && get_enable_cache_memory(matches, config),
use_gpu: use_mem && get_enable_gpu_memory(matches, config),
use_gpu: use_mem && get_enable_gpu(matches, config),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can probably just do:

Suggested change
use_gpu: use_mem && get_enable_gpu(matches, config),
use_gpu: get_enable_gpu(matches, config),

@jamartin9
Copy link
Contributor Author

Small nitpicks, but otherwise looks good to me. Happy to merge if you don't have anything else to add in.

I do not have anything to add unless you want me to address the comments. I can assist in testing after the merge for the changes too.

Thanks again for the responses.

@ClementTsang
Copy link
Owner

They're small things that I can address quickly after merging this, so no worries there.

And testing would be appreciated! I don't have any computers that use NVIDIA GPUs at the moment so it's a bit hard for me to test right now unless I mock it or until I look into supporting other GPUs.

@ClementTsang ClementTsang merged commit e4a6e75 into ClementTsang:master Nov 20, 2023
33 checks passed
@ClementTsang ClementTsang mentioned this pull request Nov 20, 2023
9 tasks
@jamartin9 jamartin9 mentioned this pull request Nov 27, 2023
@actionless
Copy link

all widgets (like processes, memory or temp) work as expected but on this one i'm not getting GPU0 etc, do i need to enable some config option for that?

2024-01-02--1704177666_2244x496_scrot

@jamartin9
Copy link
Contributor Author

all widgets (like processes, memory or temp) work as expected but on this one i'm not getting GPU0 etc, do i need to enable some config option for that?

It was determined during code review (commit) to remove the utilization and power consumption from the default displays per the following comment:

I would rather GPU information be displayed as a separate widget, like usage and power consumption.

I didn't update the screenshots after removal. Sorry for the confusion.

@actionless
Copy link

and that separate widget is implemented or not yet?

@actionless
Copy link

actionless commented Jan 2, 2024

btw i also find it a bit confusing showing VRAM and RAM memory in the same widget, but split GPU and CPU processors - in that case i guess VRAM also should be moved to the gpu widget?

@jamartin9
Copy link
Contributor Author

jamartin9 commented Jan 2, 2024

and that separate widget is implemented or not yet?

It is not implemented yet. Anyone is free to implement it tho.

VRAM also should be moved to the gpu widget?

Most likely imo

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.

Add GPU information
4 participants