blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
19.22k stars 1.76k forks source link

[HW Accel Support]: Unable to tell if hardware accelaration is running #9550

Closed kmelihk closed 9 months ago

kmelihk commented 9 months ago

Describe the problem you are having

Hello, I just added an nvidia card to this server, after a bit of struggle, I was able to pass the card to docker from what I can tell. When I type nvidia-smi inside the container, I get the following

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.147.05   Driver Version: 525.147.05   CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| 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 ...  On   | 00000000:00:1B.0 Off |                  N/A |
| 42%   51C    P8    N/A /  19W |      1MiB /  2048MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

When I go to system page on Frigate, I get the following:

GPU % | Memory % | Decoder % | Encoder %
-- | -- | -- | --
0.0% | 2.4% | 0.0% | -1.0%

If I click on vainfo button, I get the message below:

Return Code: 3

Process Error:

error: XDG_RUNTIME_DIR is invalid or not set in the environment.
error: can't connect to X server!
libva info: VA-API version 1.17.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

Is this output expected? Where can I continue troubleshooting? Any help is appreciated.

Version

0.13.1-34fb1c2

Frigate config file

ffmpeg:
  hwaccel_args: preset-nvidia-h264

docker-compose file or Docker CLI command

version: "3.9"
services:
  frigate:
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: unless-stopped
    image: ghcr.io/blakeblackshear/frigate:stable
    shm_size: "256mb" # update for your cameras based on calculation above
    devices:
      #- /dev/bus/usb:/dev/bus/usb # passes the USB Coral, needs to be modified for other versions
      - /dev/apex_0:/dev/apex_0 # passes a PCIe Coral, follow driver instructions here https://coral.ai/docs/m2/get-started/#2a-on-linux
      - /dev/apex_0:/dev/apex_1
      - /dev/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
      - /dev/dri/
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /root/config.yml:/config/config.yml
      - /mnt/NVR-Storage:/media/frigate
      - /root/config:/config
      - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 4000000000
    ports:
      - "5000:5000"
      - "8554:8554" # RTSP feeds
      - "8555:8555/tcp" # WebRTC over tcp
      - "8555:8555/udp" # WebRTC over udp
    environment:
      FRIGATE_RTSP_PASSWORD: "password"
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              device_ids: ['0']
              capabilities: [gpu]

Relevant log output

No errors on log

FFprobe output from your camera

N/A

Operating system

Proxmox

Install method

Docker Compose

Network connection

Wired

Camera make and model

Reolink

Any other information that may be helpful

No response

NickM-27 commented 9 months ago

Try running nvidia-smi on the host. And it would be good that see the whole config file

kmelihk commented 9 months ago

Thank you for helping me out again, I see ffmpeg using the card on the host:

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A     63639      C   ffmpeg                             61MiB |
|    0   N/A  N/A     63640      C   ffmpeg                             61MiB |
|    0   N/A  N/A     63649      C   ffmpeg                             61MiB |
|    0   N/A  N/A     63651      C   ffmpeg                            136MiB |
+-----------------------------------------------------------------------------+

So that should mean it's being utilized properly, shouldn't vainfo show more information though?

NickM-27 commented 9 months ago

No, vainfo doesn't apply to nvidia. That's only for Intel and amd

kmelihk commented 9 months ago

That explains it, thank you for your support