OpenCL not recognizing Intel iGPU on Linux

asked 2018-09-16 23:39:28 -0600

Hello,

I'm using OpenCV 3.4.3 in conjunction with OpenCL on Ubuntu 16.04.

I ran some sample code below to check if OpenCL could see my GPU:

if(!cv::ocl::haveOpenCL())
    std::cout << "no opencl" << std::endl;

cv::ocl::Context context;

if (!context.create(cv::ocl::Device::TYPE_ALL))
    std::cout << "failed to create" << std::endl;

std::cout << context.ndevices() << "GPU devices are detected" << std::endl;

cv::ocl::Device device = context.device(0);
std::cout << "Name: " << device.name() << std::endl;
std::cout << "Available" << device.available() << std::endl;
std::cout << device.OpenCL_C_Version() << std::endl;

cv::ocl::Device d = cv::ocl::Device::getDefault();
std::cout << d.OpenCLVersion() << std::endl;

Much to my dismay, it could not (output on Ubuntu):

no opencl
failed to create
0GPU devices are detected
Name: 
Available0

However, running that program on Windows (using OpenCV 3.2.0, but still with all of the OpenCL flags checked when building with CMake) produces a different output:

[ INFO:0] Initialize OpenCL runtime...
1GPU devices are detected
Name: Intel(R) HD Graphics 620
Available1
OpenCL C 2.1
OpenCL 2.1 NEO

While I understand Intel drivers are open-source and built into the Linux Kernel, this difference in output leads me to believe that a (similar but not the same) graphics driver is at fault.

That being said, I am unsure where to attain a different set of drivers that are more compatible with OpenCL.

https://01.org/linuxgraphics provides drivers meant only for 3D modeling, and https://www.intel.com/content/www/us/... hasn't been updated with new drivers for anything past Ivy Bridge processors.

If anyone could point me in the right direction to find (what I believe to be at fault) better drivers, or has an idea as to something else that could be causing this issue, I would very much appreciate any help!

edit retag flag offensive close merge delete

Comments

do you have the OpenCL libraries and development libraries installed? (I think the driver is called Beignet)

kbarni gravatar imagekbarni ( 2018-09-17 07:59:09 -0600 )edit

That was exactly what I needed, thank you.

Michael Lilley gravatar imageMichael Lilley ( 2018-09-21 21:01:47 -0600 )edit

I've run into a similar issue except OpenCV recognizes the OpenCL driver (Intel NEO) but my program uses the same amount of CPU usage. I'm using UMat and I also set ocl::setUseOpenCL(true). I built OpenCV with -DWITHOPENCV=ON using the default include path. I am using Intel's compute runtime NEO only. I tried installing Beignet and I receive a warning stating multiple ICD's are being used. Any help is appreciated!

msmith gravatar imagemsmith ( 2019-01-29 14:19:08 -0600 )edit

I found my issue. I was using multiple threads and opencv doesn't support mult-thread opencl software.

msmith gravatar imagemsmith ( 2019-02-01 08:38:12 -0600 )edit