- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a simple program compiled with Intel Fortran Classic that links to a static library using OpenMP directives (including !$omp SIMD on a couple of loops). When I compile the static library, I can see that there has been optimisation and that the loops I want vectorised have (supposedly) been vectorised. Then I compile the main program under /O3 and /Qopenmp (same as for the library); no errors, everything looks good. But when I profile the program using Intel Advisor it tells me that the loops that I thought I had vectorised (in the static library) are scalar.
In an effort to chase down what is going on, I moved the subroutines with the loops I want vectorised from the static library to the main program. Compiling again and then profiling using Intel Advisor, I see that the loops (that were previously in the static library and are now in the main program) are now vectorised. That leads me to suspect that the optimisation (supposedly) happening when the static library is compiled isn’t making its way to the main program. Am I missing an option when compiling the static library? Do I need to specify something special when linking the main program? How do I make it so that the code in my static library (with OpenMP SIMD) directives works the same (and performs as well) as if it were compiled in the main program?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What happens when you link the .obj file generated in the static library build directly into your main application as opposed to via the static library?
Also, the optimized code generated, especially for code that can vectorize, most often has data alignment checks (as well as CPU instruction set availability checks) and then takes one of multiple code paths. This may be the case of data alignment is different.
Additionaly, intraprocedural optimizations may have inlined the non-library build and was able to determine/have aligned data.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your question. To assist you better, we need some additional information:
- compiler version
- reproducer
- environment details, i.e. operating system, Visual Studio version if applicable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're building a static library, but how are you linking? The OpenMP library on Windows is DLL-only.
If you build your library with /Qipo and your main program too, then there will be whole-program optimization including the library.
![](/skins/images/D3C0B914909A6564BBB97F4AD1ED1973/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page