Compiling and Linking Intel® Primitive Performance Libraries with Microsoft* Visual C++* and Intel® C++ Compiler

ID 标签 688743
已更新 7/11/2016
版本 Latest
公共

author-image

作者

Intel® Integrated Performance Primitives (Intel® IPP) for Windows can be integrated in Microsoft* Visual Studio* (MSVS). After a default installation of the Intel IPP(or Intel® Parallel Studio XE Composer, which have Intel IPP as subcomponents), you can easily configure your project to automatically link with Intel IPP within Microsoft* Visual Studio* Integrated Developer Environment (MSVS IDE). If you did not install the integration component or need more control over Intel IPP libraries to link, you can configure the Microsoft Visual Studio* manually.

The following provides instructions for using Intel IPP with Intel® C++ Compiler and Microsoft* Visual C++ Compiler in Microsoft* Visual Studio* IDE. In each case, the location (path) to the Intel IPP is added to the project settings. Select an environment below for more information:
Microsoft* Visual Studio 2015/2017
Microsoft* Visual Studio 2010/2012/2013
Intel® C++ Compiler
Microsoft* Visual Studio 2003/2005/2008(not supported)
Troubleshooting in VS IDE, integration issue, Compile and Linking Errors

Microsoft* Visual Studio 2015/2017

Intel IPP can be integrated into Microsoft* Visual Studio* IDE by default during installation time. This provides developer an easy way to compile and link Intel IPP with Intel® C++ Compiler or Microsoft Visual C++* project in Microsoft Visual Studio IDE environments. Please see User and Reference Guide for the Intel® C++ Compiler => Using Intel® Performance Libraries

The latest version of MSVS, Microsoft* Visual Studio 2017 has been released. While you install the Intel IPP or Intel Parallel Studio XE, please select full installation or select IPP library as a subcomponent to install. In this section, the Intel Parallel Studio 2017 is discussed as an example for guide. The Intel IPP would be integrated into MSVS 2017 IDE by default once it installed successfully.

Use Intel IPP in Microsoft* Visual Studio 2017 IDE - Automatically

To use Intel IPP library, users just need to link your application with the Intel IPP library.

Step 1: Right click solution, select Properties » Intel Performance Libraries » Use Intel IPP. See Figure 1:


Figure 1. Use Intel IPP in MSVS 2017

Step 2: Select proper settings and apply this change for your project, the detailed infomation of each option has been shown below:

  • No: Disable use of Intel IPP libraries.
  • Default Linking Method: Use Intel IPP libraries that depend on the settings for the Code Generation > Runtime Library property.
  • Multi-threaded Static Library: Use threaded static Intel IPP libraries.
  • Single-threaded Static Library: Use sequential static Intel IPP libraries.
  • Multi-threaded DLL: Use parallel dynamic Intel IPP libraries.
  • Single-threaded DLL: Use sequential dynamic Intel IPP libraries.

Step 3: For MSVS 2017, there is no requirement to set environment variables manually. Once you allow to use IPP and select one of mode to apply, the path of IPP head files and lib files would be added into Include Directories and Library Directories automatically.

You can check include directories and library directories in Properties » VC++ Directories » edit Include Directories, see Figure 2 and Figure 3 as below:


Figure 2. Include Directories in MSVS 2015


Figure 3. Library Directories in MSVS 2017

Now, you start to use IPP library in your program and build your application directly.

Use Intel IPP in Microsoft* Visual Studio 2017 IDE - Manually

If you did not install the integration plug-in, configure your Microsoft* Visual Studio* IDE to build Intel IPP applications following instructions below.

Step 1: Set the Path for IPP header files and libraries file in MSVC IDE

  1. Right click solution, select Properties » Configuration Properties » VC++ Directories
  2. Select the <edit> option in drop down list of Include Directories, click button to add a new line and select the include sub-directory under the windows folder of the IPP installation path. The default IPP head files should be saved in the path shown below:
    C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.*.***\windows\ipp\include
  3. Select the <edit> option in drop down list of Library Directories, add new lines and select the lib sub-directory under the windows folder of the IPP installation path like below:

    C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.*.***\windows\ipp\lib\<arch>_win

​* <arch> must be ia32 or intel64

Step 2: Link required IPP library into your project

  1. Select the Link » Input » Additional Dependencies
  2. Insert required IPP libraries as additional dependencies (e.g. dynamic link: ippi.lib ipps.lib ippcore.lib or static link: ippimt.lib ippsmt.lib ippcorelmt.lib). All these lib files should be saved in following path by default:
    C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.*.***\windows\ipp\lib\<arch>_win
    Or you can find the installation path in Macros list like below Figure 4.

