Skip to content
Snippets Groups Projects
intel-integrated-performance-primitives.md 3.28 KiB
Newer Older
Lukáš Krupčík's avatar
Lukáš Krupčík committed
Intel IPP
Lukáš Krupčík's avatar
Lukáš Krupčík committed
=========

Intel Integrated Performance Primitives
---------------------------------------
Lukáš Krupčík's avatar
Lukáš Krupčík committed
Intel Integrated Performance Primitives, version 7.1.1, compiled for AVX vector instructions is available, via module ipp. The IPP is a very rich library of highly optimized algorithmic building blocks for media and data applications. This includes signal, image and frame processing algorithms, such as FFT, FIR, Convolution, Optical Flow, Hough transform, Sum, MinMax, as well as cryptographic functions, linear algebra functions and many more.
Lukáš Krupčík's avatar
Lukáš Krupčík committed

!!! Note "Note"
	Check out IPP before implementing own math functions for data processing, it is likely already there.
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
```bash
Lukáš Krupčík's avatar
Lukáš Krupčík committed
    $ module load ipp
Lukáš Krupčík's avatar
Lukáš Krupčík committed
```
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
The module sets up environment variables, required for linking and running ipp enabled applications.
Lukáš Krupčík's avatar
Lukáš Krupčík committed

IPP example
-----------

Lukáš Krupčík's avatar
Lukáš Krupčík committed
```cpp
Lukáš Krupčík's avatar
Lukáš Krupčík committed
    #include "ipp.h"
    #include <stdio.h>
    int main(int argc, char* argv[])
    {
            const IppLibraryVersion *lib;
            Ipp64u fm;
            IppStatus status;

            status= ippInit();            //IPP initialization with the best optimization layer
            if( status != ippStsNoErr ) {
                    printf("IppInit() Error:n");
                    printf("%sn", ippGetStatusString(status) );
                    return -1;
            }

            //Get version info
            lib = ippiGetLibVersion();
            printf("%s %sn", lib->Name, lib->Version);

            //Get CPU features enabled with selected library level
            fm=ippGetEnabledCpuFeatures();
            printf("SSE    :%cn",(fm>1)&1?'Y':'N');
            printf("SSE2   :%cn",(fm>2)&1?'Y':'N');
            printf("SSE3   :%cn",(fm>3)&1?'Y':'N');
            printf("SSSE3  :%cn",(fm>4)&1?'Y':'N');
            printf("SSE41  :%cn",(fm>6)&1?'Y':'N');
            printf("SSE42  :%cn",(fm>7)&1?'Y':'N');
            printf("AVX    :%cn",(fm>8)&1 ?'Y':'N');
            printf("AVX2   :%cn", (fm>15)&1 ?'Y':'N' );
            printf("----------n");
            printf("OS Enabled AVX :%cn", (fm>9)&1 ?'Y':'N');
            printf("AES            :%cn", (fm>10)&1?'Y':'N');
            printf("CLMUL          :%cn", (fm>11)&1?'Y':'N');
            printf("RDRAND         :%cn", (fm>13)&1?'Y':'N');
            printf("F16C           :%cn", (fm>14)&1?'Y':'N');

            return 0;
    }
Lukáš Krupčík's avatar
Lukáš Krupčík committed
```
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
Compile above example, using any compiler and the ipp module.
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
```bash
Lukáš Krupčík's avatar
Lukáš Krupčík committed
    $ module load intel
    $ module load ipp

    $ icc testipp.c -o testipp.x -lippi -lipps -lippcore
Lukáš Krupčík's avatar
Lukáš Krupčík committed
```
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
You will need the ipp module loaded to run the ipp enabled executable. This may be avoided, by compiling library search paths into the executable
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
```bash
Lukáš Krupčík's avatar
Lukáš Krupčík committed
    $ module load intel
    $ module load ipp

    $ icc testipp.c -o testipp.x -Wl,-rpath=$LIBRARY_PATH -lippi -lipps -lippcore
Lukáš Krupčík's avatar
Lukáš Krupčík committed
```
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Code samples and documentation
------------------------------
Intel provides number of [Code Samples for IPP](https://software.intel.com/en-us/articles/code-samples-for-intel-integrated-performance-primitives-library), illustrating use of IPP.
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Read full documentation on IPP [on Intel website,](http://software.intel.com/sites/products/search/search.php?q=&x=15&y=6&product=ipp&version=7.1&docos=lin) in particular the [IPP Reference manual.](http://software.intel.com/sites/products/documentation/doclib/ipp_sa/71/ipp_manual/index.htm)