Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
bash implementation of opencl-amd AUR package, Install opencl amdgpu amdgpu-pro opencl only. Supports ubuntu and others with standard prefix
#!/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-20.04'
major='20.45'
minor='1164792'
amdver='2.4.100'
shared="opt/amdgpu-pro/lib/x86_64-linux-gnu"
shared2="opt/amdgpu/lib/x86_64-linux-gnu"
tarname="${prefix}${major}-${minor}${postfix}"
else echo 'downloading "prefix", "amdver", "major", "minor", "shared", "shared2" and "postfix" variables from aur...'
eval $(curl https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=opencl-amd|grep 'amdver\=\|major\=\|minor\=\|prefix\=\|shared\=\|shared2\=\|postfix\=')
fi
cstdir=opencl-amd_aur_ubuntu_dir
srcdir="$(pwd)/${cstdir}"
pkgdir="${srcdir}/pkgdir"
if ls -d "${srcdir}"&> /dev/null
then echo Warning: existing \""${srcdir}"\" found, deleting it in five seconds!
sleep 5
if rm -rf "${srcdir}"
then :
else echo Warning: couldn\'t removed the folder, will try with sudo again!
sudo rm -rf "${srcdir}"
fi
fi
mkdir -p "${pkgdir}"
cd "${srcdir}"
echo "Downloading archive and extracting"
if wget --referer "https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-20-45" -N -O - "https://drivers.amd.com/drivers/linux/$tarname.tar.xz"|tar -xJ
then echo "Extraction complete, creating the files"
else echo "Extraction or downloading failed, please ping me at the gist page. You can also try running the script with a random argument"
exit
fi
mkdir -p "${srcdir}/opencl"
cd "${srcdir}/opencl"
# roc*
ar x "${srcdir}/$tarname/opencl-rocr-amdgpu-pro_${major}-${minor}_amd64.deb"
tar xJf data.tar.xz
ar x "${srcdir}/$tarname/rocm-device-libs-amdgpu-pro_1.0.0-${minor}_amd64.deb"
tar xJf data.tar.xz
ar x "${srcdir}/$tarname/hsa-runtime-rocr-amdgpu_1.2.0-${minor}_amd64.deb"
tar xJf data.tar.xz
ar x "${srcdir}/$tarname/hsakmt-roct-amdgpu_1.0.9-${minor}_amd64.deb"
tar xJf data.tar.xz
ar x "${srcdir}/$tarname/hip-rocr-amdgpu-pro_${major}-${minor}_amd64.deb"
tar xJf data.tar.xz
# comgr
ar x "${srcdir}/$tarname/comgr-amdgpu-pro_1.7.0-${minor}_amd64.deb"
tar xJf data.tar.xz
# orca
ar x "${srcdir}/$tarname/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}/$tarname/libdrm-amdgpu-amdgpu1_${amdver}-${minor}_amd64.deb"
tar xJf data.tar.xz
cd ${shared2}
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
# roc*
mv "${srcdir}/opencl/${shared}/libamdocl64.so" "${pkgdir}/usr/lib/"
mv "${srcdir}/opencl/${shared}/libamd_comgr.so.1.7.0" "${pkgdir}/usr/lib"
mv "${srcdir}/opencl/${shared}/libamdhip64.so.1.5.19245" "${pkgdir}/usr/lib"
mv "${srcdir}/opencl/${shared}/libamdhip64.so" "${pkgdir}/usr/lib"
mv "${srcdir}/opencl/${shared}/libamdhip64.so.1" "${pkgdir}/usr/lib"
mv "${srcdir}/opencl/${shared}/libhsa-runtime64.so.1.2.0" "${pkgdir}/usr/lib"
mv "${srcdir}/opencl/${shared}/libhsa-runtime64.so.1" "${pkgdir}/usr/lib"
mv "${srcdir}/opencl/${shared2}/libhsakmt.so.1.0.6" "${pkgdir}/usr/lib"
mv "${srcdir}/opencl/${shared2}/libhsakmt.so.1" "${pkgdir}/usr/lib"
# comgr
cd ${srcdir}/opencl/${shared}
ln -s "libamd_comgr.so.1.7.0" "libamd_comgr.so"
mv "${srcdir}/opencl/${shared}/libamd_comgr.so" "${pkgdir}/usr/lib/"
mv "${srcdir}/opencl/${shared}/libamd_comgr.so.1" "${pkgdir}/usr/lib/libamd_comgr.so"
# orca
mv "${srcdir}/opencl/${shared}/libamdocl-orca64.so" "${pkgdir}/usr/lib/"
mv "${srcdir}/opencl/${shared}/libamdocl12cl64.so" "${pkgdir}/usr/lib/"
mv "${srcdir}/libdrm/${shared2}/libdrm_amdgpo.so.1.0.0" "${pkgdir}/usr/lib/"
mv "${srcdir}/libdrm/${shared2}/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}"
if type md5sum&> /dev/null
then if echo -e f6c2b4435f5bdf8f2054ae0f2c7600c6 ./usr/lib/libdrm_amdgpo.so.1.0.0\\n683efdfec9983216adc07d05ef9146d5 ./usr/lib/libamdocl12cl64.so\\n153e9a1eaad5a839471cf232f17531f3 ./usr/lib/libamdocl-orca64.so\\n5cdcfc4034b53abdc79e1d668b485ee3 ./usr/lib/libhsakmt.so.1.0.6\\n3c95b008d9e17e78757e469acc99b77b ./usr/lib/libhsa-runtime64.so.1.2.0\\ncaa15ea1964d71c630b0ea3587059f77 ./usr/lib/libamdhip64.so.1.5.19245\\nba66f37f9372c5af0d91a8df300edd3b ./usr/lib/libamd_comgr.so.1.7.0\\na16da9b3dc58bcbc210f39ea5015e11c ./usr/lib/libamdocl64.so\\nd4c720fa080a71b8c960582d9a4857d7 ./etc/OpenCL/vendors/amdocl-orca64.icd\\n45a4b6c5182d693554c287765b369dfe ./etc/OpenCL/vendors/amdocl64.icd|md5sum -c
then echo All files are ok!
else echo File corruption found! Terminating!
exit
fi
else echo Warning: You don\'t have \"md5sum\" installed, skipping sum checking!
fi
echo "Creating files complete, copying files to root. Enter sudo password when asked"
sudo cp -rv * /
if [ $(whoami) = root ]
then :
else user=$USER
fi
n=0
for i in video render
do if getent group $i &> /dev/null
then if getent group $i|grep -q $user$SUDO_USER
then :
else echo Warning: $user$SUDO_USER isn\'t in the \"$i\" group, will add the user
g[$n]=$i
fi
else echo Warning: group \"$i\" does not exist
c[$n]=$i
fi
n=$(($n+1))
done
if [ "${#c[@]}" -eq 0 ]
then :
else if echo "${c[*]}"|grep -q video
then echo ERROR: important group \"video\" is missing, without that group opencl won\'t work!
else echo Warning: non-important group is missing, you can ignore the warning messages
fi
fi
if [ "${#g[@]}" -eq 0 ]
then :
else echo Warning: adding $user$SUDO_USER to \"$(echo ${g[*]}|tr ' ' ,)\" group\(s\) in five seconds!
sleep 5
sudo usermod -a -G $(echo ${g[*]}|tr ' ' ,) $user$SUDO_USER && echo Warning: you\'ve been added to group\(s\), you should login-logback for installation to complete! || echo ERROR: you\'ve failed to enter group\(s\)!
fi
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 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 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 tuxutku commented Nov 17, 2019

