Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A shell script to install AMDGPU-PRO OpenCL driver.
#!/bin/bash
# This script will install AMDGPU-PRO OpenCL and Vulkan support.
#
# For Ubuntu and it's flavor, just install the package using this command
# in extracted driver directory instread.
#
# ./amdgpu-pro-install --opencl=legacy,pal --headless --no-dkms
#
# For Arch Linux or Manjaro, use the opencl-amd or rocm-opencl-runtime on AUR instread.
#
# To use amdvlk driver, launch the program/game with this command :
#
# VK_ICD_FILENAMES="/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json" game64
#
# If the program/game is 32bit, use this command :
#
# VK_ICD_FILENAMES="/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd32.json" game32
#
prefix='amdgpu-pro'
# amdgpu-pro package version
major='21'
minor='10'
build='1247438'
system='ubuntu-20.04'
# libdrm-amdgpu-amdgpu1 version
libdrmver='2.4.100'
libamd_comgrver='2.0.0'
libhsa_ver='1.3.0'
shared32="/opt/amdgpu-pro/lib/i386-linux-gnu"
shared64="/opt/amdgpu-pro/lib/x86_64-linux-gnu"
ids="/opt/amdgpu/share/libdrm"
vk_icd="/opt/amdgpu-pro/etc/vulkan/icd.d"
# make sure we’re running with root permissions.
if [ `whoami` != root ]; then
echo Please run this script using sudo
exit
fi
# check for 64-bit arch
if [ $(uname -m) != 'x86_64' ]; then
echo This install script support only 64-bit linux.
exit
fi
# download and extract drivers
rm -r ${prefix}-${major}.${minor}-${build}-${system} &>/dev/null
if [ ! -f ./${prefix}-${major}.${minor}-${build}-${system}.tar.xz ]; then
wget --referer https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-21-10 https://drivers.amd.com/drivers/linux/${prefix}-${major}.${minor}-${build}-${system}.tar.xz
fi
tar xJf ${prefix}-${major}.${minor}-${build}-${system}.tar.xz
cd ${prefix}-${major}.${minor}-${build}-${system}
echo Extracting AMDGPU-PRO OpenCL driver files...
#ar x "../${prefix}-${major}.${minor}-${build}-${system}/clinfo-amdgpu-pro_${major}.${minor}-${build}_amd64.deb"
#tar xJf data.tar.xz
#ar x "../${prefix}-${major}.${minor}-${build}-${system}/clinfo-amdgpu-pro_${major}.${minor}-${build}_i386.deb"
#tar xJf data.tar.xz
ar x "../${prefix}-${major}.${minor}-${build}-${system}/comgr-amdgpu-pro_${libamd_comgrver}-${build}_amd64.deb"
tar xJf data.tar.xz
#ar x "../${prefix}-${major}.${minor}-${build}-${system}/comgr-amdgpu-pro-dev_${libamd_comgrver}-${build}_amd64.deb"
#tar xJf data.tar.xz
ar x "../${prefix}-${major}.${minor}-${build}-${system}/hip-rocr-amdgpu-pro_${major}.${minor}-${build}_amd64.deb"
tar xJf data.tar.xz
ar x "../${prefix}-${major}.${minor}-${build}-${system}/hsa-runtime-rocr-amdgpu_${libhsa_ver}-${build}_amd64.deb"
tar xJf data.tar.xz
#ar x "../${prefix}-${major}.${minor}-${build}-${system}/hsa-runtime-rocr-amdgpu-dev_${libhsa_ver}-${build}_amd64.deb"
#tar xJf data.tar.xz
ar x "../${prefix}-${major}.${minor}-${build}-${system}/hsakmt-roct-amdgpu_1.0.9-${build}_amd64.deb"
tar xJf data.tar.xz
#ar x "../${prefix}-${major}.${minor}-${build}-${system}/hsakmt-roct-amdgpu-dev_1.0.9-${build}_amd64.deb"
#tar xJf data.tar.xz
ar x "../${prefix}-${major}.${minor}-${build}-${system}/libdrm-amdgpu-amdgpu1_${libdrmver}-${build}_amd64.deb"
tar xJf data.tar.xz
ar x "../${prefix}-${major}.${minor}-${build}-${system}/libdrm-amdgpu-amdgpu1_${libdrmver}-${build}_i386.deb"
tar xJf data.tar.xz
ar x "../${prefix}-${major}.${minor}-${build}-${system}/libdrm-amdgpu-common_1.0.0-${build}_all.deb"
tar xJf data.tar.xz
ar x "../${prefix}-${major}.${minor}-${build}-${system}/opencl-orca-amdgpu-pro-icd_${major}.${minor}-${build}_amd64.deb"
tar xJf data.tar.xz
ar x "../${prefix}-${major}.${minor}-${build}-${system}/opencl-orca-amdgpu-pro-icd_${major}.${minor}-${build}_i386.deb"
tar xJf data.tar.xz
ar x "../${prefix}-${major}.${minor}-${build}-${system}/opencl-rocr-amdgpu-pro_${major}.${minor}-${build}_amd64.deb"
tar xJf data.tar.xz
#ar x "../${prefix}-${major}.${minor}-${build}-${system}/opencl-rocr-amdgpu-pro-dev_${major}.${minor}-${build}_amd64.deb"
#tar xJf data.tar.xz
ar x "../${prefix}-${major}.${minor}-${build}-${system}/rocm-device-libs-amdgpu-pro_1.0.0-${build}_amd64.deb"
tar xJf data.tar.xz
ar x "../${prefix}-${major}.${minor}-${build}-${system}/vulkan-amdgpu-pro_${major}.${minor}-${build}_amd64.deb"
tar xJf data.tar.xz
ar x "../${prefix}-${major}.${minor}-${build}-${system}/vulkan-amdgpu-pro_${major}.${minor}-${build}_i386.deb"
tar xJf data.tar.xz
# Remove target directory
echo Remove target directory.
rm -r /opt/amdgpu &>/dev/null
rm -r /opt/amdgpu-pro &>/dev/null
# Create target directory
echo Create target directory.
mkdir -p ${ids}
mkdir -p ${shared32}
mkdir -p ${shared64}
mkdir -p ${vk_icd}
echo Patch and installing AMDGPU-PRO OpenCL driver...
rm /etc/OpenCL/vendors/amdocl-orca64.icd
rm /etc/OpenCL/vendors/amdocl-orca32.icd
rm /etc/OpenCL/vendors/amdocl64.icd
# For some reasons this directory is not exist on some system
if [ ! -f /etc/OpenCL/vendors ]; then
echo Directory /etc/OpenCL/vendors is not exist
echo Creating it...
mkdir -p /etc/OpenCL/vendors
fi
cp ./etc/OpenCL/vendors/*.icd /etc/OpenCL/vendors
cp ./opt/amdgpu-pro/etc/vulkan/icd.d/*.json ${vk_icd}
cp ./opt/amdgpu/share/libdrm/amdgpu.ids /opt/amdgpu/share/libdrm
pushd ./opt/amdgpu/lib/i386-linux-gnu &>/dev/null
rm "libdrm_amdgpu.so.1"
mv "libdrm_amdgpu.so.1.0.0" "libdrm_amdpro.so.1.0.0"
ln -s "libdrm_amdpro.so.1.0.0" "libdrm_amdpro.so.1"
mv "libdrm_amdpro.so.1.0.0" "${shared32}"
mv "libdrm_amdpro.so.1" "${shared32}"
popd &>/dev/null
pushd ./opt/amdgpu/lib/x86_64-linux-gnu &>/dev/null
rm "libdrm_amdgpu.so.1"
mv "libdrm_amdgpu.so.1.0.0" "libdrm_amdpro.so.1.0.0"
ln -s "libdrm_amdpro.so.1.0.0" "libdrm_amdpro.so.1"
mv "libdrm_amdpro.so.1.0.0" "${shared64}"
mv "libdrm_amdpro.so.1" "${shared64}"
rm "libhsakmt.so.1"
mv "libhsakmt.so.1.0.6" "${shared64}"
ln -s "libhsakmt.so.1.0.6" "libhsakmt.so.1"
mv "libhsakmt.so.1" "${shared64}"
popd &>/dev/null
pushd ./opt/amdgpu-pro/lib/i386-linux-gnu &>/dev/null
sed -i "s|libdrm_amdgpu|libdrm_amdpro|g" libamdocl-orca32.so
mv "libamdocl-orca32.so" "${shared32}"
mv "libamdocl12cl32.so" "${shared32}"
mv "amdvlk32.so" "${shared32}"
popd &>/dev/null
pushd ./opt/amdgpu-pro/lib/x86_64-linux-gnu &>/dev/null
rm "libamd_comgr.so"
sed -i "s|libdrm_amdgpu|libdrm_amdpro|g" libamdocl-orca64.so
mv "libamdocl-orca64.so" "${shared64}"
mv "libamdocl12cl64.so" "${shared64}"
mv "libamd_comgr.so.${libamd_comgrver}" "${shared64}"
ln -s "libamd_comgr.so.${libamd_comgrver}" "libamd_comgr.so"
mv "libamd_comgr.so" "${shared64}"
mv "libamdocl64.so" "${shared64}"
#mv "libcltrace.so" "${shared64}"
mv "amdvlk64.so" "${shared64}"
rm "libamdhip64.so"
rm "libamdhip64.so.4"
mv "libamdhip64.so.4.0.21154-" "${shared64}"
ln -s "libamdhip64.so.4.0.21154-" "libamdhip64.so.4"
ln -s "libamdhip64.so.4" "libamdhip64.so"
mv "libamdhip64.so.4" "${shared64}"
mv "libamdhip64.so" "${shared64}"
rm "libhsa-runtime64.so.1"
mv "libhsa-runtime64.so.${libhsa_ver}" "${shared64}"
ln -s "libhsa-runtime64.so.${libhsa_ver}" "libhsa-runtime64.so.1"
mv "libhsa-runtime64.so.1" "${shared64}"
popd &>/dev/null
echo "# AMDGPU-PRO OpenCL support" > zz_amdgpu-pro_x86_64.conf
echo "/opt/amdgpu-pro/lib/x86_64-linux-gnu" >> zz_amdgpu-pro_x86_64.conf
cp zz_amdgpu-pro_x86_64.conf /etc/ld.so.conf.d/
echo "# AMDGPU-PRO OpenCL support" > zz_amdgpu-pro_x86.conf
echo "/opt/amdgpu-pro/lib/i386-linux-gnu" >> zz_amdgpu-pro_x86.conf
cp zz_amdgpu-pro_x86.conf /etc/ld.so.conf.d/
ldconfig
echo "Finished!"
cd ..
echo "Cleaning up"
rm -r ${prefix}-${major}.${minor}-${build}-${system}
#just in case
rm /opt/amdgpu-pro/lib/i386-linux-gnu/libdrm_amdgpu.so.1 &>/dev/null
rm /opt/amdgpu-pro/lib/i386-linux-gnu/libdrm_amdgpu.so.1.0.0 &>/dev/null
rm /opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm_amdgpu.so.1 &>/dev/null
rm /opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm_amdgpu.so.1.0.0 &>/dev/null
echo Done.
@supremelinux

This comment has been minimized.

Copy link

@supremelinux supremelinux commented Nov 8, 2019

Where have you been man ????
I have tried so many times using the amdgpu-pro to install only the opencl and i always i was breaking my system until now !
Congratulations

@kytulendu

This comment has been minimized.

Copy link
Owner Author

@kytulendu kytulendu commented Nov 9, 2019

the script shouldn't break your system as it only add files in /opt/amdgpu, /opt/amdgpu-pro, /etc/OpenCL/vendors and /etc/ld.so.conf.d directory, and modify your system library path.

if it somehow break, you can uninstall it by delete zz_amdgpu-pro_x86_64.conf in /etc/ld.so.conf.d directory and run sudo ldconfig

to remove it completely, remove these files
in /etc/OpenCL/vendors remove amdocl-orca64.icd and amdocl64.icd
remove /opt/amdgpu and /opt/amdgpu-pro directory

if there is new version and i haven't update the script (some times they release minor update that I haven't notice), you can update the script your self by change these line to match the new version from AMD site.

major='19.30'
minor='855429'
system='ubuntu-18.04'

and also, check if libdrm-amdgpu-amdgpu1 major version is being updated in the driver package, if it updated, change these line in the script.

ar x "../${prefix}-${major}-${minor}-${system}/libdrm-amdgpu-amdgpu1_2.4.98-${minor}_amd64.deb"
ar x "../${prefix}-${major}-${minor}-${system}/libdrm-amdgpu-amdgpu1_2.4.98-${minor}_i386.deb"
@supremelinux

This comment has been minimized.

Copy link

@supremelinux supremelinux commented Nov 17, 2019

Thank you for your efforts man !
Could this script work on later ubuntu versions like 19.10 or 20.04 ?

@kytulendu

This comment has been minimized.

Copy link
Owner Author

@kytulendu kytulendu commented Nov 17, 2019

for Ubuntu 19.04 is yes, as I use this script on Kubuntu 18.04 and 19.04 in the past, and it also work on Manjaro 18 KDE (the distro i currently use).
for Ubuntu 19.10 or 20.04 or newer, you can try install it and see if it working. it probably work :P
but for Ubuntu 20.04 (LTS), you better wait for AMD to release their closed source driver package for it and change the major='19.30', minor='855429' and system='ubuntu-18.04' to match with the new driver package release for Ubuntu 20.04.

@tuxutku

This comment has been minimized.

Copy link

@tuxutku tuxutku commented Nov 17, 2019

The script seems to install amdgpu-pro icd loaders too, is there a way to only install amdgpu-pro opencl drivers?, I tried to install opencl drivers with ./amdgpu-pro-install --headless --opencl=legacy,pal , everything except amdgpu-core installed but nothing is configured and both icd loaders and ldd files have dpkg-new on end of them.

@tuxutku

This comment has been minimized.

Copy link

@tuxutku tuxutku commented Nov 17, 2019

Nevermind, i have created my own script which is just modified version of opencl-amd AUR package: https://gist.github.com/tuxutku/79daa2edca131c1525a136b650cdbe0a

@supremelinux

This comment has been minimized.

Copy link

@supremelinux supremelinux commented Nov 22, 2019

This is the Guide (very easy) for installing opencl succesfuly on my newly installed Feren Os Next (linuxmint/ubuntu) system !
The script no longer works ! (maybe because i have updated to the latest kernel and mesa ??)
Please update your script using these commands:

**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**

@nanom1t

This comment has been minimized.

Copy link

@nanom1t nanom1t commented Dec 5, 2019

This is the Guide (very easy) for installing opencl succesfuly on my newly installed Feren Os Next (linuxmint/ubuntu) system !
The script no longer works ! (maybe because i have updated to the latest kernel and mesa ??)
Please update your script using these commands:

**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**

Get:3 file:/opt/amdgpu-pro-repo Packages
Err:3 file:/opt/amdgpu-pro-repo Packages
File not found - /opt/amdgpu-pro-repo/Packages (2: No such file or directory)

@rgo

This comment has been minimized.

Copy link

@rgo rgo commented Mar 31, 2020

To make it work for version 19.50-967956, I've had to modify libdrm-amdgpu-amdgpu1_2.4.98 to libdrm-amdgpu-amdgpu1_2.4.99 in lines 46 and 48.

Thanks for sharing!

@laramiel

This comment has been minimized.

Copy link

@laramiel laramiel commented Apr 19, 2020

I added a drm_version= to the script, as the drm version for 20.10 has changed to '100'

@rgo

This comment has been minimized.

Copy link

@rgo rgo commented Apr 20, 2020

As they say in pixls.us forum, amdgpu-pro installer works with --no-dkms argument. Full command:

amdgpu-pro-install --opencl=legacy,pal --headless --no-dkms

Thanks anyway for the script :)

More info: https://discuss.pixls.us/t/install-opencl-from-amdgpu-pro-under-ubuntu-non-supported-version/17528/3

@danisojo

This comment has been minimized.

Copy link

@danisojo danisojo commented May 5, 2020

I had in the past a lot of problems with amdgpu-pro installation in ubuntu 20.04, including blank screen on boot. Thanks for this script, it worked like a charm, and now everything is fixed with the GPU.

Thanks for sharing!

@Albertdup

This comment has been minimized.

Copy link

@Albertdup Albertdup commented May 8, 2020

for Ubuntu 19.04 is yes, as I use this script on Kubuntu 18.04 and 19.04 in the past, and it also work on Manjaro 18 KDE (the distro i currently use).
for Ubuntu 19.10 or 20.04 or newer, you can try install it and see if it working. it probably work :P
but for Ubuntu 20.04 (LTS), you better wait for AMD to release their closed source driver package for it and change the major='19.30', minor='855429' and system='ubuntu-18.04' to match with the new driver package release for Ubuntu 20.04.

Hi I am new to Manjaro 20 KDE plasma, Do I use this same script for Manjaro or is it only for Ubuntu? I am planning on moving from Ubuntu and is testing out Manjaro. Thanks for your great script.

@kytulendu

This comment has been minimized.

Copy link
Owner Author

@kytulendu kytulendu commented May 8, 2020

This script is working on Manjaro and *buntu, or other distro, but I'd recommend to install amdgpu-pro's OpenCL using proper installation method instead, if it not work you can use this script.

For Ubuntu and it's flavor, just install the package using this command in extracted driver directory, as recommended by above post.

./amdgpu-pro-install --opencl=legacy,pal --headless --no-dkms

For Arch Linux or Manjaro, use opencl-amd on AUR.
The below command will install opencl-amd from AUR, if your system didn't have yay package, install it first.

yay -S opencl-amd

@CrowBash

This comment has been minimized.

Copy link

@CrowBash CrowBash commented May 9, 2020

I have an old computer lying around which has a R7 240 GPU on it and wanted to put it to good use, i tried installing AMDGPU-PRO OpenCL with many different methods and here is the problem, every time i run something it gets completely broken, for example Luxmark crashes a second after it starts, DaVinci Resolve is completely broken (it does recognize the GPU though) and etc etc.
Mesa OpenCL meanwhile, it is stuck at 1.1, but it works at the very least.
Any idea why is this happening (poor driver implementation maybe)?

I have Ubuntu 20.04, switched the module to AMDGPU because Vulkan doesn't work on Radeon and the GPU has 4GB of VRAM.

@tuxutku

This comment has been minimized.

Copy link

@tuxutku tuxutku commented May 10, 2020

I have an old computer lying around which has a R7 240 GPU on it and wanted to put it to good use, i tried installing AMDGPU-PRO OpenCL with many different methods and here is the problem, every time i run something it gets completely broken, for example Luxmark crashes a second after it starts, DaVinci Resolve is completely broken (it does recognize the GPU though) and etc etc.
Mesa OpenCL meanwhile, it is stuck at 1.1, but it works at the very least.
Any idea why is this happening (poor driver implementation maybe)?

I have Ubuntu 20.04, switched the module to AMDGPU because Vulkan doesn't work on Radeon and the GPU has 4GB of VRAM

When you try those methods what clinfo reports?
From my experience the ./amdgpu-pro-install --opencl=legacy,pal --headless --no-dkms will
remove your current mesa or complain about dozens of missing dependencies.
@christhegreek's method will %100 trash your system and should be avoided and realy hard to revert back from.
This gist is also not exact copy of opencl-amd but I think it should work since they are very similar. Only caveat is that you may need to remove mesa-opencl-icd if you're on ubuntu since they may clash.
I have also made my own script which is exact copy of opencl-amd aur package https://gist.github.com/tuxutku/79daa2edca131c1525a136b650cdbe0a

@CrowBash

This comment has been minimized.

Copy link

@CrowBash CrowBash commented May 10, 2020

Clinfo does recognize the AMDGPU-PRO OpenCL driver (don't worry about Mesa one, i delete it every time i try installing proprietary one, and then install it again after i uninstall the proprietary driver)
The problem, i think, is the driver because clinfo does say that it is OpenCL 1.2 iirc but, as mentioned earlier, DaVinci Resolve does recognize the GPU but it turns into a mess, because, well my speculation is poor driver implementation.
Where can i report this issue, so that people know it is broken?

@hungrymonkey

This comment has been minimized.

Copy link

@hungrymonkey hungrymonkey commented May 12, 2020

Hi @kytulendu,

Since this script depends on bash, you can avoid intricate backtracking with pushd and popd
https://en.wikipedia.org/wiki/Pushd_and_popd

I hope this comment helps for future reference because I am graceful for your Opencl contribution.

These two cd can be change into pushd and popd.

cd ./opt/amdgpu/lib/i386-linux-gnu
rm "libdrm_amdgpu.so.1"
mv "libdrm_amdgpu.so.1.0.0" "libdrm_amdpro.so.1.0.0"
ln -s "libdrm_amdpro.so.1.0.0" "libdrm_amdpro.so.1"
mv "libdrm_amdpro.so.1.0.0" "${shared32}"
mv "libdrm_amdpro.so.1" "${shared32}"
cd ../../../..
pushd ./opt/amdgpu/lib/i386-linux-gnu
rm "libdrm_amdgpu.so.1"
mv "libdrm_amdgpu.so.1.0.0" "libdrm_amdpro.so.1.0.0"
ln -s "libdrm_amdpro.so.1.0.0" "libdrm_amdpro.so.1"
mv "libdrm_amdpro.so.1.0.0" "${shared32}"
mv "libdrm_amdpro.so.1" "${shared32}"
popd
@cdrewing

This comment has been minimized.

Copy link

@cdrewing cdrewing commented May 27, 2020

Does this work for Ubuntu Focal Fossa 20.04 although AMD didn't publish a driver later than Ubuntu 18.04?

@tuxutku

This comment has been minimized.

Copy link

@tuxutku tuxutku commented Jun 2, 2020

Does this work for Ubuntu Focal Fossa 20.04 although AMD didn't publish a driver later than Ubuntu 18.04?

yes it works personally

@molnarjoe

This comment has been minimized.

Copy link

@molnarjoe molnarjoe commented Jun 8, 2020

Hi,
I get the following:

joe@joeslinux:~/Downloads$ sudo ./install-opencl-amd.sh 
[sudo] password for joe: 
Extracting AMDGPU-PRO OpenCL driver files...
Remove target directory.
Create target directory.
Patch and installing AMDGPU-PRO OpenCL driver...
Directory /etc/OpenCL/vendors is not exist
Creating it...
rm: cannot remove '/opt/amdgpu-pro/lib/i386-linux-gnu/libdrm_amdgpu.so.1.0.0': No such file or directory
rm: cannot remove '/opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm_amdgpu.so.1.0.0': No such file or directory
Done.

I've tried to get my Radeon RX580 running with OpenCL. I've tried instructions from several sources. Nothing seems to work. I am on Ubuntu 20.04. I have downloaded in ~/Downloads directory: amdgpu-pro-20.10-1048554-ubuntu-18.04.tar.xz

**** UPDATE ****
Duh, reboot required!!!

Those errors notwithstanding, and those files in the error message are indeed there. They did not affect the outcome after all. Your script works.

I've tried various instructions for getting OpenCL working including https://math.dartmouth.edu/~sarunas/amdgpu.html and https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation-Guide.html, and https://www.youtube.com/watch?v=efKjfBkjPlM. Only your above script work and got OpenCL loaded in my application (a cryptocurrency miner, Claymore).

For that, hats off to you, and deep thanks.

@magas3000

This comment has been minimized.

Copy link

@magas3000 magas3000 commented Jul 19, 2020

This script seems to have done the trick. I am on Pop_OS 20.04 and although I had add the pop tag in the amdgpu-pro install script downloaded from amd's website, my installation would fail because of an error saying --no-dkms was an invalid option for the pro driver installation.
This is the output from my installation:

`ostefan@pop-os:~/Downloads$ sudo ./install-opencl-amd.sh

[sudo] password for ostefan:

Extracting AMDGPU-PRO OpenCL driver files...

Remove target directory.

Create target directory.

Patch and installing AMDGPU-PRO OpenCL driver...

Directory /etc/OpenCL/vendors is not exist

Creating it...

rm: cannot remove '/opt/amdgpu-pro/lib/i386-linux-gnu/libdrm_amdgpu.so.1.0.0': No such file or directory

rm: cannot remove '/opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm_amdgpu.so.1.0.0': No such file or directory

Done.`

Despite the rm errors, it all seems to be working perfectly. Blender 2.83 is detecting my RX 590 under OpenCL with no problems.
Thank you!!

@IAmALuigi

This comment has been minimized.

Copy link

@IAmALuigi IAmALuigi commented Jul 28, 2020

seems not to be working for me. davinci resolve crashes at launch, blender doesn't recognize my gpu, and each time i launch the script, it re-creates /etc/OpenCL/vendors, because "it doesn't exist" ( i checked and it's there).

Using Pop! OS 20.04 with the latest xanmod kernel, mesa-git from oibaf on a vega 56

edit: for some reason it finally decided to work on blender. resolve still doesn't load but i bet it's the software itself.

@tuxutku

This comment has been minimized.

Copy link

@tuxutku tuxutku commented Aug 5, 2020

@IAmALuigi I keep more up-to-date script based on aur opencl-amd package ,1089974 is old. https://gist.github.com/tuxutku/79daa2edca131c1525a136b650cdbe0a

@hollisticated-horse

This comment has been minimized.

Copy link

@hollisticated-horse hollisticated-horse commented Dec 28, 2020

hello there, sooo happy i found your script. Just wondering if someone could tell me how to get the latest amd driver to work with the script? I don't know what info exacly i need to change in the script from the amd tar ?

@Greifent

This comment has been minimized.

Copy link

@Greifent Greifent commented Jan 7, 2021

Hi @hollisticated-horse for me it worked fine without changing anything, openCL is now installed and is is working. My system is running pop-os 5.8.0-7630-generic. @kytulendu thank you for the script!

@hollisticated-horse

This comment has been minimized.

Copy link

@hollisticated-horse hollisticated-horse commented Jan 7, 2021

@Greifent, hey! cool, it works for me too, but i'm stuck at the 20.40 version, and there is a 20.45 which i'd like to try out. Since this script is the only one that gets OpenCL and @kytulendu previous said that it is possible to change the script to get the new update, i was wondering if anyone got it to work with 20.45 ?

@tuxutku

This comment has been minimized.

@erosenst

This comment has been minimized.

Copy link

@erosenst erosenst commented Jan 9, 2021

$ clinfo
amdgpu_device_initialize: DRM version is 2.50.0 but this driver is only compatible with 3.x.x.
amdgpu_device_initialize: DRM version is 2.50.0 but this driver is only compatible with 3.x.x.
Segmentation fault (core dumped)

Any ideas what AMD driver version should install?
Radeon driver HD5870 cards..

@hollisticated-horse

This comment has been minimized.

Copy link

@hollisticated-horse hollisticated-horse commented Jan 9, 2021

Ah yes i forgot to try your version @tuxutku. I'll give it a try.

@erosenst hey there, i've just looked at the support page of the amd website:

https://www.amd.com/en/support/graphics/amd-radeon-hd/ati-radeon-hd-5000-series/ati-radeon-hd-5870
if this is your card, it seems to only have an old driver ?
i could be wrong, but this gist seems to cater to newer gpus that all use the same latest driver.

@kytulendu

This comment has been minimized.

Copy link
Owner Author

@kytulendu kytulendu commented Jan 10, 2021

Please be minded that, from the release notes, version 20.45 may cause problem with Blender 2.90.1.

Using Blender 2.91.0 to render a few scenes with GPU seems not cause problem mentioned in release notes on my system (RX580).

@erosenst for HD5870 with recent linux kernel, the only option is using Mesa's OpenCL, which still at version 1.1.
or you can use the old proprietary fglrx driver version 15.12 or version 15.09, which (hopefully) would give you OpenCL 1.2. But you have to downgrade your kernel to version 3.19 and maybe downgrade Xorg/Xserver and glibc due to the driver was released in 2015...

@hollisticated-horse

This comment has been minimized.

Copy link

@hollisticated-horse hollisticated-horse commented Jan 11, 2021

ah cheers @kytulendu !! I'll be on the lookout for any bugs. So far, your script is the only thing that installed OpenCL correctly on my machine. Many thanks !!

@debian-alain

This comment has been minimized.

Copy link

@debian-alain debian-alain commented Feb 15, 2021

although this script seems functional (tested) .
for me, it didn't work. (linux debian sid)
I manage to install OpenCL, but neither darktable nor blender recognize it.

I think my card is too recent (AMD RX 6800), the amdgpu-pro drivers are not ready.
I have to install the kernel 5.10 and the git firmwares (free) to make it work.
Moreover, ROCm, either, is not ready.

Friendly,
dany_wilde .

also, I wonder:
how to completely erase all traces of this script?

i found , i forgot to erase /etc/OpenCL

now there's no OpenCL gpu recognised

@debian-alain

This comment has been minimized.

Copy link

@debian-alain debian-alain commented Feb 20, 2021

kytulendu, I plan to mention your script in my tutorial.

Is that a problem for you?

thank you for your participation to free software.

-- mon tuto --

@kytulendu

This comment has been minimized.

Copy link
Owner Author

@kytulendu kytulendu commented Feb 21, 2021

@debian-alain not at all :)

@BertaViader-zv

This comment has been minimized.

Copy link

@BertaViader-zv BertaViader-zv commented Feb 23, 2021

Hello, First of all, thank you for the script. But I could not find clinfo, I wonder if I'm doing something wrong. Previously of running the script, clinfo was inside the folder /opt/amdgpu-pro/bin.

But now, I can't find it:

$ locate clinfo
/etc/apt/preferences.d/clinfo-amdgpu
/usr/share/doc/clinfo-amdgpu-pro
/usr/share/doc/clinfo-amdgpu-pro/changelog.Debian.gz
/usr/share/doc/clinfo-amdgpu-pro/copyright
/var/lib/dpkg/info/clinfo-amdgpu-pro.list
/var/lib/dpkg/info/clinfo-amdgpu-pro.md5sums
/var/opt/amdgpu-pro-local/clinfo-amdgpu-pro_20.45-1188099_amd64.deb
/var/opt/amdgpu-pro-local/clinfo-amdgpu-pro_20.45-1188099_i386.deb

Any help would be appreciated.
Thank you,
Berta

@debian-alain

This comment has been minimized.

Copy link

@debian-alain debian-alain commented Feb 24, 2021

hi berta ,

on debian sid , try this :

whereis clinfo
on my machine , it give me this result :
clinfo: /usr/bin/clinfo /usr/share/man/man1/clinfo.1.gz

locate clinfo gave me nothing .

@goshhhy

This comment has been minimized.

Copy link

@goshhhy goshhhy commented Mar 19, 2021

this seems to install the correct files for the legacy stack, enabling my r9 290 to work, but not the rocr stack, so my vega 56 installed in the same machine does not.

@mrwm

This comment has been minimized.

Copy link

@mrwm mrwm commented May 2, 2021

New version

major='21'
minor='10'
build='1247438'

https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-21-10

@kytulendu

This comment has been minimized.

Copy link
Owner Author

@kytulendu kytulendu commented May 3, 2021

Thanks, updated the script.

@mrwm

This comment has been minimized.

Copy link

@mrwm mrwm commented May 4, 2021

Unfortunately, the updated script doesn't enable OpenCL in blender on Debian... probably something I'm missing though.


edit: Not sure which fixed the issue, but I'm assuming it was the linking that solved/enabled blender to see my devices as instructed in
this comment

sudo apt install opencl-headers ocl-icd-libopencl1 clinfo
sudo ln -s /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 /usr/lib/libOpenCL.so
@shadowStreamCode

This comment has been minimized.

Copy link

@shadowStreamCode shadowStreamCode commented Jun 4, 2021

Thanks for the great work and dedication.

I have a AMD R9 270x on Linux Mint 20.1 (5.4.0-74-generic kernel).
Tried running the script and rebooting and I see it installed but won't work correctly.

Here is my clinfo:

NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) No platform
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) No platform
clCreateContext(NULL, ...) [default] No platform
clCreateContext(NULL, ...) [other] Success [NV]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) No platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) No platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) Invalid device type for platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) No platform
NOTE: your OpenCL library only supports OpenCL 2.2,
but some installed platforms support OpenCL 3.0.

DarkTable-cltest results:
[opencl_init] device 1: Pitcairn
GLOBAL_MEM_SIZE: 3072MB
MAX_WORK_GROUP_SIZE: 256
MAX_WORK_ITEM_DIMENSIONS: 3
MAX_WORK_ITEM_SIZES: [ 1024 1024 1024 ]
DRIVER_VERSION: 3188.4
DEVICE_VERSION: OpenCL 1.2 AMD-APP (3188.4)
0.773228 [opencl_init] could not create command queue for device 1: -6

Anyway to get opencl running on that kernel and old GCN card?

@shadowStreamCode

This comment has been minimized.

Copy link

@shadowStreamCode shadowStreamCode commented Jun 7, 2021

After updating to kerner 5.8.0-55 and further testing I noticed opencl works but only when i run clinfo with root privileges. Do I need to symlink files or add my user to videos or render groups?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment