1 | initial version |
OK, so I thought I should answer this for others who might want to change which GPU is doing the calculations.
I found the code below here
if (!cv::ocl::haveOpenCL())
{
cout << "OpenCL is not available..." << endl;
//return;
}
cv::ocl::Context context;
if (!context.create(cv::ocl::Device::TYPE_GPU))
{
cout << "Failed creating the context..." << endl;
//return;
}
cout << context.ndevices() << " GPU devices are detected." << endl; //This bit provides an overview of the OpenCL devices you have in your computer
for (int i = 0; i < context.ndevices(); i++)
{
cv::ocl::Device device = context.device(i);
cout << "name: " << device.name() << endl;
cout << "available: " << device.available() << endl;
cout << "imageSupport: " << device.imageSupport() << endl;
cout << "OpenCL_C_Version: " << device.OpenCL_C_Version() << endl;
cout << endl;
}
cv::ocl::Device(context.device(0)); //Here is where you change which GPU to use (e.g. 0 or 1)
In the end I found that in my case the GT 710M in my laptop only supports OpenCL 1.1, and it seems OpenCL 1.2 and above is required. So I could not "force" it to use the 710M instead of the HD4000.