Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Parallel Image Processing in OpenMP - Image Blocks

Royi
Novice
511 Views

Hello,
I'm doing my first steps in the OpenMP world.

I have an image I want to apply a filter on.
Since the image is large I wanted to break it into non overlapping parts and apply the filter on each independently in parallel.
Namely, I'm creating 4 images I want to have different threads.

I'm using Intel IPP for the handling of the images and the function to apply on each sub image.

I described the code here:

http://stackoverflow.com/questions/29319226/parallel-image-processing-in-openmp-splitting-image

The problem is I tried both sections and parallel for and got only 20% improvement.

What am I doing wrong?
How can I tell each "Worker" that though data is taken from the same array, it is safe to read (Data won't change) and write (Each worker has exclusive approach to its part of the result image).

Thank You.

0 Kudos
1 Reply
jimdempseyatthecove
Honored Contributor III
511 Views

You may want to partition your image differently than in quadrants. The reason being is your processor is capable of processing the data using SSE/AVX/AVX2/... On a 4-way partition, using quadrants results in the vectored operations running half the distance before having to loop. If your data is organized such that it runs row by row, then divide the number of rows by the number of workers.

#pragma omp parallel for
for(int iRow = 0; iRow < height; ++iRow) { // or += height / chunk
  iPos = iRow * width;
  ...

Also, look at your pKernel to assure that it is vector friendly.

Jim Dempsey

 

0 Kudos
Reply