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

Bug: Doesn't detect AMD GPUs #218

Open
shawarden opened this issue Jun 15, 2023 · 4 comments
Open

Bug: Doesn't detect AMD GPUs #218

shawarden opened this issue Jun 15, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@shawarden
Copy link

shawarden commented Jun 15, 2023

Describe the bug

The status plugin for GPU usage doesn't process AMD and intel GPUs

To Reproduce

Steps to reproduce the behavior:

  1. Have something other than an Nvidia GPU
  2. Add gpu-usage to @dracula-plugins
  3. See 'unknown' in the GPU block

Expected behavior

It should report any GPU usage.

System

  • OS: Arch Linux
  • Tmux Version: 3.3a

Possible fix:

Change gpu_usage.sh line 32 from...

    usage='unknown'

...to something along the lines of...

    usage=$(cat /sys/class/drm/card?/device/gpu_busy_percent | sed -z -e 's/\n/%\//g' -e 's/\/$//g')

...which can handle one or more GPUs of any type?

Same fixes can be used for gpu_ram_info.sh:

    usage=$(cat /sys/class/drm/card?/device/mem_info_vram_used /sys/class/drm/card?/device/mem_info_vram_total | cat /sys/class/drm/card?/device/mem_info_vram_used /sys/class/drm/card?/device/mem_info_vram_total | numfmt --to=iec-i --suffix=B | sed -z -e 's#\n#/#g' -e 's#/$##g'

...and gpu_power.sh:

    usage=$(echo "$(($(cat /sys/class/drm/card0/device/hwmon/hwmon2/power1_average) / 1000 / 1000))W/$(($(cat /sys/class/drm/card0/device/hwmon/hwmon2/power1_cap_max) / 1000 / 1000))W")
@shawarden shawarden added the bug Something isn't working label Jun 15, 2023
@ethancedwards8
Copy link
Member

Looks good. I could never find an API that shows GPU usage, but I guess I wasn't looking hard enough. If you want to implement this, that would be great.

@pspiagicw
Copy link
Contributor

Hey @ethancedwards8, is this being worked on ?

@ethancedwards8
Copy link
Member

Sadly no. We (maintainers) don't have AMD hardware and can't really test or develop this feature. If you could implement the feature, providing you have the hardware, that would be amazing.

@shawarden
Copy link
Author

shawarden commented Dec 9, 2023

I'm not a contributor, nor do I know how to as I've only ever managed my own git repos, but you can just replace line 32 of scripts/gpu_usage.sh with...

usage="$(cat /sys/class/drm/card?/device/gpu_busy_percent | sed -z -e 's/\n/%\//g' -e 's/\/$//g')"

...and it will report the gpu usage for any one or more amd or intel gpu(s)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants