如何在 tiangolo/uwsgi-nginx-flask:python3.10 (debian 10) docker 容器上安装 intel/amd64 OpenCL?

如何在 tiangolo/uwsgi-nginx-flask:python3.10 (debian 10) docker 容器上安装 intel/amd64 OpenCL?

我正在尝试让 opencl 在tiangolo/uwsgi-nginx-flask容器。

FROM tiangolo/uwsgi-nginx-flask:python3.10

RUN apt-get update
#RUN apt-get install -y -f libcrypt-dev libssl-dev openssl libgconf2-dev build-essential gcc g++ make dkms libcrypto++

RUN apt-get update && apt-get install -y \
    apt-utils \
    unzip \
    tar \
    curl \
    wget \
    xz-utils \
    alien \
    clinfo \
    software-properties-common \
    ;


ARG DEBIAN_FRONTEND=noninteractive
ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1


RUN sed -e '/focal-updates main restricted/ s/^#*/#/' -i /etc/apt/sources.list
RUN apt-get update -y && apt-get install -y \
  libc6-dev libc6 libc-bin \
  build-essential \
  pkg-config \
  cmake \
  ca-certificates \
  gnupg


RUN apt-get install -y gpg-agent wget
RUN wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | apt-key add -
RUN apt-add-repository 'deb [arch=amd64] https://repositories.intel.com/graphics/ubuntu focal main'

RUN apt-get update -y
RUN apt-get install -y intel-opencl-icd intel-level-zero-gpu level-zero intel-media-va-driver-non-free libmfx1

RUN apt-get install -y libigc-dev intel-igc-cm libigdfcl-dev libigfxcmrt-dev level-zero-dev

RUN cd /tmp
RUN wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
RUN apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
RUN rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB

RUN echo "deb https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list
RUN apt update

RUN apt-get update -y && \
 apt-get install -y --no-install-recommends \
 intel-oneapi-runtime-ccl \
 intel-oneapi-runtime-compilers \
 intel-oneapi-runtime-dal \
 intel-oneapi-runtime-dnnl \
 intel-oneapi-runtime-dpcpp-cpp \
 intel-oneapi-runtime-dpcpp-library \
 intel-oneapi-runtime-fortran \
 intel-oneapi-runtime-ipp \
 intel-oneapi-runtime-ipp-crypto \
 intel-oneapi-runtime-libs \
 intel-oneapi-runtime-mkl \
 intel-oneapi-runtime-mpi \
 intel-oneapi-runtime-opencl \
 intel-oneapi-runtime-openmp \
 intel-oneapi-runtime-tbb \
 intel-oneapi-runtime-vpl

RUN apt-get update -y && apt-get install -y software-properties-common gpg-agent wget
RUN wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | apt-key add -
RUN apt-add-repository 'deb [arch=amd64] https://repositories.intel.com/graphics/ubuntu focal main'

当我尝试通过以下方式构建上述 Dockerfile 时:

$ docker build -t try . -f ./Dockerfile

我收到以下错误:

 => ERROR [11/22] RUN apt-get install -y intel-opencl-icd intel-level-zero-gpu level-zero intel-media-va-driver-non-free libmfx1                                                                                                                     1.9s
------
 > [11/22] RUN apt-get install -y intel-opencl-icd intel-level-zero-gpu level-zero intel-media-va-driver-non-free libmfx1:
