-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Obtaining a javacv build without multithreading #396
Comments
If the pthreads backend now works well enough, sure, send a pull request and let's change all the builds to that! Thanks |
Hi @saudet I'll spend some time in the next 10 days or so trying to get a build out. I'm really quite terrible and inexperienced with C++ (so I might pipe up again on the channel =D).... but we'll see how it goes! |
I do have some code (based on javacpp-preset 1.1) that changes the threading library for the opencv build to TBB. I actually have not had any problems with cvtColor running with 10 simultaneous java threads (windows), neither with the defaults in 1.1 nor with TBB. But I got a minor 5-10% performance increase on our system by switching to TBB. I can check out pthreads, and if that works out good I can make a pull request to change OpenCV default to pthreads. |
@fjank Yes TBB is kind of annoying. If pthreads work just as well, I'd switch to that. Thanks! |
Is this still an issue with JavaCV 1.4 and OpenCV 3.4.0? |
…safety and usability issues (issue bytedeco/javacv#396)
It's done, OpenCV now gets built with pthreads on both Linux and Mac! On Linux, OpenMP causes issues with multithreading for some reason, so pthreads it is. In any case, please give it a try with the snapshots and let me know if you encounter any issues with it: http://bytedeco.org/builds/ Thanks! |
And now part of JavaCV 1.4.4! Enjoy |
On linux x86_64, I see libgomp messages in some cases:
And there is still a Did I miss something ? |
@nicoulaj It's just there for backward compatibility of dependent libraries. OpenCV itself won't use it. |
Hello!
I have enjoyed using the javacv project a great deal. It is really quite excellent getting access to OpenCV from the JVM (also tesseract and a billion other libraries!).
I am, unfortunately, running into a really nasty bug within OpenCV. I have a multi-threaded program that is attempting to use a particular function from OpenCV:
cv::cvtColor
.Unfortunately for me,
cv::cvtColor
is compiled with to take advantage of multiple threads to perform color conversion. This functionality is baked into the OpenCV build. Each platform has its own different backend for multithreading. There's Grand Central Dispatch (GCD) for OSX only, pthreads and OpenMP for both Linux and OSX, and the Intel Thread Building Blocks (TBB) library for Windows and Linux.On OSX, GCD does not obey the
cv::setNumThreads(0)
semantics: it's not possible to tell GCD to not run multithreaded code with only one thread. [https://github.com/opencv/opencv/issues/6461]Would it be possible to collaborate and release platform-specific builds of javacv that use opencv built without any multithreading support?
If not that, then what about building javacv with opencv built with pthreads backends for both OSX and Linux?
The text was updated successfully, but these errors were encountered: