转载标明出处即可~
Intel® IPP offers developers high-quality, production-ready, low-level building blocks for image processing, signal processing, and data processing (data compression/decompression and cryptography) applications.
…
Optimized for Performance
Intel IPP software building blocks are highly optimized using Intel® Streaming SIMD Extensions (Intel® SSE) and Intel® Advanced Vector Extensions (Intel® AVX, Intel® AVX2) instruction sets, so your application will perform faster than what an optimized compiler can produce alone. Just by plugging in these primitives, you will see 5X to 10X faster performance on your applications.
<摘自https://software.intel.com/en-us/intel-ipp>
简单来说Intel Ipp库是Intel针对自家处理器进行高度优化的函数,能够提升诸多方面的性能,比如Opencv的图像处理性能。
IPP的官方下载地址:
https://software.intel.com/en-us/intel-ipp
邮箱里会收到一封邮件,比如我的这个:
点击download后,弹出一个网页,选择系统版本和要下载的软件,我选择的是windows:
点击Download Now就开始下载了,大小545MB
下载后,双击解压安装,如下地方记得输入之前说过的序列号。
安装结束后,会弹出一个本地的配置说明文档(file:///C:/Program%20Files%20(x86)/IntelSWTools/documentation_2017/en/ipp/common/get_started.htm),主要由下面几个地方需要配置:
1. 系统环境变量
按照下图依次点击:
在Path中加入(根据个人路径不同,需要更改):
;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.109\windows\redist\intel64_win\ipp;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.109\windows\redist\ia32_win\ipp
这里将32和64位的地方都加入了,(注意分隔符“;”),方便以后使用。
这里有一点需要注意的是,如果你的vs中的opencv项目选择的是32位,那么至少应该加入;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.109\windows\redist\ia32_win\ipp
配置完成之后,需要重启电脑。。。
2. visual studio环境变量
注意方框里我使用的是32位编译器。
这里设置编译时的环境变量(对应32位,如果是64位,需要更改ia32_win为intel64_win),包括:
① 可执行文件目录。加入:
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.109\windows\redist\ia32_win\ipp
② 包含目录。加入:
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.109\windows\ipp\include
③ 库目录。加入:
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.109\windows\ipp\lib\ia32_win
然后,设置连接器的环境变量:
加入(将下面的粘贴进去即可,不分32 64位):
ippcc.lib
ippccmt.lib
ippch.lib
ippchmt.lib
ippcore.lib
ippcoremt.lib
ippcv.lib
ippcvmt.lib
ippdc.lib
ippi.lib
ippimt.lib
ipps.lib
ippsmt.lib
ippvm.lib
ippvmmt.lib
好了,加完这些,配置就OK了。
file:///C:/Program%20Files%20(x86)/IntelSWTools/documentation_2017/en/ipp/common/get_started.htm
这里有一段代码,可以测试和打印出系统对IPP的支持情况。新建一个cpp文件,将如下复制进去,并编译,运行。如果编译并运行成功,那么说明IPP配置OK。
#include "ipp.h"
#include
int main(int argc, char* argv[])
{
const IppLibraryVersion *lib;
IppStatus status;
Ipp64u mask, emask;
/* Init IPP library */
ippInit();
/* Get IPP library version info */
lib = ippGetLibVersion();
printf("%s %s\n", lib->Name, lib->Version);
/* Get CPU features and features enabled with selected library level */
status = ippGetCpuFeatures( &mask, 0 );
if( ippStsNoErr == status ) {
emask = ippGetEnabledCpuFeatures();
printf("Features supported by CPU\tby IPP\n");
printf("-----------------------------------------\n");
printf(" ippCPUID_MMX = ");
printf("%c\t%c\t",( mask & ippCPUID_MMX ) ? 'Y':'N',( emask & ippCPUID_MMX ) ? 'Y':'N');
printf("Intel(R) Architecture MMX technology supported\n");
printf(" ippCPUID_SSE = ");
printf("%c\t%c\t",( mask & ippCPUID_SSE ) ? 'Y':'N',( emask & ippCPUID_SSE ) ? 'Y':'N');
printf("Intel(R) Streaming SIMD Extensions\n");
printf(" ippCPUID_SSE2 = ");
printf("%c\t%c\t",( mask & ippCPUID_SSE2 ) ? 'Y':'N',( emask & ippCPUID_SSE2 ) ? 'Y':'N');
printf("Intel(R) Streaming SIMD Extensions 2\n");
printf(" ippCPUID_SSE3 = ");
printf("%c\t%c\t",( mask & ippCPUID_SSE3 ) ? 'Y':'N',( emask & ippCPUID_SSE3 ) ? 'Y':'N');
printf("Intel(R) Streaming SIMD Extensions 3\n");
printf(" ippCPUID_SSSE3 = ");
printf("%c\t%c\t",( mask & ippCPUID_SSSE3 ) ? 'Y':'N',( emask & ippCPUID_SSSE3 ) ? 'Y':'N');
printf("Intel(R) Supplemental Streaming SIMD Extensions 3\n");
printf(" ippCPUID_MOVBE = ");
printf("%c\t%c\t",( mask & ippCPUID_MOVBE ) ? 'Y':'N',( emask & ippCPUID_MOVBE ) ? 'Y':'N');
printf("The processor supports MOVBE instruction\n");
printf(" ippCPUID_SSE41 = ");
printf("%c\t%c\t",( mask & ippCPUID_SSE41 ) ? 'Y':'N',( emask & ippCPUID_SSE41 ) ? 'Y':'N');
printf("Intel(R) Streaming SIMD Extensions 4.1\n");
printf(" ippCPUID_SSE42 = ");
printf("%c\t%c\t",( mask & ippCPUID_SSE42 ) ? 'Y':'N',( emask & ippCPUID_SSE42 ) ? 'Y':'N');
printf("Intel(R) Streaming SIMD Extensions 4.2\n");
printf(" ippCPUID_AVX = ");
printf("%c\t%c\t",( mask & ippCPUID_AVX ) ? 'Y':'N',( emask & ippCPUID_AVX ) ? 'Y':'N');
printf("Intel(R) Advanced Vector Extensions instruction set\n");
printf(" ippAVX_ENABLEDBYOS = ");
printf("%c\t%c\t",( mask & ippAVX_ENABLEDBYOS ) ? 'Y':'N',( emask & ippAVX_ENABLEDBYOS ) ? 'Y':'N');
printf("The operating system supports Intel(R) AVX\n");
printf(" ippCPUID_AES = ");
printf("%c\t%c\t",( mask & ippCPUID_AES ) ? 'Y':'N',( emask & ippCPUID_AES ) ? 'Y':'N');
printf("Intel(R) AES instruction\n");
printf(" ippCPUID_SHA = ");
printf("%c\t%c\t",( mask & ippCPUID_SHA ) ? 'Y':'N',( emask & ippCPUID_SHA ) ? 'Y':'N');
printf("Intel(R) SHA new instructions\n");
printf(" ippCPUID_CLMUL = ");
printf("%c\t%c\t",( mask & ippCPUID_CLMUL ) ? 'Y':'N',( emask & ippCPUID_CLMUL ) ? 'Y':'N');
printf("PCLMULQDQ instruction\n");
printf(" ippCPUID_RDRAND = ");
printf("%c\t%c\t",( mask & ippCPUID_RDRAND ) ? 'Y':'N',( emask & ippCPUID_RDRAND ) ? 'Y':'N');
printf("Read Random Number instructions\n");
printf(" ippCPUID_F16C = ");
printf("%c\t%c\t",( mask & ippCPUID_F16C ) ? 'Y':'N',( emask & ippCPUID_F16C ) ? 'Y':'N');
printf("Float16 instructions\n");
printf(" ippCPUID_AVX2 = ");
printf("%c\t%c\t",( mask & ippCPUID_AVX2 ) ? 'Y':'N',( emask & ippCPUID_AVX2 ) ? 'Y':'N');
printf("Intel(R) Advanced Vector Extensions 2 instruction set\n");
printf(" ippCPUID_AVX512F = ");
printf("%c\t%c\t",( mask & ippCPUID_AVX512F ) ? 'Y':'N',( emask & ippCPUID_AVX512F ) ? 'Y':'N');
printf("Intel(R) Advanced Vector Extensions 3.1 instruction set\n");
printf(" ippCPUID_AVX512CD = ");
printf("%c\t%c\t",( mask & ippCPUID_AVX512CD ) ? 'Y':'N',( emask & ippCPUID_AVX512CD ) ? 'Y':'N');
printf("Intel(R) Advanced Vector Extensions CD (Conflict Detection) instruction set\n");
printf(" ippCPUID_AVX512ER = ");
printf("%c\t%c\t",( mask & ippCPUID_AVX512ER ) ? 'Y':'N',( emask & ippCPUID_AVX512ER ) ? 'Y':'N');
printf("Intel(R) Advanced Vector Extensions ER instruction set\n");
printf(" ippCPUID_ADCOX = ");
printf("%c\t%c\t",( mask & ippCPUID_ADCOX ) ? 'Y':'N',( emask & ippCPUID_ADCOX ) ? 'Y':'N');
printf("ADCX and ADOX instructions\n");
printf(" ippCPUID_RDSEED = ");
printf("%c\t%c\t",( mask & ippCPUID_RDSEED ) ? 'Y':'N',( emask & ippCPUID_RDSEED ) ? 'Y':'N');
printf("The RDSEED instruction\n");
printf(" ippCPUID_PREFETCHW = ");
printf("%c\t%c\t",( mask & ippCPUID_PREFETCHW ) ? 'Y':'N',( emask & ippCPUID_PREFETCHW ) ? 'Y':'N');
printf("The PREFETCHW instruction\n");
printf(" ippCPUID_KNC = ");
printf("%c\t%c\t",( mask & ippCPUID_KNC ) ? 'Y':'N',( emask & ippCPUID_KNC ) ? 'Y':'N');
printf("Intel® Xeon Phi™ Coprocessor instruction set\n");
}
return 0;
}
到此,恭喜,完成~
欢迎大家留言交流~