Intel® Integrated Performance Primitives(Intel® IPP) Linkage Models

ID 658361
Updated 11/11/2020
Version Latest
Public

author-image

By

 

Overview

Intel® Integrated Performance Primitives (Intel® IPP) is distributed as:

  • Static library: Static linking results in a standalone executable
  • Dynamic library: Dynamic linking defers function resolution until run-time and requires that you bundle the redistributable libraries with your application

The following table provides description of libraries available for linking:

Library types Description Folder location Example

Static 
(Single-Threaded)

Static linking results in a standalone executable.
Contains processor dispatchers and implementation for all functions with no internal threading.
<ipp directory>\lib\<arch> ippsmt.lib
ippcoremt.lib
ippimt.lib
...
Dynamic
(Single-Threaded)
Dynamic linking defers function resolution until runtime. 
Include both processor dispatchers and function implementations.
Include import library and dynamic library with no internal threading.
<ipp directory>\lib\<arch>(import)
redist\<arch>\ipp(dll)
ipps.lib
ippcore.lib
...
ipps.dll
ippi.dll
 

*The multi-threaded libraries are deprecated and moving to external threading is recommended. User has the option to use different threading models like Intel® TBB, OpenMP* and Intel® Cilk Plus etc. You could learn more from following articles for using threading Intel® IPP:
Threading Your Application
​OpenMP* and the Intel® IPP Library
Threading Intel® Integrated Performance Primitives Image Resize with Intel® Threading Building Blocks
Appendix B: Intel® IPP Threading and OpenMP* Support
Please also view Finding Intel® IPP on Your System to see the folder location for Intel® IPP in different operating system.

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. Include "ipp.h" which contains Intel® IPP header files with the exception of cryptography and generated functions in your code;
  2. Use the normal Intel® IPP function names when calling Intel® 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\<arch>.
  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" which contains Intel® IPP header files with the exception of cryptography and generated functions in your code;
  2. Use the normal Intel® IPP function names to call Intel® IPP functions;
  3. Link corresponding static libraries. For example, if the function ippsCopy_8u() is used, the linked libraries are ippsmt.lib, ippcoremt.lib.

* This dispatcher automatically executes the optimal version of each Intel® IPP function at run time, thus it is inherent part of dynamic library. Since Intel Intel® IPP 9.0, there is no requirement to initialize the dispatcher by calling ippInit() for static linkage anymore. for ippInit() function, please view IPP Dispatcher Control Functions to get more information.

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 directory>\examples\components_and_examples_win_ps\components\examples_core\ipp_custom_dll


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 Extension Instructions). before the other Intel® IPP header files. Learn more about processor specific codes Intel® IPP uses, please view Dispatching.
  3. Add the file ippcoremt.lib to your project and its source tree;
  4. Include Intel® IPP head file as normal;
  5. Call Intel® IPP functions normally from your application.

* See Understanding CPU Dispatching in the Intel® IPP Libraries for more information about dispatching.
Also see Static linking to Intel® IPP Functions for One Processor in

C:\Program Files(x86)\IntelSWTools\parallel_studio_xe_2017.0.024\compilers_and_libraries_2017\windows\ipp\tools\ia32\staticlib\readme.htm


Quick comparison of the four linkage models

Features Dynamic Linkage Custom Dynamic Linkage Static Linkage without Dispatching Static linkage with Dispatching
Processor update Automatic Recompile and redistribute Release new processor-specific application Recompile and redistribute
Optimization All processors All processors One processor All processors
Build Link to stub libraries Build separate DLL Link to processor-specific libraries Link to static libraries and stub
Calling Regular names Modified names Processor-specific names Regular names
Distribution Distribute Linked IPP dll Distribute custom DLLs No extra distribution No extra distribution
Total Binary Size Large Small Smallest Small
Executable Size Smallest Smallest Small Small
Kernel Mode No No Yes Yes

Note: All Intel® IPP functions are thread-safe. They support multi-threading 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. Since Intel® IPP 8.2, multi-threading (internal threading) libraries are deprecated due to issues with performance and interoperability with other threading models, but made available for legacy applications.

For more information about external threading, please refer following documents:

Intel® IPP - Threading / OpenMP* FAQ 
Threading Intel® Integrated Performance Primitives Image Resize with Intel® Threading Building Blocks

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 User's Guide
Compiling and Linking Intel® Primitive Performance Libraries with Microsoft* Visual C++* and Intel® C++ Compiler
Intel® Integrated Performance Primitives Domain Details

For more supported configurations and system requirement of Intel IPP, please view the Intel® Integrated Performance Primitives Release Notes