
AMDGPU-PRO OpenCL Docker image
OpenCL in Docker uses the open-source amd-gpu driver and can be used for mining and/or (hopefully) in some machine learning projects
The host
OS: Debian GNU/Linux 11 (bullseye)
Video card: [AMD/ATI] Baffin [Radeon RX 460/560D / Pro 450/455/460/555/555X/560/560X]
With default Debian installation, the following message appeared in the kernel log:
[drm:amdgpu_pci_probe [amdgpu]] *ERROR* amdgpu requires firmware installed
To get rid of it I had to install the firmware-linux package with the following command:
apt-get update && apt-get install firmware-linux
This assumes the non-free and contrib repositories are enabled on the host.
After successful installation and reboot, the AMD video card should be functional and the following devices available:
/dev/dri/*
/dev/kfd
Here is the Dockerfile that I used for building the image:
FROM debian:bullseye-20230109-slim as base
RUN \
export DEBIAN_FRONTEND=noninteractive &&\
apt-get update -qq &&\
apt-get install -qq --no-install-suggests --no-install-recommends \
curl ca-certificates xz-utils
ARG RENDER_GID=106
RUN \
groupadd -g ${RENDER_GID} render &&\
useradd -c "OpenCL user" -s /bin/bash -m -u 9999 -g render opencl
ARG BUILD_DIR="amdgpu-pro-20.45-1188099-ubuntu-20.04"
ARG DOWNLOAD_URL="https://drivers.amd.com/drivers/linux/amdgpu-pro-20.45-1188099-ubuntu-20.04.tar.xz"
ARG AMD_REF="https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-20-45"
RUN \
cd /tmp &&\
curl -O -L --referer "${AMD_REF}" "${DOWNLOAD_URL}" &&\
tar -Jxf "${BUILD_DIR}.tar.xz"
RUN \
cd "/tmp/${BUILD_DIR}" &&\
export DEBIAN_FRONTEND=noninteractive &&\
./amdgpu-install -y --no-32 --opencl=legacy --no-dkms
RUN ln -s /opt/amdgpu-pro/lib/x86_64-linux-gnu/libOpenCL.so.1.2 /lib/x86_64-linux-gnu/libOpenCL.so
The Dockerfile uses Debian Bullseye slim as base image, and then installs curl, ca-certificates and xz-utils in order to download the driver from AMD website. It then creates a new group and user named 'render' and 'opencl' respectively which will have access to opencl devices. The RENDER_GID build arg must match the gid of render group on the host.
It installs AMDGPU-PRO version 20.45-1188099-ubuntu-20.04, this is the latest one that I found which can be installed on Debian. The newer versions are available only as Ubuntu deb packages and have some dependencies which could not be resolved in Debian based image.
The last step (the libOpenCL.so symlink) was added because some application complained about missing library during tests.
I build and test the image with the following commands:
docker build -t opencl ./
docker run -it --rm --name opencl --device /dev/dri:/dev/dri --device /dev/kfd:/dev/kfd opencl-test /opt/amdgpu-pro/bin/clinfo
Leave AMDGPU-PRO OpenCL Docker image to:
Read more #linux posts
Best Posts From beco132
We have not curated any of beco132's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From beco132
- Hived@Home
- Winter walk on the beach
- AMDGPU-PRO OpenCL Docker image
- Silver League reached
- Running My Own Hive Engine Node - Almost Success
- Splinterlands - A Trading Surprise From WAX Blockchain
- Cryptobrewmaster - final reward and sell off
- Phantom Of The Abyss Is Winning My Battles
- Splinterlands - End Of Season Rewards
- Splinterlands Quest Rewards