Re: [eigen] Problem with g++-4.4 -O2 and Eigen3

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


Do you have a test case for reporting bug ?

On Wed, Jun 1, 2011 at 4:42 PM, Gael Guennebaud
<gael.guennebaud@xxxxxxxxx> wrote:
> I'm afraid there is nothing we can do on our side. It's clearly a
> compiler bug. For the record, and for the others, on your initial
> example I found that a double value was wrongly modified to -1 in
> between function calls, something like:
>
> foo(1);
>
> void foo(double alpha)
> {
>   // here alpha still equal 1)
>   bar(alpha);
> }
>
> void bar(double alpha)
> {
>   // here alpha == -1
> }
>
> and even worse, this behavior was dependent on the order of the .o
> files in the linking command line, i.e., the bug only appeared for
> some orders.
>
> Valgrind did not reported any issue.
>
> All other version of gcc was fine.
>
> So I'd recommend you to upgrade your compiler. At least you could try
> with the latest version of 4.4, i.e., 4.4.6 if that's not already the
> one you are using.
>
> gael
>
> On Wed, Jun 1, 2011 at 4:29 PM, Boris Lau
> <lau@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>> Hi,
>> sorry, but no, adding the 1 and/or the noalias doesn't change anything.
>>
>> Here are some more interesting matrix multiplication results. In short, 3x3
>> * 3x9 gives a mess, while 3x9 * 9x3 and 9x3 * 3x9 does not.
>>
>> Best, Boris
>>
>> Eigen::Matrix<double,3,9> J;
>> J.fill(1.0);
>>
>> std::cout << J << std::endl;
>> 1 1 1 1 1 1 1 1 1
>> 1 1 1 1 1 1 1 1 1
>> 1 1 1 1 1 1 1 1 1
>>
>> std::cout << Eigen::Matrix3d::Identity()*J << std::endl;
>> -1 -1 -1 -1 -1 -1 -1 -1 -1
>> -1 -1 -1 -1 -1 -1 -1 -1 -1
>> -1 -1 -1 -1 -1 -1 -1 -1 -1
>> wrong!
>>
>> std::cout << J.transpose()*J << std::endl;
>> 3 3 3 3 3 3 3 3 3
>> 3 3 3 3 3 3 3 3 3
>> 3 3 3 3 3 3 3 3 3
>> 3 3 3 3 3 3 3 3 3
>> 3 3 3 3 3 3 3 3 3
>> 3 3 3 3 3 3 3 3 3
>> 3 3 3 3 3 3 3 3 3
>> 3 3 3 3 3 3 3 3 3
>> 3 3 3 3 3 3 3 3 3
>> correct!
>>
>> std::cout << J*J.transpose() << std::endl;
>> 9 9 9
>> 9 9 9
>> 9 9 9
>> correct!
>>
>> Best, Boris
>>
>> On 05/29/2011 05:08 PM, Gael Guennebaud wrote:
>>>
>>> ok, so just like before, the default value of the multiplicative
>>> factor alpha gets transformed into a -1.... that's really crasy.
>>>
>>> Does that change anything if explicitly put a multiplicative factor, e.g.:
>>>
>>> C.noalias() = 1 * A * B;
>>>
>>> Regarding the matrix size, this is because for matrices smaller than 8
>>> we use another product implementation.
>>>
>>>
>>> gael
>>>
>>>
>>> On Sun, May 29, 2011 at 2:45 PM, Boris Lau
>>> <lau@xxxxxxxxxxxxxxxxxxxxxxxxxx>  wrote:
>>>>
>>>> Hi folks,
>>>>
>>>> after updating Eigen to the newest version in the repository, I now
>>>> compile
>>>> my code with Eigen including the "no inlining of the GEBP product kernel"
>>>> change by Gael.
>>>>
>>>> However, still a simple matrix multiplication goes awfully wrong when
>>>> using
>>>> -O2 in g++-4.4:
>>>>
>>>> // a code snipped
>>>> Eigen::Matrix<double,3,9>  J;
>>>> J.fill(1.0);
>>>> Eigen::Matrix<double,3,9>  Jprime = Eigen::Matrix3d::Identity() * J;
>>>> std::cout<<  "J\n"<<  J<<  std::endl;
>>>> std::cout<<  "Jprime\n"<<  Jprime<<  std::endl;
>>>>
>>>> // output
>>>> J
>>>> 1 1 1 1 1 1 1 1 1
>>>> 1 1 1 1 1 1 1 1 1
>>>> 1 1 1 1 1 1 1 1 1
>>>> Jprime
>>>> -1 -1 -1 -1 -1 -1 -1 -1 -1
>>>> -1 -1 -1 -1 -1 -1 -1 -1 -1
>>>> -1 -1 -1 -1 -1 -1 -1 -1 -1
>>>>
>>>> As for Hauke, this only occurs only when used deeper inside a project, in
>>>> the main function it works alright. The problem also occurs for a matrix
>>>> size of 3x8, and disappears for 3x7 and smaller. Using dynamic sizes does
>>>> not help.
>>>> I also could not find a working order of .o files during linking.
>>>>
>>>> Maybe the no onlining fix didn't go far enough?
>>>>
>>>> Boris
>>>>
>>>> --
>>>> Boris Lau
>>>>
>>>> Albert-Ludwigs-University Freiburg
>>>> Institute of Computer Science, Autonomous Intelligent Systems Group
>>>> Georges-Koehler-Allee 079, D-79110 Freiburg, Germany
>>>>
>>>> Building 079, Room 1005
>>>> Phone: +49 761 203-8012 | Mobile: +49 174 9436758
>>>> http://www.informatik.uni-freiburg.de/~lau
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>> --
>> Boris Lau
>>
>> Albert-Ludwigs-University Freiburg
>> Institute of Computer Science, Autonomous Intelligent Systems Group
>> Georges-Koehler-Allee 079, D-79110 Freiburg, Germany
>>
>> Building 079, Room 1005
>> Phone: +49 761 203-8012 | Mobile: +49 174 9436758
>> http://www.informatik.uni-freiburg.de/~lau
>>
>>
>>
>
>
>



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