Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

Deploying applications with Intel® IPP DLLs

$
0
0

Introduction

The Intel® Integrated Performance Primitives (Intel® IPP) is a cross-architecture software library that provides a broad range of library functions for image processing, signal processing, data compression, cryptography, and computer vision, as well as math support routines for such processing capabilities. Intel® IPP is optimized for the wide range of Intel microprocessors.

One of the key advantages within Intel® IPP is performance. The performance advantage comes through per processor architecture optimized functions, compiled into one single library. Intel® IPP functions are “dispatched” at run-time. The “dispatcher” chooses which of these processor-specific optimized libraries to use when the application makes a call into the IPP library. This is done to maximize each function’s use of the underlying vector instructions and other architecture-specific features.

This paper covers application deployment with Intel® IPP dynamic-link libraries (DLLs). It is important to understand processor detection and library dispatching, so that software redistribution is problem free. Additionally you want to consider two key factors when it comes to DLLs:

  1. Selection of an appropriate DLL linking model.
  2. The location for the DLLs on the target system.

This document explains how the Intel® IPP dynamic libraries work and discusses these important considerations. For information on all Intel® IPP linking models, please refer to the document Intel® IPP Linkage Models – Quick Reference Guide. Further documentation on Intel® IPP can be found at Intel® Integrated Performance Primitives – Documentation.

Version Information
This document applies to Intel® IPP 2017.xx.xxx for Windows* running 32-bit and 64-bit applications but concepts can also be applied to other operating systems supported by Intel® IPP.

Library Location
Intel® IPP is also a key component of Intel® Parallel Studio XE and Intel® System Studio. The IPP libraries of Parallel Studio can be found in redist directory. For default installation on Windows*, the path to the libraries is set to ’C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_x.xx.xxx\<target_os>’ where ‘x.xx.xxx’ designates the version installed (on certain systems, instead of ‘Program Files (x86)’, the directory name is ‘Program Files’). For convenience <ipp directory> will be used instead throughout this paper.


Note: Please verify that your license permits redistribution before distributing the Intel® IPP DLLs. Any software source code included with this product is furnished under a software license and may only be used or copied in accordance with the terms of that license. Please see the Intel® Software Products End User License Agreement for license definitions and restrictions on the library.
 


Key Concepts

Library Dispatcher
Every Intel® IPP function has many binary implementations, each performance-optimized for a specific target CPU. These processor-specific functions are contained in separate DLLs. The name of each DLL has a prefix identification code that denotes its target processor. For example, a 32-bit Intel processor with SSE4.2 support requires the image processing library named ippip8.dll, where ‘p8’ is the CPU identification code for 32-bit SSE4.2.

IA-32 Intel® architecture

Intel® 64 architecture

Meaning

px

Mx

Generic code optimized for processors with Intel® Streaming SIMD Extensions (Intel® SSE)

w7

My

Optimized for processors with Intel SSE2

s8

n8

Optimized for processors with Supplemental Streaming SIMD Extensions 3 (SSSE3)

-

m7

Optimized for processors with Intel SSE3

p8

y8

Optimized for processors with Intel SSE4.2

g9

e9

Optimized for processors with Intel® Advanced Vector Extensions (Intel® AVX) and Intel® Advanced Encryption Standard New Instructions (Intel® AES-NI)

h9

l9

Optimized for processors with Intel® Advanced Vector Extensions 2 (Intel® AVX2)

-

k0

Optimized for processors with Intel® Advanced Vector Extensions 512 (Intel® AVX-512)

 

n0

Optimized for processors with Intel® Advanced Vector Extensions 512 (Intel® AVX-512) for Intel® Many Integrated Core Architecture (Intel® MIC Architecture)

Table 1: CPU Identification Codes Associated with Processor-Specific Libraries

When the first Intel® IPP function call occurs in the application, the application searches the system path for an Intel® IPP dispatcher library. The dispatcher library identifies the system processor and invokes the function version that has the best performance on the target CPU. This process does not add overhead because the dispatcher connects to an entry point of an optimized function only once during application initialization. This allows your code to call optimized functions without worrying about the processor on which the code will execute.

Dynamic Linking
Dynamic-link libraries are loaded when an application runs. Simply link the application to the Intel® IPP libraries located in the <ipp directory>\ipp\lib\ia32 or <ipp directory>\ipp\lib\intel64 folder, which load the dispatcher libraries and link to the correct entry points. Ensure that the dispatcher DLLs and the processor-specific DLLs are on the system path. In the diagram below, the application links to the ipps.lib and ipps.dll automatically loads ippsv8.dll at runtime.


