Intel Developer Zone Articles
https://software.intel.com/en-us/articles/36853%2C20824%2C20774
Article FeedenSignal Processing Usage for Intel® System Studio – Intel® MKL vs. Intel® IPP
https://software.intel.com/en-us/articles/signal-processing-usage-for-intel-system-studio-intel-mkl-vs-intel-ipp
<p>Employing performance libraries can be a great way to streamline and unify the computational execution flow for data intensive tasks, thus minimizing the risk of data stream timing issues and heisenbugs. Here we will describe the two libraries that can be used for signal processing within Intel<sup>®</sup> System Studio.<b> </b></p>
<p><b>Intel® Integrated Performance Primitives (Intel®<sup></sup>IPP)</b></p>
<p>Performance libraries such as the Intel IPP contain highly optimized algorithms and code for common functions including as signal processing, image processing, video/audio encode/decode, cryptography, data compression, speech coding, and computer vision. Advanced instruction sets help the developer take advantage of new processor features that are specifically tailored for certain applications. One calls Intel IPP as if it is a black box pocket of computation for their low-power or embedded device – ‘in’ flows the data and ‘out’ receives the result. In this fashion, using the Intel IPP can take the place of many processing units created for specific computational tasks. Intel IPP excels in a wide variety of domains where intelligent systems are utilized. <b> </b></p>
<p>Without the benefit of highly optimized performance libraries, developers would need to optimize computationally intensive functions themselves carefully to obtain adequate performance. This optimization process is complicated, time consuming, and must be updated with each new processor generation. Intelligent systems often have a long lifetime in the field and there is a high maintenance effort to hand-optimize functions.</p>
<p>Signal processing and advanced vector math are the two function domains that are most in demand across the different types of intelligent systems. Frequently, a digital signal processor (DSP) is employed to assist the general purpose processor with these types of computational tasks. A DSP may come with its own well-defined application interface and library function set. However, it is usually poorly suited for general purpose tasks; DSPs are designed to quickly execute basic mathematical operations (add, subtract, multiply, and divide). The DSP repertoire includes a set of very fast multiply and accumulate (MAC) instructions to address matrix math evaluations that appear frequently in convolution, dot product and other multi-operand math operations. The MAC instructions that comprise much of the code in a DSP application are the equivalent of SIMD instruction sets. Like the MAC instructions on a DSP, these instruction sets perform mathematical operations very efficiently on vectors and arrays of data. Unlike a DSP, the Single Instruction Multiple Data (SIMD) instructions are easier to integrate into applications using complex vector and array mathematical algorithms since all computations execute on the same processor and are part of a unified logical execution stream.</p>
<p>For example, an algorithm that changes image brightness by adding (or subtracting) a constant value to each pixel of that image must read the RGB values from memory, add (or subtract) the offset, and write the new pixel values back to memory. When using a DSP coprocessor, that image data must be packaged for the DSP (placed in a memory area that is accessible by the DSP), signaled to execute the transformation algorithm, and finally returned to the general-purpose processor. Using a general-purpose processor with SIMD instructions simplifies this process of packaging, signaling, and returning the data set. Intel IPP primitives are optimized to match each SIMD instruction set architecture so that multiple versions of each primitive exist in the library.</p>
<p>Intel IPP can be reused over a wide range of Intel® Architecture based processors, and due to automatic dispatching, the developer’s code base will always pick the execution flow optimized for the architecture in question without having to change the underlying function call (Figure 2). This is especially helpful if an embedded system employs both an Intel® Core™ processor for data analysis/aggregation as well as a series of Intel® Atom™ Processor based SoCs for data pre-processing/collection. In that scenario, the same code base may be used in part on both the Intel® Atom™ Processor based SoCs in the field and the Intel® Core™ processor in the central data aggregation point. </p>
<p>With specialized SoC components for data streaming and I/O handling combined with a limited user interface, one may think that there are not a lot of opportunities to take advantage of optimizations and/or parallelism, but that is not the case. There is room for</p>
<p>- heterogeneous asynchronous multi-processing (AMP) based on different architectures, and</p>
<p> - synchronous multi-processing (SMP) taking advantage of the Intel® Hyper-Threading Technology and dual-core design used with the latest generation of processors designed for low-power intelligent systems.</p>
<p>Both concepts often coexist in the same SoC. Code with failsafe real-time requirements is protected within its own wrapper managed by a modified round-robin real-time scheduler, while the rest of the operating system (OS) and application layers are managed using standard SMP multi-processing concepts. Intel Atom Processors contain two Intel Hyper-Threading Technology based cores and may contain an additional two physical cores resulting in a quad-core system. In addition Intel Atom Processors support the Intel SSSE3 instruction set. A wide variety of Intel IPP functions found at <a href="http://software.intel.com/en-us/articles/new-atom-support">http://software.intel.com/en-us/articles/new-atom-support</a> are tuned to take advantage of Intel Atom Processor architecture specifics as well as Intel SSSE3. </p>
<p> <a href="https://software.intel.com/sites/default/files/managed/69/dc/3.jpg"><img src="https://software.intel.com/sites/default/files/managed/69/dc/3.jpg" alt="" /></a></p>
<p style="text-align:center"><b>Figure 2</b>: Intel IPP is tuned to take advantage of the Intel Atom Processor and the Intel SSSE3 instruction set</p>
<p>Throughput intensive applications can benefit from the use of use of Intel SSSE3 vector instructions and parallel execution of multiple data streams through the use of extra-wide vector registers for SIMD processing. As just mentioned, modern Intel Atom Processor designs provide up to four virtual processor cores. This fact makes threading an interesting proposition. While there is no universal threading solution that is best for all applications, the Intel IPP has been designed to be thread-safe.</p>
<p>Intel IPP provides flexibility in linkage models to strike the right balance between portability and footprint management.</p>
<p style="text-align:center"><img src="/sites/default/files/managed/67/d6/sig_processing_table_1.jpg" /></p>
<p style="text-align:center"><b>Table 1</b>: Intel IPP Linkage Model Comparison</p>
<p>The standard dynamic and dispatched static models are the simplest options to use in building applications with the Intel IPP. The standard dynamic library includes the full set of processor optimizations and provides the benefit of runtime code sharing between multiple Intel IPP-based applications. Detection of the runtime processor and dispatching to the appropriate optimization layer is automatic.</p>
<p>If the number of Intel IPP functions used in your application is small, and the standard shared library objects are too large, using a custom dynamic library may be an alternative.</p>
<p>To optimize for minimal total binary footprint, linking against a non-dispatched static version of the library may be the approach to take. This approach yields an executable containing only the optimization layer required for your target processor. This model achieves the smallest footprint at the expense of restricting your optimization to one specific processor type and one SIMD instruction set. This linkage model is useful when a self-contained application running on only one processor type is the intended goal. It is also the recommended linkage model for use in kernel mode (ring 0) or device driver applications.</p>
<p>Intel IPP addresses both the needs of the native application developer found in the personal computing world and the intelligent system developer who must satisfy system requirements with the interaction between the application layer and the software stack underneath. By taking the Intel IPP into the world of middleware, drivers and OS interaction, it can be used for embedded devices. The limited dependency on OS libraries and its support for flexible linkage models makes it simple to add to embedded cross-build environments with popular GNU* based cross-build setups like Poky-Linux* or MADDE*.</p>
<p>Developing for intelligent systems and small form factor devices frequently means that native development is not a feasible option. Intel IPP can be easily integrated with a cross-build environment and be used with cross-build toolchains that accommodate the flow requirements of many of these real-time systems. Use of the Intel IPP allows embedded intelligent systems to take advantage of vector instructions and extra-wide vector registers on the Intel Atom Processor. Developers can also meet determinism requirements without increasing the risks associated with cross-architecture data handshakes of complex SoC architectures.</p>
<p>Developing for embedded small form factor devices also means that applications with deterministic execution flow requirements have to interface more directly with the system software layer and the OS scheduler. Software development utilities and libraries for this space need to be able to work with the various layers of the software stack, whether it is the end-user application or the driver that assists with a particular data stream or I/O interface. The Intel IPP has minimal OS dependencies and a well-defined ABI to work with the various modes. One can apply highly optimized functions for embedded signal and multimedia processing across the platform software stack while taking advantage of the underlying application processor architecture and its strengths, all without redesigning and returning the critical functions with successive hardware platform upgrades.</p>
<p><b>Intel<sup>®</sup> Math Kernel Library (Intel<sup>® </sup>MKL)</b></p>
<p>Intel<sup></sup>MKL includes routines and functions optimized for Intel® processor-based computers running operating systems that support multiprocessing. Intel MKL includes a C-language interface for the Discrete Fourier transform functions, as well as for the Vector Mathematical Library and Vector Statistical Library functions.</p>
<p>The Intel® Math Kernel Library includes the following groups of routines:</p>
<p>- Basic Linear Algebra Subprograms (BLAS):</p>
<ul><li>Vector operations</li>
<li>Matrix-vector operations</li>
<li>Matrix-matrix operations</li>
</ul><p>- Sparse BLAS Level 1, 2, and 3 (basic operations on sparse vectors and matrices)</p>
<p>- LAPACK routines for solving systems of linear equations</p>
<p>- LAPACK routines for solving least squares problems, eigenvalue and singular value problems, and Sylvester's equations</p>
<p>- Auxiliary and utility LAPACK routines</p>
<p>- ScaLAPACK computational, driver and auxiliary routines</p>
<p>- PBLAS routines for distributed vector, matrix-vector, and matrix-matrix operation</p>
<p>- Direct and Iterative Sparse Solver routines</p>
<p>- Vector Mathematical Library (VML) functions for computing core mathematical functions on vector arguments</p>
<p>- Vector Statistical Library (VSL) functions for generating vectors of pseudorandom numbers with different types of statistical distributions and for performing convolution and correlation computations</p>
<p>- General Fast Fourier Transform (FFT) Functions, providing fast computation of Discrete Fourier Transform via the FFT algorithms</p>
<p>- Tools for solving partial differential equations - trigonometric transform routines and Poisson solver</p>
<p>- Optimization Solver routines for solving nonlinear least squares problems through the Trust-Region (TR) algorithms and computing Jacobi matrix by central differences</p>
<p>- Basic Linear Algebra Communication Subprograms (BLACS) that are used to support a linear algebra oriented message passing interface</p>
<p>- Data Fitting functions for spline-based approximation of functions, derivatives and integrals of functions, and search</p>
<p><b>Intel IPP and Intel MKL for Signal Processing </b></p>
<p>The next question is when to use one Fourier Transform over another with respect to Intel IPP and Intel MKL.</p>
<p>DFT processing time can dominate a software application. Using a fast algorithm, Fast Fourier transform (FFT), reduces the number of arithmetic operations from O(N<sup>2</sup>) to O(N log<sub>2</sub> N) operations. Intel MKL and Intel IPP are highly optimized for Intel architecture-based multi-core processors using the latest instruction sets, parallelism, and algorithms.</p>
<p>Read further to decide which FFT is best for your application.</p>
<p><strong>Table 2: Comparison of Intel MKL and Intel IPP Functionality</strong></p>
<table style="width:100%" border="1"><tbody><tr><td>
<p> </p>
</td>
<td>
<p><strong> Intel MKL</strong></p>
</td>
<td>
<p><strong>Intel IPP</strong></p>
</td>
</tr><tr><td>
<p><strong>Target Applications</strong></p>
</td>
<td>
<p>Mathematical applications for engineering, scientific and financial applications</p>
</td>
<td>
<p>Media and communications applications for audio, video, imaging, speech recognition and signal processing</p>
</td>
</tr><tr><td>
<p><strong>Library Structure</strong></p>
</td>
<td>
<ul><li>Linear algebra</li>
<li>BLAS</li>
<li>LAPACK</li>
<li>ScaLAPACK</li>
<li>Fast Fourier transforms</li>
<li>Vector math</li>
<li>Vector statistics</li>
<li>Random number generators</li>
<li>Convolution and correlation</li>
<li>Partial differential equations</li>
<li>Optimization solvers</li>
</ul></td>
<td>
<ul><li>Audio coding</li>
<li>Image processing, compression and color conversion</li>
<li>String processing</li>
<li>Cryptography</li>
<li>Computer vision</li>
<li>Data compression</li>
<li>Matrix math</li>
<li>Signal processing</li>
<li>Speech coding and recognition</li>
<li>Video coding</li>
<li>Vector math</li>
<li>Rendering</li>
</ul></td>
</tr><tr><td>
<p><strong>Linkage Models</strong></p>
</td>
<td>
<p>Static, dynamic, custom dynamic</p>
</td>
<td>
<p>Static, dynamic, custom dynamic</p>
</td>
</tr><tr><td>
<p><strong>Operating Systems</strong></p>
</td>
<td>
<p>Linux*</p>
</td>
<td>
<p>Linux*</p>
</td>
</tr><tr><td>
<p><strong>Processor Support</strong></p>
</td>
<td>
<p>IA-32 and Intel® 64 architecture-based and compatible platforms, IA-64</p>
</td>
<td>
<p>IA-32 and Intel® 64 architecture-based and compatible platforms, IA-64, Intel IXP4xx Processors</p>
</td>
</tr></tbody></table><p><br /><b><strong>Intel MKL and Intel IPP Fourier Transform Features</strong></b></p>
<p>The Fourier Transforms provided by MKL and IPP are respectively targeted for the types of applications targeted by MKL (engineering and scientific) and IPP (media and communications). In the table below, we highlight specifics of the MKL and IPP Fourier Transforms that will help you decide which may be best for your application.</p>
<p><strong>Table 3: Comparison of Intel MKL and Intel IPP DFT Features</strong></p>
<table style="width:100%" border="1"><tbody><tr><td>
<p><strong>Feature</strong></p>
</td>
<td>
<p><strong>Intel MKL</strong></p>
</td>
<td>
<p><strong>Intel IPP</strong></p>
</td>
</tr><tr><td>
<p><strong>API</strong></p>
</td>
<td>
<p>DFT<br />
Cluster FFT<br />
FFTW 2.x and 3.x</p>
</td>
<td>
<p>FFT<br />
DFT</p>
</td>
</tr><tr><td>
<p><strong>Interfaces </strong></p>
</td>
<td>
<p>C</p>
<p>LP64 (64-bit long and pointer)<br />
ILP64 (64-bit int, long, and pointer)</p>
</td>
<td>
<p>C</p>
</td>
</tr><tr><td>
<p><strong>Dimensions</strong></p>
</td>
<td>
<p>1-D up to 7-D</p>
</td>
<td>
<p>1-D (Signal Processing)<br />
2-D (Image Processing)</p>
</td>
</tr><tr><td>
<p><strong>Transform Sizes </strong></p>
</td>
<td>
<p>32-bit platforms - maximum size is 2^31-1<br />
64-bit platforms - 2<sup>64</sup> maximum size</p>
</td>
<td>
<p>FFT - Powers of 2 only</p>
<p>DFT -2<sup>32</sup> maximum size (*)</p>
</td>
</tr><tr><td>
<p><strong>Mixed Radix Support</strong></p>
</td>
<td>
<p>2,3,5,7 kernels ( **)</p>
</td>
<td>
<p>DFT - 2,3,5,7 kernels (**)</p>
</td>
</tr><tr><td>
<p><strong>Data Types </strong></p>
<p>(See Table 3 for detail)</p>
</td>
<td>
<p>Real & Complex<br />
Single- & Double-Precision</p>
</td>
<td>
<p>Real & Complex<br />
Single- & Double-Precision</p>
</td>
</tr><tr><td>
<p><strong>Scaling</strong></p>
</td>
<td>
<p>Transforms can be scaled by an arbitrary floating point number (with precision the same as input data)</p>
</td>
<td>
<p>Integer ("fixed") scaling</p>
<ul><li>Forward 1/N</li>
<li>Inverse 1/N</li>
<li>Forward + Inverse SQRT (1/<em>N</em>)</li>
</ul></td>
</tr><tr><td>
<p><strong>Threading</strong></p>
</td>
<td>
<p>Platform dependent</p>
<ul><li>IA-32: All (except 1D when performing a single transform and sizes are not power of two)</li>
<li>Intel® 64: All (except in-place power of two)</li>
<li>IA-64: All</li>
</ul><p>Can use as many threads as needed on MP systems.</p>
</td>
<td>
<p>1D and 2D</p>
<p> </p>
</td>
</tr><tr><td>
<p><strong>Accuracy</strong></p>
</td>
<td>
<p><br />
High accuracy</p>
<p> </p>
</td>
<td>
<p>High Accurate</p>
</td>
</tr></tbody></table><p><br /><b><strong>Data Types and Formats</strong></b></p>
<p>The Intel MKL and Intel IPP Fourier transform functions support a variety of data types and formats for storing signal values. Mixed types interfaces are also supported. Please see the product documentation for details.</p>
<p><strong>Table 4: Comparison of Intel MKL and Intel IPP Data Types and Formats</strong></p>
<table style="width:100%" border="1"><tbody><tr><td>
<p><strong>Feature</strong></p>
</td>
<td>
<p><strong>Intel MKL</strong></p>
</td>
<td>
<p><strong>Intel IPP</strong></p>
</td>
</tr><tr><td colspan="3">
<p><strong>Real FFTs</strong></p>
</td>
</tr><tr><td>
<p><strong>Precision</strong></p>
</td>
<td>
<p>Single, Double</p>
</td>
<td>
<p>Single, Double</p>
</td>
</tr><tr><td>
<p><strong>1D Data Types</strong></p>
</td>
<td>
<p>Real for all dimensions</p>
</td>
<td>
<p>Signed short, signed int, float, double</p>
</td>
</tr><tr><td>
<p><strong>2D Data Types</strong></p>
</td>
<td>
<p>Real for all dimensions</p>
</td>
<td>
<p>Unsigned char, signed int, float</p>
</td>
</tr><tr><td>
<p><strong>1D Packed Formats</strong></p>
</td>
<td>
<p>CCS, Pack, Perm, CCE</p>
</td>
<td>
<p>CCS, Pack, Perm</p>
</td>
</tr><tr><td>
<p><strong>2D Packed Formats</strong></p>
</td>
<td>
<p>CCS, Pack, Perm, CCE</p>
</td>
<td>
<p>RCPack2D</p>
</td>
</tr><tr><td>
<p><strong>3D Packed Formats</strong></p>
</td>
<td>
<p>CCE</p>
</td>
<td>
<p>N/A</p>
</td>
</tr><tr><td>
<p><strong>Format Conversion Functions</strong></p>
</td>
<td>
<p> </p>
</td>
<td>
<p> </p>
</td>
</tr><tr><td colspan="3">
<p><strong>Complex FFTs</strong></p>
</td>
</tr><tr><td>
<p><strong>Precision</strong></p>
</td>
<td>
<p>Single, Double</p>
</td>
<td>
<p>Single, Double</p>
</td>
</tr><tr><td>
<p><strong>1D Data Types</strong></p>
</td>
<td>
<p>Complex for all dimensions</p>
</td>
<td>
<p>Signed short, complex short, signed int, complex integer, complex float, complex double</p>
</td>
</tr><tr><td>
<p><strong>2D Data Types</strong></p>
</td>
<td>
<p>Complex for all dimensions</p>
</td>
<td>
<p>Complex float</p>
</td>
</tr></tbody></table><p>Formats Legend<br />
CCE - stores the values of the first half of the output complex conjugate-even signal<br />
CCS - same format as CCE format for 1D, is slightly different for multi-dimensional real transforms<br />
For 2D transforms. CCS, Pack, Perm are not supported for 3D and higher rank<br />
Pack - compact representation of a complex conjugate-symmetric sequence<br />
Perm - same as Pack format for odd lengths, arbitrary permutation of the Pack format for even lengths<br />
RCPack2D - exploits the complex conjugate symmetry of the transformed data to store only half of the resulting Fourier coefficients<br /><br /><b><strong>Performance</strong></b></p>
<p>The Intel MKL and Intel IPP are optimized for current and future Intel<sup>®</sup> processors, and they are specifically tuned for two different usage areas:</p>
<ul><li>Intel MKL is suitable for large problem sizes</li>
<li>Intel IPP is specifically designed for smaller problem sizes including those used in multimedia, data processing, communications, and embedded C/C++ applications.</li>
</ul><p><strong>Choosing the Best FFT for Your Application</strong></p>
<p>Before making a decision, developers must understand the specific requirements and constraints of the application. Developers should consider these questions:</p>
<ul><li>What are the performance requirements for the application? How is performance measured, and what is the measurement criteria? Is a specific benchmark being used? What are the known performance bottlenecks?</li>
<li>What type of application is being developed? What are the main operations being performed and on what kind of data?</li>
<li>What API is currently being used in the application for transforms? What programming language(s) is the application code written in?</li>
<li>Does the FFT output data need to be scaled (normalized)? What type of scaling is required?</li>
<li>What kind of input and output data does the transform process? What are the valid and invalid values? What type of precision is required?</li>
</ul>Fri, 14 Nov 2014 09:42:34 -0800Noah Clemons (Intel)365930Intel® IPP MacOS Image Resize Example
https://software.intel.com/en-us/articles/intel-ipp-macos-image-resize-example
<table border="0"><tbody><tr><td>
<p><img class="floatLeft" style="" src="http://software.intel.com/sites/default/files/Screen8_0.png" width="400" /></p>
</td>
<td>
<p>This whitepaper and demo application implements image resizing using Intel® IPP on OS X*.</p>
<p> </p>
<p><a class="button-cta" href="http://software.intel.com/sites/default/files/IPPMacOSXWhitePaper.docx">Download Whitepaper</a></p>
<p> </p>
<p><a class="button-cta" href="http://software.intel.com/sites/default/files/ImageResizeIppDemo.zip">Download source files</a></p>
</td>
</tr></tbody></table>Mon, 29 Jul 2013 15:56:34 -0700admin404638