Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use BLAS and LAPACK from Eigen

I've implemented a piece of code with Eigen and I would like Eigen to use BLAS and LAPACK .

I've seen here, that is possible but I don't know how or where to put those values/directives in the code.

I have to expecify somewhere the value EIGEN_USE_BLAS but I have no idea where.

I've seen that Eigen's source includes the code of BLAS and LAPACK, but I completelly ignore if it uses it by default or what. I'm using Eigen 3.3.3.

like image 976
Santi Peñate-Vera Avatar asked Apr 10 '17 16:04

Santi Peñate-Vera


1 Answers

You don't put those directives in the code, you compile your code with these macros. For example:

LAPACK_FLAGS=('-D EIGEN_USE_LAPACKE=1 -lm -lblas -llapack -llapacke')
g++ --std=c++11 eigenSVD.cpp -o eigenSVD.cpp ${LAPACK_FLAGS[@]}

Take a look at Eigen/SVD, if your code is compiled with EIGEN_USE_LAPACKE, you see Eigen-lapacke interface and lapacke header files will be included.

#if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT)
#ifdef EIGEN_USE_MKL
#include "mkl_lapacke.h"
#else
#include "src/misc/lapacke.h"
#endif
#include "src/SVD/JacobiSVD_LAPACKE.h"
#endif
like image 156
Nicole Finnie Avatar answered Nov 10 '22 19:11

Nicole Finnie