Intel® IPP for Mac OS* - How to link to the Intel® IPP for Mac OS* X in application?

This document provides information on using Intel® Integrated Performance Primitives (Intel® IPP) with Intel® C++ Compiler and Apple LLVM 6.0 in XCode 6.1.1 integration development environment (IDE) and on the command line. In each case, the path to the Intel IPP header files and libraries is added to the project settings or command line.

Prerequisite
Build in Xcode IDE
With default Xcode Compiler
With Intel® C/C++ Compiler

Command line
With Clang* Compiler
With Intel® C/C++ Compiler

Prerequisite:

Intel IPP and Intel® Math Kernel Library (Intel MKL) for Mac OS* X are only available as components in Intel® Parallel Studio XE Composer Edition for C++ OS X* now. (The first integration was happened since Intel IPP version 7.0 in Intel® C++/Fortran Composer XE 2011 for Mac OS* X.) This documentation is using

  • Mac OS* X Yosemite Version 10.10.1, Xcode Version 6.1.1, Default C/C++ compiler (Apple LLVM 6.0)
  • Intel® Parallel Studio XE Composer Edition for C++ OS X*
  • Intel IPP Example

If you plan to work in Xcode integration environment, please check the option “Both command line and Xcode integration environment” when install Intel® Parallel Studio XE


After install, Intel IPP provides sample code under default directory. Copy the ipp-examples.tgz to a folder ~/Desktop and untar it.

$cd /opt/intel/composer_xe_2015.0.071/ipp/examples/ ipp-examples.tgz

$cp ipp-examples.tgz  ~/Desktop/.

$tar –xzvf ipp-examples.tgz

We use the sample project ipp_resize_mt/ ipp_resize_mt.xcodeproj and src/ ipp_resize_mt.cpp in the directory examples.  

Xcode IDE

1.     Double click ipp_resize_mt.xcodeproj. The project will opened it in the Xcode IDE.
2.     Click target ipp_resize_mt and the Build Settings page will opened.
3.     Select the Basic tab
4.     Select the Header Search Paths field and type.
·         /opt/intel/ipp/include
        
Select the Library Search Paths field and type
·         /opt/intel/ipp/lib
5.     Select the Other Linker Flags field and type in the linker flags for the libraries you wish to link to.
For dynamic linking:
·         -lippi –lipps -lippvm –lippcore
For static linking:
·         /opt/intel/ipp/lib/libippi.a  /opt/intel/ipp/lib/libipps.a /opt/intel/ipp/lib/libippvm.a /opt/intel/ipp/lib/libippcore.a

Note: For the Intel® IPP for Mac OS* commercial package, the Intel® IPP static and dynamic libraries are installed in the same directory $IPPROOT/lib. If link with -lipp*, the standard linker used by Xcode* first chooses a dynamic library over a static library. And if you need to use static, please link to the static libraries by using the full path and library name as shown in the examples above.

6. From the Xcode menu click the Product >> Build

Intel C++ Compiler

If you plan to use the Intel® compiler, please read the user and reference Guide for Intel C/C++ Compiler.

The Intel® C++ Compiler comes bundled with several Intel® Performance Libraries. To access these libraries in Xcode*, use the following Target Info properties, located in the Intel® C++ compiler Performance Library Build Components category:

·         Use Intel® Integrated Performance Primitives Libraries (Intel® IPP)
·         Use Intel® Math Kernel Library (Intel® MKL)
·         Use Intel® Threading Building Blocks Library (Intel® TBB)

The Use Intel Integrated Performance Primitives Libraries property provides the following options in a drop-down menu:

·         None: Disable use of Intel® IPP.
·         Use main libraries set: Use all libraries except Cryptography libraries.
·         Use main libraries and cryptography library: Use Cryptography libraries and main libraries.

  1. Double click ipp_resize_mt.xcodeproj. The project will be opened it in the Xcode IDE.
  2. Click target ipp_resize_mt and the Build Settings page will be opened.
  3. Select the All tab
  4. Select the Compiler for C/C++/Objective-C field,Select.ICC intel® C++ Compiler XE 15.0     
  5. Select the ICC intel® C++ Compiler XE 15.0 – Performance Library Build Components,Select Use Intel® Intergrated performance Primitives Library: Use main Library set (-ipp=common)
  6. from the Xcode menu click the Product >> Build

Note 1: If you are using dynamic linking then you need to add the path to the dynamic libraries to the system environment so that they are invoked at runtime.

Here is one way to add the run-time environment in Scheme Editor,
1.     From the Xcode menu click Product » Scheme » Edit Scheme…» Run
2.     Select the Arguments tab.
3.     Under Environment Variables click the [ + ] button.
4.     Under the Name field type DYLD_LIBRARY_PATH.
5.     Under the Value field type /opt/intel/ipp/lib.

Note 2: As the ipp_resize_mt need an image file lena.bmp as input, we add the customer working directory of lena.bmp in the Scheme Editor, 
1. From the Xcode menu click Product » Scheme » Edit Scheme…» Run
2.     Select the Options tab
3.     Go working Directory, check the box Use customer working directory, add the directory,
for example     /Users/xxx/Desktop/examples

Command line

Set environment variable as below
$ source /opt/intel/ipp/bin/ippvars.sh

Build the project from command-line

$ xcodebuild -project ipp_resize_mt.xcodeproj

$ build/Release/ipp_resize_mt

Or from command line:
Suppose the libcommon.a is built by $xcodebuild -project common.xcodeproj

For dynamic linking

$clang++ src/ipp_resize_mt.cpp -I/opt/intel/composer_xe_2015.0.071/ipp/include -I../common/include -L/opt/intel/ipp/lib -lippi -lipps -lippvm -lippcore -stdlib=libc++ /Users/yhu5/Desktop/examples/common/build/Release/libcommon.a

$./a.out

For static linking

$clang++ src/ipp_resize_mt.cpp -I/opt/intel/composer_xe_2015.0.071/ipp/include -I../common/include /opt/intel/ipp/lib/libippi.a  /opt/intel/ipp/lib/libipps.a  /opt/intel/ipp/lib/libippvm.a /opt/intel/ipp/lib/libippcore.a -stdlib=libc++ /Users/yhu5/Desktop/examples/common/build/Release/libcommon.a

Intel C++ Compiler

$source /opt/intel/composer_xe_2015.0.071/bin/iccvars.sh intel64
$icc src/ipp_resize_mt.cpp -I../common/include -ipp /Users/yhu5/Desktop/examples/common/build/Release/libcommon.a

Note*: Intel compiler link static Intel ipp library by default (may change in different version).  If you plan to use dynamic linking then use the common line:

$icc src/ipp_resize_mt.cpp -I../common/include –ipp-link=dynamic –ipp /Users/yhu5/Desktop/examples/common/build/Release/libcommon.a

Operating System:

>Mac OS*

Para obtener información más completa sobre las optimizaciones del compilador, consulte nuestro Aviso de optimización.