How to select device of OpenCL
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.
- AMD Ryzen 1600, GTX1080
- 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.
I got the settings from here. https://github.com/opencv/opencv/issues/14506
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.