Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ubuntu implementation of opencl-amd AUR package, Install opencl amdgpu amdgpu-pro opencl only ubuntu 18.04 18.10 19.04 19.10 proprietary drivers
#/bin/bash
#To get up-to-date variables from aur, run this script with a random option (Ex: ./opencl-amd_aur_ubuntu.txt asdaf)
if [ "$1" = "$a" ]
then prefix='amdgpu-pro-'
postfix='-ubuntu-18.04'
major='20.10'
minor='1048554'
amdver='2.4.100'
else echo 'downloading "prefix", "amdver", "major", "minor" and "postfix" variables from aur...'
eval $(curl https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=opencl-amd|grep 'amdver\=\|major\=\|minor\=\|prefix\=\|postfix\=')
fi
shared="opt/amdgpu-pro/lib/x86_64-linux-gnu"
srcdir="$(pwd)/opencl-amd_aur_ubuntu_dir"
pkgdir="${srcdir}/pkgdir"
mkdir -p "${pkgdir}"
cd "${srcdir}"
echo "Downloading archive and extracting"
wget --referer "https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-20-10" -N -O - "https://drivers.amd.com/drivers/linux/${prefix}${major}-${minor}${postfix}.tar.xz"|tar -xJ
echo "Extraction complete, creating the files"
mkdir -p "${srcdir}/opencl"
cd "${srcdir}/opencl"
# pal
ar x "${srcdir}/${prefix}${major}-${minor}${postfix}/opencl-amdgpu-pro-icd_${major}-${minor}_amd64.deb"
tar xJf data.tar.xz
ar x "${srcdir}/${prefix}${major}-${minor}${postfix}/opencl-amdgpu-pro-comgr_${major}-${minor}_amd64.deb"
tar xJf data.tar.xz
# orca
ar x "${srcdir}/${prefix}${major}-${minor}${postfix}/opencl-orca-amdgpu-pro-icd_${major}-${minor}_amd64.deb"
tar xJf data.tar.xz
cd ${shared}
sed -i "s|libdrm_amdgpu|libdrm_amdgpo|g" libamdocl-orca64.so
mkdir -p "${srcdir}/libdrm"
cd "${srcdir}/libdrm"
ar x "${srcdir}/${prefix}${major}-${minor}${postfix}/libdrm-amdgpu-amdgpu1_${amdver}-${minor}_amd64.deb"
tar xJf data.tar.xz
cd ${shared/amdgpu-pro/amdgpu}
rm "libdrm_amdgpu.so.1"
mv "libdrm_amdgpu.so.1.0.0" "libdrm_amdgpo.so.1.0.0"
ln -s "libdrm_amdgpo.so.1.0.0" "libdrm_amdgpo.so.1"
mv "${srcdir}/opencl/etc" "${pkgdir}/"
mkdir -p ${pkgdir}/usr/lib
# pal
mv "${srcdir}/opencl/${shared}/libamdocl64.so" "${pkgdir}/usr/lib/"
mv "${srcdir}/opencl/${shared}/libamd_comgr.so" "${pkgdir}/usr/lib/"
# orca
mv "${srcdir}/opencl/${shared}/libamdocl-orca64.so" "${pkgdir}/usr/lib/"
mv "${srcdir}/opencl/${shared}/libamdocl12cl64.so" "${pkgdir}/usr/lib/"
mv "${srcdir}/libdrm/${shared/amdgpu-pro/amdgpu}/libdrm_amdgpo.so.1.0.0" "${pkgdir}/usr/lib/"
mv "${srcdir}/libdrm/${shared/amdgpu-pro/amdgpu}/libdrm_amdgpo.so.1" "${pkgdir}/usr/lib/"
mkdir -p "${pkgdir}/opt/amdgpu/share/libdrm"
cd "${pkgdir}/opt/amdgpu/share/libdrm"
ln -s /usr/share/libdrm/amdgpu.ids amdgpu.ids
rm -r "${srcdir}/opencl"
rm -r "${srcdir}/libdrm"
cd "${pkgdir}"
echo "Creating files complete, copying files to root. Enter sudo password when asked"
sudo cp -rv * /
echo Warning: remeber to remove \'mesa-opencl-icd\' \!, otherwise you will have each device in both opencl 1.1 and 1.2 modes as seperate devices . clpeak for example will report each gpu twice \! This is problematic for BOINC
@tuxutku

