Alfred's New Ramblings

Let’s give Immich some GPU

Immich uses machine learning to extract info like text and faces from the photos. To aid this, it can use the GPU like any AI.

In the docker compose file, add the following in bold. Note the indentations are sensitive.

immich-machine-learning:
  image: ghcr.io/immich-app/immich-machine-learning:release-openvino
  devices:
    - /dev/dri:/dev/dri

Start the container by

docker compose up -d

Check if /dev/dri is available inside the container

docker exec -it immich_machine_learning ls /dev/dri

There should be

card0
renderD128

I got

by-path
card0

Install the GPU drivers

sudo apt install mesa-utils -y
sudo apt install intel-gpu-tools -y
lspci | grep -i vga

It should return

00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630

Check the Docker OpenVINO status

docker exec -it immich_machine_learning python3 -c "import onnxruntime as ort; print(ort.get_available_providers())"

Both of the following should be shown. If it shows CPUExecution Provider only it means GPU support is not available.

['OpenVINOExecutionProvider', 'CPUExecutionProvider']

Immich machine learning is now running on the GPU.

The ls dev/dri command should show the following

card0
renderD128

My setup shows only card0, which is a virtual GPU. I need to passthrough the GPU functions from Proxmox into Debian. In the Proxmox, find the GPU hardware.

lspci | grep -i vga

The output should be something like this:

00:02.0 VGA compatible controller [0300]: Intel Corporation UHD Graphics 630 [8086:3e92]
qm list
qm stop <VMID>
qm set <VMID> -hostpci0 00:02.0 
qm start <VMID>

Inside Debian, list again.

ll /dev/dri 
 
drwxr-xr-x 2 root root 100 Jul 2 10:44 by-path 
crw-rw----+ 1 root video 226, 0 Jul 2 10:44 card0 
crw-rw----+ 1 root video 226, 1 Jul 2 10:44 card1 
crw-rw----+ 1 root render 226, 128 Jul 2 10:44 renderD128 

In Jellyfin’s Dashboard, Playback, Encoding, set the following to use the GPU

Hardware acceleration

VA API

VA API Device

/dev/dri/renderD128

To check verify use

sudo apt update
sudo apt install intel-gpu-tools
sudo intel_gpu_top

Play a video at a very high or low bitrate. The video bar should be high. Click on thumbnail below for a bigger picture




One thought on “Let’s give Immich some GPU

  1. Pingback: New Immich server - Alfred’s New Ramblings

Leave a Reply

Your email address will not be published. Required fields are marked *