meaning of nstripes parameter in parallel_for_ in OpenCV3

asked 2015-08-03 03:42:53 -0500

mbkv gravatar image

updated 2015-08-03 03:51:32 -0500

What does the parameter "nstripes" mean in paralell_for_() function in OpenCV3? From my initial search, I found the following points.

  1. "Specifying proper nstripes can be crucial for good performance" says the OpenCV3 presentation in CVPR 2015.

  2. Browsing the source files, I found that this parameter is passed to the underlying pthreads wrapper.

  3. Most importantly, this parameter cannot exceed the size of the first parameter Range passed to parallel_for_

  4. In bgfg_gaussmix2.cpp, the parallel_for_ is invoked with nstripes parameter equal to "image.total()/(double)(1 << 16)", that is, the total number of pixels divided by 256*256. Why is this so?

edit retag flag offensive close merge delete

Comments

I'm not sure but may be this link can help you

LBerger gravatar imageLBerger ( 2015-08-03 04:19:40 -0500 )edit

It does not. Because it is the tbb API, whereas in OpenCV parallel_for(), this parameter has been passed on to the pthreads API

mbkv gravatar imagembkv ( 2015-08-03 07:53:45 -0500 )edit
1

may be you don't use TBB because your cmake config is different. I think that parallel_for is defined here and code parallelization depends of your config.

About nstripes I think it gives you number of loop by thread (relative to range parameter) I have deduce this from this line and this line

LBerger gravatar imageLBerger ( 2015-08-03 09:19:26 -0500 )edit