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!