opencvsharp icon indicating copy to clipboard operation
opencvsharp copied to clipboard

How to select device of OpenCL

Open utarn opened this issue 7 years ago • 2 comments

Summary of your issue

I have two system. One is AMD ryzen with GTX1080. The other is INTEL 7th gen with GTX1080. I run the yolo face recognition using

On AMD system, Opencvsharp select GTX1080 as the cpu does not support OpenCL. However, on Intel system, Opencvsharp select Intel first as it could run OpenCL.

Environment

There are 2 systems.

  1. AMD Ryzen 1600, GTX1080
  2. Intel i5-7500, GTX1080, (Intel graphic onboard is disabled) Both Windows 10 64-bit

What did you do when you faced the problem?

CPU is 100% on Intel system and GTX1080 cuda usage is 0%

Example code:

            net = CvDnn.ReadNetFromDarknet(cfg, model);
            net.SetPreferableBackend(Net.Backend.DEFAULT);
            net.SetPreferableTarget(Net.Target.OPENCL);

Output:

paste your output

What did you intend to be?

I want to use GTX1080 for Dnn on both AMD and Intel. To improve the framerate. How do I select GTX1080 as a performing device instead of Intel cpu.

utarn avatar May 08 '19 23:05 utarn

I got the settings from here. https://github.com/opencv/opencv/issues/14506

utarn avatar May 09 '19 04:05 utarn

Concrete code, that worked for me: Environment.SetEnvironmentVariable("OPENCV_OPENCL_DEVICE", "NVIDIA:GPU:0"); Validation: Console.WriteLine(Environment.GetEnvironmentVariable("OPENCV_OPENCL_DEVICE")); NOTE: my 1050Ti is actually slower than my HD630 during YOLOv3, so something is fishy here.

vndlczndr avatar Nov 03 '19 19:11 vndlczndr