tested on Pop!_OS 19.10

@supremelinux

This comment has been minimized.

Copy link

@supremelinux supremelinux 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 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 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 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 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 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)

@ehoffman2

This comment has been minimized.

Copy link

@ehoffman2 ehoffman2 commented Jun 7, 2020

I get error:

Downloading archive and extracting
WARNING: timestamping does nothing in combination with -O. See the manual
for details.

--2020-06-07 02:14:51-- https://drivers.amd.com/drivers/linux/amdgpu-pro-20.10-1048554-ubuntu-18.04.tar.xz
Resolving drivers.amd.com (drivers.amd.com)... 104.91.203.83
Connecting to drivers.amd.com (drivers.amd.com)|104.91.203.83|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 320559080 (306M) [text/plain]
Saving to: ‘STDOUT’

  •                                             100%[============================================================================================================>] 305.71M  53.3MB/s    in 5.9s    
    

2020-06-07 02:14:57 (51.7 MB/s) - written to stdout [320559080/320559080]

Extraction complete, creating the files
./opencl-amd_aur_ubuntu: 38: Bad substitution


Edit: I ran the script as sudo, but I'm not sure if that what's caused the issue. When I cleaned up (deleted the downloaded package directory) and tried again, without sudo, it worked fine.

Probably just a small-ish issue :-)

clinfo now report the GPU fine. Thanks.

@tuxutku

This comment has been minimized.

Copy link
Owner Author

@tuxutku tuxutku commented Jun 8, 2020

I get error:

Downloading archive and extracting
WARNING: timestamping does nothing in combination with -O. See the manual
for details.

--2020-06-07 02:14:51-- https://drivers.amd.com/drivers/linux/amdgpu-pro-20.10-1048554-ubuntu-18.04.tar.xz
Resolving drivers.amd.com (drivers.amd.com)... 104.91.203.83
Connecting to drivers.amd.com (drivers.amd.com)|104.91.203.83|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 320559080 (306M) [text/plain]
Saving to: ‘STDOUT’

  •                                             100%[============================================================================================================>] 305.71M  53.3MB/s    in 5.9s    
    

2020-06-07 02:14:57 (51.7 MB/s) - written to stdout [320559080/320559080]

Extraction complete, creating the files
./opencl-amd_aur_ubuntu: 38: Bad substitution

Edit: I ran the script as sudo, but I'm not sure if that what's caused the issue. When I cleaned up (deleted the downloaded package directory) and tried again, without sudo, it worked fine.

Probably just a small-ish issue :-)

clinfo now report the GPU fine. Thanks.

Thanks! @ehoffman2. The issue was the wrong shebang: #/bin/bash, sudo by itself is not an interpreter and cannot interpret ${} so it requires a shell to be specified. I have fixed the shebang and know it works.

@amanda-santini

This comment has been minimized.

Copy link

@amanda-santini amanda-santini commented Jul 27, 2020

I'm only getting OpenCL 1.2. Any ideas?
Here's my script https://raw.githubusercontent.com/amanda-santini/Debian/master/do.sh

@amanda-santini

This comment has been minimized.

Copy link

@amanda-santini amanda-santini commented Jul 27, 2020

