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:
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.
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?
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
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:
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!
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!
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?
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).
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.