Intel® Integrated Performance Primitives (Intel® IPP)

Asynchronous C/C++ Getting Started Guide

Intel® Integrated Performance Primitives (Intel® IPP) Asynchronous C/C++ is a software library of GPU-accelerated primitive functions. Use this library to accelerate the visual computing algorithms of your application, such as object tracking, or pattern recognition.

This document guides you through the key steps of using the Intel IPP Asynchronous C/C++ library. For detailed descriptions of the library functions, refer to the Intel IPP Asynchronous C/C++ Reference Manual.

Contents

Finding Intel® IPP Asynchronous C/C++ on Your System

Configuring the Microsoft* Visual Studio* IDE to Link with the Intel® IPP Asynchronous C/C++ Library

Building Intel® IPP Asynchronous C/C++ Applications

Additional Resources

Legal Information

Finding Intel® IPP Asynchronous C/C++ on Your System

By default, the <install_dir> for the Intel® IPP Asynchronous C/C++ library is C:\Program Files (x86)\Intel\IPP Preview <version> (on certain systems, instead of Program Files (x86), the directory name is Program Files).

The table below describes the Intel IPP Asynchronous C/C++ installation directory structure:

Directory Contents
Documentation\en_US\ipp\

Intel IPP Asynchronous C/C++ documentation

ipp\examples\

Intel IPP Asynchronous C/C++ example files

ipp\include

Header files for the library functions

ipp\lib\<arch>\, where <arch> is one of {ia32, intel64}

Static library files

redist\<arch>\ipp\

Dynamic library files

Configuring the Microsoft* Visual Studio* IDE to Link with the Intel® IPP Asynchronous C/C++ Library

To configure your Microsoft* Visual Studio* development system for linking with the Intel® IPP Asynchronous C/C++ library, perform the following steps. Though some versions of the Visual Studio* IDE may vary slightly in the menu items mentioned below, the fundamental configuring steps are applicable to all the supported versions.

  1. In Solution Explorer, right-click your project and click Properties (for Visual Studio* 2010 or higher) or select Tools > Options (for Visual Studio* 2008)
  2. Select Configuration Properties > VC++ Directories (for Visual Studio* 2010 or higher) or select Projects and Solutions (for Visual Studio* 2008) and set the following from the Show directories for drop down menu:
  3. Select Configuration Properties > Linker > Input and enter ipp_async_preview.lib to the Additional Dependencies field.

Building Intel® IPP Asynchronous C/C++ Applications

The code example below represents a short application to help you get started with Intel® IPP Asynchronous C/C++ library:

#include "ipp_async_op.h"
#include "ipp_async_accel.h"
#include <stdio.h>

#define MAT_WIDTH 128
#define MAT_HEIGHT 128

int main(int argc, char* argv[])
{
    hppAccel accel   = 0;
    hppiMatrix *src1 = 0;
    hppiMatrix *src2 = 0;
    hppiMatrix *dst  = 0;
    hppStatus sts;
    //Allocate data buffers
    char* srcBuf1 = new char[MAT_WIDTH*MAT_HEIGHT];
    char* srcBuf2 = new char[MAT_WIDTH*MAT_HEIGHT];
    char* dstBuf  = new char[MAT_WIDTH*MAT_HEIGHT];
    if(!srcBuf1 || !srcBuf2 || !dstBuf)
    {
        printf("Memory allocation error\n");
        return -1;
    }
    //Fill source data buffers
    memset(srcBuf1, 2, MAT_WIDTH*MAT_HEIGHT);
    memset(srcBuf2, 3, MAT_WIDTH*MAT_HEIGHT);
    //Create accelerator instance
    sts = hppCreateInstance(HPP_ACCEL_TYPE_CPU, 0, &accel);
    if(sts != HPP_STATUS_NO_ERROR)
    {
        printf("hppCreateInstance error %d\n", sts);
        return -1;
    }
    //Create matrix instances
    src1 = hppiCreateMatrix(HPP_DATA_TYPE_8U, MAT_WIDTH, MAT_HEIGHT, srcBuf1, MAT_WIDTH);
    src2 = hppiCreateMatrix(HPP_DATA_TYPE_8U, MAT_WIDTH, MAT_HEIGHT, srcBuf2, MAT_WIDTH);
    dst  = hppiCreateMatrix(HPP_DATA_TYPE_8U, MAT_WIDTH, MAT_HEIGHT, dstBuf , MAT_WIDTH);
    if(!src1 || !src2 || !dst)
    {
        printf("hppiCreateMatrix error\n");
        return -1;
    }
    //Add operation to queue
    sts  = hppiAdd(accel, src1, src2, 0, dst);
    if(sts != HPP_STATUS_NO_ERROR)
    {
        printf("hppiAdd error %d\n", sts);
        return -1;
    }
    //Wait for the operation to finish
    hppWait(accel, HPP_TIME_OUT_INFINITE);
    //Check operation result
    for(int i = 0; i < MAT_WIDTH*MAT_HEIGHT; i++)
    {
        if(dstBuf[i] != 5)
        {
            printf("Operation error\n");
            return -1;
        }
    }
    //Cleanup
    hppiFreeMatrix(src1);
    hppiFreeMatrix(src2);
    hppiFreeMatrix(dst);
    delete[] srcBuf1;
    delete[] srcBuf2;
    delete[] dstBuf;
    hppDeleteInstance(accel);
    printf("SUCCESS\n");
    return 0;
 }

