OpenCL on Ubuntu 24.04 with open source drivers only
Running OpenCL on Linux with older AMD GPU (not supported by ROCm) has been mostly disappointing.
Recently, I've stumbled upon Rusticl which an OpenCL implementation on Mesa Galium driver.
However, my current Ubuntu 24.04 does not come with latest mesa packages and I'd prefer to not install kisak-mesa PPA which can sometimes mess up the system when upgrading Ubuntu.
It seems that Fedora comes with latest Mesa packages with rusticl enabled and I found this blog describing how to install the required packages: https://nullr0ute.com/2023/12/getting-started-with-opencl-using-mesa-rusticl/
Based on that, I've found a way to use OpenCL with rusticl within podman/docker container.
Here's the Dockerfile:
FROM fedora
ENV RUSTICL_ENABLE=radeonsi
ENV http_proxy=http://192.168.0.130:3128/
RUN dnf install -y mesa-libOpenCL mesa-dri-drivers spirv-llvm-translator spirv-tools-libs clinfo clpeak
RUN cd /root && \
curl -L https://cdn.geekbench.com/Geekbench-6.3.0-Linux.tar.gz -O && \
tar xaf Geekbench-6.3.0-Linux.tar.gz && \
rm -f Geekbench-6.3.0-Linux.tar.gz
ENV PATH="$PATH:/root/Geekbench-6.3.0-Linux"
WORKDIR /root/Geekbench-6.3.0-Linux/
Build the podman/docker image:
$ podman build -t ocl_geekbench6 -f ./Dockerfile
Podman/Docker command:
# To get the list of OpenCL GPUs:
$ podman run -it --rm --device=/dev/dri --security-opt seccomp=unconfined ocl_geekbench6 clinfo --list
Platform #0: Clover
`-- Device #0: AMD Radeon RX Vega M GH Graphics (radeonsi, vegam, LLVM 19.1.0, DRM 3.57, 6.8.0-51-generic)
Platform #1: rusticl
`-- Device #0: AMD Radeon RX Vega M GH Graphics (radeonsi, vegam, LLVM 19.1.0, DRM 3.57, 6.8.0-51-generic)
# To run geekbench on rusticl (platform #1):
$ podman run -it --rm --device=/dev/dri --security-opt seccomp=unconfined ocl_geekbench6 geekbench6 --gpu opencl --gpu-platform 1
Geekbench 6.3.0 : https://www.geekbench.com/
Geekbench 6 requires an active internet connection and automatically uploads
benchmark results to the Geekbench Browser.
...
OpenCL Information
Platform Vendor Mesa/X.org
Platform Name rusticl
Device Vendor AMD
Device Name AMD Radeon RX Vega M GH Graphics (radeonsi, vegam, LLVM 19.1.0, DRM 3.57, 6.8.0-51-generic)
Device Driver Version 24.2 .8
Maximum Frequency 1190 MHz
Compute Units 24
Device Memory 4.00 GB
OpenCL
Running Background Blur
Running Face Detection
Running Horizon Detection
Running Edge Detection
Running Gaussian Blur
Running Feature Matching
Running Stereo Matching
Running Particle Physics
Comments