创建链接到英特尔 ipp 库的 mex 文件

Creating a mex file linked to Intel's ipp library

我试图通过用 c++ 程序替换其中的一部分来提高我的 matlab 代码性能,为此我正在使用英特尔的 ipp 库。尝试编译和 link 程序时出现问题。我收到了添加的错误。

我正在使用 Matlab2016a 64 位、Windows 10 64 位并使用 'Microsoft Visual C++ 2015 Professional' 构建。

谢谢!

纳达夫

mex nesta.cpp -L'C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.2.187\windows\ipp\lib\intel64_win' -I'C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.2.187\windows\ipp\include' Building with 'Microsoft Visual C++ 2015 Professional'. Error using mex Creating library nesta.lib and object nesta.exp nesta.obj : error LNK2019: unresolved external symbol ippsAdd_32fc_I referenced in function "int __cdecl nesta(struct Ipp32fc *,struct Ipp32fc *)" (?nesta@@YAHPEAUIpp32fc@@0@Z) nesta.obj : error LNK2019: unresolved external symbol ippsAdd_32fc referenced in function "int __cdecl nesta(struct Ipp32fc *,struct Ipp32fc *)" (?nesta@@YAHPEAUIpp32fc@@0@Z) nesta.obj : error LNK2019: unresolved external symbol ippsMulC_32fc referenced in function "int __cdecl nesta(struct Ipp32fc *,struct Ipp32fc *)" (?nesta@@YAHPEAUIpp32fc@@0@Z) nesta.obj : error LNK2019: unresolved external symbol ippsMul_32fc referenced in function "void __cdecl perform_L1_constraint(struct Ipp32fc *,float,struct Ipp32fc *,float *)" (?perform_L1_constraint@@YAXPEAUIpp32fc@@M0PEAM@Z) nesta.obj : error LNK2019: unresolved external symbol ippsSub_32fc_I referenced in function "int __cdecl nesta(struct Ipp32fc *,struct Ipp32fc *)" (?nesta@@YAHPEAUIpp32fc@@0@Z) nesta.obj : error LNK2019: unresolved external symbol ippsSub_32fc referenced in function "int __cdecl nesta(struct Ipp32fc *,struct Ipp32fc *)" (?nesta@@YAHPEAUIpp32fc@@0@Z) nesta.obj : error LNK2019: unresolved external symbol ippsDiv_32fc_I referenced in function "void __cdecl perform_L1_constraint(struct Ipp32fc *,float,struct Ipp32fc *,float *)" (?perform_L1_constraint@@YAXPEAUIpp32fc@@M0PEAM@Z) nesta.obj : error LNK2019: unresolved external symbol ippsConj_32fc referenced in function "void __cdecl perform_L1_constraint(struct Ipp32fc *,float,struct Ipp32fc *,float *)" (?perform_L1_constraint@@YAXPEAUIpp32fc@@M0PEAM@Z) nesta.obj : error LNK2019: unresolved external symbol ippsSum_32fc referenced in function "void __cdecl perform_L1_constraint(struct Ipp32fc *,float,struct Ipp32fc *,float *)" (?perform_L1_constraint@@YAXPEAUIpp32fc@@M0PEAM@Z) nesta.obj : error LNK2019: unresolved external symbol ippsMax_32f referenced in function "int __cdecl nesta(struct Ipp32fc *,struct Ipp32fc *)" (?nesta@@YAHPEAUIpp32fc@@0@Z) nesta.obj : error LNK2019: unresolved external symbol ippsNorm_L2_32fc64f referenced in function "void __cdecl perform_L1_constraint(struct Ipp32fc *,float,struct Ipp32fc *,float *)" (?perform_L1_constraint@@YAXPEAUIpp32fc@@M0PEAM@Z) nesta.obj : error LNK2019: unresolved external symbol ippsDFTInit_C_32fc referenced in function "int __cdecl nesta(struct Ipp32fc *,struct Ipp32fc *)" (?nesta@@YAHPEAUIpp32fc@@0@Z) nesta.obj : error LNK2019: unresolved external symbol ippsDFTFwd_CToC_32fc referenced in function "void __cdecl A(struct Ipp32fc *,struct Ipp32fc *,struct DFTSpec_C_32fc *)" (?A@@YAXPEAUIpp32fc@@0PEAUDFTSpec_C_32fc@@@Z) nesta.obj : error LNK2019: unresolved external symbol ippsDFTInv_CToC_32fc referenced in function "void __cdecl At(struct Ipp32fc *,struct Ipp32fc *,struct DFTSpec_C_32fc *)" (?At@@YAXPEAUIpp32fc@@0PEAUDFTSpec_C_32fc@@@Z) nesta.obj : error LNK2019: unresolved external symbol ippsAbs_32fc_A11 referenced in function "int __cdecl nesta(struct Ipp32fc *,struct Ipp32fc *)" (?nesta@@YAHPEAUIpp32fc@@0@Z) nesta.mexw64 : fatal error LNK1120: 15 unresolved externals`enter code here

看来我解决了。 -l 标志没有像我预期的那样工作。

此命令有效:

mex 'C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.2.187\windows\ipp\lib\intel64_win\*.lib' nesta.cpp -I'C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.2.187\windows\ipp\include'