DEV Community

Dmitry Gordin
Dmitry Gordin

Posted on • Edited on

The minimal setup for OpenVino iGPU

Python script to print available execution providers and devices:

# pip install openvino

import openvino as ov
core = ov.Core()
for d in core.available_devices:
    print(d, "-", core.get_property(d, "FULL_DEVICE_NAME"))
Enter fullscreen mode Exit fullscreen mode

To access iGPU on current machine:

sudo apt install intel-opencl-icd
sudo usermod -a -G render $LOGNAME
Enter fullscreen mode Exit fullscreen mode

Optional tools, helpful for debugging:

sudo apt install htop clinfo intel-gpu-tools
Enter fullscreen mode Exit fullscreen mode
  • clinfo - detailed info about devices available
  • htop - cpu and mem utilisation
  • intel_gpu_top - igpu load

For docker:

FROM python:3.12-slim

# intel-opencl-icd is required
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
    apt-get install -y --no-install-recommends intel-opencl-icd && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /app
RUN pip install --no-cache-dir openvino
COPY main.py .
CMD ["python", "main.py"]
Enter fullscreen mode Exit fullscreen mode

docker-compose.yml

services:
  app:
    build: 
      context: .
    devices:
      - /dev/dri:/dev/dri
Enter fullscreen mode Exit fullscreen mode

User inside docker must be root, otherwise you have to deal with permissions.

Top comments (0)