openCV 3.0 beta and OpenCL setDevice
Hi,
in OpenCL, I have studied the ocl_test.cpp. Retrieving information about my system (Windows 7 SP1, 32bit) concerning available CPUs, GPUs and so on works fine. Studying the documentation, I have not found a way to set the device to do the actual computations.
In an older version of openCV, I saw a method like "setDevice", which is not available in the 3.0 beta. So, how can I enable a specific device for further computations? I only found a method called "set" which accepts a void-pointer. Since my GPU (device 0) is not the newest model I would like to enable my multicore-CPU (following device 1 and so on).
Thanks for your tips! Johannes
@JohannesZ as I mention in my answer if you want to enable/specify the device that should be used with opencl, you need to apply the environment variable
OPENCV_OPENCL_DEVICE
. For example in linux:export OPENCV_OPENCL_DEVICE=":GPU:0"
in windows I guess it would be to add theOPENCV_OPENCL_DEVICE=":GPU:0"
in your environment variables path. Moreover, in the Qtcreator IDE that I am using I can specify this variable through the IDE settings for the specific project, so no need to set anything outside the IDE. I guess something similar would apply for other IDE's as well. Anyway, the idea is specify the above variable beforehand and not within your code. I guess this option will be added later on in the new v3.0.0 api.Thanks for your tip! I think it's too bad that you can't set the device in the code directly. I made some tests (see below) but the cast to the void* pointer is not working - no idea why.
Hm, this is strange: without the environment variable you mentioned, cv::ocl::useOpenCL() always return true.
When i set the environment variable to:
Intel(R) OpenCL:CPU:0
There are no error messages (I recently got an error message writing 1:CPU:0) So these parameters should be fine. But in this case, useOpenCL() always returns false.
This is somewhat strange!
you can switch opencl on or off by using the cv::ocl::setUseOpenCL() function:
yes sure. But in case of the environment variable, the methd useOpenCl always returns false, no matter of setuseOpenCL(true/false)
What do you recommend as a OpenCL Runtime for Intel Processors (Core Processors)?
For example, is the "Intel Integrated Native Developer Experience Starter Edition" suitable? Or ist there anoher software package from Intel recommended?
Hi JohannesZ. Did you solve this? I am trying to figure out how to force either the Intel HD 4000 GPU or the nVidia GT710M to do the OpenCL calculations. Check my thread: http://answers.opencv.org/question/62...
Thank you in advance! :)