71

I downloaded intel_sdk_for_opencl_2016_ubuntu_6.0.0.1049_x64, tried to run install.sh but it says Unsupported OS, so I then read somewhere that I needed to make .deb file from one of the RPM files, I did it with 2:

opencl-1.2-devel_6.0.0.1049-2_amd64.deb

opencl-1.2-intel-devel_6.0.0.1049-2_amd64.deb

Installed them both with sudo dpkg -i, but I still don't have the libOpenCL.so that I need

Now I'm stuck... :(

4 Answers 4

98

It looks like libOpenCL.so is provided by the ocl-icd-opencl-dev package. To install this package, run:

sudo apt update
sudo apt install ocl-icd-opencl-dev

Now libOpenCL.so should be located at /usr/lib/x86_64-linux-gnu/libOpenCL.so

5
  • 2
    Also there is python3-pyopencl to use opencl with python / numpy , and drivers for nvidia graphics cards, for c development you will need opencl-headers .. those may be optional for the generic driver listed @Nick Weinberg
    – John Hall
    Jul 9, 2016 at 20:02
  • Thank you very much! Funny in my research I never found a simple answer like that... would you mind telling me if there is a similar way to install cuda as well? Thanks!
    – Badjano
    Jul 9, 2016 at 20:37
  • You can take a look at the packages here: packages.ubuntu.com/… , but I'm not sure which one you need. If you're looking for a specific file provided by a package (like you were looking for libOpenCL.so) there's a "list of files" link on each package's detail page that comes in handy. Jul 10, 2016 at 1:23
  • Seems like it removed nvidia-opencl-dev and installed ocl-icd-opencl-dev for me. Is that what we want? clinfo did not detect anything, either before or after
    – xjcl
    Dec 30, 2020 at 16:39
  • FWIW I needed more packages and I found this question to be helpful Jul 10, 2021 at 23:28
13

The way, suggested by Nick Weinberg, installs a pretty outdated version of the driver, therefore I would suggest to download the one directly from your hardware vendor.

Since you have Intel CPU, do the following

  1. Open the Intel OpenCL drivers web-page, go to "Intel CPU Runtime for OpenCL™ Applications 18.1 for Linux* OS (64bit only)" and press "Download"
  2. The web-site will ask you to register and login. This is mandatory. Then you will be directed to the link with tgz-archive.
  3. Download this archive and install it as follows.

    tar -pvxf l_opencl_p_18.1.0.013.tgz
    cd l_opencl_p_18.1.0.013/`
    sudo ./install.sh`
    

    This installation script will write a lot of libraries into /opt/intel and will create a symbolic link (or replace the old one) /usr/lib/x86_64-linux-gnu/libOpenCL.so.

My understanding of the subject is that the above steps allow OpenCL to access your Intel CPU. But if you have Intel HD Graphics, it makes sense to allow OpenCL to use this integrated graphics too. Then do the following

  1. Open the Intel OpenCL drivers web-page again, but this time go to "Linux* OS Ubuntu* 16.04.x (deb)" under "Intel® Graphics Technology" section. Then you have two choices: "Download" and "Build". Use the "Download" link, it will bring you to pre-built binaries ("Build" will bring you to the source code at Intel's github, but I have never tried to compile it from source).
  2. Follow instructions given over there. I've just copied these here with one fix - use sudo apt instead of sudo dpkg -i *.deb since dpkg does not check dependencies:

    mkdir neo
    cd neo
    wget https://github.com/intel/compute-runtime/releases/download/19.14.12751/intel-gmmlib_19.1.1_amd64.deb
    wget https://github.com/intel/compute-runtime/releases/download/19.14.12751/intel-igc-core_19.11.1622_amd64.deb
    wget https://github.com/intel/compute-runtime/releases/download/19.14.12751/intel-igc-opencl_19.11.1622_amd64.deb
    wget https://github.com/intel/compute-runtime/releases/download/19.14.12751/intel-opencl_19.14.12751_amd64.deb
    wget https://github.com/intel/compute-runtime/releases/download/19.14.12751/intel-ocloc_19.14.12751_amd64.deb
    sudo apt install ./*deb
    

    Note that . in ./*deb is important: without this dot you will get Unable to locate and Couldn't find errors.

P.S. the Intel website lists the suitable CPUs, make sure that yours is in this list.

0

I wanted to get OpenCL working for darktable on Ubuntu 19.04 x64.

Initially darktable-cltest reports

0.016782 [opencl_init] could not find opencl runtime library 'libOpenCL'
0.016851 [opencl_init] could not find opencl runtime library 'libOpenCL.so'
0.016988 [opencl_init] found opencl runtime library 'libOpenCL.so.1'
0.017020 [opencl_init] opencl library 'libOpenCL.so.1' found on your system and loaded
0.021674 [opencl_init] found 1 platform
0.077428 [opencl_init] found 1 device
0.077458 [opencl_init] discarding device 0 `Intel(R) HD Graphics 5500 BroadWell U-Processor GT2' because the driver `OpenCL 1.2 beignet 1.3' is blacklisted.
0.077464 [opencl_init] no suitable devices found.
0.077469 [opencl_init] FINALLY: opencl is NOT AVAILABLE on this system.
0.077473 [opencl_init] initial status of opencl enabled flag is OFF.

But after sudo apt-get install intel-opencl-icd it is working fine.

0

This thread: https://einsteinathome.org/content/quick-guide-how-install-opencl-amd-gpus-linux-kubuntu-1804-and-similar-distro resolved my problem.

To do that you just have to go on the official AMD website and look for your drivers https://www.amd.com/en/support and download the correct Linux one, right now the recent version is 18.30, so get it and extract the content in a folder.

Now use the terminal, move inside that folder, and just run ./amdgpu-install --opencl=legacy,pal --headless

I had to do this in addition to installing the ocl-icd-opencl-dev package.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .