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!