BTW, I didn't fully install the -pro drivers.

  • Clean Ubuntu 20.04 install
  • Rocm install
  • Add myself to 'video' and 'render' groups
  • script to use the -pro OpenCL files
@ehoffman2

This comment has been minimized.

Copy link

@ehoffman2 ehoffman2 commented Jul 27, 2020

amanda, not sure, but you're aware that you have a wrong shebang in your script. The first line should read
#!/bin/bash (missing exclamation mark).

On my end, I ended up uninstalling AMDGPU-PRO and installed ROCm instead. That was needed as AMDGPU-PRO does not support inline assembly. This was a requirement for me as I do have to optimize using GCN instructions, I'm coding modular arithmetic stuff with 256-bit numbers, and there's a lot of 32x32=64-bit multiplications (v_mad_u32_u64) and addition chains with carry logic that is simply not possible to implement efficiently in plain "c".

@amanda-santini

This comment has been minimized.

Copy link

@amanda-santini amanda-santini commented Jul 27, 2020

Thanks.

I don't know what's going on, but I can't get OpenCL 2.0 to work.

I love AMD, but ever since 2015 their professional support on Linux is abysmal, a complete joke. I sold a GCN 1.0 card a few years ago because it was useless for my work (3D artist), and now bought a used RX 570 thinking it would have OpenCL 2.0 easy to use. But no, still on 1.2.

I did another clean install of Kubuntu 20.04 and installed their amdgpu-pro 20.20 driver, but only got OpenCL 1.2.
This means I have to chose between Linux with OpenCL 1.2, and Windows with OpenCL 2.0. If you consider that OpenCL 2.0 can be more than twice as fast than OpenCL 1.2 in Blender, and that some renders can take up to 4 hours on OpenCL 2.0, it's easy to see which OS I'll have to stick with.

My next GPU will have to be NVIDIA. Blob and all. Much better to use Linux with a good working driver than "crap AMD driver, or Windows".

@tuxutku

This comment has been minimized.

Copy link
Owner Author

@tuxutku tuxutku commented Aug 2, 2020

I'm only getting OpenCL 1.2. Any ideas?
Here's my script https://raw.githubusercontent.com/amanda-santini/Debian/master/do.sh

@amanda-santini This repo is port of https://aur.archlinux.org/packages/opencl-amd for bash. This script doesn't meant to install opencl 2.0, this is for computers that doesn't support ROCm. This script is made so you won't have to install full proprietary stack since opensource mesa driver is better for gaming for example.
If you install ROCm and clinfo sees all the gpu's then you should be good to go. What happens is that some motherboards aren't capable of supporting ROCm so dedicated gpu's aren't seen in clinfo. Means you can't use your dedicated gpu's for opencl at all.
You can read more about hardware support on https://github.com/RadeonOpenCompute/ROCm#hardware-and-software-support

You can install clinfo by: sudo apt install clinfo

Also AMD keeps changing the url's (and updates the drivers now and then) and because of that this script needs to be kept maintained. So if this script fails to download please ping me

@vypinac

This comment has been minimized.

Copy link

@vypinac vypinac commented Oct 25, 2020

Could you please help me what's wrong.
I tried to install amdgpu and opencl manually, also via scripts and still zero devices and no other errors.
Thank you for any tip.

Ubuntu 20.04 Linux 5.4.0-52-generic

$ clinfo
Number of platforms 1
Platform Name AMD Accelerated Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.1 AMD-APP (3180.7)
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd cl_amd_event_callback cl_amd_offline_devices
Platform Host timer resolution 1ns
Platform Extensions function suffix AMD

Platform Name AMD Accelerated Parallel Processing
Number of devices 0

NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) AMD Accelerated Parallel Processing
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)
clCreateContext(NULL, ...) [default] No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) No devices found in platform

ICD loader properties
ICD loader Name OpenCL ICD Loader
ICD loader Vendor OCL Icd free software
ICD loader Version 2.2.11
ICD loader Profile OpenCL 2.1

$lspci
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] (rev e7)
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590]

