What Is The Minimal Nesesary File Subset, Required to Amd Opencl Work on Linux

What is the minimal nesesary file subset, required to AMD OpenCL work on Linux?

It took me several steps further, to get all up and running:

  • There are several important symbolic links for libraries, like *.1, *.1.0.0, so on. They must be copied as well. That got opencl working, but miner still wrongs on the number of availble memory and compute units was displayed incorrectly and i had segfaults.

  • /opt/amdgpu/share/libdrm/amdgpu.ids is required for gpu models' names and their video memory sizes being detected and displayed correctly.

  • /etc/amd/amdapfxx.blb is important file, serving for some top secret, unknown reasons.

  • As I was upgrading amdgpu-pro driver it was important not to mess library files from different versions. It was easy to do such mistake, as buildroot caches overlay to output/target structure, if you delete something from overlay you have to delete it from target as well. And such a library mess could lead to segfaults

  • To further minify subset, libEGL and libGLESv2, libgbm can be deleted. They are not nesesary for OpenCL operation and this saves 1-1.5 megs extra space.

  • LLVM seems to be unrelated to OpenCL totally, saving huge amount of space. I am not sure, maybe it is required by GL or Vulkan.

And here is complete list of nesesary files and symlinks, with exact locations, in order to get OpenCL properly working:

/usr/lib/libamdocl64.so
/usr/lib/libamdocl12cl64.so
/usr/lib/libdrm.so -> libdrm.so.2.4.0
/usr/lib/libdrm.so.2 -> libdrm.so.2.4.0
/usr/lib/libdrm.so.2.4.0
/usr/lib/libdrm_amdgpu.so -> libdrm_amdgpu.so.1.0.0
/usr/lib/libdrm_amdgpu.so.1 -> libdrm_amdgpu.so.1.0.0
/usr/lib/libdrm_amdgpu.so.1.0.0
/usr/lib/libdrm_radeon.so -> libdrm_radeon.so.1.0.1
/usr/lib/libdrm_radeon.so.1 -> libdrm_radeon.so.1.0.1
/usr/lib/libdrm_radeon.so.1.0.1
/usr/lib/libkms.so -> libkms.so.1.0.0
/usr/lib/libkms.so.1 -> libkms.so.1.0.0
/usr/lib/libkms.so.1.0.0
/usr/lib/libOpenCL.so -> libOpenCL.so.1
/usr/lib/libOpenCL.so.1
/usr/bin/clinfo
/etc/amd/amdapfxx.blb
/etc/OpenCL/vendors/amdocl64.icd
/opt/amdgpu/share/libdrm/amdgpu.ids

Enable OpenCL over multiple platforms in Linux? How to proceed with ICD files?

As mentioned before, three things are necessary:

From https://wiki.tiker.net/OpenCLHowTo

  • Packages of ICD loaders: (you just need one of these)
  • Packages of ICDs
  • Package for headers

Thus for an Intel CPU and a NVIDIA GPU

  • Packages of ICD loaders:

    • ocl-icd-libopencl1
  • Packages of ICDs
    • Installed Intel OpenCL runtime
    • nvidia-opencl-icd-352
  • Package for headers
    • opencl-headers

However, to get it to work, it is necessary to make sure the packages are marked as install by dpkg --get-selections | grep opencl

sudo apt-get install --reinstall nvidia-opencl-icd-352 opencl-headers ocl-icd-libopencl1

On top of that, you must make sure that intel64.icd and nvidia.icd are in /etc/OpenCL/vendors (ls -l /etc/OpenCL/vendors).

That said, I had to link intel64.icd with:

cd /etc/OpenCL/vendors/
sudo ln -s /opt/intel/opencl-1.2-X.X.X.X/etc/intel64.icd

And, since nvidia.icd was not in the folder (even after the installation of the right package) I had to extract it and manually move from the deb package

dpkg -x /var/cache/apt/archives/nvidia-opencl-icd-352_352.63-0ubuntu0.14.04.1_amd64.deb ~/tempfolder
sudo mv ~/tempfolder/etc/OpenCL/vendors/nvidia.icd /etc/OpenCL/vendors/nvidia.icd
rm -r ~/tempfolder

Finally, make sure nvidia is the active GPU

sudo prime-select nvidia
sudo reboot -r now

Install and execute clinfo and both platforms should show-up.

clinfo 
Number of platforms: 2
Platform Profile: FULL_PROFILE
Platform Version: OpenCL 1.2 CUDA 7.5.23
Platform Name: NVIDIA CUDA
Platform Vendor: NVIDIA Corporation
Platform Extensions: cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts
Platform Profile: FULL_PROFILE
Platform Version: OpenCL 1.2 LINUX
Platform Name: Intel(R) OpenCL
Platform Vendor: Intel(R) Corporation
Platform Extensions: cl_khr_icd 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_byte_addressable_store cl_khr_spir cl_intel_exec_by_local_thread cl_khr_depth_images cl_khr_3d_image_writes cl_khr_fp64


Related Topics



Leave a reply



Submit