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

Submit New Article

Last Modified On :   November 4, 2009 1:19 AM PST
Rate
 


Intel® Integrated Performance Primitives (Intel® IPP)

Intel® IPP linkage models - quick reference guide


 

 


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

Library types Description Folder location Example
Dynamic Include both processor dispatchers and function implementations. ia32\stublib
ia32\bin

ipps.lib
ipps.dll, ippst7.dll

Static Emerged Contains only processor dispatchers for all functions. ia32\lib ippsemerged.lib
Static Merged Contains only function implementations for all supported processor types. ia32\lib ippsmerged.lib

 

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

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

 

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;
}

 


  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 \stublib.
  4. Make sure that run-time libraries, for example ipps.dll, are on the executable search path at run time. Run the ippenv.bat from directory \tools\env to ensure this application built with the Intel IPP dynamic libraries will load the appropriate processor-specific DLL.

 


  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 ippStaticInit inside of DllMain to initialize the dispatching mechanism
  3. Compile mydll.c as a dynamic link library and link it against ippsemerged.lib , ippsmerged.lib and ippcorel.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:
ippStaticInit();
break;
default:
hinstDLL;
lpvReserved;
break;
}
return TRUE;
}

 

There is another way to create a custom DLL that allows more customization. You can define CPU specific code for your targeted processor. For example "w7" code is for Intel® Pentium® 4 processor. Please refer the latest updated customdll samples from Intel IPP samples directory:
\ipp-samples\advanced-usage\linkage\customdll


 

  1. Include ipp.h in your code,
  2. Before calling any Intel IPP functions, initialize the static dispatcher using either the function ippStaticInit() or ippStaticInitCPU()declared in ippcore.h
  3. Use the normal IPP function names to call IPP functions,
  4. Link corresponding e-merged libraries followed by merged libraries, and then ippcorel.lib. For example, if the function ippsCopy_8u() is used, the linked libraries are ippsemerged.lib, ippsmerged.lib, and ippcorel.lib.

  

  1. Include ipp.h , after the header ipp_w7.h (In case of Pentium® 4).
  2. Add the file ippsmerged.lib to your project and its source tree.
  3. Include ipp_w7.h for Intel Pentium 4 processor, this inclusion must be before the other Intel IPP header files.
  4. Add the file ippcorel.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:\ProgramFiles\Intel\IPP\6.0.x.xxx\ia32\tools\staticlib\readme.htm

     

     


     

    Features Dynamic linkage Custom dynamic linkage Single processor static linkage Static linkage with dispatching
    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 stub dispatch libraries Build separate DLL Link to processor-specific libraries Link to static libraries & dispatching static libs
    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 No No Yes, when linking with the threaded Intel IPP static merged libraries

     

    For more information about the above linkage models, please refer to the Intel® IPP white paper:

    Choosing the best Intel® IPP Linkage Models for Your Applications.


    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

     


    In this example, our target system processor is an Intel Pentium 4 processor:





This article applies to: Intel® Integrated Performance Primitives Knowledge Base