I am writing a program in C (a 2d poisson solver) and I am using openMP to speed-up a big for loop. What I observed is that inside an openMP parallel block, the for loop is not vectorized even in the case where I include the #pragma always vector directive. For the compilation I am using the pathscale compiler.
The code I want to vectorize looks like this :
#pragma omp parallel shared(in, out, lambda,dim,C) private(k)
{
#pragma omp for schedule(guided,dim/nthreads) nowait
for(k = 0;k < dim; k++){
in[k] = C*out[k]*lambda[k];
}
}
where out,lambda and in are double precision arrays.
But even if I include #pragma always vector, what the compiler answers is :
warning: ignoring #pragma always vector
Do you know if there is any workaround for this?
Thanks.
I looked through the User Guide for the PathScale compiler, and did not find neither
#pragma alwaysnor#pragma vector. So I think the compiler just tells you that it does not recognize this pragma, and ignores it.However in section 7.4.5 I found the following options that should help you with vectorization:
As a side note (guessing where you could take that
#pragma always vectorfrom), Intel’s compiler has#pragma vectorwithalwaysbeing one possible parameter to the pragma. But pragmas are generally compiler-specific, except for few extensions (OpenMP being one) that are supported by multiple vendors.