Ask Your Question
1

How to change OpenCL device.

asked 2017-05-12 05:09:51 -0600

nim gravatar image

Hello, I'm an image process software developer and using OpenCV3.2.0.

I'm also using OpenCL, and confronting with a problem as shown below.


※ PC Environment

  • CPU : Intel(R) Core(TM) i5-6300HQ
  • iGPU : Intel(R) HD Graphics 530
  • dGPU : NVIDIA Quadro M1000M

Qestion

If my knowledge is correct, I have 2 platforms(Intel, NVIDIA), and 3 devices(CPU, iGPU, dGPU).

And I want to use dGPU when an application running on the CPU tries to perform image processing.

But both platforms are different, can't I do it?

Thanks in advance.


What I tried

try 1

the code runing on the CPU

cv::ocl::Context context;
context.create(cv::ocl::Device::TYPE_ALL); … ①
cv::ocl::Device device;

std::string deviceName;

for(int i = 0; i < context.ndevices(); i++) {
    device = context.device(i);
    deviceName = device.name();
}

"deviceName" is always "Intel(R) HD Graphics 530".

I changed ① to TYPE_GPU, TYPE_DGPU, there was no change.


try 2

std::vector<cv::ocl::PlatformInfo> platforms;
cv::ocl::getPlatfomsInfo(platforms);
const cv::ocl::PlatformInfo* platform;

std::string name = platform->name();

for(int i = 0; i < platforms.size(); i++) {
    platform = &platforms[i];
    platform->getDevice(device, 0);
    deviceName = device.name();
}

"deviceName" are "Intel(R) HD Graphics 530", "Quadro M1000M".

It seems dGPU is recognized, but I don't know how to fix it to GPGPU device.


try 3

I changed OPENCV_OPENCL_DEVICE environment variable to "NVIDIA:DGPU:1000", there was no change.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
2

answered 2017-05-12 08:45:09 -0600

mshabunin gravatar image

The suggestions from the issue #5165 are:

OPENCV_OPENCL_DEVICE=:GPU:650
OPENCV_OPENCL_DEVICE=NVIDIA:GPU:650
OPENCV_OPENCL_DEVICE=NVIDIA:GPU:

Also, the documentation states the following format of OPENCV_OPENCL_DEVICE:

<Platform>:<CPU|GPU|ACCELERATOR|nothing=GPU/CPU>:<DeviceName or ID>
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-05-12 05:09:51 -0600

Seen: 4,650 times

Last updated: May 12 '17