Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Linking a project using IPP and MKL

Thomas_W_4
初學者
1,574 檢視

Unfortunately I'm new to C++ compiling, and I've been thrown in at the deep end and asked to convert an Intel C++ compiled DLL on Windows into the Linux equivalent (which I believe to be a dynamically linked shared object?).

I think I have successfully altered the code so that it should compile, but it seems to be tripping up when it comes to linking. I'm getting dozens of errors in the format 'source.cpp: undefined reference to `ippsMalloc_64f' in function 'someFunction'', and ippsMalloc_64f can be replaced with ippsfree, ippsSet_64f etc...

I'm assuming that the problem lies with my arguments that I pass to the compiler. These are:

$ icpc *.cpp -I$MKLROOT/include -I$IPPROOT/include -L$IPPROOT/lib/intel64 -L$MKLROOT/lib/intel64

My environment variables: IPPROOT is /opt/intel/composer_xe_2013.5.192/ipp, and MKLROOT is /opt/intel/composer_xe_2013.5.192/mkl

O/S is Fedora 18. Each source file has #include<ipp.h> and #include<mkl.h> at the top.

What am I doing wrong, and how do I specify to output a shared object?

Thanks, and sorry for the amateur questions.
Thomas 

0 積分
6 回應
SergeyKostrov
傑出貢獻者 II
1,574 檢視
>>...I'm getting dozens of errors in the format 'source.cpp: undefined reference to `ippsMalloc_64f' in function 'someFunction''... >>... >>$ icpc *.cpp -I$MKLROOT/include -I$IPPROOT/include -L$IPPROOT/lib/intel64 -L$MKLROOT/lib/intel64 Since this is the error during Linking it is clear that you have Not linked some IPP libraries. Could you check $IPPROOT/lib/intel64 folder?
Sergey_K_Intel
1,574 檢視

Hi Thomas,

You need "-l<lib_name>" (low-case L) option in your command line. This option tells Linux linker to search "lib<libname>.a" file for unresolved external references.

Look into $IPPROOT/lib/intel64 folder. ippsMalloc* (and most of ipps* functions) are part of IPPS library. If your IPP is 7.1.x you need to add
"-lipps<suffix>", where <suffix> is either blank for dynamic linking, or "_l" for static single-thread, or "_t" for static multi-thread.

Regards,
Sergey 

Gennady_F_Intel
1,574 檢視

in the case if you will evaluate the latest version 8.0, please take into account  the following info:

  • Intel® IPP library "_l" and "_t" suffixes removed. A new OS native convention is now implemented: Windows* static libraries now have an "mt" suffix for both single and multi-threaded libraries.
  • Threaded static and dynamic/shared libraries are now in a "threaded" subfolder.

more info about that you can find onto IPP release note page following the link:

http://software.intel.com/en-us/articles/intel-ipp-80-library-release-notes

Thomas_W_4
初學者
1,574 檢視

Sergey Kostrov wrote:

>>...I'm getting dozens of errors in the format 'source.cpp: undefined reference to `ippsMalloc_64f' in function 'someFunction''...
>>...
>>$ icpc *.cpp -I$MKLROOT/include -I$IPPROOT/include -L$IPPROOT/lib/intel64 -L$MKLROOT/lib/intel64

Since this is the error during Linking it is clear that you have Not linked some IPP libraries. Could you check $IPPROOT/lib/intel64 folder?

Thomas_W_4
初學者
1,574 檢視

Sergey Khlystov (Intel) wrote:
You need "-l<lib_name>" (low-case L) option in your command line. This option tells Linux linker to search "lib<libname>.a" file for unresolved external references.

This solved it! Using grep and the Intel Library Link Line Advisor I ended up with the command

icpc *.cpp  -I/opt/intel/composer_xe_2013.5.192/mkl/include -I/opt/intel/composer_xe_2013.5.192/ipp/include -L/opt/intel/composer_xe_2013.5.192/ipp/lib/intel64 -L/opt/intel/composer_xe_2013.5.192/mkl/lib/intel64 -lipps -lippcore -lippvm -lippm -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -lpthread -lm

No doubt I'll be back in the near future with some other amateur questions.

Thanks,
Thomas 

SergeyKostrov
傑出貢獻者 II
1,574 檢視
All libipps* libraries in the folder and I'm glad that you've managed to fix the problem. Thanks for the screenshot and update on the issue.
回覆