intel ipp库(Integrated Performance Primitives)
概述
来自维基百科
https://zh.wikipedia.org/wiki/英特尔集成性能原语
- 一个多线程软件函式库,包含用于多媒体和数据处理应用的函数,支持英特尔和兼容处理器,可用于Linux、macOS、Windows和Android操作系统
- Intel IPP被划分为四大主要处理组:信号(带有线性阵列或矢量数据)、图像(具有典型颜色空间的2D阵列)、矩阵(用于矩阵运算的nxm数组)和密码学。
- 其入口点中一半为矩阵类型,三分之一为信号类型,其余是图像和密码类型。Intel IPP函数分为4种数据类型:数据类型包括8u (8-bit unsigned)、8s (8-bit signed)、16s、32f (32-bit floating-point)、64f等。
该库利用处理器的包括MMX、SSE、SSE2、SSE3、SSSE3、SSE4、AVX、AVX2、AVX-512、AES-NI和多核心处理器特性。[3]Intel IPP包含下列函数:- 视频解码/编码
- 音频解码/编码
- JPEG/JPEG2000/JPEG XR
- 计算机视觉
- 密码学
- 数据压缩
- 图像颜色转换
- 图像处理
- 光线追踪和渲染
- 信号处理
- 语音编码
- 语音识别
- 字符串处理
- 矢量和矩阵数学
IPPI
ippi即是IPP库的Image Processing部分
IPPS
ipps即是IPP库的Signal and Data Processing部分
OneAPI
OneAPI是intel搞的一个项目,听名字就知道了,intel想开发一个api,可以在各个平台使用。
而IPP库是Oneapi的一个子集,Oneapi的所有子集在intel的官网可以找到,比如这个链接
这里搬运并整理一下网页上“What’s Included”部分。
- Intel® oneAPI Base Toolkit (Base Kit),The Intel® oneAPI Base Toolkit (Base Kit) is a core set of tools and libraries for developing high-performance, data-centric applications across diverse architectures. It features an industry-leading C++ compiler and the Data Parallel C++ (DPC++) language, an evolution of C++ for heterogeneous computing.
- Add-on Toolkits for Specialized Workloads,Domain-specific libraries and the Intel® Distribution for Python* provide drop-in acceleration across relevant architectures. Enhanced profiling, design assistance, and debug tools complete the kit.
组件 列表
- Intel® oneAPI Collective Communications Library
- Intel® oneAPI Data Analytics Library
- Intel® oneAPI Deep Neural Network Library
- Intel® oneAPI DPC++/C++ Compiler
- Intel® oneAPI DPC++ Library
- Intel® oneAPI Math Kernel Library
- Intel® oneAPI Threading Building Blocks
- Intel® oneAPI Video Processing Library
- Intel® Advisor
- Intel® Distribution for GDB*
- Intel® Distribution for Python*
- Intel® DPC++ Compatibility Tool
- Intel® FPGA Add-on for oneAPI Base Toolkit
- Intel® Integrated Performance Primitives (即IPP库)
- Intel® VTune™ Profiler
文档
windows
get-started-with-ipp-for-oneapi-windows
Developer Guide(dev-guide-ipp-for-oneapi)
linux
install-using-package-managers
安装
注意检查系统要求 https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-base-toolkit-system-requirements.html,比如ubuntu18.04以上才能用
ubuntu 18.04
使用离线安装
参考教程
https://software.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/install-with-command-line.html#install-with-command-line_INTERACTIVE
wget https://registrationcenter-download.intel.com/akdlm/irc_nas/17769/l_BaseKit_p_2021.2.0.2883_offline.sh
sudo sh ./l_BaseKit_p_2021.1.0.2659_offline.sh -s -a --silent --eula accept # 我觉得静默安装方便一些
参考安装过程如下
lmy@ubuntu-lmy:/media/lmy/Data/ubuntu/ipp$ sudo sh ./l_BaseKit_p_2021.1.0.2659_offline.sh -s -a --silent --eula accept
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Checking system requirements...
Done.
Wait while the installer is preparing...
Done.
Launching the installer...
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Intel® Graphics Compute Runtime for OpenCL™ not found.
For developing and running applications for GPU on this system, the latest version of the Intel® Graphics Driver is required. Please reference the GPU driver section at <a href="https://dgpu-docs.intel.com/installation-guides/index.html">https://dgpu-docs.intel.com/installation-guides/index.html</a> about GPU driver version(s) and installation information.
Start installation flow...
Installed Location: /opt/intel/oneapi
Installation has successfully completed
Log file: /opt/intel/oneapi/logs/installer.install.intel.oneapi.lin.basekit.product,v=2021.1.0-2659.2021.06.19.22.41.16.813721.log
Set Environment Variables
$ source <install-dir>/setvars.sh
测试
link
link2
https://software.intel.com/content/www/us/en/develop/articles/porting-guide-for-icc-users-to-dpcpp-or-icx.html
icc = intel c++ compiler
icx is one of icc
#include <stdio.h>
#include "ipp.h"
#define PRINT_INFO(feature, text) printf(" %-30s= ", #feature); \
printf("%c\t%c\t", (cpuFeatures & feature) ? 'Y' : 'N', (enabledFeatures & feature) ? 'Y' : 'N'); \
printf( #text "\n")
int main(int argc, char* argv[])
{
const IppLibraryVersion *libVersion;
IppStatus status;
Ipp64u cpuFeatures, enabledFeatures;
ippInit(); /* Initialize Intel(R) IPP library */
libVersion = ippGetLibVersion();/* Get Intel(R) IPP library version info */
printf("%s %s\n", libVersion->Name, libVersion->Version);
status = ippGetCpuFeatures(&cpuFeatures, 0);/* Get CPU features and features enabled with selected library level */
if (ippStsNoErr != status) return status;
enabledFeatures = ippGetEnabledCpuFeatures();
printf("Features supported: by CPU\tby Intel(R) IPP\n");
printf("------------------------------------------------\n");
PRINT_INFO(ippCPUID_MMX, Intel(R) Architecture MMX technology supported);
PRINT_INFO(ippCPUID_SSE, Intel(R) Streaming SIMD Extensions);
PRINT_INFO(ippCPUID_SSE2, Intel(R) Streaming SIMD Extensions 2);
PRINT_INFO(ippCPUID_SSE3, Intel(R) Streaming SIMD Extensions 3);
PRINT_INFO(ippCPUID_SSSE3, Supplemental Streaming SIMD Extensions 3);
PRINT_INFO(ippCPUID_MOVBE, Intel(R) MOVBE instruction);
PRINT_INFO(ippCPUID_SSE41, Intel(R) Streaming SIMD Extensions 4.1);
PRINT_INFO(ippCPUID_SSE42, Intel(R) Streaming SIMD Extensions 4.2);
PRINT_INFO(ippCPUID_AVX, Intel(R) Advanced Vector Extensions instruction set);
PRINT_INFO(ippAVX_ENABLEDBYOS, Intel(R) Advanced Vector Extensions instruction set is supported by OS);
PRINT_INFO(ippCPUID_AES, Intel(R) AES New Instructions);
PRINT_INFO(ippCPUID_CLMUL, Intel(R) CLMUL instruction);
PRINT_INFO(ippCPUID_RDRAND, Intel(R) RDRAND instruction);
PRINT_INFO(ippCPUID_F16C, Intel(R) F16C new instructions);
PRINT_INFO(ippCPUID_AVX2, Intel(R) Advanced Vector Extensions 2 instruction set);
PRINT_INFO(ippCPUID_ADCOX, Intel(R) ADOX/ADCX new instructions);
PRINT_INFO(ippCPUID_RDSEED, Intel(R) RDSEED instruction);
PRINT_INFO(ippCPUID_PREFETCHW, Intel(R) PREFETCHW instruction);
PRINT_INFO(ippCPUID_SHA, Intel(R) SHA new instructions);
PRINT_INFO(ippCPUID_AVX512F, Intel(R) Advanced Vector Extensions 512 Foundation instruction set);
PRINT_INFO(ippCPUID_AVX512CD, Intel(R) Advanced Vector Extensions 512 CD instruction set);
PRINT_INFO(ippCPUID_AVX512ER, Intel(R) Advanced Vector Extensions 512 ER instruction set);
PRINT_INFO(ippCPUID_AVX512PF, Intel(R) Advanced Vector Extensions 512 PF instruction set);
PRINT_INFO(ippCPUID_AVX512BW, Intel(R) Advanced Vector Extensions 512 BW instruction set);
PRINT_INFO(ippCPUID_AVX512VL, Intel(R) Advanced Vector Extensions 512 VL instruction set);
PRINT_INFO(ippCPUID_AVX512VBMI, Intel(R) Advanced Vector Extensions 512 Bit Manipulation instructions);
PRINT_INFO(ippCPUID_MPX, Intel(R) Memory Protection Extensions);
PRINT_INFO(ippCPUID_AVX512_4FMADDPS, Intel(R) Advanced Vector Extensions 512 DL floating-point single precision);
PRINT_INFO(ippCPUID_AVX512_4VNNIW, Intel(R) Advanced Vector Extensions 512 DL enhanced word variable precision);
PRINT_INFO(ippCPUID_KNC, Intel(R) Xeon Phi(TM) Coprocessor);
PRINT_INFO(ippCPUID_AVX512IFMA, Intel(R) Advanced Vector Extensions 512 IFMA (PMADD52) instruction set);
PRINT_INFO(ippAVX512_ENABLEDBYOS, Intel(R) Advanced Vector Extensions 512 is supported by OS);
return 0;
}
compile code
$ icx ipptest.cpp -o ipptest -I$IPPROOT/include -L$IPPROOT/lib/intel64 -lippcore
$ ./ipptest
my@ubuntu-lmy:~/myfile/ipp$ ./ipptest
ippCore 2021.1 (r0xe13a8835)
Features supported: by CPU by Intel(R) IPP
------------------------------------------------
ippCPUID_MMX = Y Y Intel(R) Architecture MMX technology supported
ippCPUID_SSE = Y Y Intel(R) Streaming SIMD Extensions
ippCPUID_SSE2 = Y Y Intel(R) Streaming SIMD Extensions 2
ippCPUID_SSE3 = Y Y Intel(R) Streaming SIMD Extensions 3
ippCPUID_SSSE3 = Y Y Supplemental Streaming SIMD Extensions 3
ippCPUID_MOVBE = Y Y Intel(R) MOVBE instruction
ippCPUID_SSE41 = Y Y Intel(R) Streaming SIMD Extensions 4.1
ippCPUID_SSE42 = Y Y Intel(R) Streaming SIMD Extensions 4.2
ippCPUID_AVX = Y Y Intel(R) Advanced Vector Extensions instruction set
ippAVX_ENABLEDBYOS = Y Y Intel(R) Advanced Vector Extensions instruction set is supported by OS
ippCPUID_AES = Y Y Intel(R) AES New Instructions
ippCPUID_CLMUL = Y Y Intel(R) CLMUL instruction
ippCPUID_RDRAND = Y Y Intel(R) RDRAND instruction
ippCPUID_F16C = Y Y Intel(R) F16C new instructions
ippCPUID_AVX2 = Y Y Intel(R) Advanced Vector Extensions 2 instruction set
ippCPUID_ADCOX = Y Y Intel(R) ADOX/ADCX new instructions
ippCPUID_RDSEED = Y Y Intel(R) RDSEED instruction
ippCPUID_PREFETCHW = Y Y Intel(R) PREFETCHW instruction
ippCPUID_SHA = N N Intel(R) SHA new instructions
ippCPUID_AVX512F = N N Intel(R) Advanced Vector Extensions 512 Foundation instruction set
ippCPUID_AVX512CD = N N Intel(R) Advanced Vector Extensions 512 CD instruction set
ippCPUID_AVX512ER = N N Intel(R) Advanced Vector Extensions 512 ER instruction set
ippCPUID_AVX512PF = N N Intel(R) Advanced Vector Extensions 512 PF instruction set
ippCPUID_AVX512BW = N N Intel(R) Advanced Vector Extensions 512 BW instruction set
ippCPUID_AVX512VL = N N Intel(R) Advanced Vector Extensions 512 VL instruction set
ippCPUID_AVX512VBMI = N N Intel(R) Advanced Vector Extensions 512 Bit Manipulation instructions
ippCPUID_MPX = Y Y Intel(R) Memory Protection Extensions
ippCPUID_AVX512_4FMADDPS = N N Intel(R) Advanced Vector Extensions 512 DL floating-point single precision
ippCPUID_AVX512_4VNNIW = N N Intel(R) Advanced Vector Extensions 512 DL enhanced word variable precision
ippCPUID_KNC = N N Intel(R) Xeon Phi(TM) Coprocessor
ippCPUID_AVX512IFMA = N N Intel(R) Advanced Vector Extensions 512 IFMA (PMADD52) instruction set
ippAVX512_ENABLEDBYOS = N N Intel(R) Advanced Vector Extensions 512 is supported by OS
compile GetBilinearTransform.c
icx GetBilinearTransform.c -o GetBilinearTransform -I$IPPROOT/include -L$IPPROOT/lib/intel64 -lippi -lipps -lippcore
run
$ ./GetBilinearTransform
Exit status 0 (ippStsNoErr: No errors)