Some Intel IPP functions require internal memory for various optimization strategies. However, memory allocation inside of the function may have a negative impact on performance in some situations, for example, cache misses. To avoid or minimize memory allocation and keep your data in a warm cache, some functions, for example, Fourier transform functions (FFT), can use or reuse memory given as a parameter to the function.
If you call such a function, many times, you can reuse of an external buffer and get better performance.
The following example reuses memory buffers to compute FFT as two FFTs in two separate threads:
ippsFFTInitAlloc_C_32fc(&ctxN2, order-1, IPP_FFT_DIV_INV_BY_N, ippAlgHintAccurate); ippsFFTGetBufSize_C_32fc( ctxN2, &sz ); buffer = sz > 0 ? ippsMalloc_8u( sz ) : 0; /// prepare source data for two FFTs int phase = 0; ippsSampleDown_32fc( x, fftlen, xleft, &fftlen2, 2, &phase ); phase = 1; ippsSampleDown_32fc( x, fftlen, xrght, &fftlen2, 2, &phase ); ippsFFTFwd_CToC_32fc( xleft, Xleft, ctxN2, buffer ); ippsFFTFwd_CToC_32fc( xrght, Xrght, ctxN2, buffer );
The external buffer is not necessary. If the pointer to the buffer is 0, the function allocates memory inside.
Optimization Notice |
---|
The Intel® Integrated Performance Primitives (Intel® IPP) library contains functions that are more highly optimized for Intel microprocessors than for other microprocessors. While the functions in the Intel® IPP library offer optimizations for both Intel and Intel-compatible microprocessors, depending on your code and other factors, you will likely get extra performance on Intel microprocessors. While the paragraph above describes the basic optimization approach for the Intel® IPP library as a whole, the library may or may not be optimized to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include Intel® Streaming SIMD Extensions 2 (Intel® SSE2), Intel® Streaming SIMD Extensions 3 (Intel® SSE3), and Supplemental Streaming SIMD Extensions 3 (Intel® SSSE3) instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Intel recommends that you evaluate other library products to determine which best meets your requirements. |
Copyright © 2008 - 2010, Intel Corporation. All rights reserved.