链接 IPP 和 MKL 库文件

2014-06-25

Intel C++ Composer XE 2013 内含的 IPP8.1 Update1 的库文件名又有变化。

线程安全的库文件名,静态链接时为 ipp*mt.lib,动态链接时为 ipp*.lib。

多线程的库,Intel不推荐使用了。

另外,静态链接 ippsmt.lib 时,可能会提示缺少 sin/cos 函数方面的错误,需要再增加链接 ippvmmt.lib。

参考:https://software.intel.com/en-us/forums/topic/506677


2012-01-11

从IPP7开始,就没有 Xmerged.lib 之类的库了。

链接线程安全的库是

#pragma comment(lib, "ipps_l.lib")
#pragma comment(lib, "ippcore_l.lib")

链接多线程的库是

#pragma comment(lib, "ipps_t.lib")
#pragma comment(lib, "ippcore_t.lib")

 

2011-08-10

1、对IPP库的链接,比如只用到信号处理的函数,需

#pragma comment(lib, "ippsemerged.lib")
#pragma comment(lib, "ippsmerged.lib")
#pragma comment(lib, "ippcorel.lib")

或者

#pragma comment(lib, "ippsemerged.lib")
#pragma comment(lib, "ippsmerged_t.lib")
#pragma comment(lib, "ippcore_t.lib")

前者是线程安全的,后者是多线程的(即对库中的某些函数,当编译器的OpenMP选项被启用的时候,函数自动开启多线程并发处理。)

这种链接方式是 带派遣的 (即根据不同CPU动态选择优化代码)静态链接,当然程序中需调用 ippStaticInit。

还有动态链接、不带派遣的(这种形式需要指定函数原型)的静态链接、自定义DLL 等方式。

不同链接方式的区别参考 “IPP用户指南”的第五章 “Linking Your Application with Intel® IPP”。

不同库文件的区别参考 http://software.intel.com/en-us/articles/simplified-link-instructions-for-the-ipp-library/ 。 

摘取部分如下:

- Static Link (thread-safe model):

ippacemerged.lib ippccemerged.lib ippchemerged.lib ippcvemerged.lib ippdcemerged.lib ippdiemerged.lib ippgenemerged.lib ippiemerged.lib ippjemerged.lib ippmemerged.lib ippremerged.lib ippscemerged.lib ippsemerged.lib ippsremerged.lib ippvcemerged.lib ippvmemerged.lib ippacmerged.lib ippccmerged.lib ippchmerged.lib ippcvmerged.lib ippdcmerged.lib ippdimerged.lib ippgenmerged.lib ippimerged.lib ippjmerged.lib ipprmerged.lib ippmmerged.lib ippscmerged.lib ippsmerged.lib ippsrmerged.lib ippvcmerged.lib ippvmmerged.lib ippcorel.lib

Note: These library files are located in the lib subdirectory in your IPP install directory. The “thread-safe” model means these libraries are safe to use within a multi-threaded application, even though this version of the library is not multi-threaded.

- Static Link (multi-threaded model):

ippacemerged.lib ippccemerged.lib ippchemerged.lib ippcvemerged.lib ippdcemerged.lib ippdiemerged.lib ippgenemerged.lib ippiemerged.lib ippjemerged.lib ippmemerged.lib ippremerged.lib ippscemerged.lib ippsemerged.lib ippsremerged.lib ippvcemerged.lib ippvmemerged.lib ippacmerged_t.lib ippccmerged.lib ippchmerged_t.lib ippcvmerged_t.lib ippdcmerged_t.lib ippdimerged_t.lib ippgenmerged_t.lib ippimerged_t.lib ippjmerged_t.lib ippmmerged_t.lib ipprmerged_t.lib ippscmerged_t.lib ippsmerged_t.lib ippsrmerged_t.lib ippvcmerged_t.lib ippvmmerged_t.lib ippcore_t.lib libircmt.lib svml_dispmt.lib libmmt.lib libiomp5md.lib

Note: library files in red are Intel Compiler support files and are needed if you are NOT using the Intel compiler to compile and link your application. The equivalent files on a Linux system are named libirc, libsvml, libimf, and libiomp5. these libraries are required to satisfy Intel compiler optimizations and OpenMP calls used by the IPP library, because the IPP libraries are created using the Intel compiler.

- Dynamic Link:

ippac.lib ippcc.lib ippch.lib ippcv.lib ippdc.lib ippdi.lib ippgen.lib ippi.lib ippj.lib ippm.lib ippr.lib ipps.lib ippsc.lib ippsr.lib ippvc.lib ippvm.lib ippcore.lib libiomp5md.lib

Note: libiomp5md.lib is the Intel OpenMP library file and is used by the IPP libraries to implement multi-threading. The equivalent file is named libiomp5 on a Linux system. These files are located in the stublib directory on a Windows system and in the sharedlib directory on a Linux system. You are not required to use OpenMP in your application when you include this library file, but it is required by some IPP library functions when mult-threading is enabled (the default case). To disable OpenMP threading, within the dynamic libraries, see the ippSetNumThread() function.

Note: libiomp5mt.lib and libiomp5md.lib are two different versions of the same Intel OpenMP library. The "t" version is a static link library and the "d" version is a dynamic link library. Both OpenMP libraries provide the same functionality. You are strongly encouraged to link against the dynamic version of the OpenMP library, regardless of how you link against the IPP library, in order to avoid conflicts associated with having multiple copies of the OpenMP library running on your system at the same time. One caveat is that linking against the "d" version of the OpenMP library will require that you redistribute the shared OpenMP library file (e.g., libiomp5md.dll) with your application, even if you have statically linked with the IPP library.

 

 2、MKL的链接比较简单,如果是多线程版本的静态链接,

32位程序,链接 mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib 三个文件。

64位程序,把 mkl_intel_c.lib 改为 mkl_intel_lp64.lib (MKL_INT当成32位)或 mkl_intel_ilp64.lib(MKL_INT当成64位)。

一个不错的MKL库文件选择工具, http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/

“MKL 用户指南”的第五章“Linking Your Application with Intel® Math Kernel Library” ,主要是解释链接的层模型,接口层,线程层,计算层和运行时层。每层根据需要选择不同的库文件。接口层对应着函数原型,可选择的库为 mkl_intel_c.lib、mkl_intel_lp64.lib 等,线程层对应着 mkl_intel_thread.lib 和 mkl_sequential.lib,计算层对应着 mkl_core.lib 等(这个我不确定,因为没在文档上看到),运行时层对应着 libiomp5md.lib。

 

3、无论是 IPP 或 MKL 发生链接错误时,都可以加上 libiomp5md.lib 试试,因为它们中的有些函数内部用到了多线程模型。

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值