Failed to specialize function template

Yihua Lou
2013-02-23
2013-06-12
  • Yihua Lou

    Yihua Lou - 2013-02-23

    I'm getting the following error when trying to compile any BLAS2 or BLAS3 code. This includes my project or any of the examples. I'm running Windows 8 64-bit and I'm compiling ViennaCL with VS2012. Any ideas?

    error C2893: Failed to specialize function template 'viennacl::enable_if<viennacl::is_any_dense_nonstructured_matrix<T>::value&&viennacl::is_any_dense_nonstructured_matrix<M2>::value&&viennacl::is_any_dense_nonstructured_matrix<T3>::value>::type viennacl::linalg::prod_impl(const MatrixType &,const VectorType1 &,VectorType2 &)'
    1>          With the following template arguments:
    1>          'viennacl::matrix<SCALARTYPE>'
    1>          with
    1>          [
    1>              SCALARTYPE=float
    1>          ]
    1>          'viennacl::vector<SCALARTYPE>'
    1>          with
    1>          [
    1>              SCALARTYPE=float
    1>          ]
    1>          'viennacl::vector<SCALARTYPE>'
    1>          with
    1>          [
    1>              SCALARTYPE=float
    1>          ]
    1>          connection\connection.cpp(11) : see reference to function template instantiation 'viennacl::vector<SCALARTYPE> &viennacl::vector<SCALARTYPE>::operator =<viennacl::matrix<SCALARTYPE>,viennacl::vector<SCALARTYPE>>(const viennacl::vector_expression<LHS,RHS,OP> &)' being compiled
    1>          with
    1>          [
    1>              SCALARTYPE=float,
    1>              LHS=const viennacl::matrix<float>,
    1>              RHS=const viennacl::vector<float>,
    1>              OP=viennacl::op_prod
    1>          ]
    1>          connection\connection.cpp(11) : see reference to function template instantiation 'viennacl::vector<SCALARTYPE> &viennacl::vector<SCALARTYPE>::operator =<viennacl::matrix<SCALARTYPE>,viennacl::vector<SCALARTYPE>>(const viennacl::vector_expression<LHS,RHS,OP> &)' being compiled
    1>          with
    1>          [
    1>              SCALARTYPE=float,
    1>              LHS=const viennacl::matrix<float>,
    1>              RHS=const viennacl::vector<float>,
    1>              OP=viennacl::op_prod
    1>          ]
    
     
  • Karl Rupp

    Karl Rupp - 2013-02-23

    Hi,

    thanks for reporting. It seems like there is some glitch/change in VS 2012 that makes the compiler behave differently than their predecessors. VS 2005 and VS 2010 were tested explicitly, but it seems that this wasn't enough (our experience with different codes is  that once it compiles on VS 2005, it works with all newer versions). I will obtain and test VS 2012 Express later today and let you know.

    Best regards,
    Karli

     
  • Karl Rupp

    Karl Rupp - 2013-02-23

    Hi again,

    alright, I've looked at VS 2012 and can only conclude that something is badly broken in VS 2012. More precisely, the compiler messes up the enable_if<> constructs. For example, in your snippet there are complaints about

    viennacl::enable_if<viennacl::is_any_dense_nonstructured_matrix<T>::value
                                         &&viennacl::is_any_dense_nonstructured_matrix<M2>::value
                                         &&viennacl::is_any_dense_nonstructured_matrix<T3>::value>::type
    viennacl::linalg::prod_impl(const MatrixType &,const VectorType1 &,VectorType2 &)
    

    Clearly, there are no T, M2 and T3 types in the list of function arguments which could be matched. However, there is no such function in ViennaCL with that signature.

    The respective function in ViennaCL is

        template <typename MatrixType, typename VectorType1, typename VectorType2>
        typename viennacl::enable_if<   viennacl::is_any_dense_nonstructured_matrix<MatrixType>::value 
                                      && viennacl::is_any_dense_nonstructured_vector<VectorType1>::value 
                                      && viennacl::is_any_dense_nonstructured_vector<VectorType2>::value >::type
        prod_impl(const MatrixType & mat, const VectorType1 & vec, VectorType2 & result)
    

    and here all the types match. I've checked the various other examples and found that e.g. examples/tutorials/blas1.cpp fails due to a similar mix-up in VS 2012 when using vector_assign, and for inplace_solve in e.g. examples/tutorials/blas2.cpp

    In summary, my only conclusion is that this is a bug in VS 2012 which we cannot reasonably circumvent without larger refactoring of valid code. :-(

    Best regards,
    Karli

     
  • Yihua Lou

    Yihua Lou - 2013-02-24

    Thanks for the super fast reply. I can confirm that switching to the VS2010 toolset fixes the problem.

     
  • Karl Rupp

    Karl Rupp - 2013-02-24

    Hi,

    you're welcome. :-) I filed a bug report at Microsoft, let's see whether this changes anything.

    Thanks again and best regards,
    Karli

     
  • Karl Rupp

    Karl Rupp - 2013-04-29

    FYI: The latest 1.4.2-release now compiles cleanly on VS 2012. We restructured the code significantly so that the bug in VS 2012 does not show up.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks