-
Notifications
You must be signed in to change notification settings - Fork 747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unstable result of opencv_core.useOpenCL() #659
Comments
In the latest JavaCPP 1.4.4-SNAPSHOT (OpenCV 4.0.0) there is the same behavior: sometimes useOpenCL() returns false, but usually true, |
Sounds like a bug in your video driver. Upgrade to the latest version, but as usual if that doesn't fix it, please report this issue upstream! |
I've updated my driver to the latest version from https://www.nvidia.com/Download/index.aspx My version is GeForce GTX 770M, 417.35 (latest for today). It does not help. I just added the following line to the start of every my OpenCV function:
When I call my functions from single thread, results are always correct: But while calling from different parallel threads, the results are another: sometimes I see C++ implementation of useOpenCL is almost the same in 3.3.0 and 4.0.0. For example, in 4.0.0 it returns It seems that it checks whether the device in "available" now, and return false if not. What does it mean? Can you advise me to use always |
So, sounds like another bug in OpenCV. Please report upstream!
|
Hello Samuel, it seems I found the problem: see opencv/opencv#13472 (comment) |
I don't think that's issue, unless your OpenCL implementation has a bug and isn't thread-safe, which may very well be the case... |
Let's close this issue as it is now being tracked upstream. |
I detected very strange bug. In my test, I intensively call opencv functions from different threads (I repeat all calculations 150 times in a simple loop). Every time I call opencv_core.useOpenCL() method to decide, whether I should use Mat or UMat version of my function. And... sometimes opencv_core.useOpenCL() returns false!
Of course, usually it returns
true
on my computer. However, in the same program, moreover, in a single Java loop (!) this method sometimes returnfalse
.How is it possible? Maybe, it is also a problem of insufficient synchronization, like in #650 ? Can you advise me some workaround (probably, I need to call this function only once and store the results in some Java constant)?
I work with JavaCPP 1.4 version (OpenCV 3.4.0-1.4)
The text was updated successfully, but these errors were encountered: