Skip to content

Instantly share code, notes, and snippets.

@kytulendu
Last active October 21, 2024 14:26
Show Gist options
  • Save kytulendu/3351b5d0b4f947e19df36b1ea3c95cbe to your computer and use it in GitHub Desktop.
Save kytulendu/3351b5d0b4f947e19df36b1ea3c95cbe to your computer and use it in GitHub Desktop.
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='30'
build='1290604'
system='ubuntu-20.04'
# libdrm-amdgpu-amdgpu1 version
libdrmver='2.4.106'
libamd_comgrver='2.1.0'
libhsa_ver='1.3.0'
libamdhip_ver='4.2.21303'
shared32="/usr/lib32"
shared64="/usr/lib"
amd_shared32="/opt/amdgpu-pro/lib/i386-linux-gnu"
amd_shared64="/opt/amdgpu-pro/lib/x86_64-linux-gnu"
ids="/opt/amdgpu/share/libdrm"
vk_icd="/opt/amdgpu-pro/etc/vulkan/icd.d"
gcn_bitcode="/opt/amdgpu-pro/amdgcn/bitcode"
# 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-30 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
# Remove old version
rm ${shared32}/libdrm_amdpro.so.1
rm ${shared32}/libdrm_amdpro.so.1.0.0
rm ${shared32}/libamdocl-orca32.so
rm ${shared64}/libdrm_amdpro.so.1
rm ${shared64}/libdrm_amdpro.so.1.0.0
rm ${shared64}/libhsakmt.so.1
rm ${shared64}/libhsakmt.so.1.0.6
rm ${shared64}/libamdocl-orca64.so
rm ${shared64}/libamdocl64.so
rm ${shared64}/libamd_comgr.so
rm ${shared64}/libamd_comgr.so.2
rm ${shared64}/libamd_comgr.so.${libamd_comgrver}
rm ${shared64}/libamdhip64.so
rm ${shared64}/libamdhip64.so.4
rm ${shared64}/libamdhip64.so.${libamdhip_ver}-
rm ${shared64}/libhsa-runtime64.so.1
rm ${shared64}/libhsa-runtime64.so.${libhsa_ver}
# Create target directory
echo Create target directory.
mkdir -p ${ids}
mkdir -p ${amd_shared32}
mkdir -p ${amd_shared64}
mkdir -p ${vk_icd}
mkdir -p ${gcn_bitcode}
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
cp ./opt/amdgpu-pro/amdgcn/bitcode/*.bc /opt/amdgpu-pro/amdgcn/bitcode
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}"
mv "libhsakmt.so.1.0.6" "${shared64}"
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 "amdvlk32.so.1.0" "${amd_shared32}"
mv "amdvlk32.so" "${amd_shared32}"
popd &>/dev/null
pushd ./opt/amdgpu-pro/lib/x86_64-linux-gnu &>/dev/null
sed -i "s|libdrm_amdgpu|libdrm_amdpro|g" libamdocl-orca64.so
mv "libamdocl-orca64.so" "${shared64}"
mv "libamdocl64.so" "${shared64}"
mv "libamd_comgr.so.${libamd_comgrver}" "${shared64}"
ln -s "libamd_comgr.so.2" "libamd_comgr.so"
mv "libamd_comgr.so.2" "${shared64}"
mv "libamd_comgr.so" "${shared64}"
mv "libcltrace.so" "${amd_shared64}"
mv "amdvlk64.so.1.0" "${amd_shared64}"
mv "amdvlk64.so" "${amd_shared64}"
mv "libamdhip64.so.${libamdhip_ver}-" "${shared64}"
mv "libamdhip64.so.4" "${shared64}"
mv "libamdhip64.so" "${shared64}"
mv "libhsa-runtime64.so.1" "${shared64}"
mv "libhsa-runtime64.so.${libhsa_ver}" "${shared64}"
mv "libhiprtc-builtins.so.4.2" "${amd_shared64}"
popd &>/dev/null
echo "Finished!"
cd ..
echo "Cleaning up"
rm -r ${prefix}-${major}.${minor}-${build}-${system}
echo Done.
@sstativa
Copy link

sstativa commented Aug 27, 2021

ubuntu driver has gone to 21.30 version.
can you update your script ?
tried to use it and to correct the data , but i was wrong , i didn't managed .

Would you mind trying this?

#!/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='30'
build='1290604'
system='ubuntu-20.04'

# libdrm-amdgpu-amdgpu1 version
libdrmver='2.4.106'
libamd_comgrver='2.1.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.2.21303-" "${shared64}"
ln -s "libamdhip64.so.4.2.21303-" "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.

@debian-alain
Copy link

debian-alain commented Aug 27, 2021

hi guys :) :) :)
this installation script gives me these errors :

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...
mv: impossible d'évaluer 'libamdocl12cl32.so': Aucun fichier ou dossier de ce type
rm: impossible de supprimer 'libamd_comgr.so': Aucun fichier ou dossier de ce type
mv: impossible d'évaluer 'libamdocl12cl64.so': Aucun fichier ou dossier de ce type
mv: impossible d'évaluer 'libamdhip64.so.4.0.21154-': Aucun fichier ou dossier de ce type
Finished!
Cleaning up
Done.

clinfo
Erreur de segmentation

is that normal ?
how to solve it ?

an approximative script to erase and reset datas of this one .

`#!/bin/bash

sudo rm -rf /etc/OpenCL
sudo rm -rf /opt/amdgpu-pro
sudo rm -rf /opt/amdgpu
sudo rm /etc/ld.so.conf.d/zz_amdgpu-pro_x86_64.conf
ldconfig
`
have a nice day ....

note : (my platform)
$ uname -a
Linux sid 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) x86_64 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux bookworm/sid
Release: unstable
Codename: sid

@sstativa
Copy link

sstativa commented Aug 27, 2021

mv: impossible d'évaluer 'libamdocl12cl32.so': Aucun fichier ou dossier de ce type
rm: impossible de supprimer 'libamd_comgr.so': Aucun fichier ou dossier de ce type
mv: impossible d'évaluer 'libamdocl12cl64.so': Aucun fichier ou dossier de ce type
mv: impossible d'évaluer 'libamdhip64.so.4.0.21154-': Aucun fichier ou dossier de ce type

Replace these two lines in the script

mv "libamdhip64.so.4.0.21154-" "${shared64}"
ln -s "libamdhip64.so.4.0.21154-" "libamdhip64.so.4"

by these lines

mv "libamdhip64.so.4.2.21303-" "${shared64}"
ln -s "libamdhip64.so.4.2.21303-" "libamdhip64.so.4"

Update: Or copy the scrip above, because I've changed these lines.

And I believe you can ignore these:

mv: cannot stat 'libamdocl12cl32.so': No such file or directory
rm: cannot remove 'libamd_comgr.so': No such file or directory
mv: cannot stat 'libamdocl12cl64.so': No such file or directory

@debian-alain
Copy link

hi sstativa . and thanks :) :) :)
official script updated and new script copied .
I will test them .

result :

Extracting AMDGPU-PRO OpenCL driver files...
Remove target directory.
Create target directory.
Patch and installing AMDGPU-PRO OpenCL driver...
rm: impossible de supprimer '/etc/OpenCL/vendors/amdocl-orca64.icd': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/etc/OpenCL/vendors/amdocl-orca32.icd': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/etc/OpenCL/vendors/amdocl64.icd': Aucun fichier ou dossier de ce type
Directory /etc/OpenCL/vendors is not exist
Creating it...
mv: impossible d'évaluer 'libamdocl12cl32.so': Aucun fichier ou dossier de ce type
rm: impossible de supprimer 'libamd_comgr.so': Aucun fichier ou dossier de ce type
mv: impossible d'évaluer 'libamdocl12cl64.so': Aucun fichier ou dossier de ce type
Finished!
Cleaning up
Done.

$ clinfo
Erreur de segmentation
(Segmentation error)

@sstativa
Copy link

sstativa commented Aug 28, 2021

$ clinfo
Erreur de segmentation
(Segmentation error)

Hmm, I personally did not try 21.30. I was using 21.20. However, when I run the 21.30 script and tried clinfo myself I got the segmentation error too.

Probably, for now, you can stick to 21.20 (at least, till that time when someone finds the fix for 21.30).

This is a 21.20 script, it works perfectly fine for me, without any issues.

#!/bin/bash
# 21.20

# 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='20'
build='1271047'
system='ubuntu-20.04'

# libdrm-amdgpu-amdgpu1 version
libdrmver='2.4.100'
libamd_comgrver='2.1.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.1.21233-" "${shared64}"
ln -s "libamdhip64.so.4.1.21233-" "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.

@debian-alain
Copy link

created the script for 21.20 opencl version .
installation is good .
clinfo is good
but , opencl do not work at all with blender and also darktable .

results :

$ clinfo
Number of platforms 1
Platform Name AMD Accelerated Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.0 AMD-APP (3261.0)
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, ...) No devices found in platform [AMD Accelerated Parallel Processing?]
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.14
ICD loader Profile OpenCL 3.0

@sstativa
Copy link

created the script for 21.20 opencl version .
installation is good .
clinfo is good
but , opencl do not work at all with blender and also darktable .

I'm out of suggestions.

I used this script because no other installation guides worked for me (including the official one). This script allowed me to run a mining rig in a "headless" mode with multiple gpus. I think if you want to use GUI this script won't help you.

Why don't you follow the official installation guide? 21.20 did not work for me, but maybe AMD has already fixed installation issues in 21.30.

@kytulendu
Copy link
Author

kytulendu commented Aug 28, 2021

I have fixed the clinfo segfault by install the library in /usr/lib directory like Arch Linux AUR do.

You may have to manually delete some files that have been added by previous version of script listed below.

  • /etc/ld.so.conf.d/zz_amdgpu-pro_x86_64.conf
  • /etc/ld.so.conf.d/zz_amdgpu-pro_x86.conf

I also provide removal script for the new version 21.30 install script below.

Also, please read the script before you run any script with root privilege, just in case :P

#!/bin/bash

# AMDGPU-PRO OpenCL and Vulkan remove script
# for use with https://gist.github.com/kytulendu/3351b5d0b4f947e19df36b1ea3c95cbe

libamd_comgrver='2.1.0'
libhsa_ver='1.3.0'
libamdhip_ver='4.2.21303'

shared32="/usr/lib32"
shared64="/usr/lib"

# 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

echo "Cleaning up"

rm -r /opt/amdgpu &>/dev/null
rm -r /opt/amdgpu-pro &>/dev/null

rm ${shared32}/libdrm_amdpro.so.1
rm ${shared32}/libdrm_amdpro.so.1.0.0
rm ${shared32}/libamdocl-orca32.so

rm ${shared64}/libdrm_amdpro.so.1
rm ${shared64}/libdrm_amdpro.so.1.0.0
rm ${shared64}/libhsakmt.so.1
rm ${shared64}/libhsakmt.so.1.0.6
rm ${shared64}/libamdocl-orca64.so
rm ${shared64}/libamdocl64.so
rm ${shared64}/libamd_comgr.so
rm ${shared64}/libamd_comgr.so.2
rm ${shared64}/libamd_comgr.so.${libamd_comgrver}
rm ${shared64}/libamdhip64.so
rm ${shared64}/libamdhip64.so.4
rm ${shared64}/libamdhip64.so.${libamdhip_ver}-
rm ${shared64}/libhsa-runtime64.so.1
rm ${shared64}/libhsa-runtime64.so.${libhsa_ver}

rm /etc/OpenCL/vendors/amdocl-orca64.icd
rm /etc/OpenCL/vendors/amdocl-orca32.icd
rm /etc/OpenCL/vendors/amdocl64.icd

echo Done.

@debian-alain
Copy link

debian-alain commented Aug 29, 2021

alain@sid:~/Téléchargements/3351b5d0b4f947e19df36b1ea3c95cbe$ sudo bash install-21.30.sh
[sudo] Mot de passe de alain :
Cleaning up
rm: impossible de supprimer '/usr/lib32/libdrm_amdpro.so.1': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/usr/lib32/libdrm_amdpro.so.1.0.0': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/usr/lib32/libamdocl-orca32.so': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/usr/lib/libdrm_amdpro.so.1': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/usr/lib/libdrm_amdpro.so.1.0.0': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/usr/lib/libhsakmt.so.1': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/usr/lib/libhsakmt.so.1.0.6': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/usr/lib/libamdocl-orca64.so': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/usr/lib/libamdocl64.so': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/usr/lib/libamd_comgr.so': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/usr/lib/libamd_comgr.so.2': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/usr/lib/libamd_comgr.so.2.1.0': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/usr/lib/libamdhip64.so': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/usr/lib/libamdhip64.so.4': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/usr/lib/libamdhip64.so.4.2.21303-': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/usr/lib/libhsa-runtime64.so.1': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/usr/lib/libhsa-runtime64.so.1.3.0': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/etc/OpenCL/vendors/amdocl-orca64.icd': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/etc/OpenCL/vendors/amdocl-orca32.icd': Aucun fichier ou dossier de ce type
rm: impossible de supprimer '/etc/OpenCL/vendors/amdocl64.icd': Aucun fichier ou dossier de ce type
Done.

$ clinfo
Number of platforms 0

the clinfo problem seems to be solved (badly) , but , neither with blender or darktable , opencl do not work at all .

opencl is not recognized anyway .

@kytulendu
Copy link
Author

@debian-alain The script I previously post at https://gist.github.com/kytulendu/3351b5d0b4f947e19df36b1ea3c95cbe#gistcomment-3875095 is for removal of files installed by the new install script for v21.30 that I have updated in first post (https://gist.github.com/kytulendu/3351b5d0b4f947e19df36b1ea3c95cbe#file-install-opencl-amd-sh).
You can use the new version of script to install OpenCL if you have older version installed as it also remove files installed by older version of script, except for /etc/ld.so.conf.d/zz_amdgpu-pro_x86_64.conf and /etc/ld.so.conf.d/zz_amdgpu-pro_x86.conf that you will have to remove by your self.

@debian-alain
Copy link

debian-alain commented Aug 30, 2021

thanks a lot kytulendu .

created the installation script like you told me (21.30)
created also the unistall script like you said .

$ clinfo
Number of platforms 1
Platform Name AMD Accelerated Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.0 AMD-APP (3314.0)
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, ...) No devices found in platform [AMD Accelerated Parallel Processing?]
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.14
ICD loader Profile OpenCL 3.0

uninstall file seems to be ok .
install file seems to be ok , too .
here is the clinfo report . open-cl seems to be well installed but neither blender nor darktable seems to be able to use it .
opencl is not recognized by these programs.
Where do you think the problem comes from ?

@kytulendu
Copy link
Author

@debian-alain The problem is clinfo report number of devices as 0.
maybe something in your system cause AMD's OpenCL gpu detection code breakage, possibly old kernel driver or old libdrm? idk.

@debian-alain
Copy link

I think you are right kytulendu .
my kernel must be a bit old.
currently kernel 5.10 when ubuntu is at 5.11
kernel 5.14 in preparation ("trunk" for the moment) .
I don't know if we're going to switch to the latter or to kernel 5.15 ?

thank you very much for your help and assistance .
thanks also for your community and your "github" site
(very useful)

@Gouki-b
Copy link

Gouki-b commented Sep 10, 2021

It WORKS,
but whenever i try to install or update any other stuff i get this error:

Removing old amdgpu-pro-16.40-348864 DKMS files...


Deleting module version: 16.40-348864
completely from the DKMS tree.

Done.
Loading new amdgpu-pro-16.40-348864 DKMS files...
Building for 5.10.0-kali9-amd64
Building for architecture amd64
Building initial module for 5.10.0-kali9-amd64
Error! Bad return status for module build on kernel: 5.10.0-kali9-amd64 (amd64)
Consult /var/lib/dkms/amdgpu-pro/16.40-348864/build/make.log for more information.
dpkg: error processing package amdgpu-pro-dkms (--configure):
installed amdgpu-pro-dkms package post-installation script subprocess returned error exit status 10
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for kali-menu (2021.3.3) ...
Errors were encountered while processing:
amdgpu-pro-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)

@Gouki-b
Copy link

Gouki-b commented Sep 12, 2021

WHEN I WANT TO UPDATE MY FUCKING REAVER( WHICH HAS NOTHING TO DO WITH ANYTHING ) OR ANY OTHER TOOL I GET THIS AFTER USING THIS SCRIPT

└─# apt-get upgrade reaver
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
reaver is already the newest version (1.6.6-0kali1).
Calculating upgrade... Done
The following packages have been kept back:
clinfo-amdgpu-pro
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up amdgpu-pro-dkms (16.40-348864) ...
Removing old amdgpu-pro-16.40-348864 DKMS files...


Deleting module version: 16.40-348864
completely from the DKMS tree.

Done.
Loading new amdgpu-pro-16.40-348864 DKMS files...
Building for 5.10.0-kali9-amd64
Building for architecture amd64
Building initial module for 5.10.0-kali9-amd64
Error! Bad return status for module build on kernel: 5.10.0-kali9-amd64 (amd64)
Consult /var/lib/dkms/amdgpu-pro/16.40-348864/build/make.log for more information.
dpkg: error processing package amdgpu-pro-dkms (--configure):
installed amdgpu-pro-dkms package post-installation script subprocess returned error exit status 10
Errors were encountered while processing:
amdgpu-pro-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)

@debian-alain
Copy link

debian-alain commented Oct 1, 2021

sorry , do not work at all on the 5.14.9 (kernel.org) debian kernel
no more on the 5.14.0-2 (debian 5.14.9-2)
a slight improvement but still no solution.
also tested on 5.14.0-3-amd64 (5.14.12-1) : does not seems to work at all .

do i have to wait until the ubuntu 22.04 LTS ?
six months again !
which make nearly one year from the date i bouhght my graphics card !
do Ubuntu or AMD stop the debian support from OpenCL  ?

@Etaash-mathamsetty
Copy link

The script dosen't work
these are the errors;
Extracting AMDGPU-PRO OpenCL driver files...
ar: ../amdgpu-pro-20.40-1147286-ubuntu-20.04/comgr-amdgpu-pro_2.1.0-1147286_amd64.deb: No such file or directory
tar (child): data.tar.xz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
ar: ../amdgpu-pro-20.40-1147286-ubuntu-20.04/hip-rocr-amdgpu-pro_20.40-1147286_amd64.deb: No such file or directory
tar (child): data.tar.xz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
ar: ../amdgpu-pro-20.40-1147286-ubuntu-20.04/hsa-runtime-rocr-amdgpu_1.3.0-1147286_amd64.deb: No such file or directory
tar (child): data.tar.xz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
ar: ../amdgpu-pro-20.40-1147286-ubuntu-20.04/hsakmt-roct-amdgpu_1.0.9-1147286_amd64.deb: No such file or directory
tar (child): data.tar.xz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
ar: ../amdgpu-pro-20.40-1147286-ubuntu-20.04/libdrm-amdgpu-amdgpu1_2.4.106-1147286_amd64.deb: No such file or directory
tar (child): data.tar.xz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
ar: ../amdgpu-pro-20.40-1147286-ubuntu-20.04/libdrm-amdgpu-amdgpu1_2.4.106-1147286_i386.deb: No such file or directory
tar (child): data.tar.xz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
ar: ../amdgpu-pro-20.40-1147286-ubuntu-20.04/opencl-rocr-amdgpu-pro_20.40-1147286_amd64.deb: No such file or directory
ar: ../amdgpu-pro-20.40-1147286-ubuntu-20.04/rocm-device-libs-amdgpu-pro_1.0.0-1147286_amd64.deb: No such file or directory
Remove target directory.

didn't work with 21.30 either

@Etaash-mathamsetty
Copy link

Etaash-mathamsetty commented Oct 20, 2021

alright I used the modded script with 21.20 and it worked, thanks to the person who made it

@Etaash-mathamsetty
Copy link

nope not working
Error: AMD HSA Code Object loading failed: HSA_STATUS_ERROR_INVALID_CODE_OBJECT: The code object is invalid.

@debian-alain
Copy link

Hello to all.
there is a solution to install OpenCL on Debian .
provided by AMD :

download and unpack the latest version of amdgpu-pro
(currently, 21.30)
go to its folder.
and enter this command:

sudo ./amdgpu-install --opencl=legacy --headless --no-dkms

OpenCL is installed but, at this time (kernel 5.14.0-3), it is not functional.

to uninstall : sudo amdgpu-uninstall

to test : clinfo

thanks to the AMD staff .

@debian-alain
Copy link

debian-alain commented Oct 25, 2021

also kytulendu, you removed your thread from your main github page ?

now it is independent ?

@debian-alain
Copy link

debian-alain commented Dec 12, 2021

Hello kytulendu and thank you for your script.

today i tested it with kernel 5.15.6 (kernel.org) on my debian sid .

complete success .

apparently, indeed, you were right.
my kernel, until now, was not ready.

now blender recognizes openCL and my graphic card (also my cpu)

darktable also recognizes openCL.

in short, all is well in the best of worlds.

Thanks again.

I re-communicate below my clinfo .
attention, it is long.

alain@sid:~/Téléchargements/AMDGPU$ clinfo
Number of platforms 1
Platform Name AMD Accelerated Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.0 AMD-APP (3314.0)
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 1
Device Name gfx1030
Device Vendor Advanced Micro Devices, Inc.
Device Vendor ID 0x1002
Device Version OpenCL 2.0
Driver Version 3314.0 (HSA1.1,LC)
Device OpenCL C Version OpenCL C 2.0
Device Type GPU
Device Board Name (AMD) Navi 21 [Radeon RX 6800/6800 XT / 6900 XT]
Device PCI-e ID (AMD) 0x73bf
Device Topology (AMD) PCI-E, 0000:0a:00.0
Device Profile FULL_PROFILE
Device Available Yes
Compiler Available Yes
Linker Available Yes
Max compute units 30
SIMD per compute unit (AMD) 4
SIMD width (AMD) 32
SIMD instruction width (AMD) 1
Max clock frequency 2475MHz
Graphics IP (AMD) 10.3
Device Partition (core)
Max number of sub-devices 30
Supported partition types None
Supported affinity domains (n/a)
Max work item dimensions 3
Max work item sizes 1024x1024x1024
Max work group size 256
Preferred work group size (AMD) 256
Max work group size (AMD) 1024
Preferred work group size multiple (kernel) 32
Wavefront width (AMD) 32
Preferred / native vector sizes
char 4 / 4
short 2 / 2
int 1 / 1
long 1 / 1
half 1 / 1 (cl_khr_fp16)
float 1 / 1
double 1 / 1 (cl_khr_fp64)
Half-precision Floating-point support (cl_khr_fp16)
Denormals No
Infinity and NANs No
Round to nearest No
Round to zero No
Round to infinity No
IEEE754-2008 fused multiply-add No
Support is emulated in software No
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 17163091968 (15.98GiB)
Global free memory (AMD) 16760832 (15.98GiB) 16760832 (15.98GiB)
Global memory channels (AMD) 8
Global memory banks per channel (AMD) 4
Global memory bank width (AMD) 256 bytes
Error Correction support No
Max memory allocation 14588628168 (13.59GiB)
Unified memory for Host and Device No
Shared Virtual Memory (SVM) capabilities (core)
Coarse-grained buffer sharing Yes
Fine-grained buffer sharing Yes
Fine-grained system sharing No
Atomics No
Minimum alignment for any data type 128 bytes
Alignment of base address 1024 bits (128 bytes)
Preferred alignment for atomics
SVM 0 bytes
Global 0 bytes
Local 0 bytes
Max size for global variable 14588628168 (13.59GiB)
Preferred total size of global vars 17163091968 (15.98GiB)
Global Memory cache type Read/Write
Global Memory cache size 16384 (16KiB)
Global Memory cache line size 64 bytes
Image support Yes
Max number of samplers per kernel 29631
Max size for 1D images from buffer 134217728 pixels
Max 1D or 2D image array size 8192 images
Base address alignment for 2D image buffers 256 bytes
Pitch alignment for 2D image buffers 256 pixels
Max 2D image size 16384x16384 pixels
Max 3D image size 16384x16384x8192 pixels
Max number of read image args 128
Max number of write image args 8
Max number of read/write image args 64
Max number of pipe args 16
Max active pipe reservations 16
Max pipe packet size 1703726280 (1.587GiB)
Local memory type Local
Local memory size 65536 (64KiB)
Local memory size per CU (AMD) 65536 (64KiB)
Local memory banks (AMD) 32
Max number of constant args 8
Max constant buffer size 14588628168 (13.59GiB)
Preferred constant buffer size (AMD) 16384 (16KiB)
Max size of kernel argument 1024
Queue properties (on host)
Out-of-order execution No
Profiling Yes
Queue properties (on device)
Out-of-order execution Yes
Profiling Yes
Preferred size 262144 (256KiB)
Max size 8388608 (8MiB)
Max queues on device 1
Max events on device 1024
Prefer user sync for interop Yes
Number of P2P devices (AMD) 0
Profiling timer resolution 1ns
Profiling timer offset since Epoch (AMD) 0ns (Thu Jan 1 01:00:00 1970)
Execution capabilities
Run OpenCL kernels Yes
Run native kernels No
Thread trace supported (AMD) No
Number of async queues (AMD) 8
Max real-time compute queues (AMD) 8
Max real-time compute units (AMD) 30
printf() buffer size 4194304 (4MiB)
Built-in kernels (n/a)
Device Extensions cl_khr_fp64 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_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_amd_device_attribute_query cl_amd_media_ops cl_amd_media_ops2 cl_khr_image2d_from_buffer cl_khr_subgroups cl_khr_depth_images cl_amd_copy_buffer_p2p cl_amd_assembly_program

NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) AMD Accelerated Parallel Processing
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) Success [AMD]
clCreateContext(NULL, ...) [default] Success [AMD]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) Success (1)
Platform Name AMD Accelerated Parallel Processing
Device Name gfx1030
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1)
Platform Name AMD Accelerated Parallel Processing
Device Name gfx1030
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 AMD Accelerated Parallel Processing
Device Name gfx1030

ICD loader properties
ICD loader Name OpenCL ICD Loader
ICD loader Vendor OCL Icd free software
ICD loader Version 2.2.14
ICD loader Profile OpenCL 3.0

@Jorgen-VikingGod
Copy link

found link to this script in a forum. Before I try on my system I wanted to ask, if someone already tried on Pop_OS! 21.10?

I'm using Pop_OS! 21.10 on a Ryzen 9 5900X system with an old AMD Radeon RX 580 GPU

But it is not recognized in Davinci Resolve Sudio 17

> clinfo
Number of platforms                               0
> uname -r
5.15.11-76051511-generic

Would be awesome if this script runs on my Pop too...

@DeeDeeRanged
Copy link

@Jorgen-VikingGod Your missing OpenCL. Install OpenCL for your card. Try installing it with the the amdgpu-pro-21.30 drivers unpack it cd into the directory and just run amdgpu-install --no-dkms --opencl=legacy (--headless). If it installed properly run /opt/amdgpu-pro/bin/clinfo and it should show the rx 580. For you --headless might not be needed. This way I have my rx 580 8gb running on Debian testing/bookworm and on Debian bullseye.

@Jorgen-VikingGod
Copy link

thx. @DeeDeeRanged I will try it today. But I could rmember that the amdgpu-pro script did not have any pop os support. Maybe I have to just add pop to the conditions (debian and ubuntu is there, as I remember).

Hopefully the script will work to install OpenCL for me.
I'll report if it worked or not. Thx 👍

@Jorgen-VikingGod
Copy link

Sorry for late reply...
Following result:

  • amdgpu pro seams not to build against newer linux kernel like 5.15 used by Pop!_OS 21.10
  • on Pop!_OS 20.04, my RX 580 is visible and works
  • didn't try to upgrade to 21.10 (once I done, I'll report if driver still there or not)
    Thank you all for the help 👍

@inteus707
Copy link

I'm running Pop!_OS 21.10 (PopOS was discontinuing support for 20.04 early). I run the Ubuntu command and it failed because it found pop as the os, but I changed that in the install script. However, when running ./amdgpu-pro-install --opencl=legacy,pal --headless --no-dkms it gives the following error:

ERROR: using --no-dkms with a pro install is invalid.
Did you want to run the following instead?
amdgpu-install --no-dkms

Does anyone have a solution for Pop!_OS 21.10?

Copy link

ghost commented Mar 5, 2022

How do I revert the changes made by this script? (I want to uninstall)

@Dany-Wilde
Copy link

hello ;) ;) ;)

ubuntu is now in 22.04 but I don't know what happened to the amdgpupro driver?

  • has it evolved?
  • is it still available?
  • in what form?
  • and open CL ?
  • what about the evolution of the sources driven by amd?

a lot of questions are asked but, until now, few answers,
few answers.

@yhilgjff
Copy link

yhilgjff commented Oct 20, 2022

a lot of questions are asked but, until now, few answers, few answers.

Dany,

Exactly my thought too and our posts are several months apart. So yes, still very relevant!

My real quest is this however: For 22.04.1 systems is it possible to simply adapt the versions of the script and have it fix OpenCL automagically?

For example, the script says:
major='21'
minor='30'
build='1290604'
system='ubuntu-20.04'

So if we base ourselves on the AMD driver reference which is currently pointing to v22.20 (no build) (https://www.amd.com/en/support/linux-drivers) that would then mean that the same lines would need to read:

major='22'
minor='20'
system='ubuntu-22.04.1'

Should that work on Ubuntu 22.04.1 systems or am I day dreaming here?

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