Re: [eigen] Problem with ei_cache_friendly_product?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi Frank,

First of all, for the licensing question, I now remember (sorry that I
didn't remember before...) that we had luck in the past contacting the
FSF at the address licensing@xxxxxxx. They were positive that "the
LGPL v3 is perfectly suited for C++ template libraries":
http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2008/02/msg00008.html

Quote:
>When application developers use such header files whose materials are
>incorporated directly into the object code, they only need to provide
>notice that they're using your library, and include a copy of LGPLv3
>with their application.

So I'm pretty confident that you're out of trouble but feel free to
ask them your more specific questions regarding closed-source software
and the interpretation of sections 0 and 4...

Regarding your crash, this is very interesting, the line in question is
              A0 = ei_pload(localB + k*MaxBlockRows);
so this could be an alignment issue (ei_pload would crash if passed a
non-aligned ptr), so could you please add before this line:
std::cout << localB + k*MaxBlockRows << std::endl;
and show us the output of your program just before it crashes? If this
really an alignment issue then the hex number will NOT end with a 0 as
it should.

Another possibility is that for MSVC, 16x16 fixed-size matrices are
somehow too big for the stack. In your program, you use matrices of
type Matrix<double,16,16> hence fixed-size. They are represented as
arrays like
double array[16*16]
which is 2 kilobytes. This is quite big -- for this kind of size one
usually starts preferring heap allocation. Could you please test with
replacing these lines

Matrix<double,MATSIZE,MATSIZE> I = Matrix<double,MATSIZE,MATSIZE>::Identity();
Matrix<double,MATSIZE,MATSIZE> m;

by

MatrixXd I = MatrixXd::Identity(MATSIZE,MATSIZE);
MatrixXd m(MATSIZE,MATSIZE);

and retry? Do you still get the crash?

Cheers,
Benoit

2008/12/23 FMDSPAM <fmdspam@xxxxxxxxx>:
> Hi List,
>
> I have an unhandled exception in a tiny testcase (attached).
> What is going wrong?
>
> My Eigen2-Version is:
>   freshly updated to Revision 900873.
>
> My Compiler is:
>   Microsoft Visual Studio 2008
>   Version 9.0.30729.1 SP
>   Microsoft .NET Framework
>   Version 3.5 SP1.
> My Prozessor is:
>   Intel(R) Core(TM)2 Duo CPU E6750
>
> Cheers
> Frank
>
>
> P.S.
> My examination of the LGPLv3 in regard of header-only libs is an ongoing
> effort,
> obviously this case is not well discussed in the LPGL community, stay tuned.
>
> #include "stdafx.h"
> /* in stdafx.h:
> #include <stdio.h>
> #include <tchar.h>
> #include <Eigen/Array>
> */
>
> #define MATSIZE 16
>
> using namespace std;
> USING_PART_OF_NAMESPACE_EIGEN
>
> int main(int argc, char *argv[])
> {
>        Matrix<double,MATSIZE,MATSIZE> I =
> Matrix<double,MATSIZE,MATSIZE>::Identity();
>        Matrix<double,MATSIZE,MATSIZE> m;
>        for(int i = 0; i < MATSIZE; i++) {
>                for(int j = 0; j < MATSIZE; j++) {
>                        m(i,j) = (i+MATSIZE*j);
>                }
>        }
>
>        // Eigen2 Revision: 900873
>
>        // Unhandled exeption in code below,
>        // If RELEASE-Mode and MATSIZE >= 16.
>        // (No Problems in DEBUG-Mode or if MATSIZE < 16)
>
>        // MSVC reports crash in
>        //      Eigen::ei_cache_friendly_product<double>(int _rows=16, int
> _cols=16, int depth=8, bool _lhsRowMajor=true, const double *
> _lhs=0x0030ec70, int _lhsStride=16, bool _rhsRowMajor=true, const double *
> _rhs=0x0030ec70, int _rhsStride=16, bool resRowMajor=true, double *
> res=0x0030f490, int resStride=16)  Line 203     C++
>        //      Eigen::MatrixBase<Eigen::Matrix<double,16,16,0,16,16>
>>::operator+<Eigen::Product<Eigen::Matrix<double,16,16,0,16,16> const
> &,Eigen::Matrix<double,16,16,0,16,16> const &,1> >(const
> Eigen::MatrixBase<Eigen::Product<Eigen::Matrix<double,16,16,0,16,16> const
> &,Eigen::Matrix<double,16,16,0,16,16> const &,1> > & other={...})  Line 182
> + 0x70 bytes        C++
>        //      Line b) if line a) IS NOT commented out
>        //  Line b) if line c)   IS   commented out (miracleous!)
>        //  Line d) if line a) IS and line c) IS NOT commented out
>
>        //cout << m << endl;                    // <- a)
>        m = I + 0.0005 * (m + (m*m));   // <- b)
>        cout << m << endl;                              // <- c)
>
>        m = I + 0.0005 * (m + (m*m));   // <- c)
>        return 0;
> }
>
>

---


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/