Can we use OpenMP with latest version of openCV - visual-c++

I want to parallelize my image processing codes using openMP. I have a doubt if OpenMP is supported by the latest versions of OpenCV like 2.4.4 or 2.4.5 versions. I know abt TBB but looks too complicated.

You might consider looking into cv::parallel_for_(). It provides a layer of abstraction for several parallelism mechanisms. If you have compiled OpenCV with OpenMP support, cv::parallel_for_() will use OpenMP when it can. Many OpenCV functions use cv::parallel_for_ intenally, but you might have to dig into the source to see whether parallel execution is actually happening.

Related

Multithreaded MKL and Eigen

I need to use a parallel linear algebra on OSX and as painlessly as possible (i.e., at most I can use HomeBrew with my colleagues) factorization library due to the number of DOFs I have in my problems.
I've tried Armadillo, it supports sparse algebra which is what I need, I can link with the Accelerate framework, but it just solves linear problems, it doesn't support factorization AFAIK.
Next, MKL, but nothing I can do seems to trigger threading, even with TBB:
tbb::task_scheduler_init scheduler(4);
mkl_set_dynamic(true);
mkl_set_num_threads(4);
mkl_set_num_threads_local(4);
Eigen could be cool, but it seems that, like MKL, it won't run in parallel.
Do you have any suggestions?
OSX clang does not support openmp, which is required by multi-thread Eigen and MKL.
According to IntelĀ® Math Kernel Library Link Line Advisor, MKL does not support TBB threading with clang.
But it seems to support Intel OpenMP library with the extra link option -liomp5. You could try if it works. If not, you may have to use another compiler such as gcc. You could find it in HomeBrew.

How to use IPLib of Intel Imageprocessing Library in vc++?

I have just found IPL21 library of Intel image processing library on web.
But I can't find how to use and compile this library in vc++2010.
There isn't an example about this as I know.
So would you please let me know the example of what how to load and compile the library in vc++2010 and how to read file and use in processing.
IPL library is too outdated to be helpful. It misses code optimizations for all modern CPU architectures. Instead, you better try community license IPP.Besides optimization it has many additional functions for image processing.

C++ 98 and threading

I am working with OpenCV, an open source image processing library, and due to complexities in my algorithm I need to use multiple threads for video processing.
How multi-threading is done on C++ 98? I know about C++ 11 has a built in support library for threading (std::thread) but my platform (MSVC++ 2010) does not have that. Also I read about Boost library, which is a general purpose extension to C++ STL, has methods for multi-threading. I also know with MSDN support (windows.h) I can create and manage threads for Windows applications. Finally, I found out that Qt library, a cross platform GUI solution, has support for threading.
Is there a naive way (not having any 3rd party libraries) to create a cross-platform multi-threading application?
C++98 does not have any support for threading, neither in the language nor the standard library. You need to use a third party library and you have already listed a number of the main candidates.
OpenCV relies on different external systems for multithreading (or more accurately parallel processing).
Possible options are:
OpenMP (handled at the compiler level);
Intel's TBB (external library);
libdispatch (on systems that support it, like MacOS, iOS, *BSD);
GPGPU approaches with CUDA and OpenCL.
In recent versions of OpenCV these systems are "hidden" behind a parallel_for construct.
All this applies to parallel processing, i.e., data parallel tasks (roughly speaking, process each pixel or row of the input in parallel). If you need application level multithreading (like for example having a master thread and workers) then you need to use frameworks such as POSIX's threads or Qt.
I recommend boost::thread which is (mostly) compatible with std::thread in C++11. It is cross-platform and very mature.
OpenCV's parallelism is internal and does not directly mix with your code, but it may use more resources and cores than you might expect (as a feature), but this might be at the expense of other external processes.

OpenCV parallel computing descriptors?

I am developing an object-recognition system. I found that the critical part of my algo is the
extractor.compute();
(After having detector.detect() keypoints)
Is there any way to let compute the feature vector with more core? I can use up to 8 core.
Opencv already implements multithread framework for this. Check that you compiled opencv with threading option 'ON'. You should go for an opencv documentation reading, gpu::SURF_GPU may interest you.
You can run cmake again to see the compilation options you used.

OpenMP with OCAML

Does anyone know if it's possible use OpenMP with OCaml source code?
Or another application/ambient of work, compatible with OCaml, that allows me to run parallel programs that exploit multiple cores?
If yes, how? Have you got an easy example?
Currently there is OC4MC (ocaml 4 multi-core) to perform shared memory multi-processing. I have not used the project, but there are fairly recent updates, so I can only assume the project is still moving forward.
JOCAML is another concurrent extension to ocaml implementing the join calculus. I have also not used this project, but their site is updated to mention ocaml 3.12, which came out fairly recently. Disregard; see comment.
If you can pry yourself away from the openMP paradigm, then there are ocaml bindings for mpi. I use this project, and have not had problems with it, and it's pretty easy to use if you are familiar with MPI.
Lastly, some (possibly unmaintained) packages pertaining to multi-core / parallel processing can be found on the ocaml hump.

Resources