Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
43 Views

Overriding data dependency and force vectorization

I have a loop which inside a parallel construct which goes like this 

# pragma omp parallel ... //directives
{
// other loops 
....

#pragma omp for
for (i=1; i<=nx; i++) for (j=1; j<=ny; j++) for (k=1; k<=nz; k++)
 {
	  p_sparse_s = RLL + (riri_sparse2 / noemer_sparse) * p_sparse_s;
 }

// other loops
....
}

On inspecting it seems this loop is not being vectorized because of assumed dependency. On further inspecting with dependence analysis there is no dependency ( as evident from the code ). How should the directive be changed so that I enforce vectorization.

Also I tried using ivdep directive still the compiler didn't vectorised.

0 Kudos
2 Replies
Highlighted
43 Views

You can try other methods of enforcing vectorization listed here.

 

0 Kudos
Highlighted
Black Belt
43 Views

You don't show sufficient information to understand why there might be a dependency; it's not at all evident how you have declared p[][][].  The requirements for restrict qualifiers on your declaration of p[][][] get annoying with multiple levels of indirection, so I'm guessing you may not have that set up.  You could over-ride that category of dependency  if you write the nested loops out with #pragma omp simd on the inner loop.

0 Kudos