Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6704 Discussions

Can I use > 1 instance of IPP static libs?

YZhan69
Beginner
237 Views
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?
0 Kudos
4 Replies
YZhan69
Beginner
237 Views
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.
0 Kudos
j3r3mi
Beginner
237 Views
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.
BR.
0 Kudos
matthieu_darbois
New Contributor III
237 Views
Hi,
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.

Regards,
Matthieu
0 Kudos
YZhan69
Beginner
237 Views
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
0 Kudos
Reply