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

How to statically link libiomp5md in IVF 11.0?

Greynolds__Alan
Beginner
972 Views

I want to create a standaloneOpenMp application in IVF 11.0 but even with /static the exe still needs to find libiomp5md.dll.

Al Greynolds

www.ruda.com

'

0 Kudos
1 Solution
pbkenned1
Employee
972 Views
There's more involved than just compiling with /Qopenmp here. If you want to link against the static OpenMP RTL, you must add /Qopenmp-link:static, which is a new switch for 11.0. So to produce a purely static executable, compile/link with /MT /Qopenmp-link:static /Qopenmp

The 11.0 Windows compilers (both C++ and Fortran) have decoupled /MT from having any effect on which OpenMP runtime (static or dynamic) gets linked. In fact, all of /MT, /MD, and /ML (latter VS2003 only) now only effect which MS C runtime is linked.

We made this change because we want dynamic to be the default when linking the OpenMP RTL. The use of static OpenMP libraries is not recommended, because they might cause multiple libraries to be linked in an application. The condition is not supported and could lead to unpredictable results. It can also cause Thread Checker false positives and other problems with the Intel Threading tools.

Patrick Kennedy
Intel Compiler Lab

View solution in original post

0 Kudos
8 Replies
Steven_L_Intel1
Employee
972 Views

/Qopenmp-link:static

0 Kudos
Greynolds__Alan
Beginner
972 Views

/Qopenmp-link:static

Thanks Steve. Didn't think to look under /Qopenmp.

Al

0 Kudos
pbkenned1
Employee
972 Views
Quoting - layzarc@aol.com

Thanks Steve. Didn't think to look under /Qopenmp.

Al

0 Kudos
pbkenned1
Employee
973 Views
There's more involved than just compiling with /Qopenmp here. If you want to link against the static OpenMP RTL, you must add /Qopenmp-link:static, which is a new switch for 11.0. So to produce a purely static executable, compile/link with /MT /Qopenmp-link:static /Qopenmp

The 11.0 Windows compilers (both C++ and Fortran) have decoupled /MT from having any effect on which OpenMP runtime (static or dynamic) gets linked. In fact, all of /MT, /MD, and /ML (latter VS2003 only) now only effect which MS C runtime is linked.

We made this change because we want dynamic to be the default when linking the OpenMP RTL. The use of static OpenMP libraries is not recommended, because they might cause multiple libraries to be linked in an application. The condition is not supported and could lead to unpredictable results. It can also cause Thread Checker false positives and other problems with the Intel Threading tools.

Patrick Kennedy
Intel Compiler Lab
0 Kudos
Steefel__Carl
Beginner
972 Views
Quoting - pbkenned
There's more involved than just compiling with /Qopenmp here. If you want to link against the static OpenMP RTL, you must add /Qopenmp-link:static, which is a new switch for 11.0. So to produce a purely static executable, compile/link with /MT /Qopenmp-link:static /Qopenmp

The 11.0 Windows compilers (both C++ and Fortran) have decoupled /MT from having any effect on which OpenMP runtime (static or dynamic) gets linked. In fact, all of /MT, /MD, and /ML (latter VS2003 only) now only effect which MS C runtime is linked.

We made this change because we want dynamic to be the default when linking the OpenMP RTL. The use of static OpenMP libraries is not recommended, because they might cause multiple libraries to be linked in an application. The condition is not supported and could lead to unpredictable results. It can also cause Thread Checker false positives and other problems with the Intel Threading tools.

Patrick Kennedy
Intel Compiler Lab

0 Kudos
Steefel__Carl
Beginner
972 Views
Quoting - Carl Steefel

Sorry about the double post, don't know what happened.

But the issue here is that many of us would like to distribute executables to non-computer types without also having to distribute the libiomp5md.lib. The people I give my code to are severely challenged by something as simple as an Environment Variable. Not impossible to deal with, but if one can minimize these extra dynamic libraries, it helps.

Speaking of which, I cannot get the OpenMP to link statically in any case. I built the PETSc library using the link flags

/Qopenmp-link:static /Qopenmp /MT

then built my Intel Visual Fortran project (Intel 11.1.046) using the same thing as additional options in the Command Line (for Fortran and Link). I don't see anywhere else to include this.

When I transfer the executable to another Windows PC, I get the message that libiomp5md.dll is missing, and this is fixed by dropping in this library in next to the executable. Anyway, it seems as if the /Qopenmp-link:static is being ignored???
0 Kudos
DavidWhite
Valued Contributor II
972 Views
Quoting - Carl Steefel
Sorry about the double post, don't know what happened.

But the issue here is that many of us would like to distribute executables to non-computer types without also having to distribute the libiomp5md.lib. The people I give my code to are severely challenged by something as simple as an Environment Variable. Not impossible to deal with, but if one can minimize these extra dynamic libraries, it helps.

Speaking of which, I cannot get the OpenMP to link statically in any case. I built the PETSc library using the link flags

/Qopenmp-link:static /Qopenmp /MT

then built my Intel Visual Fortran project (Intel 11.1.046) using the same thing as additional options in the Command Line (for Fortran and Link). I don't see anywhere else to include this.

When I transfer the executable to another Windows PC, I get the message that libiomp5md.dll is missing, and this is fixed by dropping in this library in next to the executable. Anyway, it seems as if the /Qopenmp-link:static is being ignored???

To avoid having to statically link the libraries, have you thought about packaging the files for your users into an installer? I use NSIS (available from sourceforge.net) - this isopen source and available for use both commercially and personally.
0 Kudos
Steefel__Carl
Beginner
972 Views
Quoting - David White

To avoid having to statically link the libraries, have you thought about packaging the files for your users into an installer? I use NSIS (available from sourceforge.net) - this isopen source and available for use both commercially and personally.
Yes, I believe this is the way to go. I used to do this in the past, then quit doing it when so many people had trouble downloading *.exe files (the Installers I used had this format). Maybe it is no problem again...
0 Kudos
Reply