$ dmesg | grep -i amdgpu
[ 2.316870] [drm] amdgpu kernel modesetting enabled.
[ 2.316871] [drm] amdgpu version: 5.6.16.20.40
[ 2.317067] amdgpu: CRAT table not found
[ 2.317069] amdgpu: Virtual CRAT table created for CPU
[ 2.317081] amdgpu: Topology: Add CPU node
[ 2.353371] amdgpu 0000:01:00.0: remove_conflicting_pci_framebuffers: bar 0: 0xe0000000 -> 0xefffffff
[ 2.353373] amdgpu 0000:01:00.0: remove_conflicting_pci_framebuffers: bar 2: 0xf0000000 -> 0xf01fffff
[ 2.353374] amdgpu 0000:01:00.0: remove_conflicting_pci_framebuffers: bar 5: 0xf7c00000 -> 0xf7c3ffff
[ 2.353384] amdgpu 0000:01:00.0: enabling device (0000 -> 0003)
[ 2.353478] amdgpu 0000:01:00.0: amdgpu: Trusted Memory Zone (TMZ) feature not supported
[ 2.353479] amdgpu 0000:01:00.0: amdgpu: set kernel compute queue number to 8 due to invalid parameter provided by user
[ 2.582057] amdgpu: ATOM BIOS: 113-1E3660EU-O55
[ 2.807340] amdgpu 0000:01:00.0: BAR 2: releasing [mem 0xf0000000-0xf01fffff 64bit pref]
[ 2.807342] amdgpu 0000:01:00.0: BAR 0: releasing [mem 0xe0000000-0xefffffff 64bit pref]
[ 2.807368] amdgpu 0000:01:00.0: BAR 0: assigned [mem 0x2000000000-0x20ffffffff 64bit pref]
[ 2.807375] amdgpu 0000:01:00.0: BAR 2: assigned [mem 0x2100000000-0x21001fffff 64bit pref]
[ 2.807408] amdgpu 0000:01:00.0: amdgpu: VRAM: 4096M 0x000000F400000000 - 0x000000F4FFFFFFFF (4096M used)
[ 2.807410] amdgpu 0000:01:00.0: amdgpu: GART: 256M 0x000000FF00000000 - 0x000000FF0FFFFFFF
[ 2.816959] [drm] amdgpu: 4096M of VRAM memory ready
[ 2.816961] [drm] amdgpu: 15708M of GTT memory ready.
[ 2.872155] amdgpu: [powerplay] hwmgr_sw_init smu backed is polaris10_smu
[ 2.940525] snd_hda_intel 0000:01:00.1: bound 0000:01:00.0 (ops amdgpu_dm_audio_component_bind_ops [amdgpu])
[ 3.068445] kfd kfd: amdgpu: Allocated 3969056 bytes on gart
[ 3.072141] amdgpu: Virtual CRAT table created for GPU
[ 3.072508] amdgpu: Topology: Add dGPU node [0x67df:0x1002]
[ 3.072512] kfd kfd: amdgpu: added device 1002:67df
[ 3.072514] amdgpu 0000:01:00.0: amdgpu: SE 4, SH per SE 1, CU per SH 9, active_cu_number 36
[ 3.076317] [drm] Initialized amdgpu 3.40.0 20150101 for 0000:01:00.0 on minor 1

$ sudo lshw -c video
*-display
description: VGA compatible controller
product: Ellesmere [Radeon RX 470/480/570/570X/580/580X/590]
vendor: Advanced Micro Devices, Inc. [AMD/ATI]
physical id: 0
bus info: pci@0000:01:00.0
logical name: /dev/fb0
version: e7
width: 64 bits
clock: 33MHz
capabilities: pm pciexpress msi vga_controller bus_master cap_list rom fb
configuration: depth=32 driver=amdgpu latency=0 mode=1920x1080 visual=truecolor xres=1920 yres=1080
resources: iomemory:200-1ff iomemory:210-20f irq:155 memory:2000000000-20ffffffff memory:2100000000-21001fffff ioport:e000(size=256) memory:f7c00000-f7c3ffff memory:f7c40000-f7c5ffff

$ lsmod | grep amd
amdgpu 5726208 13
amd_iommu_v2 20480 1 amdgpu
amd_sched 32768 1 amdgpu
amdttm 102400 1 amdgpu
amdkcl 24576 2 amdttm,amdgpu
drm_kms_helper 184320 2 amdgpu,i915
i2c_algo_bit 16384 2 amdgpu,i915
drm 491520 23 drm_kms_helper,amd_sched,amdttm,amdgpu,i915,amdkcl

@tuxutku

This comment has been minimized.

Copy link
Owner Author

@tuxutku tuxutku commented Oct 30, 2020

@vypinac have you installed ROCm before?
Also you say that you have tried to install amdgpu (opensource drivers that come pre-installed on many distros if not all) before. Are you sure that you're not mixing it with amdgpu-pro. This script is made to avoid that and you should remove amdgpu-pro if you've installed it.
Other than that you seem to have the latest version installed looking at clinfo and it should've worked.
Also what kind of hardware do you have (if it supports then you should go with ROCm for opencl).
amdgpu-pro opencl is for legacy/unsupported hardware

@vypinac

This comment has been minimized.

Copy link

@vypinac vypinac commented Oct 30, 2020

Hello,

i have Radeon RX580

Should i remove all of these or only the first two ?

apt list --installed | grep -i amdgpu-pro

amdgpu-pro-core/unknown,now 20.40-1147286 all [installed,automatic]
amdgpu-pro-pin/unknown,now 20.40-1147286 all [installed]
clinfo-amdgpu-pro/unknown,now 20.40-1147286 amd64 [installed]
ocl-icd-libopencl1-amdgpu-pro/unknown,now 20.40-1147286 amd64 [installed,automatic]
opencl-amdgpu-pro-comgr/unknown,now 20.40-1147286 amd64 [installed,automatic]
opencl-amdgpu-pro-icd/unknown,now 20.40-1147286 amd64 [installed]
opencl-orca-amdgpu-pro-icd/unknown,now 20.40-1147286 amd64 [installed]

ROCm officially supports AMD GPUs that use following chips:
... "Polaris 10" chips, such as on the AMD Radeon RX 580 and Radeon Instinct MI6

So should i use ROCm only and remove all amdgpu & amdgpu-pro ?

Thank you.

@tuxutku

This comment has been minimized.

Copy link
Owner Author

@tuxutku tuxutku commented Oct 30, 2020

@vypinac can you post the output of sudo lspci -vv this will show all the info on PCI, then I can tell you if you can use ROCm.
or If you want to do it yourself: https://unix.stackexchange.com/a/397/292068

you can than determine the PCI version by comparing the speeds here: https://en.wikipedia.org/wiki/PCI_Express#History_and_revisions

@vypinac

