user6456078
user6456078

Reputation:

Compilation of Eigen3 with MKL

During an integration work of TensorFlow 1.1 with my ongoing C++ project on Ubuntu 16... I want to include a support to MKL and 64 bit integers. I encountered a compilation problem in Eigen library while instantiate a template struct that has a direct call to MKL:

 In file included from /usr/local/include/eigen3/unsupported/Eigen/CXX11/../../../Eigen/Core:526:0,
                 from /usr/local/include/eigen3/unsupported/Eigen/CXX11/Tensor:14,
                 from /home/drormeirovich/projects/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /home/drormeirovich/projects/tensorflow/tensorflow/core/framework/tensor.h:19,
                 from /home/drormeirovich/projects/tensorflow/tensorflow/cc/framework/ops.h:21,
                 from /home/drormeirovich/projects/tensorflow/tensorflow/cc/client/client_session.h:24,
                 from /home/drormeirovich/projects/my_project.cpp:10:
/usr/local/include/eigen3/unsupported/Eigen/CXX11/../../../Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h: In static member function ‘static void Eigen::internal::general_matrix_matrix_product<Index, double, LhsStorageOrder, ConjugateLhs, double, RhsStorageOrder, ConjugateRhs, 0>::run(Index, Index, Index, const double*, Index, const double*, Index, double*, Index, double, Eigen::internal::level3_blocking<double, double>&, Eigen::internal::GemmParallelInfo<Index>*)’:
/usr/local/include/eigen3/unsupported/Eigen/CXX11/../../../Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h:103:173: error: cannot convert ‘char*’ to ‘CBLAS_LAYOUT’ for argument ‘1’ to ‘void cblas_dgemm(CBLAS_LAYOUT, CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, long long int, long long int, long long int, double, const double*, long long int, const double*, long long int, double, double*, long long int)’
   BLASPREFIX##gemm(&transa, &transb, &m, &n, &k, &numext::real_ref(alpha), (const BLASTYPE*)a, &lda, (const BLASTYPE*)b, &ldb, &numext::real_ref(beta), (BLASTYPE*)res, &ldc); \
                                                                                                                                                                             ^
/usr/local/include/eigen3/unsupported/Eigen/CXX11/../../../Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h:106:1: note: in expansion of macro ‘GEMM_SPECIALIZATION’
 GEMM_SPECIALIZATION(double,   d,  double, cblas_d)
 ^

For more details... My whole progress on this integration issue is in this link:

https://docs.google.com/document/d/1VFTdPJy59QTCTHO8NHMNmnO8AOoQhNXgWixas9KmLLM/edit?usp=drivesdk

Do I have to remove the support of MKL from Eigen3?

Any help would be appreciated...

Upvotes: 2

Views: 489

Answers (1)

Jens Timmerman
Jens Timmerman

Reputation: 9816

disclaimer: I used to be an EasyBuild developer.

In EasyBuild we can build Eigen3 with MKL support, so this should work.

One of our contributers seems to have figured out that for eigen3 you need to copy the 'signature_of_eigen3_matrix_library' file into the path you use for your includes, see https://github.com/hpcugent/easybuild-easyblocks/blob/master/easybuild/easyblocks/e/eigen.py

https://github.com/RLovelett/eigen/blob/master/signature_of_eigen3_matrix_library

Upvotes: 1

Related Questions