blakeblackshear / frigate

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

Does frigate support INTEL-GPU-SRIOV? #14840

Open fay000fay opened 2 weeks ago

fay000fay commented 2 weeks ago

I am using an n100 CPU, running LXC in PVE 8.2.7, and deploying frigate in a docker with version 0.14.1. I have enabled the CPU's SRIOV function and successfully virtualized 4 virtual GPUs. However, frigate encountered an error,However, if I disable SRIOV, frigate can access the GPU normally. This is very strange, could it be that frigate is not compatible with SRIOV?

ERROR : Unable to poll intel GPU stats: Failed to detect engines! (No such file or directory) 2024-11-06 13:30:54.245952251 (Kernel 4.16 or newer is required for i915 PMU support.)

Here is my LXC configuration file:

arch: amd64 cores: 2 features: fuse=1,mknod=1,nesting=1 hostname: frigate memory: 4096 mp0: /mnt,mp=/mnt net0: name=eth0,bridge=vmbr0,firewall=1,gw=192.168.100.3,hwaddr=BC:24:11:FE:EE:3A,ip=192.168.100.171/24,type=veth onboot: 0 ostype: alpine rootfs: local:101/vm-101-disk-0.raw,size=10G swap: 512 lxc.mount.entry: /dev/dri/card0 dev/dri/card0 none bind,optional,create=file lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file lxc.cgroup2.devices.allow: c 226:0 rwm lxc.cgroup2.devices.allow: c 226:128 rwm lxc.apparmor.profile: unconfined lxc.cgroup.devices.allow: a lxc.cap.drop:

Here is my docker-compose.yaml file:

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"
    devices:
      - /dev/dri/renderD128:/dev/dri/renderD128
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /mnt/frigate/config:/config
      - /mnt/frigate/video:/media/frigate
      - type: tmpfs
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "8971:8971"
      - "1984:1984"
      - "9150:5000"
      - "8554:8554"
      - "8555:8555/tcp"

Here is the log of my frigate:

2024-11-06 13:30:37.630971506 [INFO] Preparing Frigate... 2024-11-06 13:30:37.654593663 [INFO] Starting Frigate... 2024-11-06 13:30:39.299050768 [2024-11-06 13:30:39] frigate.app INFO : Starting Frigate (0.14.1-f4f3cfa) 2024-11-06 13:30:39.299353049 [2024-11-06 13:30:39] frigate.util.config INFO : Checking if frigate config needs migration... 2024-11-06 13:30:39.339558101 [2024-11-06 13:30:39] frigate.util.config INFO : frigate config does not need migration... 2024-11-06 13:30:46.753884993 [2024-11-06 13:30:46] peewee_migrate.logs INFO : Starting migrations 2024-11-06 13:30:46.754131689 [2024-11-06 13:30:46] peewee_migrate.logs INFO : There is nothing to migrate 2024-11-06 13:30:46.763016435 [2024-11-06 13:30:46] frigate.app INFO : Recording process started: 345 2024-11-06 13:30:46.767461716 [2024-11-06 13:30:46] frigate.app INFO : Recording process started: 347 2024-11-06 13:30:46.769435421 [2024-11-06 13:30:46] frigate.app INFO : go2rtc process pid: 101 2024-11-06 13:30:46.790650155 [2024-11-06 13:30:46] detector.ov INFO : Starting detection process: 374 2024-11-06 13:30:46.792243381 [2024-11-06 13:30:46] frigate.app INFO : Output process started: 376 2024-11-06 13:30:46.836122486 [2024-11-06 13:30:46] frigate.app INFO : Camera processor started for laojiaoutdoor: 394 2024-11-06 13:30:46.844010821 [2024-11-06 13:30:46] frigate.app INFO : Capture process started for laojiaoutdoor: 395 2024-11-06 13:30:54.245948418 [2024-11-06 13:30:54] frigate.util.services ERROR : Unable to poll intel GPU stats: Failed to detect engines! (No such file or directory) 2024-11-06 13:30:54.245952251 (Kernel 4.16 or newer is required for i915 PMU support.) 2024-11-06 13:30:54.245954102 timeout: the monitored command dumped core 2024-11-07 09:01:20.132814 2024-11-06 13:30:54.245955295

微信截图_20241107091122

NickM-27 commented 2 weeks ago

Your logs don't show any camera errors so looks like it is working

fay000fay commented 2 weeks ago

Your logs don't show any camera errors so looks like it is working

there is one error below, and GPU is not working 2024-11-06 13:30:54.245948418 [2024-11-06 13:30:54] frigate.util.services ERROR : Unable to poll intel GPU stats: Failed to detect engines! (No such file or directory) 2024-11-06 13:30:54.245952251 (Kernel 4.16 or newer is required for i915 PMU support.)

NickM-27 commented 2 weeks ago

Right, there's nothing wrong just means stats don't work. Not sure how we'd fix that exactly

guoqiang881245 commented 2 weeks ago

I also found the same problem. ERROR: Unable to poll intel GPU stats: Failed to detect engines! (No such file or directory), did not seem to support the sriov CPU, did not find a solution for two days, and finally gave up, do not use the sriov driver.

guoqiang881245 commented 2 weeks ago

The camera is working properly, the detector cannot be used, and even if it can use the CPU, it is very expensive

fay000fay commented 2 weeks ago

The camera is working properly, the detector cannot be used, and even if it can use the CPU, it is very expensive

是的。我也暂时放弃了。不过我SRIOV还是开着,虚拟核显分给飞牛NAS影视用来解码用是可以的,在飞牛NAS里装了个Intel驱动,就成功调用虚拟GPU了。只是Frigate无论装在LXC,还是虚拟机,还是HA的addon,只要是虚拟的,一律无法调用,切换到物理GPU后,就可以了。

guoqiang881245 commented 2 weeks ago

是的,没什么问题,只是意味着统计数据不起作用。不知道我们该如何解决这个问题

The camera is not a problem, the object detector can not call the GPU