This comment has been minimized.

Copy link

@vypinac vypinac commented Oct 30, 2020

Hello,

sure and thank you for your help.
is this portion enough?

01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] (rev e7) (prog-if 00 [VGA controller])
Subsystem: Sapphire Technology Limited Nitro+ Radeon RX 570/580/590
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- SERR- <PERR- INTx-
Latency: 0
Interrupt: pin A routed to IRQ 155
Region 0: Memory at 2000000000 (64-bit, prefetchable) [size=4G]
Region 2: Memory at 2100000000 (64-bit, prefetchable) [size=2M]
Region 4: I/O ports at e000 [size=256]
Region 5: Memory at f7c00000 (32-bit, non-prefetchable) [size=256K]
Expansion ROM at f7c40000 [disabled] [size=128K]
Capabilities: [48] Vendor Specific Information: Len=08 Capabilities: [50] Power Management version 3 Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1+,D2+,D3hot+,D3cold+) Status: D3 NoSoftRst+ PME-Enable+ DSel=0 DScale=0 PME- Capabilities: [58] Express (v2) Legacy Endpoint, MSI 00 DevCap: MaxPayload 256 bytes, PhantFunc 0, Latency L0s <4us, L1 unlimited ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset- DevCtl: CorrErr- NonFatalErr- FatalErr- UnsupReq- RlxdOrd+ ExtTag+ PhantFunc- AuxPwr- NoSnoop+ MaxPayload 256 bytes, MaxReadReq 512 bytes DevSta: CorrErr+ NonFatalErr- FatalErr- UnsupReq+ AuxPwr- TransPend- LnkCap: Port #0, Speed 8GT/s, Width x16, ASPM L1, Exit Latency L1 <1us ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp+ LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk+ ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt- LnkSta: Speed 2.5GT/s (downgraded), Width x1 (downgraded) TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt- DevCap2: Completion Timeout: Not Supported, TimeoutDis-, NROPrPrP-, LTR+ 10BitTagComp-, 10BitTagReq-, OBFF Not Supported, ExtFmt+, EETLPPrefix+, MaxEETLPPrefixes 1 EmergencyPowerReduction Not Supported, EmergencyPowerReductionInit- FRS- AtomicOpsCap: 32bit+ 64bit+ 128bitCAS- DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR+, OBFF Disabled AtomicOpsCtl: ReqEn+ LnkCtl2: Target Link Speed: 8GT/s, EnterCompliance- SpeedDis- Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS- Compliance De-emphasis: -6dB LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1- EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest- Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+ Address: 00000000fee00678 Data: 0000 Capabilities: [100 v1] Vendor Specific Information: ID=0001 Rev=1 Len=010
Capabilities: [150 v2] Advanced Error Reporting
UESta: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
UEMsk: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
UESvrt: DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
CESta: RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr-
CEMsk: RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr+
AERCap: First Error Pointer: 00, ECRCGenCap+ ECRCGenEn- ECRCChkCap+ ECRCChkEn-
MultHdrRecCap- MultHdrRecEn- TLPPfxPres- HdrLogCap-
HeaderLog: 00000000 00000000 00000000 00000000
Capabilities: [200 v1] Resizable BAR <?>
Capabilities: [270 v1] Secondary PCI Express
LnkCtl3: LnkEquIntrruptEn-, PerformEqu-
LaneErrStat: 0
Capabilities: [2b0 v1] Address Translation Service (ATS)
ATSCap: Invalidate Queue Depth: 00
ATSCtl: Enable-, Smallest Translation Unit: 00
Capabilities: [2c0 v1] Page Request Interface (PRI)
PRICtl: Enable- Reset-
PRISta: RF- UPRGI- Stopped-
Page Request Capacity: 00000020, Page Request Allocation: 00000000
Capabilities: [2d0 v1] Process Address Space ID (PASID)
PASIDCap: Exec+ Priv+, Max PASID Width: 10
PASIDCtl: Enable- Exec- Priv-
Capabilities: [320 v1] Latency Tolerance Reporting
Max snoop latency: 71680ns
Max no snoop latency: 71680ns
Capabilities: [328 v1] Alternative Routing-ID Interpretation (ARI)
ARICap: MFVC- ACS-, Next Function: 1
ARICtl: MFVC- ACS-, Function Group: 0
Capabilities: [370 v1] L1 PM Substates
L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1+ ASPM_L1.2+ ASPM_L1.1+ L1_PM_Substates+
PortCommonModeRestoreTime=0us PortTPowerOnTime=170us
L1SubCtl1: PCI-PM_L1.2- PCI-PM_L1.1- ASPM_L1.2- ASPM_L1.1-
T_CommonMode=0us LTR1.2_Threshold=0ns
L1SubCtl2: T_PwrOn=10us
Kernel driver in use: amdgpu
Kernel modules: amdgpu

@tuxutku

This comment has been minimized.

Copy link
Owner Author

@tuxutku tuxutku commented Oct 30, 2020

@vypinac
OK so you have installed ROCm before (you haven't told me though. Please tell me if you've installed ROCm before). ROCm only supports PCI gen 3x for latest GCN cards which is yours is one of them.
LnkCap: Port #0, Speed 8GT/s, Width x16 --> This is the PCI lane that going to your gpu, its gen 3x
LnkSta: Speed 2.5GT/s (downgraded), Width x1 (downgraded) --> but its downgraded to gen 1!!!
You're either using a laptop. Then you need to completely remove ROCm and stick with this script.
Or you're connecting your GPU to the motherboard using and extender and not directly