This comment has been minimized.

Copy link
Owner Author

tuxutku commented Nov 17, 2019

script will create opencl-amd_aur_ubuntu directory inside where current directory is.

@tuxutku

This comment has been minimized.

Copy link
Owner Author

tuxutku commented Nov 17, 2019

Warning: remeber to remove mesa-opencl-icd!, otherwise you will have each device in both opencl 1.1 and 1.2 modes as seperate devices . clpeak for example will report each gpu twice! This is problematic for BOINC

@tuxutku

This comment has been minimized.

Copy link
Owner Author

tuxutku commented Nov 17, 2019

tested on Pop!_OS 19.10

@christhegreek

This comment has been minimized.

Copy link

christhegreek commented Nov 22, 2019

**The Absolute Perfect Guide for Installing Opencl on Ubuntu/Linux Mint/Debian buster:

Download radeon driver (tested on Revision 19.30)
Extract files
tar xf amdgpu-pro-19.30-855429-ubuntu-18.04.tar.xz

Rename folder
$ mv amdgpu-pro-19.30-855429-ubuntu-18.04 amdgpu-pro-repo

Move your repository to /opt
$ sudo mv amdgpu-pro-repo /opt

Create your repository
$ sudo nano /etc/apt/sources.list.d/amdgpu-pro.list

Content:

deb [trusted=yes] file:/opt/amdgpu-pro-repo /

Update apt allowing insecure repositories security risks
$ sudo apt update --allow-insecure-repositories

Install legacy opencl driver. Allow again to install non-signed packages.
$ sudo apt install clinfo-amdgpu-pro opencl-orca-amdgpu-pro-icd

Optional steps:
8) Install package clinfo (some aplications use it)

$ sudo apt install clinfo

Remove your repository if you do not want to see more warnings during apt upgrade
$ sudo rm /etc/apt/sources.list.d/amdgpu-pro.list

Remove files if you want to save disk space
$ sudo rm -Rf /opt/amdgpu-pro-repo

Now you have your device with full opencl support. (Tested for AMD RX 570 and RX 550 graphics cards)

To remove the packages simply

$ sudo apt remove --auto-remove clinfo-amdgpu-pro opencl-orca-amdgpu-pro-icd**

@tuxutku

This comment has been minimized.

Copy link
Owner Author

tuxutku commented Nov 30, 2019

**The Absolute Perfect Guide for Installing Opencl on Ubuntu/Linux Mint/Debian buster:

Download radeon driver (tested on Revision 19.30)
Extract files
tar xf amdgpu-pro-19.30-855429-ubuntu-18.04.tar.xz

Rename folder
$ mv amdgpu-pro-19.30-855429-ubuntu-18.04 amdgpu-pro-repo

Move your repository to /opt
$ sudo mv amdgpu-pro-repo /opt

Create your repository
$ sudo nano /etc/apt/sources.list.d/amdgpu-pro.list

Content:

deb [trusted=yes] file:/opt/amdgpu-pro-repo /

Update apt allowing insecure repositories security risks
$ sudo apt update --allow-insecure-repositories

Install legacy opencl driver. Allow again to install non-signed packages.
$ sudo apt install clinfo-amdgpu-pro opencl-orca-amdgpu-pro-icd

Optional steps:
8) Install package clinfo (some aplications use it)

$ sudo apt install clinfo

Remove your repository if you do not want to see more warnings during apt upgrade
$ sudo rm /etc/apt/sources.list.d/amdgpu-pro.list

Remove files if you want to save disk space
$ sudo rm -Rf /opt/amdgpu-pro-repo

Now you have your device with full opencl support. (Tested for AMD RX 570 and RX 550 graphics cards)

To remove the packages simply

$ sudo apt remove --auto-remove clinfo-amdgpu-pro opencl-orca-amdgpu-pro-icd**

doing this trashed my system on Pop!_OS 19.10

@juanro49

This comment has been minimized.

Copy link

juanro49 commented Mar 21, 2020

**The Absolute Perfect Guide for Installing Opencl on Ubuntu/Linux Mint/Debian buster:

Download radeon driver (tested on Revision 19.30)
Extract files
tar xf amdgpu-pro-19.30-855429-ubuntu-18.04.tar.xz

Rename folder
$ mv amdgpu-pro-19.30-855429-ubuntu-18.04 amdgpu-pro-repo

