Can I use > 1 instance of IPP static libs?

Can I use > 1 instance of IPP static libs?

I have a DLL that statically links to almost all the IPP static libraries, including Intel OpenMP. Likewise, I also have an EXE that links against almost all IPP static libs. The EXE also links against the DLL, thus creating 2 instances of IPP.

At 1st, I get the message

"OMP abort: Initializing libiomp5mt.lib, but found libiomp5mt.lib already initialized.
This may cause performance degradation and correctness issues."

This happens when I call ippStaticInit() at the beginning of main(), which is after ippInit is called in the DLL. This doesn't make sense because there are 2 separate instances, unless they share resources in a non-thread safe way.

After setting KMP_DUPLICATE_LIB_OK=TRUE, the 64bit version of the app runs OK. But, the 32bit version crashes after calling ippMalloc in the EXE.

Any ideas?

5 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

OK, I know why I got the crash. It hat nothing to do with having 2 instances of IPP, it was a wrongly typed function pointer (I forgot __stdcall), which only mattered for 32 bit.

Sorry fir asking this. I'm really puzzled why do you want to do this. Why don't just use the DLLs?? Just trying to learn more... hehe !!

I'm not sure if you did trying running MATLAB with IPP, there will be a conflict. I experience this some time ago while i was verifying some results using the MATLAB external engine.


You can link against libiom5md.lib to avoid static linking openMP. You'll have to distribute openMP DLL along with your application but no Environment variable has to be set then.


Right, I should be using the DLLs since I'm using IPP in sufficiently many places to negate any space savings of static linking. My philosophy up to now is, if the library isn't standard (< 70% users have it), then use the static version, which creates a chicken and egg problem. I also assumed my supervisor didn't like the extra IPP baggage.

Also, I know static linking has slightly less call overhead because you can do a direct branch instead of an indirect branch, but that's moot because the difference is probably negligible.

I also ran into the 1 IPP dll instance, 1 static instance when I gave someone a Matlab DLL port of his matlab code to test. I just removed IPP from the DLL, but I'm pretty sure it would've worked if I just set KMP_DUPLICATE_LIB_OK=TRUE

Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen