b3rs3rk / gpustat-unraid

An UnRAID plugin for displaying GPU status
https://forums.unraid.net/topic/89453-plugin-gpu-statistics/?tab=comments#comment-830112
MIT License
50 stars 14 forks source link

[ENHANCEMENT] - Frigate Icon #40

Open shadow7412 opened 2 years ago

shadow7412 commented 2 years ago

Can we add https://frigate.video to the list of detected applications? It's the only one I have running 24/7.

b3rs3rk commented 2 years ago

@shadow7412 Can you get me the result of nvidia-smi while Frigate is actively using your GPU? I need to see what process it runs to trigger the app detection.

shadow7412 commented 2 years ago
Tue Nov  8 23:28:17 2022       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.76       Driver Version: 515.76       CUDA Version: 11.7     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:41:00.0 Off |                  N/A |
| 20%   67C    P2    51W / 180W |    592MiB /  8192MiB |      5%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A     44160      C   ffmpeg                            323MiB |
|    0   N/A  N/A    125423      C   ffmpeg                            267MiB |
+-----------------------------------------------------------------------------+

Hmm. You might not have a great deal to work with here...

shadow7412 commented 2 years ago

(both of those are frigate, by the way)

b3rs3rk commented 2 years ago

You're right about that. I have a second method of detection though but is an extra step. Again, while Frigate is using your GPU, take the PID from nvidia-smi for each process and execute the following for each process and paste it to me:

cat /proc/<pid>/cmdline

shadow7412 commented 2 years ago
ffmpeg-hide_banner-loglevelwarning-c:vh264_cuvid-avoid_negative_tsmake_zero-fflags+genpts+discardcorrupt-rtsp_transporttcp-stimeout5000000-use_wallclock_as_timestamps1-irtsp://[URL_REDACTED]-fsegment-segment_time10-segment_formatmp4-reset_timestamps1-strftime1-c:vcopy-c:aaac/tmp/cache/front-%Y%m%d%H%M%S.mp4-ccopy-fflvrtmp://127.0.0.1/live/front-r5-s1280x720-frawvideo-pix_fmtyuv420ppipe

Poking around in there for anything useful, I did come across /proc/44160/cwd which contains a folder called frigate... but that's the best I could see. Perhaps you know of something in there that might be more useful (like, getting the parent pid?)

shadow7412 commented 2 years ago

Ok.

So, the following steps seem to work.

  1. nvidia-smi (to get the pid)
  2. cat /proc/53892/task/53892/status | grep PPid (where 53892 is the pid found in the previous step. Note it's present twice in this command)
  3. cat /proc/91204/cmdline to get the command line of the parent process, which is python3-u-mfrigate.
b3rs3rk commented 2 years ago

@shadow7412 Does the plugin detect Frigate now?

shadow7412 commented 2 years ago

Looks like there's been a regression :( image

Are there any logs I could attach to help you diagnose what's wrong? (There's no related javascript errors coming up in the console)

b3rs3rk commented 2 years ago

@shadow7412 Can you update your plugin and test again? Thanks.

shadow7412 commented 2 years ago

I just updated - the plugin is no longer broken, but I'm not seeing frigate in the active apps.

shadow7412 commented 2 years ago

Here is a screenshot of me going through the process I outlined in the ticket above, in case that helps you in any way. image

b3rs3rk commented 2 years ago

Hmm, I'll have to look at my code again, but my initial impression is that it should be working with the parent process detection I added.

shadow7412 commented 2 years ago

I had a poke around - and have raised a PR with a change I think will do the trick.

shadow7412 commented 2 years ago

Let me know when I can test the release.

b3rs3rk commented 2 years ago

@shadow7412 You should be able to update and try now

shadow7412 commented 2 years ago

Hmm. Still no dice...

shadow7412 commented 1 year ago

For what it's worth, upgrading unraid to 6.11.5 didn't seem to make an impact.