Add IPP libraries as additional dependencies
Figure 4. Add IPP link file as additional dependencies

Please refer to the document Configuration the Microsoft* Visual Studio* IDE to Link with Intel IPP to view the detailed steps for adding IPP link to your project manually. And view the document Finding Intel® IPP on Your System to learn the structure of high-level directories on different target platform.

Step 3: Add IPP dynamic library into your executable environment (optional for DLL)

You can add Intel IPP dll path either in your system environment setting by system Start Menu>> Right Click Computer >>Properties>> Advanced System setting >>Open System Properties Page >> Advanced >> Edit the system environment variables >>Add ipp dll path <parent product directory>\redist\<arch>\ipp\ to Path

Or if you start with command line windows,

  1. Run ippvars.bat [ia32|intel64] from directory <ipp root path>\bin\ in one command windows, (by default ipp root path should be like:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.072\windows\ipp)
  2. then start < Microsoft Visual Studio>/IDE/devenv.exe in the same command windows. The detailed instructions can be found in following Figure 5.

Set environment variables to add dll path
Figure 5. Add IPP dynamic library into your executable environment

Please refer to User's Guide => Libraries Dependency by Domain or the document Finding the Intel IPP Libraries Needed by your Application to determine libraries to link to. For more information on choosing the best linkage model for your Intel IPP application, please refer to our FAQ on Building an Application

Microsoft* Visual Studio 2010/2012/2013

In these section, the using of Intel IPP for MSVS 2010/2012/2013 will be discussed. The setting steps and screenshots of MSVS 2010 are presented as sample, for other Microsoft* Visual Studio editions, besides MSVS 2015, please refer the following guide.

During installation time, you can select integrate with Microsoft* Visual Studio 2010, full installation. Once install successfully, IPP libraries, as part of Parallel Studio are integrated to MSVS 2010 IDE by default. This make the build of IPP based application become quite easy.

Use Intel IPP in Microsoft* Visual Studio 2010 IDE - Automatically

Step 1: Allow use IPP in MSVS

For compile and link IPP library, just open the Property Pages » Configuration Properties » Intel Integrated Performance Primitives Tab, click Use IPP =Yes, (see Figure 6) Then all thing should be done.

IPPinMSVS2010_Tab.jpg
Figure 6. Set to use Intel IPP in MSVS 2010

Step 2: Select setting for using Intel IPP in following page.


Figure 7. Use Intel® IPP in MSVS 2010

If there is no such option in your IDE, then please follow the below step to set compiler options manually.

Use Intel® IPP in Microsoft* Visual Studio 2010 IDE - Manually

Step 1: Set environment, mainly set the Path for IPP header files and libraries file in MSVC IDE

  1. Open your project in MSVC2010 IDE, select View » Solution Explorer (and make sure this window is active).
  2. Select Project » Properties, Open the Property Pages
  3. Select the C/C++ » General tab, In the Additional Include Directories line, add Intel IPP header files include path (e.g. default: C:\Program Files\Intel\IPP\X.X\ia32\include).
  4. Select the Link » General tab, In the Additional Library Directories line, add IPP library files path(e.g. default: C:\Program Files\Intel|IPP\X.X.X\ia32\stublib)

Step 2: Link required IPP library into your project

  1. Select the Link » Input tab, In the Additional Dependencies, add the required IPP libraries (e.g. dynamic link: ippi.lib ipps.lib ippcore.lib or static link: ippiemerged.lib ippimerged.lib ippsemerged.lib ippsmerged.lib ippcorel.lib). Figure 8

IPPinMSVS2010_lib.jpgFigure 8. Add additional dependencies

Step 3: Add IPP dynamic library into your executable environment (optional for DLL)

  1. Select Configuration Properties>VC++ Directories and set the following from the Select directories for drop down menu:
    -Include Files menu item, and then type in the directory for the Intel IPP include files (default is <ipp directory>\include)
    -Library Files menu item, and then type in the directory for the Intel IPP library files (default is <ipp directory>\lib)
    -Executable Files menu item, and then type in the directory for the Intel IPP executable files (default is <parent product directory>\redist\<arch>\ipp\ )
  2. Add Intel IPP dll path either in your system environment setting by system Start Menu>> Right Click Computer >>Properties>> Advanced System setting >>Open System Properties Page >> Advanced >> Edit the system environment variables >>Add ipp dll path <parent product directory>\windows\\redist\<arch>\ipp\ to Path;
    Or you can run ippvars.bat [ia32|intel64] from directory <ipp directory>\ipp\bin\ in command windows, then start < Microsoft Visual Studio>/IDE/devenv.exe in the same command windows

