Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
7731 Discussions

Overriding data dependency and force vectorization

Aniruddha_P_
Beginner
326 Views

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
Sravani_K_Intel
Moderator
326 Views

You can try other methods of enforcing vectorization listed here.

 

TimP
Black Belt
326 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.

Reply