Ask Your Question


asked 2017-11-06 05:27:12 -0500 gravatar image

Dear all how to compile opencv code when we use parallel_for_ inside the code i need to add some options in g++ ? for example g++ - pthread ? it is not clear for me thanks per advence

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-11-06 07:26:49 -0500

kbarni gravatar image

If you want to use OpenCV's parallel_for_, you don't need to add anything at compile time, but you need OpenCV compiled with WITH_TBB flag and have libtbb2 installed.

I find a lot easier to use the parallel_for directly from the tbb2 library. In this case toy need to add -ltbb to the g++ arguments.

See this answer about using TBB's parallel_for.

edit flag offensive delete link more


parallel_for_ is a wrapper not only for TBB. It also works with OpenMP, pthreads (Linux), Concurrency and WINRT (Windows),, GCD (Apple) and CStripes.

matman gravatar imagematman ( 2017-11-06 11:29:34 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-11-06 05:27:12 -0500

Seen: 103 times

Last updated: Nov 06 '17