Why does cv::ocl::haveOpenCL() not return?

asked 2015-08-03 08:32:36 -0600

mbkv gravatar image

updated 2015-08-03 08:47:37 -0600

I am trying to use a simple code to check for presence of OpenCL support in Fedora 21. "clinfo" on my system lists my CPU as supporting OpenCL specifications.

 #include <opencv2/core/ocl.hpp> // check OCL
 if (!cv::ocl::haveOpenCL())
 {
     cout << "OpenCL is not avaiable..." << endl;
     return -1;
 }
else
{
    cout << "Hi1" << endl;
}
std::exit(-1);

The call to haveOpenCL() in the above code does not return. I checked and it seems that the problem occurs in the function call g_isOpenCLAvailable = ::clGetPlatformIDs(0, NULL, &n) == CL_SUCCESS; in the source file ocl.cpp. I have provided the gdb backtrace below.

(gdb) bt #0 0x00007ffff33fadd3 in pthread_mutex_unlock () at /lib64/libpthread.so.0 
#1 0x00007ffff7ded4c9 in tls_get_addr_tail () at /lib64/ld-linux-x86-64.so.2
#2 0x00007ffff2f3704c in __cxa_get_globals () at /lib64/libstdc++.so.6 
#3 0x00007ffff2f38063 in __cxa_throw () at /lib64/libstdc++.so.6 
#4 0x00007ffff41333ff in (anonymous namespace)::opencl_fn3<58, int, unsigned int, _cl_platform_id**, unsigned int*>::switch_fn(unsigned int, _cl_platform_id**, unsigned int*) () at  /home/myopencv3build/lib/libopencv_core.so.3.0 
#5 0x00007ffff414d096 in cv::ocl::haveOpenCL() () at /home/myopencv3build/lib/libopencv_core.so.3.0 
#6 0x0000000000405096 in main(int, char**) (argc=3, argv=0x7fffffffdb78) at /home/mysources/bgsub.cpp:69

Any help in resolving this would be greatly appreciated. Update: bug filed in the official channel https://github.com/Itseez/opencv/issu...

edit retag flag offensive close merge delete

Comments

2

Can you try your code with an another graphic card? Many cards are ready for opencl in theory but in practise you can have some surprise

LBerger gravatar imageLBerger ( 2015-08-03 09:09:25 -0600 )edit