Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Using IVF and MKL with libguide

brianlamm
Beginner
357 Views
This question is related to using IVF and Intel MKL together, with the necessity of using libguide.lib or libguide40.lib.

The MKL doc reads if one is using the IVF compiler, use the libguide provided with the compiler. Now, my problem is the library "mkl_solver.lib" (I'm assuming IA32 build and target for concreteness), is Not supplied in dll form, so it Must be Statically linked, per the MKL doc. However, the MKL doc goes on to read even if one is statically linking that solver, use the Dynamic lib libguide40.lib. Part of the problem is MKL also supplies libguide40.lib (and libguide40.dll) dynamic libraries, and static library libguide.lib (in case one is Not using IVF to build using MKL). IVF also supplies those exact same Named libraries, even though the IVF libraries are different. Besides, like I wrote above, MKL recommends (strongly) using the dynamic libguide40.lib even if statically linking, and, if one is also using IVF, to use the libguide supplied with IVF, and Not the libguide supplied with MKL.

So my problem is How do I ensure libguide40.lib from the IVF gets used instead of the one shipped with MKL? In the command line I have specified /Qopenmp and /Qopenmp-lib:legacy (thus assuring I get the IVF libguide), But I have also specified (by Necessity since I Must statically link since I'm using mkl_solver.lib) the options /libs:static /threads . In the "additional dependencies" for the Linker (project properties) I have specified all the additional mkl libraries I need to link my app.

Now, in "additional dependencies" I have in one build added "libguide40.lib" and in a different build I have Not included "libguide40.lib" (in front of and in addition to the mkl libraries required). BOTH times the solution built without error, and it appears (based on built dll size alone) the dll built which uses the mkl_solver is Identical. But I did notice in the build log where I specified "libguide40.lib" dependency the IVF lib directory was first searched, and searched in libguide40.lib, and then the mkl (ia32) lib directory was searched in the mkl libraries specified in the additional dependencies, and right after that the IVF lib directory was searched in libguide.lib (no "40").

In the build where I did Not specify libguide40.lib in the additional dependencies only libguide.lib was searched in the IVF lib directory, after the mkl lib directory was searched for the required mkl libraries.

HOW do I determine whether or not libguide40.lib or libguide.lib was used in the build? As I wrote above, regardless of having "libguide40.lib" in the additional dependencies or not, the IVF lib directory was used to search libguide.lib (no "40"). Both the IVF and MKL docs strongly recommend against using libguide.lib (static), so I want to make sure I'm adhering to that recommendation, but cannot find out how to determine Which (libguide40.lib or libguide.lib) was linked against in the build.

-Brian
0 Kudos
4 Replies
Steven_L_Intel1
Employee
357 Views
Brian,

libguide.lib is the static library and libguide40.lib is the export library for the DLL version. If you generate a link map you can see which library was used, but it should be reasonably obvious as to whether you are linking to static or DLL libraries.

It can be a problem that both the compiler and MKL provide libguide - this is because MKL can be used with non-Intel compilers. The particular situation you describe, with link order, can indeed cause a mess. It's a problem which we've recently become more aware of and we are looking for a good solution.

I think the advice I'd offer is to rename the libguide.lib and libguide40.lib in the MKL folder to something else and to use the compiler's version only.
0 Kudos
brianlamm
Beginner
357 Views
Steve,

Thanks very much for the renaming recommendation. I have now done that.

However, I might mention the libguide export library and the libguide static library searched in the two builds were from the IVF installation, so I was already adhering to your, and the MKL and IVF, advice of linking against the libguide in IVF, I just did not know which one, the export or the static, was used to resolve dependencies.

So, it appears I must include libguide40.lib in the additional dependencies, as well as specifying /Qopenmp and /Qopenmp-lib:legacy in the command line, to adhere to (strong) Intel recommendation of linking against dynamic libguide, even when the rest of the project build is "static" (/libs:static); "static" in this case because mkl_solver can, currently, only be statically linked.

It just worried me a bit to see libguide.lib being searched After libguide40.lib was searched (both from the IVF installation though) where I had specified libguide40.lib in the linker dependencies.

Thanks again,
-Brian
0 Kudos
Steven_L_Intel1
Employee
357 Views
If you have a situation where you must link statically, then do that. You're correct in saying that you'd then have to manually enter libguide40.lib as a dependency, and it might not hurt to add libguide.lib to the list of "ignore" library settings in the linker property page.
0 Kudos
brianlamm
Beginner
357 Views
Steve,

Thanks for the advice regarding specifying libguide.lib in "ignore" libraries linker property setting, I'll certainly to that as well.

Enough already! Enjoy (what's left of) your weekend! Of course, this may be exactly how you enjoy your weekend. It's how I enjoy most of mine!

-Brian
0 Kudos
Reply