Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Evaluating multiple regions of interest


Hi all,

I'm trying to accelerate a 2D visual tracker using ARBB. My application needs to evaluate multiple regions of interest (ROIs) from each frame. These ROIs are independent, so they can be evaluate in parallel.

To do that, I develop a simple program using ARBB technology. I create a map function which extracts each ROI using the ARBB section function. Then, a sum reduction is applied to compute its weight. The code:

[cpp]void evaluateROIMap (const dense& frame, const i32 & ROIX , const i32 & ROIY, i32 & weight, i32 ROIWidth, i32 ROIHeight) { dense ROI = section(frame, ROIX, ROIWidth, ROIY, ROIHeight); weight = sum(ROI); }[/cpp]

where ROIX and ROIY represent the upper-left corner of each ROI, and ROIWidth and ROIHeight represent the ROI size.

Im running this code in a Intel Core I7-2620 CPU 2.70GHz (Windows7-64 bits), but ARBB version is spending more time than non-optimized serial version. Launch configuration consist in:

    • Number of ROIs: 4096
    • ROIWidth: 32
    • ROIHeight: 32
    • Frame size: 512x512

Serial version elapsed time after 50 executions: 0.0048 seconds
ARBB version elapsed time after 50 executions: 3.32 seconds

Am I doing something wrong?. Any help will be appreciated.


0 Kudos
2 Replies
I assume there is not enough work (4.5ms workload for serial execution) to scale it to 8 threads. Amplifier XE can show more detailed information.
0 Kudos
Black Belt
Have you verified that all threads are not each running all regions?
Also, the large variance between serial = 0.0048 and parallel == 3.32 seconds is about 691:1.
Running VTune may indicate where your program is hiding.

I suspect your code is

Instantiating thead teams 4096/8 times (each ROI)

As opposed to

Instantiating a thread team once, each thread examining 4096/8 (512) seperateROI's

IOW excessive thread team build/takedown

Jim Dempsey
0 Kudos