The Intel® oneAPI DPC++/C++ Compiler provides a high performance implementation of specialized one-dimensional valarray operations for the C++ standard STL valarray container.
The standard C++ valarray template consists of array/vector operations for high performance computing. These operations are designed to exploit high performance hardware features such as parallelism and achieve performance benefits.
Intel's valarray implementation uses the Intel® Integrated Performance Primitives (Intel® IPP), which is part of the product. Select Intel® IPP when you install the product.
The valarray implementation consists of a replacement header, <valarray>, that provides a specialized, high-performance implementation for the following operators and types:
Operator |
Type |
---|---|
abs, acos, acosh, asin, asinh, atan, atan2, atanh, cbrt, cdfnorm, ceil, cos, cosh, erf, erfc, erfinv, exp, expm1, floor, hypot, inv, invcbrt, invsqrt, ln, log, log10, log1p, nearbyint, pow, pow2o3, pow3o2, powx, rint, round, sin, sinh, sqrt, tan, tanh, trunk |
float, double |
add, conj, div, mul, mulbyconj, mul, sub |
Ipp32fc, Ipp64fc |
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 |
valarray is not available for SYCL.
Intel's valarray implementation allows you to declare large arrays for parallel processing. Improved implementation of valarray is tied up with calling the Intel® IPP libraries that are part of Intel® IPP.
To use valarrays in your source code, include the valarray header file, <valarray>. The <valarray> header file is located in the path <installdir>/perf_header.
The following example shows a valarray addition operation (+) specialized through use of Intel's implementation of valarray:
#include <valarray>
void test( )
{
std::valarray<float> vi(N), va(N);
…
vi = vi + va; //array addition
…
}
To compile your valarray source code, the compiler option, /Quse-intel-optimized-headers (for Windows) or -use-intel-optimized-headers (for Linux), is used to include the required valarray header file and all the necessary Intel® IPP library files.
The following examples illustrate how to compile and link a program to include the Intel valarray replacement header file and link with the Intel® IPP libraries. Refer to the Intel® IPP documentation for details.
In the following examples, the merged libraries use a static library that contains all the CPU-specific variants of the library code.
The following command line performs a one-step compilation for a system based on Intel® 64 architecture, running Linux:
icpx -use-intel-optimized-headers source.cpp
The following command lines perform separate compile and link steps for a system based on Intel® 64 architecture, running Linux:
so (dynamic):
icpx -use-intel-optimized-headers -c source.cpp
icpx source.o -use-intel-optimized-headers -shared-intel
Merged (static):
icpx -use-intel-optimized-headers -c source.cpp
icpx source.o -use-intel-optimized-headers
The following command example performs a one-step compilation for a system running Windows:
icx /Quse-intel-optimized-headers source.cpp
The following command examples perform separate compile and link steps for a system running Windows:
DLL (dynamic):
icx /Quse-intel-optimized-headers /c source.cpp
icx source.obj /Quse-intel-optimized-headers
Merged (static):
icx /Quse-intel-optimized-headers /Qipp-link:static /c source.cpp icx source.obj /Quse-intel-optimized-headers /Qipp-link:static
Product and Performance Information |
---|
Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex. Notice revision #20201201 |