New user self-registration is disabled due to spam. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!

Bug 923

Summary: Compilation failure due to missing assign_impl when building with MKL
Product: Eigen Reporter: Kevin locke <kevin>
Component: InteroperabilityAssignee: Nobody <eigen.nobody>
Status: RESOLVED FIXED    
Severity: Compilation Problem CC: chtz, gael.guennebaud, hauke.heibel, jacob.benoit.1, zhouyan
Priority: Normal    
Version: 3.3 (current stable)   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 558    

Description Kevin locke 2014-12-22 18:59:05 UTC
When using the current development version of Eigen from the default branch on Bitbucket (83b91d08), compiling the following program:

#define EIGEN_USE_MKL_ALL
#include <Eigen/Core>

int main(void)
{
    return 0;
}

With `g++ -I$EIGEN -I$MKLROOT/include -c eigenbug.cpp` results in several errors, the first of which are:


eigen/Eigen/src/Core/Assign_MKL.h:79:16: error: expected template-name before ‘<’ token
   : assign_impl<Derived1, Eigen::CwiseUnaryOp<UnaryOp, Derived2>,Traversal,Unrolling,BuiltIn>
                ^
eigen/Eigen/src/Core/Assign_MKL.h:79:16: error: expected ‘{’ before ‘<’ token
eigen/Eigen/src/Core/Assign_MKL.h:79:16: error: expected unqualified-id before ‘<’ token
eigen/Eigen/src/Core/Assign_MKL.h:118:10: error: ‘assign_impl’ is not a class template
   struct assign_impl<Derived1, Eigen::CwiseUnaryOp<UnaryOp, Derived2>, TRAVERSAL, UNROLLING, Specialized>  {  \
          ^
eigen/Eigen/src/Core/Assign_MKL.h:124:1: note: in expansion of macro ‘EIGEN_MKL_VML_SPECIALIZE_ASSIGN’
 EIGEN_MKL_VML_SPECIALIZE_ASSIGN(DefaultTraversal,NoUnrolling)
 ^
eigen/Eigen/src/Core/Assign_MKL.h:118:105: error: wrong number of template arguments (5, should be 3)
   struct assign_impl<Derived1, Eigen::CwiseUnaryOp<UnaryOp, Derived2>, TRAVERSAL, UNROLLING, Specialized>  {  \
                                                                                                         ^
eigen/Eigen/src/Core/Assign_MKL.h:125:1: note: in expansion of macro ‘EIGEN_MKL_VML_SPECIALIZE_ASSIGN’
 EIGEN_MKL_VML_SPECIALIZE_ASSIGN(DefaultTraversal,CompleteUnrolling)


The issue first appeared in changeset e4505314, although that change obviously exposed the issue rather than introducing it.  From the other instances of assign_impl being removed in changeset 0a4228bd, it appears that this may be mostly (all?) dead code.  Removing the content from Assign_MKL.h appears to fix compilation, but I am unsure if it introduces a performance issue by removing the calls to MKL and if these calls may need to be moved elsewhere.

Any advice about either short and long term fixes would be appreciated.

Thanks,
Kevin
Comment 1 Christoph Hertzberg 2014-12-23 04:15:14 UTC
Unfortunately, MKL is barely tested. Very likely it was never fully ported to the new evaluator design.

To find the problem, first you could add this to beginning of your test program:

#define EIGEN_TEST_EVALUATORS

and bisect which is the first failing version. Perhaps from that you can figure out how to fix it, otherwise hopefully Gael can have a look at it.

Generally, it would be very appreciated, if the test suite was run with MKL activated more regularly. See here on how to do that:
http://eigen.tuxfamily.org/index.php?title=Tests

You can also test the latest stable version (3.2.3 at the moment)
Comment 2 Kevin locke 2015-01-02 18:47:18 UTC
Hi Cristoph,

Sorry for the slow reply, I missed your response because the mail server used by Bugzilla (edony.tuxfamily.net) is blacklisted by the Barracuda RBL <http://barracudacentral.org/rbl>, which is used by my mail server.

Bisecting with "#define EIGEN_TEST_EVALUATORS" added to the test program shows that the error was introduced in 1b9b24c4ace8.  However, the preceeding commit (ab2f3cc049c1) shows a different error which may be covering the error I was looking for, the last of which was:

In file included from ./Eigen/Core:386:0,
                 from eigentest.cpp:3:
./Eigen/src/Core/products/TriangularMatrixVector.h:216:8: error: ‘triangular_product_impl’ is not a class template
 struct triangular_product_impl<Mode,true,Lhs,false,Rhs,true>
        ^
./Eigen/src/Core/products/TriangularMatrixVector.h:227:61: error: wrong number of template arguments (6, should be 3)
 struct triangular_product_impl<Mode,false,Lhs,true,Rhs,false>
                                                             ^
./Eigen/src/Core/products/TriangularMatrixVector.h:216:60: error: provided for ‘template<int Mode, class Lhs, class Rhs> struct Eigen::internal::triangular_product_impl’
 struct triangular_product_impl<Mode,true,Lhs,false,Rhs,true>
                                                            ^

It appears that there were different errors preceding this one as well.  If it would be helpful to determine the history of when each error was introduced, let me know and I'll work it out.  But, as you say, it looks like software rot in the MKL codepaths and just need some love from someone familiar with MKL and the new evaluator design.

Eigen 3.2.3 compiles correctly.  Unfortunately, for our use case we need AVX which is not available in 3.2.3 (in my understanding).

I'll see about running the test suite more regularly with MKL to help catch these issues as they appear.  Thanks for pointing that out!
Comment 3 Gael Guennebaud 2015-06-23 09:08:07 UTC
*** Bug 1015 has been marked as a duplicate of this bug. ***
Comment 4 Gael Guennebaud 2015-06-23 11:12:44 UTC
https://bitbucket.org/eigen/eigen/commits/3ae2c8f4a27f/
Summary:     Bug 923: fix EIGEN_USE_BLAS mode

Support for VML coming soon...
Comment 5 Gael Guennebaud 2015-07-22 12:40:35 UTC
Forgot to update this entry:
https://bitbucket.org/eigen/eigen/commits/aa79288d6b3b