Fix compilation of MKL support.

This commit is contained in:
Gael Guennebaud 2015-12-11 10:55:07 +01:00
parent 7ad1aaec1d
commit 79c1e6d0a6
6 changed files with 22 additions and 21 deletions

13
Eigen/src/Core/products/SelfadjointMatrixVector_MKL.h Normal file → Executable file
View File

@ -52,16 +52,16 @@ template<typename Index, int StorageOrder, int UpLo, bool ConjugateLhs, bool Con
struct selfadjoint_matrix_vector_product<Scalar,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs,Specialized> { \ struct selfadjoint_matrix_vector_product<Scalar,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs,Specialized> { \
static void run( \ static void run( \
Index size, const Scalar* lhs, Index lhsStride, \ Index size, const Scalar* lhs, Index lhsStride, \
const Scalar* _rhs, Index rhsIncr, Scalar* res, Scalar alpha) { \ const Scalar* _rhs, Scalar* res, Scalar alpha) { \
enum {\ enum {\
IsColMajor = StorageOrder==ColMajor \ IsColMajor = StorageOrder==ColMajor \
}; \ }; \
if (IsColMajor == ConjugateLhs) {\ if (IsColMajor == ConjugateLhs) {\
selfadjoint_matrix_vector_product<Scalar,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs,BuiltIn>::run( \ selfadjoint_matrix_vector_product<Scalar,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs,BuiltIn>::run( \
size, lhs, lhsStride, _rhs, rhsIncr, res, alpha); \ size, lhs, lhsStride, _rhs, res, alpha); \
} else {\ } else {\
selfadjoint_matrix_vector_product_symv<Scalar,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs>::run( \ selfadjoint_matrix_vector_product_symv<Scalar,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs>::run( \
size, lhs, lhsStride, _rhs, rhsIncr, res, alpha); \ size, lhs, lhsStride, _rhs, res, alpha); \
}\ }\
} \ } \
}; \ }; \
@ -79,13 +79,13 @@ typedef Matrix<EIGTYPE,Dynamic,1,ColMajor> SYMVVector;\
\ \
static void run( \ static void run( \
Index size, const EIGTYPE* lhs, Index lhsStride, \ Index size, const EIGTYPE* lhs, Index lhsStride, \
const EIGTYPE* _rhs, Index rhsIncr, EIGTYPE* res, EIGTYPE alpha) \ const EIGTYPE* _rhs, EIGTYPE* res, EIGTYPE alpha) \
{ \ { \
enum {\ enum {\
IsRowMajor = StorageOrder==RowMajor ? 1 : 0, \ IsRowMajor = StorageOrder==RowMajor ? 1 : 0, \
IsLower = UpLo == Lower ? 1 : 0 \ IsLower = UpLo == Lower ? 1 : 0 \
}; \ }; \
MKL_INT n=size, lda=lhsStride, incx=rhsIncr, incy=1; \ MKL_INT n=size, lda=lhsStride, incx=1, incy=1; \
MKLTYPE alpha_, beta_; \ MKLTYPE alpha_, beta_; \
const EIGTYPE *x_ptr, myone(1); \ const EIGTYPE *x_ptr, myone(1); \
char uplo=(IsRowMajor) ? (IsLower ? 'U' : 'L') : (IsLower ? 'L' : 'U'); \ char uplo=(IsRowMajor) ? (IsLower ? 'U' : 'L') : (IsLower ? 'L' : 'U'); \
@ -93,10 +93,9 @@ const EIGTYPE* _rhs, Index rhsIncr, EIGTYPE* res, EIGTYPE alpha) \
assign_scalar_eig2mkl(beta_, myone); \ assign_scalar_eig2mkl(beta_, myone); \
SYMVVector x_tmp; \ SYMVVector x_tmp; \
if (ConjugateRhs) { \ if (ConjugateRhs) { \
Map<const SYMVVector, 0, InnerStride<> > map_x(_rhs,size,1,InnerStride<>(incx)); \ Map<const SYMVVector, 0 > map_x(_rhs,size,1); \
x_tmp=map_x.conjugate(); \ x_tmp=map_x.conjugate(); \
x_ptr=x_tmp.data(); \ x_ptr=x_tmp.data(); \
incx=1; \
} else x_ptr=_rhs; \ } else x_ptr=_rhs; \
MKLFUNC(&uplo, &n, &alpha_, (const MKLTYPE*)lhs, &lda, (const MKLTYPE*)x_ptr, &incx, &beta_, (MKLTYPE*)res, &incy); \ MKLFUNC(&uplo, &n, &alpha_, (const MKLTYPE*)lhs, &lda, (const MKLTYPE*)x_ptr, &incx, &beta_, (MKLTYPE*)res, &incy); \
}\ }\

4
Eigen/src/Core/util/DisableStupidWarnings.h Normal file → Executable file
View File