This application consists of three sections:

  1. Setup:

  2. Execution: The application executes the library function, waits for completion, and checks the result.

  3. Release: The application deletes source and destination matrices, and the accelerator instance.

On Windows* OS, you can build Intel IPP Asynchronous C/C++ applications with Microsoft* Visual Studio* 2010 and higher. To build the code example above, follow these steps:

  1. Start Microsoft Visual Studio* and create an empty C++ project.

  2. Add a new cpp file and paste the code into it.

  3. Set the include directories and the linking model as described in Configuring the Microsoft* Visual Studio* IDE to Link with the Intel® IPP Asynchronous C/C++ Library.

  4. Compile and run the application.

Additional Resources

To get the most of the Intel® IPP Asynchronous C/C++ library, explore the following additional resources:

  1. Reference is a complete, detailed reference manual for all functions and structures provided by Intel IPP Asynchronous C/C++ library. It is available for download from http://software.intel.com/en-us/articles/intel-ipp-asynchronous-preview-feature-documentation.

  2. Examples includes a collection of example programs that demonstrate the various features of Asynchronous C/C++ library. These programs are located in the ipp_async_examples.zip archive at the ipp\examples\ subdirectory. The archive also includes the ipp_async_examples.html documentation file at the documentation subdirectory.

Legal Information

INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL® PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER, AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
A "Mission Critical Application" is any application in which failure of the Intel Product could result, directly or indirectly, in personal injury or death. SHOULD YOU PURCHASE OR USE INTEL'S PRODUCTS FOR ANY SUCH MISSION CRITICAL APPLICATION, YOU SHALL INDEMNIFY AND HOLD INTEL AND ITS SUBSIDIARIES, SUBCONTRACTORS AND AFFILIATES, AND THE DIRECTORS, OFFICERS, AND EMPLOYEES OF EACH, HARMLESS AGAINST ALL CLAIMS COSTS, DAMAGES, AND EXPENSES AND REASONABLE ATTORNEYS' FEES ARISING OUT OF, DIRECTLY OR INDIRECTLY, ANY CLAIM OF PRODUCT LIABILITY, PERSONAL INJURY, OR DEATH ARISING IN ANY WAY OUT OF SUCH MISSION CRITICAL APPLICATION, WHETHER OR NOT INTEL OR ITS SUBCONTRACTOR WAS NEGLIGENT IN THE DESIGN, MANUFACTURE, OR WARNING OF THE INTEL PRODUCT OR ANY OF ITS PARTS.
Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined." Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The information here is subject to change without notice. Do not finalize a design with this information.

The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request.

Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order.

Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtained by calling 1-800-548-4725, or go to

http://www.intel.com/design/literature.htm

Intel processor numbers are not a measure of performance. Processor numbers differentiate features within each processor family, not across different processor families. See http://ww.intel.com/products/processor_number for details.

BunnyPeople, Celeron, Celeron Inside, Centrino, Centrino Inside, Cilk, Core Inside, i960, Intel, the Intel logo, Intel AppUp, Intel Atom, Intel Atom Inside, Intel Core, Intel Inside, Intel Inside logo, Intel NetBurst, Intel NetMerge, Intel NetStructure, Intel SingleDriver, Intel SpeedStep, Intel Sponsors of Tomorrow., the Intel Sponsors of Tomorrow. logo, Intel StrataFlash, Intel Viiv, Intel vPro, Intel XScale, InTru, the InTru logo, InTru soundmark, Itanium, Itanium Inside, MCS, MMX, Moblin, Pentium, Pentium Inside, skoool, the skoool logo, Sound Mark, The Journey Inside, vPro Inside, VTune, Xeon, and Xeon Inside are trademarks of Intel Corporation in the U.S. and other countries.

* 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.

Copyright © 2013, Intel Corporation. All rights reserved.