Either way you have to do a clean install. You've probably screwed your system by trying more than one script without knowing how to clean them.

@tuxutku

This comment has been minimized.

Copy link
Owner Author

@tuxutku tuxutku commented Oct 30, 2020

@vypinac
You should remove ROCm and amdgpu-pro. Don't touch amdgpu

@vypinac

This comment has been minimized.

Copy link

@vypinac vypinac commented Oct 30, 2020

Okay, i tried something to remove those, but still same.
So i reinstalled whole Ubuntu from scratch.
And ran your script, but still no success.
It is mining rig with GPUs set to PCIe Gen2 connected via extenders.
Thank you.

$ clinfo
Number of platforms 0

$ ./opencl-amd_aur_ubuntu.sh
Downloading archive and extracting
WARNING: timestamping does nothing in combination with -O. See the manual
for details.
--2020-10-30 23:04:50-- https://drivers.amd.com/drivers/linux/amdgpu-pro-20.40-1147286-ubuntu-20.04.tar.xz
Resolving drivers.amd.com (drivers.amd.com)... 23.47.212.92, 2a02:26f0:ea:485::b51, 2a02:26f0:ea:4a9::b51
Connecting to drivers.amd.com (drivers.amd.com)|23.47.212.92|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 333011308 (318M) [text/plain]
Saving to: ‘STDOUT’
100%
==========================================================================================>] 317,58M 11,0MB/s in 29s
2020-10-30 23:05:19 (11,0 MB/s) - written to stdout [333011308/333011308]
Extraction complete, creating the files
ln: failed to create symbolic link 'amdgpu.ids': File exists
Creating files complete, copying files to root. Enter sudo password when asked
'etc/OpenCL' -> '/etc/OpenCL'
'etc/OpenCL/vendors' -> '/etc/OpenCL/vendors'
'etc/OpenCL/vendors/amdocl64.icd' -> '/etc/OpenCL/vendors/amdocl64.icd'
'etc/OpenCL/vendors/amdocl-orca64.icd' -> '/etc/OpenCL/vendors/amdocl-orca64.icd'
removed '/opt/amdgpu/share/libdrm/amdgpu.ids'
'opt/amdgpu/share/libdrm/amdgpu.ids' -> '/opt/amdgpu/share/libdrm/amdgpu.ids'
'usr/lib/libamdocl64.so' -> '/usr/lib/libamdocl64.so'
'usr/lib/libamd_comgr.so.1.7.0' -> '/usr/lib/libamd_comgr.so.1.7.0'
'usr/lib/libamd_comgr.so' -> '/usr/lib/libamd_comgr.so'
'usr/lib/libamdocl12cl64.so' -> '/usr/lib/libamdocl12cl64.so'
'usr/lib/libamdocl-orca64.so' -> '/usr/lib/libamdocl-orca64.so'
'usr/lib/libdrm_amdgpo.so.1.0.0' -> '/usr/lib/libdrm_amdgpo.so.1.0.0'
'usr/lib/libdrm_amdgpo.so.1' -> '/usr/lib/libdrm_amdgpo.so.1'
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

$ clinfo
Number of platforms 1
Platform Name AMD Accelerated Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.1 AMD-APP (3180.7)
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd cl_amd_event_callback cl_amd_offline_devices
Platform Host timer resolution 1ns
Platform Extensions function suffix AMD

Platform Name AMD Accelerated Parallel Processing
Number of devices 0

NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) AMD Accelerated Parallel Processing
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)
clCreateContext(NULL, ...) [default] No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) No devices found in platform

ICD loader properties
ICD loader Name OpenCL ICD Loader
ICD loader Vendor OCL Icd free software
ICD loader Version 2.2.11
ICD loader Profile OpenCL 2.1

@tuxutku

This comment has been minimized.

Copy link
Owner Author

@tuxutku tuxutku commented Oct 31, 2020

@vypinac can you try installing other icd loaders?
sudo apt install mesa-opencl-icd pocl-opencl-icd ocl-icd-libopencl1

@vypinac

This comment has been minimized.

Copy link

@vypinac vypinac commented Oct 31, 2020

I have not installed those icd loaders yet, but found out, that if i run clinfo with sudo, now it does show 13 devices found.
clinfo without sudo as normal user still shows 0.

So it seems your script is working well and i learned something.

Thank you for your help.

$ sudo clinfo
Number of platforms 1
Platform Name AMD Accelerated Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.1 AMD-APP (3180.7)
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd cl_amd_event_callback cl_amd_offline_devices
Platform Host timer resolution 1ns
Platform Extensions function suffix AMD

Platform Name AMD Accelerated Parallel Processing
Number of devices 13
Device Name Ellesmere
Device Vendor Advanced Micro Devices, Inc.
Device Vendor ID 0x1002
Device Version OpenCL 1.2 AMD-APP (3180.7)
Driver Version 3180.7
Device OpenCL C Version OpenCL C 1.2
Device Type GPU
Device Board Name (AMD) Radeon RX 580 Series

@tuxutku

This comment has been minimized.

Copy link
Owner Author

@tuxutku tuxutku commented Nov 20, 2020

since @vypinac had issues with the script I have added some features to it;
It will tell and remove if there is any existing work directory
It will checksum the files
It will add the user into video group if it isn't already (the issue @vypinac had)

