语言识别之IPP简介

来源:互联网 发布:淘宝ceo 编辑:程序博客网 时间:2024/06/06 08:28

IPP使用入门


1、Exmaple


IPP入门的话,直接看example就好,快准狠!看完直接开始写代码。


2、Special

对于IPP里面的东西做一些特别的说明。


数据类型:


原语细节:


描述语言:


依赖范围:


链接选择:

我们经常看到动态链接和静态链接,what 是动态链接和静态链接?


3、Function

Init/InitCpu(初始化CPU)

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.

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 ippInitCpu function for this. This function sets the dispatcher to use the processor-specific code according to the specified processor type without querying the system.

The ippInit and ippInitCpu 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 32-byte aligned:

void* ippMalloc(int length)void ippFree(void* ptr)

The ippMalloc function provides a 32-byte aligned buffer, and the ippFree function frees it.

The signal and image processing libraries provide ippsMalloc and ippiMalloc functions, respectively, to allocate a 32-byte aligned buffer that can be freed by the ippsFree and ippiFree functions.

  1. Compute the size of the required buffer using the <operation function>GetSize function.
  2. Set up any buffers needed for initialization.
  3. Initialize the specification structure for the operation.
  4. Free the buffers need for initialization only.
  5. Set up working buffers for the main operation.
  6. Do the main operation.
  7. Free the specification and working buffers.

Thread Managing(调用几个线程)

By default, the number of threads for Intel IPP threaded libraries follows the OpenMP* default, which is the number of logical processors visible to the operating system. If the value of the OMP_NUM_THREADS environment variable is less than the number of processors, then the number of threads for Intel IPP threaded libraries equals the value of the OMP_NUM_THREADS environment variable.

To configure the number of threads used by Intel IPP internally, at the very beginning of an application call the ippSetNumThreads(n) function, where n is the desired number of threads (1, ...). To disable internal parallelization, call the ippSetNumThreads(1) function.

Getting Information on Number of Threads(获取线程数目)

To find the number of threads created by the Intel IPP, call the ippGetNumThreads function.

     到目前为止估计你已经对于IPP有那么多多少少一点认识,接下来就去看example吧!或者直接百度,我只是闲的蛋疼才看这些的大笑


PS:如果你想进行自动补全的话,按Alt + RIGHT ARROW or Ctrl + SPACEBAR。

0 0
原创粉丝点击