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

Error when linking against static libs

postaquestion
Beginner
829 Views
I can link against the stub libs without issue. When I try to link against the static libs, I get unresolved external symbol errors from the MSVC 8.0 linker (VisualC++ 2005). I use functions in ippi.h, ipps.h. ippvm.h.

I have properly adjusted the lib directory from stublib to lib. I have tried using both ippimerged.lib and ippimerged_t.lib (as well as the ipps and ippvm variants). What am I doing wrong? Is there a simple sample you can send me?

Assuming the include, library directories are set properly (using ippenv.bat). Something like:
main.cpp

#include
#pragma comment( lib, "ippsmerged.lib" )

int main(int argc, char* argv[])
{
Ipp32f* f = ippsMalloc_32f(256);
ippsSet_32f(4.0f, f, 256 );
ippsFree(f);
return 0;
}
0 Kudos
6 Replies
Vladimir_Dudnik
Employee
829 Views

Hello,

Please pay attention to IPP documentation. To use static linkage you need both ippExmerged and ippxmerged libraries, where libraries with 'e' letter are static dispatcher libraries and 'x' stands for any particular IPP domain.

Regards,
Vladimir

0 Kudos
robertbiro
Beginner
829 Views
There really isn't any supplied IPP documentation on the static libraries.
Eventually I found an Intel web page which says:

How can I link with threaded static libraries?
The Intel IPP provides merged threaded static libraries "*merged_t" in the lib directory. To statically link with threaded static libraries with CPU dispatch, users need to add *emerged, *merged_t, ippcorel_t, and libguide into linking command. If the application is not compiled with Intel Compiler, users also need to include additional Intel Compiler runtime libraries. Here are the runtime libraries needed for different platforms:

Windows*:
IA32 application: libircmt.lib libmmt.lib svml_dispmt.lib
Intel 64 application: libircmt.lib libmmt.lib svml_dispmt.lib
IA64 application: libircmt.lib libmmt.lib

Linux*:
IA32 application: libimf.a libsvml.a libirc.a
Intel 64 application: libimf.a libsvml.a libirc.a
IA64 application: libimf.a libirc.a

Mac OS*:
IA32 application: libimf.a libsvml.a libirc.a
Intel 64 application: libimf.a libsvml.a libirc.a


The following are some linkage examples for threaded static libraries:

Linking with Intel IPP signal processing libraries for Windows*, and with Intel C++ Compiler.
>icl myapp.c ippsemerged.lib ippsmerged_t.lib ippcorel_t.lib libguide.lib

Linking with Intel IPP image processing and signal processing libraries for Windows*, and with Microsoft* Visual C++*.NET Compiler.
>cl myapp.c ippiemerged.lib ippimerged_t.lib ippsemerged.lib ippsmerged_t.lib ippcorel_t.lib libguide.lib libircmt.lib libmmt.lib svml_dispmt.lib

So now it links and runs, but it is dog slow!
It runs 3x slower than with DLLs.
Both in release mode.
0 Kudos
robertbiro
Beginner
829 Views
And if I loop around a call to ippiDFTFwd_CToC_32fc_C1R a thousand times, I see that only 1 core is maxed out with the other idle when linked statically but both cores are maxed out when linking dynamically. (It doesn't matter if I link against -merged.lib or -merged_t.lib)
0 Kudos
Vladimir_Dudnik
Employee
829 Views

The slowdown at static libraries linkage is caused by small footprint technology we use in IP static libraries to minimize the final executable size. For this purpose we split each function in separate compilation unit. As a result, your final executable will only contain those functions which used in your application.

Regards,
Vladimir

0 Kudos
Vladimir_Dudnik
Employee
829 Views

Did you call ippStaticInit function to initialize IPP static dispatcher?

Vladimir

0 Kudos
robertbiro
Beginner
829 Views
Had no clue about that function - where is it documented?

But that does the trick, now the speed is exactly the same.
0 Kudos
Reply