And before removing or adding, script will give five seconds of decision time

@adraffy

This comment has been minimized.

Copy link

@adraffy adraffy commented Jan 5, 2021

I have an Asus PN50 w/4500U running Ubuntu 20.04.1 LTS with 5.8.0 kernel. The integrated graphics is Renoir (Radeon 6). LnkCap is x16.

I got here after trying and failing with https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-20-45.

  • amdgpu-install --opencl=legacy --headless --no-dkms installs but gives dlerror: libMesaOpenCL.so.1: missing
  • --opencl=rocr seems to force amdgpu-dkms which fails with error exit status 10

This script fails at checksums if I bump the version to the latest (20.45-1188099).

This script as-is installs successfully on my setup but clinfo reports no devices.

My goal is to get opencl operational.

Edit: strange, I started uninstalling this by removing everything that was copied over from pkgdir, and once I finished and ran clinfo, my device properly shows up under the pocl engine.

clinfo
raffy@pn50:~$ clinfo
Number of platforms                               1
  Platform Name                                   Portable Computing Language
  Platform Vendor                                 The pocl project
  Platform Version                                OpenCL 1.2 pocl 1.4, None+Asserts, LLVM 9.0.1, RELOC, SLEEF, DISTRO, POCL_DEBUG
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd
  Platform Extensions function suffix             POCL

  Platform Name                                   Portable Computing Language
Number of devices                                 1
  Device Name                                     pthread-AMD Ryzen 5 4500U with Radeon Graphics
  Device Vendor                                   AuthenticAMD
  Device Vendor ID                                0x6c636f70
  Device Version                                  OpenCL 1.2 pocl HSTR: pthread-x86_64-pc-linux-gnu-znver1
  Driver Version                                  1.4
  Device OpenCL C Version                         OpenCL C 1.2 pocl
  Device Type                                     CPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               6
  Max clock frequency                             2375MHz
  Device Partition                                (core)
    Max number of sub-devices                     6
    Supported partition types                     equally, by counts
    Supported affinity domains                    (n/a)
  Max work item dimensions                        3
  Max work item sizes                             4096x4096x4096
  Max work group size                             4096
  Preferred work group size multiple              8
  Preferred / native vector sizes                 
    char                                                16 / 16      
    short                                               16 / 16      
    int                                                  8 / 8       
    long                                                 4 / 4       
    half                                                 0 / 0        (n/a)
    float                                                8 / 8       
    double                                               4 / 4        (cl_khr_fp64)
  Half-precision Floating-point support           (n/a)
  Single-precision Floating-point support         (core)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  Yes
  Double-precision Floating-point support         (cl_khr_fp64)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Address bits                                    64, Little-Endian
  Global memory size                              30977970176 (28.85GiB)
  Error Correction support                        No
  Max memory allocation                           8589934592 (8GiB)
  Unified memory for Host and Device              Yes
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       1024 bits (128 bytes)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        4194304 (4MiB)
  Global Memory cache line size                   64 bytes
  Image support                                   Yes
    Max number of samplers per kernel             16
    Max size for 1D images from buffer            536870912 pixels
    Max 1D or 2D image array size                 2048 images
    Max 2D image size                             16384x16384 pixels
    Max 3D image size                             2048x2048x2048 pixels
    Max number of read image args                 128
    Max number of write image args                128
  Local memory type                               Global
  Local memory size                               2097152 (2MiB)
  Max number of constant args                     8
  Max constant buffer size                        2097152 (2MiB)
  Max size of kernel argument                     1024
  Queue properties                                
    Out-of-order execution                        Yes
    Profiling                                     Yes
  Prefer user sync for interop                    Yes
  Profiling timer resolution                      1ns
  Execution capabilities                          
    Run OpenCL kernels                            Yes
    Run native kernels                            Yes
  printf() buffer size                            16777216 (16MiB)
  Built-in kernels                                (n/a)
  Device Extensions                               cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_3d_image_writes cl_khr_fp64 cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp64

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  Portable Computing Language
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [POCL]
  clCreateContext(NULL, ...) [default]            Success [POCL]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 Portable Computing Language
    Device Name                                   pthread-AMD Ryzen 5 4500U with Radeon Graphics
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  Success (1)
    Platform Name                                 Portable Computing Language
    Device Name                                   pthread-AMD Ryzen 5 4500U with Radeon Graphics
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)
    Platform Name                                 Portable Computing Language
    Device Name                                   pthread-AMD Ryzen 5 4500U with Radeon Graphics

ICD loader properties
  ICD loader Name                                 OpenCL ICD Loader
  ICD loader Vendor                               OCL Icd free software
  ICD loader Version                              2.2.11
  ICD loader Profile                              OpenCL 2.1
@tuxutku

This comment has been minimized.

Copy link
Owner Author

@tuxutku tuxutku commented Jan 8, 2021

