- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a project that runs fine in Windows with Eigen 3. When enabling MKL in Visual Studio with EIGEN_USE_MKL_ALL, I see speed-ups of about 5-15 percent.
When trying to get this to run in Linux, it causes problems during linking. I am using Eigen3 (3.2.92) together with MKL (2017.4.196) in an Ubuntu 14.04 project. For the preprocessor I defined in the CMakeFile:
ADD_DEFINITIONS(-DEIGEN_USE_MKL_ALL) - I also tried instead ADD_DEFINITIONS(-DEIGEN_USE_BLAS) as this is the part I am benefitting the most.
For CXX_CMAKE_CXX_FLAGS I added -D TBB_USE_THREADING_TOOLS -DMKL_LP64
Added include directory: /opt/intel/compilers_and_libraries/linux/mkl/include
Added linker directory: /opt/intel/compilers_and_libraries/linux/mkl/lib/intel64
TARGET_LINK_LIBRARIES(visualizer mkl_core mkl_tbb_thread mkl_def mkl_intel_lp64 mkl_intel_ilp64 tbb ${catkin_LIBRARIES} ${SDL2_LIBRARIES} ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES} ${PNG_LIBRARY} ${PROJECT_NAME} )
I also tried just using intel_lp64 or just using intel_ilp64, which doesn't seem to change the behaviour of this. What is the difference anyway?
When I build it (using catkin build), I get the following:
/home/elch/catkin-ws2/devel/.private/o_m/lib/libo_m.a(Qq.cpp.o): In function `Eigen::internal::general_matrix_matrix_product<long, float, 0, false, float, 0, false, 0>::run(long, long, long, float const*, long, float const*, long, float*, long, float, Eigen::internal::level3_blocking<float, float>&, Eigen::internal::GemmParallelInfo<long>*)': /usr/include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix_MKL.h:112: undefined reference to `sgemm' collect2: error: ld returned 1 exit status make[2]: *** [/home/elch/catkin-ws2/devel/.private/o_m/lib/o_m/visualizer] Error 1 make[1]: *** [CMakeFiles/visualizer.dir/all] Error 2 make: *** [all] Error 2
Any advice?
Thanks!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Daniel,
The sgemm is in the library mkl_intel_lp64.so
>nm libmkl_intel_lp64.so | grep sgemm
00000000001357b0 T sgemm
If possible, could you please post the link line when you build the project?
especially. the line of TARGET_LINK_LIBRARIES(visualizer mkl_core mkl_tbb_thread mkl_def mkl_intel_lp64 mkl_intel_ilp64 tbb
Generally, you can find the wanted MKL library by https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
for example,
-L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_tbb_thread -lmkl_core -ltbb -lstdc++ -lpthread -lm -ldl (the order does matter).
Under windows the library name is mkl_intel_lp64.lib etc.
Under linux the library name is libmkl_intel_lp64. a .
So please check how the Cmake to parse the link line: ARGET_LINK_LIBRARIES(visualizer mkl_core. ...)
Best Regards,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Ying,
thanks for your fast reply!
The issue resolved itself now. I had been building another library in the same CMakeFile, which also used MKL, but forgot to add the MKL libraries there :/. Now that it is added, it works fine! :)
Thanks and best regards,
Dnaiel
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page