Visible to Intel only — GUID: GUID-306078DF-2244-47B4-9772-A82FC1873FDE
Visible to Intel only — GUID: GUID-306078DF-2244-47B4-9772-A82FC1873FDE
Core and Support Functions
There are several general purpose functions that simplify using the library and report information on how it is working:
- Init/GetCpuFeatures/ SetCpuFeatures/GetEnabledCpuFeatures
- GetStatusString
- GetLibVersion
- Malloc/Free
Init/GetCpuFeatures/ SetCpuFeatures/GetEnabledCpuFeatures
The ippInit function detects the processor type and sets the dispatcher to use the processor-specific code of the Intel® IPP library corresponding to the instruction set capabilities available. If your application does not call the ippInit function, initialization of the library to the available instruction set capabilities is performed automatically with the first call of any Intel IPP function from the domain different from ippCore.
In some cases like debugging and performance analysis, you may want to get the data on the difference between various processor-specific codes on the same machine. Use the ippSetCpuFeatures function for this. This function sets the dispatcher to use the processor-specific code according to the specified set of CPU features. You can obtain features supported by CPU using ippGetCpuFeatures and obtain features supported by the currently dispatched Intel IPP code using ippGetEnabledCpuFeatures. If you need to enable support of some CPU features without querying the system (without CPUID instruction call), you must set the ippCPUID_NOCHECK bit for ippSetCpuFeatures, otherwise, only supported by the current CPU features are set.
The ippInit, ippGetCpuFeatures, ippGetEnabledCpuFeatures, and ippSetCpuFeatures functions are a part of the ippCore library.
GetStatusString
The ippGetStatusString function decodes the numeric status return value of Intel® IPP functions and converts them to a human readable text:
status= ippInit(); if( status != ippStsNoErr ) { printf("IppInit() Error:\n"); printf("%s\n", ippGetStatusString(status) ); return -1; }
The ippGetStatusString function is a part of the ippCore library.
GetLibVersion
Each domain has its own GetLibVersion function that returns information about the library layer in use from the dispatcher. The code snippet below demonstrates the usage of the ippiGetLibVersion from the image processing domain:
const IppLibraryVersion* lib = ippiGetLibVersion(); printf("%s %s %d.%d.%d.%d\n", lib->Name, lib->Version, lib->major, lib->minor, lib->majorBuild, lib->build);
Use this function in combination with ippInitCpu to compare the output of different implementations on the same machine.
Malloc/Free
Intel IPP functions provide better performance if they process data with aligned pointers. Intel IPP provides the following functions to ensure that data is aligned appropriately - 16-byte for CPU that does not support Intel® Advanced Vector Extensions (Intel® AVX) instruction set, 32-byte for Intel AVX and Intel® Advanced Vector Extensions 2 (Intel® AVX2), and 64-byte for Intel® Many Integrated Core Instructions.
void* ippMalloc(int length) void ippFree(void* ptr)
The ippMalloc function provides appropriately aligned buffer, and the ippFree function frees it.
The signal and image processing libraries provide ippsMalloc and ippiMalloc functions, respectively, to allocate appropriately aligned buffer that can be freed by the ippsFree and ippiFree functions.
- When using buffers allocated with routines different from Intel IPP, you may get better performance if the starting address is aligned. If the buffer is created without alignment, use the ippAlignPtr function.
For more information about the Intel IPP functions see the Intel® Integrated Performance Primitives for Intel® Architecture Developer Reference available in Intel® Software Documentation Library.