libiomp5md.dll duplicate lib problem

libiomp5md.dll duplicate lib problem

Hello,

The
problem is our application crashes on startup with this message:

OMP:
Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already
initialized.

The
application loads properly from Visual Studio debugger, but doesn't do so when being run
as a stand-alone executable in a clean customer environment. Instead, it displays this
message.

Our
problem began when we ported from Visual Studio 2008 to Visual Studio 2010, and
it appears only in Windows 7:

our application is compiled for platform of 32bit, and is
run on Windows XP and Windows 7 64 bit.
This problem only occurs under Windows 7 (64 bit), not on Windows XP, and only
when compiling with Visual Studio 2010!

Note
these additional data:

1.
The libiomp5md.lib, along
with other used libs, is statically linked in our application (see MklLibs.jpg).
The libiomp5md.dll, along with the other two MKL dlls (mkl_core.dll,
mkl_intel_thread.dll), are put in the application folder, so there shouldn't be
any dll-type issues here. See attached Init_dll_loading.txt for debugger
output regarding loaded dlls.

Also note we marked 'Use MKL' under the 'Intel Performance Libraries' (see IntelPerfLibs.jpg)
as 'NO', in order to link them statically. When linking them by choosing 'YES'
rather than doing it ourselves, the problem remains the same.

2.
The problematic issue is of
course with KMP, but the error message appears, seemingly, for no reason
we're only using libiomp5md.dll for specific purposes, and Visual Studio OpenMP
support is disabled in our project.
Is the duplicate usage due to some forced/implicit Open MP support via VS2010?

3.
When attempting to run with
environment variable 'KMP_DUPLICATE_LIB_OK' as 'TRUE', it's functioning
properly, but we can't use this environment variable on our customers'
machines, as they also run other existing modules which we produced in the past
and which shouldn't run in this mode. I tried to set this environment variable
programmatically (see code line below) and delay loading of the libiomp5md.dll
till after it is set, but it didn't help, as during the linkage it reports no imports
are found:

25>LINK : warning
LNK4199: /DELAYLOAD:mkl_intel_c.lib ignored; no imports found from
mkl_intel_c.lib

25>LINK : warning
LNK4199: /DELAYLOAD:mkl_intel_thread.lib ignored; no imports found from
mkl_intel_thread.lib

25>LINK : warning
LNK4199: /DELAYLOAD:mkl_core.lib ignored; no imports found from mkl_core.lib

25>LINK : warning
LNK4199: /DELAYLOAD:libiomp5md.lib ignored; no imports found from
libiomp5md.lib

This is the code for the env. variable:

CHAR szEnvVarValue[2000];

::SetEnvironmentVariable("KMP_DUPLICATE_LIB_OK", "TRUE");

4.
Version of MKL in use
is the one attached to Intel Composer XE 2011 which is 10.3.4, I presume. See
attached printout of VS2010 information in VS2010_info.txt.
However, I also downloaded and tried the latest MKL through Composer XE 2011
update 11 (it didn't solve the problem), it appear under Visual Studio info
like this:
Intel C++ Composer XE 2011 Update 11
Package ID: w_ccompxe_2011.11.344

Intel C++
Composer XE 2011 Update 11 Integration for Microsoft Visual Studio* 2010,
Version 12.1.1113.2010, Copyright 2002-2012 Intel Corporation

5. When rebooting the machine and retrying, we managed to avoid
this crash, but only when using a specific libiomp5md.dll, dated from 28/4/2011
(file version is 5.0.2011.325).

Any help would be greatly appreciated!

8 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers Noah Clemons (Intel)

Hello there, thank you for being so descriptive in the problem you are having. I believe the issue can be explained by the OpenMP static library removal for Intel MKL for Windows, and I have linked you to the Knowledge Base article. It's very descriptive and adds the reasoning with possible workarounds.

Next, if you want to try the latest and greatest MKL version, if you go to the MKL home page there's a link to download the standalone MKL 11.0 Beta. This version is newer than that Composer XE update you were trying.

Let me know if you have any morequestions and concerns, and I'll be happy to help you out!

Hi Noah,

I tried your advice and I'm afraid the MKL 11.0 Beta didn't solve the problem, the error still remains.
Also note, regarding the 'OpenMP static library removal in Intel MKL on Microsoft Windows*' article - maybe I misunderstood, but it appears to me that it is irrelevant to my problem, given these two facts:
1. I'm linking dynamically to OpenMP rather than statically.
2. The error I've encountered doesn't list libiomp5mt.dll, but rather libiomp5md.dll as the library which is already loaded:
"OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized"

Also - why is it that this issue popped up only in VS2010 and only for Windows 7?

Thanks!

I (and possibly Noah as well) was confused by your comment that you linked the (dynamic) OpenMP library statically. I guess you ran into a pitfall with setting up the 32- bit libiomp5.dll to run in the customer's 64-bit installation. I don't know whether the Intel compiler library redistributable instructions (for ia32) give you a suitable suggestion about where to install the .dll and how to add it to PATH. I suppose it should work if you copy the .dll into the same folder as the .exe which requires it. The 32-bit .exe should ignore the 64-bit dlls it will see and continue searching for 32-bit ones. Did your warnings come from wow-64 searching the 64-bit libiomp5 .dll (and not resolving the 32-bit dependencies there)?

I didn't link the dynamic OpenMP library statically - I linked it dynamically. My error is only regarding libiomp5md.dll. As for the customer's installation, it is the same as with Windows XP 32bit, but runs also on Windows 7 64 bit. It is compiled as a 32-bit application, and links to 32-bit MKL libraries.

I followed MKL link-line advisor guidlines (see attached 'LinkLineAdvisor.jpg'), and put all the necessary 32bit Intel DLL files (libiomp5md.dll, mkl_core.dll, mkl_intel_thread.dll) in the same directory as the executable, so there are no 64bit dlls which may be causing issues during runtime (I also made sure of that using dependency walker).

Bild des Benutzers Noah Clemons (Intel)

Hi, please give me a day or so to investigate. I'm going to check and see if OpenMP and IPP are having a problem with libiomp5md.dll as well.

Bild des Benutzers Noah Clemons (Intel)

All right, it appears that this issue has been seen before, and particularly in the case of MKL. The first link here is an article that details an environment variable fix and goes more into why the problem happens. The second link is similar but goes deeper into the error from an OpenMP perspective. Let me know if that fixes your problem, as it appears to be highly specfic to your case.

Unfortunately, both articles referred to by Noah appear to refer to the situation where both the old libguide and the more recent libiomp are involved in various stages of the build. I don't see that these address the stated problem directly, although they may provide some background.
As you stated that you placed the necessary .dlls in the directory with the .exe, I can think only of the following: Please check the file properties of those .dlls as present in the troublesome installation, to make sure that all users have necessary read and execute permissions on the 32-bit .dlls (and of course that they are finding the .exe in the intended folder). The message seems to my inexpert eye to indicate that the 32-bit .dlls (if those are actually the ones placed in the customer installation) are being ignored and the messages may refer to the 64-bit ones. You may be able to check e.g. by file size that those are the 32-bit versions.

Melden Sie sich an, um einen Kommentar zu hinterlassen.