#!/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 |
This comment has been minimized.
This comment has been minimized.
Warning: remeber to remove |
This comment has been minimized.
This comment has been minimized.
tested on Pop!_OS 19.10 |
This comment has been minimized.
This comment has been minimized.
**The Absolute Perfect Guide for Installing Opencl on Ubuntu/Linux Mint/Debian buster: Download radeon driver (tested on Revision 19.30) Rename folder Move your repository to /opt Create your repository Content: deb [trusted=yes] file:/opt/amdgpu-pro-repo / Update apt allowing insecure repositories security risks Install legacy opencl driver. Allow again to install non-signed packages. Optional steps: $ sudo apt install clinfo Remove your repository if you do not want to see more warnings during apt upgrade Remove files if you want to save disk space 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** |
This comment has been minimized.
This comment has been minimized.
doing this trashed my system on Pop!_OS 19.10 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Worked for me in Ubuntu 19.10 making the following changes: Fix URL download path:
Updating version:
Now darktable is working and steam :) |
This comment has been minimized.
This comment has been minimized.
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 |
This comment has been minimized.
This comment has been minimized.
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. |
This comment has been minimized.
This comment has been minimized.
I get error: Downloading archive and extracting --2020-06-07 02:14:51-- https://drivers.amd.com/drivers/linux/amdgpu-pro-20.10-1048554-ubuntu-18.04.tar.xz
2020-06-07 02:14:57 (51.7 MB/s) - written to stdout [320559080/320559080] Extraction complete, creating the files 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. |
This comment has been minimized.
This comment has been minimized.
Thanks! @ehoffman2. The issue was the wrong shebang: |
This comment has been minimized.
This comment has been minimized.
I'm only getting OpenCL 1.2. Any ideas? |
This comment has been minimized.
This comment has been minimized.
BTW, I didn't fully install the -pro drivers.
|
This comment has been minimized.
This comment has been minimized.
amanda, not sure, but you're aware that you have a wrong shebang in your script. The first line should read 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". |
This comment has been minimized.
This comment has been minimized.
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. 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". |
This comment has been minimized.
This comment has been minimized.
@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. You can install 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 |
This comment has been minimized.
This comment has been minimized.
Could you please help me what's wrong. Ubuntu 20.04 Linux 5.4.0-52-generic $ clinfo Platform Name AMD Accelerated Parallel Processing NULL platform behavior ICD loader properties $lspci $ dmesg | grep -i amdgpu $ sudo lshw -c video $ lsmod | grep amd |
This comment has been minimized.
This comment has been minimized.
@vypinac have you installed ROCm before? |
This comment has been minimized.
This comment has been minimized.
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] ROCm officially supports AMD GPUs that use following chips: So should i use ROCm only and remove all amdgpu & amdgpu-pro ? Thank you. |
This comment has been minimized.
This comment has been minimized.
@vypinac can you post the output of you can than determine the PCI version by comparing the speeds here: https://en.wikipedia.org/wiki/PCI_Express#History_and_revisions |
This comment has been minimized.
This comment has been minimized.
Hello, sure and thank you for your help. 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]) |
This comment has been minimized.
This comment has been minimized.
@vypinac 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. |
This comment has been minimized.
This comment has been minimized.
@vypinac |
This comment has been minimized.
This comment has been minimized.
Okay, i tried something to remove those, but still same. $ clinfo $ ./opencl-amd_aur_ubuntu.sh $ clinfo Platform Name AMD Accelerated Parallel Processing NULL platform behavior ICD loader properties |
This comment has been minimized.
This comment has been minimized.
@vypinac can you try installing other icd loaders? |
This comment has been minimized.
This comment has been minimized.
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. So it seems your script is working well and i learned something. Thank you for your help. $ sudo clinfo Platform Name AMD Accelerated Parallel Processing |
This comment has been minimized.
This comment has been minimized.
since @vypinac had issues with the script I have added some features to it; And before removing or adding, script will give five seconds of decision time |
This comment has been minimized.
This comment has been minimized.
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
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 My goal is to get opencl operational. Edit: strange, I started uninstalling this by removing everything that was copied over from clinfo
|
This comment has been minimized.
This comment has been minimized.
@adraffy I just tested my script (because I accidentally dd'd my boot drive ): Also sadly P.S: |
This comment has been minimized.
This comment has been minimized.
@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 |
This comment has been minimized.
This comment has been minimized.
soo, i uninstalled the other script and used yours... now blender doesn't see my card anymore ... |
This comment has been minimized.
This comment has been minimized.
$ clinfo 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 |
This comment has been minimized.
This comment has been minimized.
@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. 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 |
This comment has been minimized.
This comment has been minimized.
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. |
This comment has been minimized.
This comment has been minimized.
@hollisticated-horse I directly copy the file creation part from the aur while kytulendu writes that part. |
This comment has been minimized.
This comment has been minimized.
I had to add my user to the
|
This comment has been minimized.
This comment has been minimized.
@bbedward it seems like user has to be added to |
This comment has been minimized.
This comment has been minimized.
Hey @tuxutku, i've tried both your script and here is what i get with
And OpenCL doesn't work... |
This comment has been minimized.
This comment has been minimized.
I have exactly the same problem on Kubuntu 20.10 with a 5700 xt |
This comment has been minimized.
This comment has been minimized.
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 ... |
This comment has been minimized.
This comment has been minimized.
@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. |
This comment has been minimized.
This comment has been minimized.
@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! |
This comment has been minimized.
This comment has been minimized.
@bbedward thanks to your suggestions I have revamped my "groups" section. |
This comment has been minimized.
script will create
opencl-amd_aur_ubuntu
directory inside where current directory is.