Skip to content

Intel CPU OpenCL runtime on windows not found with Intel:CPU: configuration #20613

@diablodale

Description

@diablodale

The official Intel OpenCL CPU runtime for Windows v2021.3.0.3372 fails to be found by OpenCV when Intel:CPU: is the desired OpenCL configuration. This is due to a code logic failure in the OpenCV OpenCL support function selectOpenCLDevice().

System information (version)

  • OpenCV => 3.x and 4.x
  • Operating System / Platform => all
  • Compiler => all
  • Intel UHD GPU driver v30.0.100.9684
  • NVidia rtx2070super graphics driver v471.68 studio
  • Intel OpenCL CPU runtime for Windows v2021.3.0.3372

Detailed description

On my development computer I have 2 GPUs: integrated Intel GPU, NVidia discrete. Each have OpenCL runtimes as part of their standard graphics drivers install. In addition, I installed the official Intel OpenCL CPU runtime for Windows v2021.3.0.3372 so I can debug a separate OpenCV issue.

When clinfo and OpenCV probe to find the known platforms, there are three platforms. The platform names are returned by the OpenCL apis from index 0 -> 2 as

NVIDIA CUDA
Intel(R) OpenCL HD Graphics
Intel(R) OpenCL

These three platforms represent the nvidia discrete, intel gpu, and intel cpu runtimes.
The OpenCV support function selectOpenCLDevice() is universally called to find and associate to a specific OpenCL device. I need to use the specific device runtime so I set the env var OPENCV_OPENCL_DEVICE

Set to value Intel:CPU:
Fails.
The function finds the substring "Intel" in the 2nd platform and stops the search. It then attempts to find a CPU runtime in the "Intel(R) OpenCL HD Graphics" runtime and fails. Therefore, no matching OpenCL device is found and OpenCL is disabled.

Set to value Intel(R) OpenCL:CPU:
Fails.
The function finds the substring "Intel(R) OpenCL" in the 2nd platform and stops the search. It then attempts to find a CPU runtime in the "Intel(R) OpenCL HD Graphics" runtime and fails. Therefore, no matching OpenCL device is found and OpenCL is disabled.

The current code's approach to look for a substring and stop at first match will not work when there are multiple platforms with the same substring.

Workaround

The general issue has no workaround.
If there is only one CPU runtime installed and a CPU runtime is needed, then a workaround is the envvar to :CPU:

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions