OpenMP inhibits vectorization

OpenMP inhibits vectorization

Attached is a reduced test case where the use of OpenMP inhibits vectorization for no apparent reason, resulting in a substantial performance decrease.

Using the -vec-report flag, the missed vectorization is the loop beginning on line 77.  If compiled without OpenMP, the two function calls to "weno6" are inlined and vectorized; without OpenMP, the loop is not vectorized.  It's not clear to me if ifort is inlining the function calls when OpenMP is active, which may be the source of the problem.  Using -opt-report, ifort reports a possible vector dependence in the loop, but only when compiled with OpenMP.  A workaround is to add "!DEC$ SIMD" before the loop, in which case it is vectorized.

This is with ifort 12.1.6 20120928 on Mac OS X 10.8.3.  The code is compiled with "ifort -O3 -finline -vec-report".

Downloadapplication/octet-stream missed-opt.f904.4 KB
2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

It certainly looks as if your function is inlined.

I wouldn't say there is "no apparent reason" for non-vectorization, but the reasons I've seen from various compiler versions are bogus.

It's not the first time -openmp has caused the compiler to be more cautious about dependencies.  This also looks complicated enough to fall under the stated policy of relying on the directives to control optimization in cases of any doubt.

If you're interested in the direction ifort is taking, you might get the beta compiler and file a problem report, possibly with respect to both the old and future directives.

Leave a Comment

Please sign in to add a comment. Not a member? Join today