Intel® IPP - Intel® IPP linkage models - quick reference guide

Intel® Integrated Performance Primitives (Intel® IPP)

Intel® IPP linkage models - quick reference guide


Overview

The Intel® IPP is organized by three types of library files:

Library types Description Folder location Example

Dynamic
(Single-Threaded)

Include both processor dispatchers and function implementations.
Include import library and dynamic library, no internal threading.

ipp\lib\ia32 (import library)
redist\ia32\ipp

ipps.lib
ipps-*.dll, ippsg9-*.dll

Static 
(Single-Threaded)

Contains processor dispatchers and implementation for all functions.
No internal threading

ia32\lib ippsmt.lib
Multi-Threaded Deprecated,  include both static and dynamic library, Keep in current version for legacy applications. It is strongly recommended to use single-threaded version

ipp\lib\ia32\threaded
redist\ia32\ipp\threaded

ipps.lib/ipps*.dll
ippsmt.lib

These libraries offer various linkage models for different needs. The following are the four linkage models supported by the Intel® IPP:

  • Dynamic linkage
  • Static linkage
  • Custom dynamic linkage
  • Single processor static linkage

Steps to quickly demonstrate each linkage model are listed below. This code is used to illustrate the different linkage models:

#include "ipp.h" 
int main( ) 
{ 
const int SIZE = 256; 
Ipp8u pSrc[SIZE],pDst[SIZE]; 
int i; 
for (i=0; i<SIZE; i++) 
pSrc[i] = (Ipp8u)i; 
ippsCopy_8u(pSrc, pDst, SIZE); 
return 0; 
}

Dynamic linkage

  1. Add ipp.h which will include the “include” files of all IPP domains,
  2. Use the normal IPP function names when calling IPP functions,
  3. Link corresponding domain import libraries. For example, if you use the ippsCopy_8u function, link against ipps.lib from directory ipp\lib\ia32.
  4. Make sure that run-time libraries, for example ipps*.dll, are on the executable search path at run time. Run the ippvars.bat [ia32|intel64] from directory \ipp\bin to ensure this application built with the Intel IPP dynamic libraries will load the appropriate processor-specific DLL.

Static Linkage

  1. Include ipp.h in your code,
  2. Before calling any Intel IPP functions, initialize the static dispatcher using either the function ippInit() or ippInitCpu() declared in ippcore.h
  3. Use the normal IPP function names to call IPP functions,
  4. Link corresponding static libraries. For example, if the function ippsCopy_8u() is used, the linked libraries are ippsmt.lib, ippcoremt.lib.

Custom dynamic linkage

  1. Copy the function names of all Intel® IPP functions used from the Intel® IPP files into the file export.def. For our code example the content of this file is:
    EXPORTS
    ippsCopy_8u
  2. Write a DLL initialization function called DllMain in mydll.c, and call the function ippInit inside of DllMain to initialize the dispatching mechanism
  3. Compile mydll.c as a dynamic link library and link it against ippsmt.lib  and ippcoremt.lib . The import library mydll.lib will be generated automatically.
//=========== mydll.c====================== 

#define WIN32_LEAN_AND_MEAN 
#include <windows.h> 
#include <ipp.h> 

BOOL WINAPI DllMain(HINSTANCE hinstDLL, 
DWORD fdwReason, LPVOID lpvReserved) 
{ 
switch( fdwReason ) 
{ 
case DLL_PROCESS_ATTACH: 
ippInit(); 
break; 
default: 
hinstDLL; 
lpvReserved; 
break; 
} 
return TRUE; 
}

Moreover, Intel® IPP provide a Building Custom DLLs tool to create a custom DLL in early version. It is  available in legacy sample
\ipp-samples\advanced-usage\linkage\customdll


Single Processor Static Linkage  

  1. Add the file ippsmt.lib to your project and its source tree.
  2. Include  the header ipp_g9.h (In case of  Processor with Intel® Advanced Vector Instructions ). before the other Intel IPP header files
  3. Include ipp.h
  4. Add the file ippcoremt.lib to your project and its source tree.
  5. Call Intel IPP functions normally from your application.

See also Static linking to Intel® IPP Functions for One Processor in
C:\Program Files (x86)\Intel\Composer XE 2015\ipp\tools\ia32\staticlib\readme.htm


Quick comparison of the four linkage models

Features Dynamic linkage Custom dynamic linkage Single processor static linkage Static linkage
Processor update Automatic Recompile and redistribute Release new processor-specific application Recompile and redistribute
Optimization All processors All processors One processors All processors
Build Link to dynamic libraries Build separate DLL Link to processor-specific libraries Link to static libraries 
Calling Regular names Regular names Regular names Regular names
Distribution Distribute Linked IPP dll Distribute custom DLLs No extra distribution No extra distribution
Total Binary Size Large Small Small Small
Executable Size Smallest Smallest Small Small
Kernel Mode No No Yes Yes
Multi-Threading Support Yes Yes No Yes, when linking with the threaded static libraries

Note: All Intel® Integrated Performance Primitives functions are thread-safe. They support multithreading in both dynamic and static libraries and can be used in multi-threaded applications. However, if an application has its own threading model or if other threaded applications are expected to run at the same time on the system, it is strongly recommended to use non-threaded/single-threaded libraries.

For more information about the above linkage models, please refer to the Intel® IPP User Guide 
under IPP install directory or on-line articles: 

Intel® IPP New User's Guide
Selecting the Intel® IPP Libraries Needed by Your Application 


Operating System:

Windows* XP Professional x64 Edition, Windows Server* 2003 Standard x64 Edition, Windows Server* 2003 Enterprise x64 Edition, Mac OS*, Windows* XP 64-Bit Edition, Windows* XP Professional, Windows* XP Home Edition, Red Hat* Linux 8.0, Red Hat* Linux Advanced Server 2.x, Windows Server* 2003, Red Hat* Linux 9.0, Red Hat* Enterprise Linux 3.0, SUSE* Linux* 8.2, Windows Server* 2003 Standard Edition, Red Hat* Linux Advanced Server 3.x, Windows* XP 64-Bit Edition Version 2003

Einzelheiten zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.