@adraffy I just tested my script (because I accidentally dd'd my boot drive ):
it works as usual, are you sure your copy of clinfo is from default repositories? afaik amd's deb package installs its own icl loaders and clinfo. You have to clean them first.

Also sadly pocl is different from opencl and is not a replacement

P.S:
My script is only up-to-date to aur version. Because new versions sometimes come with new libraries. It takes some time for aur package to update

@adraffy

This comment has been minimized.

Copy link

@adraffy adraffy commented Jan 8, 2021

@tuxutku Oh interesting, I'll try again this weekend and report back. Agreeed, pocl performance seems pretty poor but at least it works.

I made a comment over on the AMD forums: https://community.amd.com/t5/drivers-software/can-t-install-amdgpu-drivers-on-ubuntu-20-04-1-5-4-0-56-generic/m-p/437178/highlight/true#M136973

@hollisticated-horse

This comment has been minimized.

Copy link

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

soo, i uninstalled the other script and used yours... now blender doesn't see my card anymore ...

@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.
Segmentation fault (core dumped)

Any ideas how to get hd5870 to opencl 1.2 level in ubuntu 20.04?

I put libs in /opt, chmod +x /opt/amdgpu-pro/lib/x86_64-linux-gnu/libamdocl64.so
/opt/amdgpu-pro/lib/x86_64-linux-gnu/libamdocl64.so
Segmentation fault (core dumped)

@tuxutku

This comment has been minimized.

Copy link
Owner Author

@tuxutku tuxutku commented Jan 10, 2021

soo, i uninstalled the other script and used yours... now blender doesn't see my card anymore ...

@hollisticated-horse firstly you didn't needed to get rid of the files previous script installed. I only encourage to remove clinfo that comes from the dreaded official amd package. Package also adds itself as a repo so when you think you're removing and reinstalling clinfo with apt. It actually reinstall same stuff from the package because they're cached and their version is higher than the ones in ubuntu (its not just clinfo but other components too) so you need to do a cleanup with synaptic and remove the repos.
Also to test blender I've installed it from this ppa: https://launchpad.net/~thomas-schiex/+archive/ubuntu/blender

Blender from this ppa sees my both gpu's and renders. (install llvm 6 too)

sometimes opencl version and blender is incompatible and can cause crashes and invisibility

Also you haven't reported your clinfo output

@hollisticated-horse

This comment has been minimized.

Copy link

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

Yes sorry @tuxutku, i clearly didn't read correctly what you had recommended. I'm trying the other script first, and try yours later this week.
What are the differences between your script and kytulendu's ?

@tuxutku

This comment has been minimized.

Copy link
Owner Author

@tuxutku tuxutku commented Jan 11, 2021

@hollisticated-horse I directly copy the file creation part from the aur while kytulendu writes that part.

@bbedward

This comment has been minimized.

Copy link

@bbedward bbedward commented Jan 15, 2021

I had to add my user to the render group as well, not sure why but my install is a little weird. Ubuntu 20.04 with liquorix 5.10.7 kernel, otherwise clinfo only showed devices as root.

usermod -aG render $user

@tuxutku

This comment has been minimized.

Copy link
Owner Author

@tuxutku tuxutku commented Jan 15, 2021

@bbedward it seems like user has to be added to render group too other than just video group. I will be adding that to script now

@hollisticated-horse

This comment has been minimized.

Copy link

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

Hey @tuxutku, i've tried both your script and here is what i get with clinfo:

  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.0 AMD-APP (3188.4)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_amd_event_callback 
  Platform Extensions function suffix             AMD

  Platform Name                                   AMD Accelerated Parallel Processing
Number of devices                                 0

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  AMD Accelerated Parallel Processing
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   �T�]
  clCreateContext(NULL, ...) [default]            No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  No devices found in platform

ICD loader properties
  ICD loader Name                                 OpenCL ICD Loader
  ICD loader Vendor                               OCL Icd free software
  ICD loader Version                              2.2.12
  ICD loader Profile                              OpenCL 2.2

And OpenCL doesn't work...

@charno

This comment has been minimized.

Copy link

@charno charno commented Jan 24, 2021

Hey @tuxutku, i've tried both your script and here is what i get with clinfo:

  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.0 AMD-APP (3188.4)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_amd_event_callback 
  Platform Extensions function suffix             AMD

  Platform Name                                   AMD Accelerated Parallel Processing
Number of devices                                 0

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  AMD Accelerated Parallel Processing
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   �T�]
  clCreateContext(NULL, ...) [default]            No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  No devices found in platform

ICD loader properties
  ICD loader Name                                 OpenCL ICD Loader
  ICD loader Vendor                               OCL Icd free software
  ICD loader Version                              2.2.12
  ICD loader Profile                              OpenCL 2.2

And OpenCL doesn't work...

I have exactly the same problem on Kubuntu 20.10 with a 5700 xt

@hollisticated-horse

This comment has been minimized.

Copy link

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

Hey @charno,

in the end, this script did work. I installed clinfo seperatly, ran the script again, and it worked after a reboot... Weird, i wasn't really paying attention so maybe i did something else that did it for me ...

@bbedward

This comment has been minimized.

Copy link

@bbedward bbedward commented Jan 24, 2021

@charno @hollisticated-horse the reason it worked after a reboot is because the group additions don't take effect until you login again. Maybe script should add a warning to reboot or logout/login again.

@charno

This comment has been minimized.

Copy link

@charno charno commented Jan 24, 2021

@hollisticated-horse @bbedward

Thanks! I did add the groups video and render with newgrp after the script ran. But probably that was not enough. After a reboot (first one in a month or so) it worked for me as well.

Really nice script!

@tuxutku

This comment has been minimized.

Copy link
Owner Author

@tuxutku tuxutku commented Jan 25, 2021

@bbedward thanks to your suggestions I have revamped my "groups" section.
Now it checks for missing groups, tells user wheter or not they were important, adds user to existing groups and tells them to re-login if they're added to any groups.

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