Move your repository to /opt
$ sudo mv amdgpu-pro-repo /opt

Create your repository
$ sudo nano /etc/apt/sources.list.d/amdgpu-pro.list

Content:

deb [trusted=yes] file:/opt/amdgpu-pro-repo /

Update apt allowing insecure repositories security risks
$ sudo apt update --allow-insecure-repositories

Install legacy opencl driver. Allow again to install non-signed packages.
$ sudo apt install clinfo-amdgpu-pro opencl-orca-amdgpu-pro-icd

Optional steps:
8) Install package clinfo (some aplications use it)

$ sudo apt install clinfo

Remove your repository if you do not want to see more warnings during apt upgrade
$ sudo rm /etc/apt/sources.list.d/amdgpu-pro.list

Remove files if you want to save disk space
$ sudo rm -Rf /opt/amdgpu-pro-repo

Now you have your device with full opencl support. (Tested for AMD RX 570 and RX 550 graphics cards)

To remove the packages simply

$ sudo apt remove --auto-remove clinfo-amdgpu-pro opencl-orca-amdgpu-pro-icd**

I try this, but when I reboot, Xorg doesn't start because can't connect to OpenGL render. This is inxi info before install and after install:
imagen

@rgo

This comment has been minimized.

Copy link

rgo commented Mar 31, 2020

Worked for me in Ubuntu 19.10 making the following changes:

Fix URL download path:

# Original
12: wget --referer "https://support.amd.com/en-us/kb-articles/Pages/AMDGPU-PRO-Driver-for-Linux-Release-Notes.aspx" -N -O - "https://drivers.amd.com/drivers/linux/${prefix}${major}-${minor}${postfix}.tar.xz"|tar -xJ
#Modified
12: wget --referer "https://support.amd.com/en-us/kb-articles/Pages/AMDGPU-PRO-Driver-for-Linux-Release-Notes.aspx" -N -O - "https://drivers.amd.com/drivers/linux/${major}/${prefix}${major}-${minor}${postfix}.tar.xz"|tar -xJ

Updating version:

# Original
26: ar x "${srcdir}/${prefix}${major}-${minor}${postfix}/libdrm-amdgpu-amdgpu1_2.4.98-${minor}_amd64.deb"
#Fixed
26: ar x "${srcdir}/${prefix}${major}-${minor}${postfix}/libdrm-amdgpu-amdgpu1_2.4.99-${minor}_amd64.deb"

Now darktable is working and steam :)
Thanks!

@FlorianTimm

This comment has been minimized.

Copy link

FlorianTimm commented Apr 26, 2020

Thank you! Worked for me with two little changes in URL and libdrm version.

--- opencl-amd_aur_ubuntu_old.sh 2020-04-26 14:40:54.280375393 +0200
+++ opencl-amd_aur_ubuntu.sh 2020-04-26 14:40:54.288375312 +0200
@@ -12 +12 @@
-wget --referer "https://support.amd.com/en-us/kb-articles/Pages/AMDGPU-PRO-Driver-for-Linux-Release-Notes.aspx" -N -O - "https://drivers.amd.com/drivers/linux/${prefix}${major}-${minor}${postfix}.tar.xz"|tar -xJ
+wget --referer "https://support.amd.com/en-us/kb-articles/Pages/AMDGPU-PRO-Driver-for-Linux-Release-Notes.aspx" -N -O - "https://drivers.amd.com/drivers/linux//${major}/${prefix}${major}-${minor}${postfix}.tar.xz"|tar -xJ
@@ -26 +26 @@
-ar x "${srcdir}/${prefix}${major}-${minor}${postfix}/libdrm-amdgpu-amdgpu1_2.4.98-${minor}_amd64.deb"
+ar x "${srcdir}/${prefix}${major}-${minor}${postfix}/libdrm-amdgpu-amdgpu1_2.4.99-${minor}_amd64.deb"

@tuxutku

This comment has been minimized.

Copy link
Owner Author

tuxutku commented Apr 26, 2020

thanks @rgo, @FlorianTimm I have updated my script to fix problems, for "2.4.98" aur is now using "amdver" variable so I have adapted that too.
I have also added a feature where if script is run with any random option it will pull "prefix", "amdver", "major", "minor" and "postfix" variables from aur script (Ex: ./opencl-amd_aur_ubuntu.txt asdaf)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.