Skip to content

fix opencv/opencv#20613 -- selectOpenCLDevice#20689

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
diablodale:fix20613-selectocldevice
Sep 10, 2021
Merged

fix opencv/opencv#20613 -- selectOpenCLDevice#20689
opencv-pushbot merged 1 commit intoopencv:3.4from
diablodale:fix20613-selectocldevice

Conversation

@diablodale
Copy link
Copy Markdown
Contributor

This fixes #20613 and is compatible with existing behavior of platforms, device types, and device indices. It fixes the case of multiple platforms when those platforms have common substrings. See issue for details.

There should be no change in already working existing behavior of 3.4 and 4.x master when using APIs that allow specification of OpenCL "configuration" or setting the envvar OPENCV_OPENCL_DEVICE. If it worked before, it should continue working in the same way. It it previously failed and could only use the workaround I describe in the issue...now the PR's code will work using the expected manner + the workaround.

Code approach:

  • copy 4.x selectOpenCLDevice() back to 3.4 -- it is compatible and easily used
  • filter platforms rather than trying only first matching platform
  • Alter code to interate the platforms when attempting to get specific devices
  • Overall, there is very little code change.
  • This PR works on 3.4 and 4.x master
  • I squashed the two commits (4.x code, the fix) into one

I could not think of a consistent way to create a test case to exercise this. So existing test cases and CI processes should continue to work. It should not cause a failure.

It is possible to create a specific test case for a specific machine. So if you want that, I will need to have a specific CI setup for the specific fail case described in the issue. Then I can write a test case for that scenario to catch regressions on that specific CI setup.

Pull Request Readiness Checklist

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

* copy 4.x selectOpenCLDevice() -- it is compatible
* filter platforms rather than trying only first matching
* this works on 3.4 and 4.x master
Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done 👍

@opencv-pushbot opencv-pushbot merged commit 07e4076 into opencv:3.4 Sep 10, 2021
@alalek alalek mentioned this pull request Sep 11, 2021
@alalek alalek mentioned this pull request Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants