Building Applications Using Intel Performance Headers

The Intel compiler provides a high performance implementation of specialized valarray operations for the C++ standard valarray container.

The standard C++ valarray template consists of array or vector operations for high performance computing; these operations are designed to exploit high performance hardware features such as parallelism and achieve performance benefits. The Intel implementation of valarray, which requires installation of IntelĀ® Integrated Performance Primitives (IPP), consists of a replacement header that provides a specialized high performance implementation for the following operators and types:

 

operator

valarrays of Type

abs, acos, asin, atan, atan2, cos, cosh, exp, log, log10, pow, sin, sinh, sqrt, tan, tanh

float, double

addition, subtraction, division, multiplication

float,double

bitwise or, and, xor

(all unsigned) char, short, int

min, max, sum

signed or short/signed int, float, double



The following examples illustrate two instances of how to compile and link a program to include the Intel valarray replacement header file and link with IPP. Refer to the IPP documentation for details.

In the following examples:

Windows OS examples:

The following command lines perform separate compile and link steps for a system based on IA-32 architecture, running Windows OS:

DLL (dynamic):

icl -Icompiler_dir/perf_headers/c++ -Iipp_include_dir /c source.cpp

icl source.obj /link /libpath:ipp_lib_dir ippcore.lib ipps.lib ippvm.lib

Merged (static):

icl -Icompiler_dir/perf_headers/c++ -Iipp_include_dir /c source.cpp icl source.obj /link /libpath:ipp_lib_dir ippcorel.lib ippsemerged.lib ippsmerged.lib ippvmemerged.lib ippvmmerged.lib

 

Linux OS examples:

The following command lines perform separate compile and link steps for a system based on IntelĀ® 64 architecture, running Linux OS:

so (dynamic):

icpc -Icompiler_dir/perf_headers/c++ -Iipp_include_dir -c source.cpp

icpc source.o -Lipp_lib_dir -lippsem64t -lippvmem64t -lippcoreem64t

Merged (static):

icpc -Icompiler_dir/perf_headers/c++ -Iipp_include_dir -c source.cpp

icpc source.o -Lipp_lib_dir -lippsemergedem64t -lippsmergedem64t -lippvmemergedem64t -lippvmmergedem64t -lippcoreem64t

 

Note iconNote

To use the static merged library, containing all cpu-specific optimized versions of the library code, you need to call the ippStaticInit function first, before any IPP calls. This ensures automatic dispatch to the correct version of the library code at runtime. If you don't call ippStaticInit first, the emerged library will use the generic instance of the code.

If you are using the dynamic version of the libraries, you do not need to call ippStaticInit.