My main goal is to make Blender 2.82a able to detect my system's GPU then use as OpenCL compute to fasten the time in rendering.
The problem seems to be my Ubuntu distribution version is too high as I have 19.10 (with kernel 5.5.11-050511-lowlatency
) + AMDGPU-PRO's OpenCL component can only officially support up to Ubuntu 18.04, same goes to ROCm.
I did try install AMDGPU-PRO's OpenCL via its installation script targeting only OpenCL component (via --headless
), and even manually install one by one package; all with no success. It is clear as stated, not support shown up in error message. I would like to try again with ROCm but its package seems to be large. With no pre-built package available for my distro, I guess it will fail the same.
So what would be my options if going back to 18.04 would be a last resort in installing OpenCL driver for my GPU (APU from Ryzen 3 2200g to be exact, I have no discrete GPU) alongside already installed open-source OpenGL/Vulkan driver from Mesa ?
Edit:
In the mean time, I did what I can to test things out by installing OpenCL 1.1 via libclang-common-10-dev libclc-amdgcn libclc-dev libclc-r600 libllvm10 mesa-opencl-icd
packages. It shows meaningful information via clinfo
. But Blender still didn't detect any GPU as OpenCL device.
Update 1:
I tested with ROCm. With good reports from here, and here, it becomes clear Ubuntu release version of 19.10 should not be a problem, only just need a proper kernel version. Thus I reverted my kernel version back to 5.3.x (specifically use 5.3.18 generic as 5.3 is stated as a supported version for ROCm, and from the report).
Note that I minimally install packages as stated in 2nd report link as ROCm packages are huge then follow the less of installation instruction from README.md of its github page. Although I'm on eoan
and the package is from xenial
, I do take the risk for now. All passed. I can validate via clinfo
or its /opt/rocm-3.1.0/opencl/bin/x86_64/clinfo
both give meaningful result that I now have OpenCL 2.1 but with NO device found!!!.
Result from clinfo
Number of platforms 1
Platform Name AMD Accelerated Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.1 AMD-APP (3084.0)
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
Result from /opt/rocm-3.1.0/opencl/bin/x86_64/clinfo
Number of platforms: 1
Platform Profile: FULL_PROFILE
Platform Version: OpenCL 2.1 AMD-APP (3084.0)
Platform Name: AMD Accelerated Parallel Processing
Platform Vendor: Advanced Micro Devices, Inc.
Platform Extensions: cl_khr_icd cl_amd_event_callback cl_amd_offline_devices
Platform Name: AMD Accelerated Parallel Processing
ERROR: clGetDeviceIDs(-1)
Asides testing with Blender still doesn't detect GPU, that's right as now I'm having a problem with device not found.
I'm further investigating ...
Update 2:
Problem solved although performance is not good. See my answer of this question below.
At last, I make it works and here is the result from
clinfo
(binary bundled from ROCm).Let's catch up here a bit. Now my system is
apt
command.The point is after completing installation of ROCm. You have to download latest AMD driver. As of my writing it is version 19.50, the exact link is amdgpu-pro-19.50-967956-ubuntu-18.04.tar.xz. Don't worry about Ubuntu release version even you're at 19.10 like my case, the important thing might be to stay at kernel 5.3.x for safety that will suit both ROCm and AMD driver.
Then you use / modify the script from tuxutku here. You can comment out the line of downloading the remote file as you now download it yourself, then operate offline against such file in file system instead. Take good care of the last command which it will copy the result files into
/
. You can even comment that line and do it manually yourself for safety as well.The catch from the script is that we don't really install anything from AMD driver package, but just take shared library, and a few config files out then place in our system. ROCm will interact with it. It involves renaming shared library to avoid conflict in case you have working AMDGPU-PRO installed already as well, so this will isolate the problem.
Remember that
/opt/OpenCL/vendors/amdocl64.icd
haslibamdocl64.so
as its content. We already copied the extracted.so
file to/
thus it will refer to it instead of ROCm's bundled.so
file. If you refer to ROCm's, it won't work and will shout out error of no device found.Now all done. You can verify all things by using separate binary of
clinfo
or the one bundled from ROCm to check if things went well.Even better have some OpenCL-based applications to test it out. I use Phoronix test suite i.e.
pts/juliagpu
orpts/luxmark
to test capability of OpenCL. For Blender, it detects and lists as followingSelect the first one (unknown) seems to be true GPU for Blender, as selected the second one the Scene's setting of "GPU Compute" will grey out.
Yes, you need to make sure it is not greyed out to be sure that it's really GPU that render. Or you can use
radeontop
to monitor the activity when rendering the scene.Lastly, although it works now and Blender detects my GPU. But the performance is worse than before of using CPU with a laggy loading when you click to render the scene. This Blender issue indicates that it only officially support proprietary driver. Thus next step would be trying to purely use AMDGPU-PRO and test things out, but you have to involve effort in properly switch between open source driver and closed one.
Update:
I summed up the solution as described above with some improvement to make it easily to do it in this video.