Figure 1: Processor-Specific Dispatching

Dynamic linking is useful if many Intel® IPP functions are called in the application. Most applications are good candidates for this model.

Building a Custom DLL
In addition to dynamic linking, the Intel® IPP provides a tool called Intel® IPP Custom Library Tool for developers to create their own DLL. This tool can be found under <ipp directory>\ipp\tools\custom_library_tool and links selected Intel® IPP functions into a new separate DLL and generates an import library to which the application can link. A custom DLL is useful if the application uses a limited set of functions. The custom DLL must be distributed with the application. Intel® IPP supports two dynamic linking options. Refer to Table 2 below to choose which dynamic linking model best suits the application.

Feature

Dynamic Linking

Custom DLL

Processor Updates

Automatic

Recompile and redistribute

Optimization

All processors

All processors

Build

Link to stub static libraries

Build and link to a separate import library which dispatches a separate DLL

Function Naming

Regular names

Regular names

Total Binary Size

Large

Small

Executable Size

Smallest

Smallest

Kernel Mode

No

No

Table 2: Dynamic Linking Models

For detailed information on how to build and link to a custom DLL, unzip the example package files under <ipp directory>\ipp\examples and look at the core examples under components\examples_core\ipp_custom_dll.

Threading and Multi-core Support
Intel continues deprecation of internal threading that was started in version Intel® IPP 7.1. Internal (inside a primitive) threading is significantly less effective than external (at the application level) threading. For threading Intel® IPP functions, external threading is recommended which gives significant performance gain on multi-processor and multi-core systems. A good starting point on how to develop code for external threading can be found here.


Linking the Application

The Intel® IPP can be compiled with Microsoft Visual Studio* and Intel® C++ Compiler. Instructions for configuring Microsoft Visual Studio to link to the Intel® IPP libraries can be found in the Getting Started with Intel® Integrated Performance Primitives document.


Deploying the Application

The Intel® IPP dispatcher and processor-specific DLLs, located in <ipp directory>\redist\ia32\ipp or <ipp directory>\redist\intel64\ipp, or a custom DLL must be distributed with the application software. The Intel® IPP core functions library, ippcore.dll must also be distributed.

When distributing a custom DLL, it is best to create a distinct naming scheme to avoid conflicts and for tracking purposes. This is also important because custom DLLs must be recompiled and redistributed to include new processor optimizations not available in previous Intel® IPP versions.

On Microsoft Windows*, the system PATH variable holds a list of folder locations that is searched for executable files. When the application is invoked, the Intel® IPP DLLs need to be located in a folder that is listed in the PATH variable. Choose a location for the Intel® IPP DLLs and custom DLLs on the target system so that the application can easily find them. Possible distribution locations include %SystemDrive%/WINDOWS\system32, the application folder or any other folder on the target system. Table 3 below compares these options.

 

System PATH

Permissions

%SystemDrive%\WINDOWS\system32

This folder is listed on the system PATH by default.

Administrator permissions may be required to copy files to this folder.

Application Folder or Subfolder

Windows will first check the application folder for the DLLs.

Special permissions may be required.

Other Folder

Add this directory to the system PATH.

Special permissions may be required.

Table 3: Intel® IPP DLL Location

In all cases, the application must be able to find the location of the Intel® IPP DLLs and custom DLLs in order to run properly.

The Intel® IPP provides a convenient method to performance optimize a 32-bit or Intel 64-bit application for the latest processors. Application and DLL distribution requires developers to do the following:

  1. Choose the appropriate DLL linking model
    • Dynamic linking– Application is linked to stub libraries. At runtime, dispatcher DLLs detect the target processor and dispatch processor-specific DLLs. Dispatcher and processor-specific DLLs to be distributed with the application.
    • Custom DLL– Application is linked to a custom import library. At runtime, the custom DLL is invoked. Custom DLL to be distributed with the application.
  1. Determine the best location for the Intel® IPP DLLs on the end–user system.
    • %SystemDrive%\WINDOWS\system32
    • Application folder or subfolder
    • Other folder

* Other names and brands may be claimed as the property of others.

Microsoft, Windows, and the Windows logo are trademarks, or registered trademarks of Microsoft Corporation in the United States and/or other countries.

Optimization Notice

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804

Copyright © 2002-2016, Intel Corporation. All rights reserved.


Viewing all articles
Browse latest Browse all 3384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>