Please refer to the document Finding the Intel IPP Libraries Needed by your Application to determine which libraries to link to. For more information on choosing the best linkage model for your Intel IPP application, please refer to the FAQ on Building an Application and the whitepaper.

Intel® C++ Compiler

The Intel® C++ Compiler as an subcomponent of Intel® Parallel Studio/Intel® System Studio could be integrated into Microsoft* Visual Studio *. Once user fully install the Intel Parallel Studio or selected to install Intel C++ Compiler in MSVS, the Intel C++ Compiler could be selected to use for your project.

Step 1: select to use Intel® C++ Compiler in MSVS

Right click the project, select Intel Compiler » Use Intel C++. The screenshot Figure 9 displays how to switch between Intel® C++ compiler and Visual C++ compiler.

switch of using icc
Figure 9. Use Intel® C++ Compiler to build projects

Step 2: Check if the include and library path of Intel>® C++ Compiler and Intel® IPP has been added

  1. Right click project and select Properties » VC++ Directories » Include Directories/Library Directories to check if the include and library path of Intel® C++ Compiler has been added automatically.
  2. Please view Using Intel® IPP in Microsoft* Visual Studio 2015 and make sure the option "Use Intel® IPP" is on and all related Include Directories/Library of Intel® IPP had been added.
  3. Check the screenshots of Include & Library Directories in MSVS 2015. Make sure following paths have been added into Include Directories:
    C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.*.***\windows\compiler\include
    C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.*.***\windows\compiler\include\<arch>

    and below path has been added into Library Directories:
    C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.*.***\windows\compiler\lib\<arch>_win

Step 3: (Optional) If you'd like start with Command Prompt with Intel® C++ Compiler under the start path of Intel Parallel Studio XE

  1. Once the Intel® C++ Compiler is integrated into the Microsoft* Visual Studio* successfully, user could choose to start command prompt with Intel Compiler. For example, in below Figure 10, user could open IA32/Intel 64 Visual Studio 2015 environment to type command instruction.

Use command prompt for icc
Figure 10. Use Command Prompt with Intel Compiler

Step 4: Find Intel IPP root path by command instruction (optional)

Type instruction echo %IPPROOT% in command prompt window to locate the root path of Intel IPP. The default path would be:

C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.*.***\<target>\ipp

Now, you could use Intel C++ compiler to start your work.

Microsoft Visual Studio 2003/2005/2008(dropped)

Step 1: Set environment variable, mainly PATH for IPP header files and libraries file in MSVC IDE

  1. Open MSVC, select View » Solution Explorer (and make sure this window is active).
  2. Select Tools » Options » Projects » VC++ Directories.
  3. In the drop down menu titled Show directories for:, select Include Files, and then type in the directory for the Intel IPP include files (e.g. default: C:\Program Files\Intel\IPP\X.X\ia32\include).
  4. In the drop down menu titled Show directories for:, select Library Files, and then type in the directory for the Intel IPP library files (e.g. default: C:\Program Files\Intel\IPP\X.X\ia32\stublib or C:\Program Files\Intel\IPP\X.X\ia32\lib).
  5. In the drop down menu titled Show directories for:, select Executable Files, and then type in the directory for the Intel IPP executable files (e.g. default: C:\Program Files\Intel\IPP\X.X\ia32\bin).

Step 2: Link required IPP library into your project

  1. On the main toolbar select Project » {your project name} Properties, Project Property Pages windows will show up, select Configuration Properties» Linker » Input and in the Additional Dependencies line, add the libraries you wish to link to (e.g. dynamic link: ippi.lib ipps.lib ippcore.lib or static link: ippiemerged.lib ippimerged.lib ippsemerged.lib ippsmerged.lib ippcorel.lib).

Please refer to the document Finding the Intel IPP Libraries Needed by your Application to determine libraries to link to. For more information on choosing the best linkage model for your Intel IPP application, please refer to our FAQ on Building an Application and our whitepaper.

Troubleshooting in VS IDE, integration issue, Compile and Linking Errors

Whatever with above guide, you may still have trouble getting your program or even IPP samples to build in VS IDE, get complile errors, link errors , etc. Please go Intel® Developer Zone for Intel® IPP to search your problem from previous topics, or post your questions on forum.

"