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 ```
author | beco132 |
---|---|
permlink | amdgpu-pro-opencl-docker-image |
category | linux |
json_metadata | {"app":"peakd/2023.1.1","format":"markdown","tags":["linux","opencl","docker"],"users":[],"image":[]} |
created | 2023-01-19 21:01:27 |
last_update | 2023-01-19 21:01:27 |
depth | 0 |
children | 1 |
last_payout | 2023-01-26 21:01:27 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 1.547 HBD |
curator_payout_value | 1.542 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 2,791 |
author_reputation | 13,334,818,383,892 |
root_title | "AMDGPU-PRO OpenCL Docker image" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 120,024,873 |
net_rshares | 5,770,820,839,310 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
gamer00 | 0 | 7,119,940,464 | 5% | ||
ambyr00 | 0 | 1,203,281,632 | 0.75% | ||
cryptoknight12 | 0 | 8,949,930,646 | 41.32% | ||
emekasegun | 0 | 590,652,246 | 20.66% | ||
sneakyninja | 0 | 12,349,009,812 | 20.66% | ||
steembasicincome | 0 | 2,039,709,135,175 | 100% | ||
mastergerund | 0 | 9,164,857,210 | 41.32% | ||
anikys3reasure | 0 | 2,463,668,916 | 50% | ||
oadissin | 0 | 11,698,000,762 | 50% | ||
sbi2 | 0 | 1,392,926,388,198 | 100% | ||
sbi3 | 0 | 722,661,742,522 | 100% | ||
sbi4 | 0 | 636,738,520,427 | 100% | ||
sbi5 | 0 | 379,817,229,859 | 100% | ||
sbi6 | 0 | 276,696,923,980 | 100% | ||
thedailysneak | 0 | 16,672,652,539 | 20.66% | ||
sbi7 | 0 | 178,369,608,979 | 100% | ||
babysavage | 0 | 6,462,042,538 | 41.32% | ||
ravensavage | 0 | 3,594,712,627 | 41.32% | ||
sbi8 | 0 | 44,761,646,324 | 34.67% | ||
piestrikesback | 0 | 646,291,404 | 100% | ||
sbi-tokens | 0 | 9,431,371,356 | 41.32% | ||
qwertm | 0 | 3,443,596,924 | 50% | ||
dpend.active | 0 | 1,523,116,158 | 4.13% | ||
sketching | 0 | 2,435,169,439 | 20.66% | ||
kiemis | 0 | 525,719,521 | 2.5% | ||
sovstar | 0 | 575,372,158 | 20.66% | ||
sthor | 0 | 290,257,494 | 100% |
Congratulations @beco132! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s) <table><tr><td><img src="https://images.hive.blog/60x70/http://hivebuzz.me/@beco132/upvotes.png?202301250431"></td><td>You distributed more than 72000 upvotes.<br>Your next target is to reach 73000 upvotes.</td></tr> </table> <sub>_You can view your badges on [your board](https://hivebuzz.me/@beco132) and compare yourself to others in the [Ranking](https://hivebuzz.me/ranking)_</sub> <sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub> **Check out our last posts:** <table><tr><td><a href="/hive-139531/@hivebuzz/proposal-2324"><img src="https://images.hive.blog/64x128/https://i.imgur.com/RNIZ1N6.png"></a></td><td><a href="/hive-139531/@hivebuzz/proposal-2324">The Hive Gamification Proposal</a></td></tr></table> ###### Support the HiveBuzz project. [Vote](https://hivesigner.com/sign/update_proposal_votes?proposal_ids=%5B%22248%22%5D&approve=true) for [our proposal](https://peakd.com/me/proposals/248)!
author | hivebuzz |
---|---|
permlink | notify-beco132-20230125t043925 |
category | linux |
json_metadata | {"image":["http://hivebuzz.me/notify.t6.png"]} |
created | 2023-01-25 04:39:24 |
last_update | 2023-01-25 04:39:24 |
depth | 1 |
children | 0 |
last_payout | 2023-02-01 04:39:24 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,104 |
author_reputation | 368,226,314,729,979 |
root_title | "AMDGPU-PRO OpenCL Docker image" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 120,175,012 |
net_rshares | 0 |