I have two GPUs : Intel HD and nVidia Quadro. Using GPU Caps Viewer, I can detect my both GPUs in the OpenCL tab. However, by executing this code I am only getting the Intel one:
cv::ocl::setUseOpenCL(true);
if (!cv::ocl::haveOpenCL()) {
std::cout << "OpenCL is not available..." << std::endl;
}
cv::ocl::Context context;
if (!context.create(cv::ocl::Device::TYPE_ALL)) {
std::cout << "Failed creating the context..." << std::endl;
}
std::cout << context.ndevices() << " GPU devices are detected." << std::endl;
for (int i = 0; i < context.ndevices(); i++) {
cv::ocl::Device device = context.device(i);
std::cout << "name: " << device.name() << std::endl;
std::cout << "available: " << device.available() << std::endl;
std::cout << "imageSupport: " << device.imageSupport() << std::endl;
std::cout << "OpenCL_C_Version: " << device.OpenCL_C_Version() << std::endl;
std::cout << std::endl;
}
Results:
1 GPU devices are detected.
name: Intel(R) HD Graphics P530
available: 1
imageSupport: 1
OpenCL_C_Version: OpenCL C 2.0
Information:
- Windows 10
- OpenCV 3.1
- Visual studio 2013
- nVidia Quadro M4000M
Notes:
- I am able to call my nVidia GPU directly using the OpenCV Cuda Interface.
- I have just installed the latest driver from nVidia website.