@ -25,10 +25,12 @@
// typedef that may be a reference type. // typedef that may be a reference type.
// 279 - controlling expression is constant // 279 - controlling expression is constant
// ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case. // ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case.
// 1684 - conversion from pointer to same-sized integral type (potential portability problem)
// 2259 - non-pointer conversion from "Eigen::Index={ptrdiff_t={long}}" to "int" may lose significant bits
#ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
#pragma warning push #pragma warning push
#endif #endif
#pragma warning disable 2196 279 #pragma warning disable 2196 279 1684 2259
#elif defined __clang__ #elif defined __clang__
// -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant // -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant
// this is really a stupid warning as it warns on compile-time expressions involving enums // this is really a stupid warning as it warns on compile-time expressions involving enums

8
Eigen/src/Eigenvalues/ComplexSchur_MKL.h Normal file → Executable file
View File

@ -40,9 +40,9 @@ namespace Eigen {
/** \internal Specialization for the data types supported by MKL */ /** \internal Specialization for the data types supported by MKL */
#define EIGEN_MKL_SCHUR_COMPLEX(EIGTYPE, MKLTYPE, MKLPREFIX, MKLPREFIX_U, EIGCOLROW, MKLCOLROW) \ #define EIGEN_MKL_SCHUR_COMPLEX(EIGTYPE, MKLTYPE, MKLPREFIX, MKLPREFIX_U, EIGCOLROW, MKLCOLROW) \
template<> inline \ template<> template<typename InputType> inline \
ComplexSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >& \ ComplexSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >& \
ComplexSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW>& matrix, bool computeU) \ ComplexSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const EigenBase<InputType>& matrix, bool computeU) \
{ \ { \
typedef Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> MatrixType; \ typedef Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> MatrixType; \
typedef MatrixType::RealScalar RealScalar; \ typedef MatrixType::RealScalar RealScalar; \
@ -53,7 +53,7 @@ ComplexSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const Matri
m_matUisUptodate = false; \ m_matUisUptodate = false; \
if(matrix.cols() == 1) \ if(matrix.cols() == 1) \
{ \ { \
m_matT = matrix.cast<ComplexScalar>(); \ m_matT = matrix.template cast<ComplexScalar>(); \
if(computeU) m_matU = ComplexMatrixType::Identity(1,1); \ if(computeU) m_matU = ComplexMatrixType::Identity(1,1); \
m_info = Success; \ m_info = Success; \
m_isInitialized = true; \ m_isInitialized = true; \
@ -61,7 +61,6 @@ ComplexSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const Matri
return *this; \ return *this; \
} \ } \
lapack_int n = matrix.cols(), sdim, info; \ lapack_int n = matrix.cols(), sdim, info; \
lapack_int lda = matrix.outerStride(); \
lapack_int matrix_order = MKLCOLROW; \ lapack_int matrix_order = MKLCOLROW; \
char jobvs, sort='N'; \ char jobvs, sort='N'; \
LAPACK_##MKLPREFIX_U##_SELECT1 select = 0; \ LAPACK_##MKLPREFIX_U##_SELECT1 select = 0; \
@ -69,6 +68,7 @@ ComplexSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const Matri
m_matU.resize(n, n); \ m_matU.resize(n, n); \
lapack_int ldvs = m_matU.outerStride(); \ lapack_int ldvs = m_matU.outerStride(); \
m_matT = matrix; \ m_matT = matrix; \
lapack_int lda = m_matT.outerStride(); \
Matrix<EIGTYPE, Dynamic, Dynamic> w; \ Matrix<EIGTYPE, Dynamic, Dynamic> w; \
w.resize(n, 1);\ w.resize(n, 1);\
info = LAPACKE_##MKLPREFIX##gees( matrix_order, jobvs, sort, select, n, (MKLTYPE*)m_matT.data(), lda, &sdim, (MKLTYPE*)w.data(), (MKLTYPE*)m_matU.data(), ldvs ); \ info = LAPACKE_##MKLPREFIX##gees( matrix_order, jobvs, sort, select, n, (MKLTYPE*)m_matT.data(), lda, &sdim, (MKLTYPE*)w.data(), (MKLTYPE*)m_matU.data(), ldvs ); \

6
Eigen/src/Eigenvalues/RealSchur_MKL.h Normal file → Executable file
View File

@ -40,14 +40,13 @@ namespace Eigen {
/** \internal Specialization for the data types supported by MKL */ /** \internal Specialization for the data types supported by MKL */
#define EIGEN_MKL_SCHUR_REAL(EIGTYPE, MKLTYPE, MKLPREFIX, MKLPREFIX_U, EIGCOLROW, MKLCOLROW) \ #define EIGEN_MKL_SCHUR_REAL(EIGTYPE, MKLTYPE, MKLPREFIX, MKLPREFIX_U, EIGCOLROW, MKLCOLROW) \
template<> inline \ template<> template<typename InputType> inline \
RealSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >& \ RealSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >& \
RealSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW>& matrix, bool computeU) \ RealSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const EigenBase<InputType>& matrix, bool computeU) \
{ \ { \
eigen_assert(matrix.cols() == matrix.rows()); \ eigen_assert(matrix.cols() == matrix.rows()); \
\ \
lapack_int n = matrix.cols(), sdim, info; \ lapack_int n = matrix.cols(), sdim, info; \
lapack_int lda = matrix.outerStride(); \
lapack_int matrix_order = MKLCOLROW; \ lapack_int matrix_order = MKLCOLROW; \
char jobvs, sort='N'; \ char jobvs, sort='N'; \
LAPACK_##MKLPREFIX_U##_SELECT2 select = 0; \ LAPACK_##MKLPREFIX_U##_SELECT2 select = 0; \
@ -55,6 +54,7 @@ RealSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const Matrix<E
m_matU.resize(n, n); \ m_matU.resize(n, n); \
lapack_int ldvs = m_matU.outerStride(); \ lapack_int ldvs = m_matU.outerStride(); \
m_matT = matrix; \ m_matT = matrix; \
lapack_int lda = m_matT.outerStride(); \
Matrix<EIGTYPE, Dynamic, Dynamic> wr, wi; \ Matrix<EIGTYPE, Dynamic, Dynamic> wr, wi; \
wr.resize(n, 1); wi.resize(n, 1); \ wr.resize(n, 1); wi.resize(n, 1); \
info = LAPACKE_##MKLPREFIX##gees( matrix_order, jobvs, sort, select, n, (MKLTYPE*)m_matT.data(), lda, &sdim, (MKLTYPE*)wr.data(), (MKLTYPE*)wi.data(), (MKLTYPE*)m_matU.data(), ldvs ); \ info = LAPACKE_##MKLPREFIX##gees( matrix_order, jobvs, sort, select, n, (MKLTYPE*)m_matT.data(), lda, &sdim, (MKLTYPE*)wr.data(), (MKLTYPE*)wi.data(), (MKLTYPE*)m_matU.data(), ldvs ); \

8
Eigen/src/Eigenvalues/SelfAdjointEigenSolver_MKL.h Normal file → Executable file
View File

@ -40,9 +40,9 @@ namespace Eigen {
/** \internal Specialization for the data types supported by MKL */ /** \internal Specialization for the data types supported by MKL */
#define EIGEN_MKL_EIG_SELFADJ(EIGTYPE, MKLTYPE, MKLRTYPE, MKLNAME, EIGCOLROW, MKLCOLROW ) \ #define EIGEN_MKL_EIG_SELFADJ(EIGTYPE, MKLTYPE, MKLRTYPE, MKLNAME, EIGCOLROW, MKLCOLROW ) \
template<> inline \ template<> template<typename InputType> inline \
SelfAdjointEigenSolver<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >& \ SelfAdjointEigenSolver<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >& \
SelfAdjointEigenSolver<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW>& matrix, int options) \ SelfAdjointEigenSolver<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const EigenBase<InputType>& matrix, int options) \
{ \ { \
eigen_assert(matrix.cols() == matrix.rows()); \ eigen_assert(matrix.cols() == matrix.rows()); \
eigen_assert((options&~(EigVecMask|GenEigMask))==0 \ eigen_assert((options&~(EigVecMask|GenEigMask))==0 \
@ -56,7 +56,7 @@ SelfAdjointEigenSolver<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(c
\ \
if(n==1) \ if(n==1) \
{ \ { \
m_eivalues.coeffRef(0,0) = numext::real(matrix.coeff(0,0)); \ m_eivalues.coeffRef(0,0) = numext::real(m_eivec.coeff(0,0)); \
if(computeEigenvectors) m_eivec.setOnes(n,n); \ if(computeEigenvectors) m_eivec.setOnes(n,n); \
m_info = Success; \ m_info = Success; \
m_isInitialized = true; \ m_isInitialized = true; \
@ -64,7 +64,7 @@ SelfAdjointEigenSolver<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(c
return *this; \ return *this; \
} \ } \
\ \
lda = matrix.outerStride(); \ lda = m_eivec.outerStride(); \
matrix_order=MKLCOLROW; \ matrix_order=MKLCOLROW; \
char jobz, uplo='L'/*, range='A'*/; \ char jobz, uplo='L'/*, range='A'*/; \
jobz = computeEigenvectors ? 'V' : 'N'; \ jobz = computeEigenvectors ? 'V' : 'N'; \

4
Eigen/src/QR/ColPivHouseholderQR_MKL.h Normal file → Executable file
View File

@ -41,10 +41,10 @@ namespace Eigen {
/** \internal Specialization for the data types supported by MKL */ /** \internal Specialization for the data types supported by MKL */
#define EIGEN_MKL_QR_COLPIV(EIGTYPE, MKLTYPE, MKLPREFIX, EIGCOLROW, MKLCOLROW) \ #define EIGEN_MKL_QR_COLPIV(EIGTYPE, MKLTYPE, MKLPREFIX, EIGCOLROW, MKLCOLROW) \
template<> inline \ template<> template<typename InputType> inline \
ColPivHouseholderQR<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> >& \ ColPivHouseholderQR<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> >& \
ColPivHouseholderQR<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> >::compute( \ ColPivHouseholderQR<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> >::compute( \
const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>& matrix) \ const EigenBase<InputType>& matrix) \
\ \
{ \ { \
using std::abs; \ using std::abs; \