#15 0.581 Reading package lists...
#15 1.389 Building dependency tree...
#15 1.614 Reading state information...
#15 1.738 Some packages could not be installed. This may mean that you have
#15 1.738 requested an impossible situation or if you are using the unstable
#15 1.738 distribution that some required packages have not yet been created
#15 1.738 or been moved out of Incoming.
#15 1.738 The following information may help to resolve the situation:
#15 1.738
#15 1.738 The following packages have unmet dependencies:
#15 1.844  intel-level-zero-gpu : Depends: libc6 (>= 2.29) but 2.28-10 is to be installed
#15 1.844                         Depends: libgcc-s1 (>= 3.4) but it is not installable
#15 1.844                         Depends: libigdgmm11 (>= 21.2.2+i620~u20.04) but it is not going to be installed
#15 1.844                         Depends: libigc1 (>= 1.0.8517) but it is not going to be installed
#15 1.844                         Depends: libigdfcl1 (>= 1.0.8517) but it is not going to be installed
#15 1.844  intel-media-va-driver-non-free : Depends: libc6 (>= 2.29) but 2.28-10 is to be installed
#15 1.844                                   Depends: libgcc-s1 (>= 3.0) but it is not installable
#15 1.844                                   Depends: libigdgmm11 (>= 21.2.2+i620~u20.04) but it is not going to be installed
#15 1.844  intel-opencl-icd : Depends: libc6 (>= 2.29) but 2.28-10 is to be installed
#15 1.844                     Depends: libgcc-s1 (>= 3.4) but it is not installable
#15 1.844                     Depends: libigdgmm11 (>= 21.2.2+i620~u20.04) but it is not going to be installed
#15 1.844                     Depends: libstdc++6 (>= 9) but 8.3.0-6 is to be installed
#15 1.844                     Depends: libigc1 (>= 1.0.8517) but it is not going to be installed
#15 1.852                     Depends: libigdfcl1 (>= 1.0.8517) but it is not going to be installed
#15 1.852                     Recommends: intel-igc-cm (>= 1.0.1) but it is not going to be installed
#15 1.852  level-zero : Depends: libgcc-s1 (>= 3.0) but it is not installable
#15 1.852  libmfx1 : Depends: libc6 (>= 2.29) but 2.28-10 is to be installed
#15 1.852            Depends: libgcc-s1 (>= 3.0) but it is not installable
#15 1.876 E: Unable to correct problems, you have held broken packages.
------
executor failed running [/bin/sh -c apt-get install -y intel-opencl-icd intel-level-zero-gpu level-zero intel-media-va-driver-non-free libmfx1]: exit code: 100

我该如何解决这种依赖性歧义?如果它有帮助,则下划线的Linux发行版是tiangolo/uwsgi-nginx-flask

lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

答案1

使用英特尔发布的计算运行时 GitHub 存储库应该可以解决问题。

FROM tiangolo/uwsgi-nginx-flask:python3.8
#RUN echo "deb http://ftp.us.debian.org/debian testing main contrib non-free" >> /etc/apt/sources.list

RUN apt-get update

RUN apt-get update && apt-get install -y \
    apt-utils \
    unzip \
    tar \
    curl \
    wget \
    xz-utils \
    alien \
    clinfo \
    software-properties-common \
    ;


ARG DEBIAN_FRONTEND=noninteractive
ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1

RUN wget https://github.com/intel/compute-runtime/releases/download/21.13.19438/intel-gmmlib_20.4.1_amd64.deb
RUN wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.6748/intel-igc-core_1.0.6748_amd64.deb
RUN wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.6748/intel-igc-opencl_1.0.6748_amd64.deb
RUN wget https://github.com/intel/compute-runtime/releases/download/21.13.19438/intel-opencl_21.13.19438_amd64.deb
RUN wget https://github.com/intel/compute-runtime/releases/download/21.13.19438/intel-ocloc_21.13.19438_amd64.deb
RUN wget https://github.com/intel/compute-runtime/releases/download/21.13.19438/intel-level-zero-gpu_1.0.19438_amd64.deb

RUN dpkg -i *.deb


#RUN sed -e '/focal-updates main restricted/ s/^#*/#/' -i /etc/apt/sources.list
RUN apt-get update -y && apt-get install -y \
  libc6-dev libc6 libc-bin \
  build-essential \
  pkg-config \
  cmake \
  ca-certificates \
  gnupg


RUN apt-get install -y gpg-agent wget
RUN wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | apt-key add -
RUN apt-add-repository 'deb [arch=amd64] https://repositories.intel.com/graphics/ubuntu focal main'

RUN cd /tmp
RUN wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
RUN apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
RUN rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB

RUN echo "deb https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list
RUN apt update

RUN apt-get update -y && apt-get install -y software-properties-common gpg-agent wget
RUN wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | apt-key add -
RUN apt-add-repository 'deb [arch=amd64] https://repositories.intel.com/graphics/ubuntu focal main'

RUN apt-get update -y && \
 apt-get install -y --no-install-recommends \
 intel-oneapi-runtime-ccl \
 intel-oneapi-runtime-compilers \
 intel-oneapi-runtime-dal \
 intel-oneapi-runtime-dnnl \
 intel-oneapi-runtime-dpcpp-cpp \
 intel-oneapi-runtime-dpcpp-library \
 intel-oneapi-runtime-fortran \
 intel-oneapi-runtime-ipp \
 intel-oneapi-runtime-ipp-crypto \
 intel-oneapi-runtime-libs \
 intel-oneapi-runtime-mkl \
 intel-oneapi-runtime-mpi \
 intel-oneapi-runtime-opencl \
 intel-oneapi-runtime-openmp \
 intel-oneapi-runtime-tbb \
 intel-oneapi-runtime-vpl

相关内容