Re: [eigen] Eigen 3 is extremely slow |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Eigen 3 is extremely slow
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Mon, 14 Mar 2011 16:01:35 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=6x6+brimT4qr7qGthk/vrJZOUiqV9OSUYro2MgsM4jw=; b=NfB58jjQYj++62uLpNGE5qOwztnbPLGMTLf/KVxLcYRJbrJFvl5hw8mV6VjwzMNCi5 dc/Xrz1gV6L4YcH1fa3epHmTks+hjRXRWx8iEiIqsGMyYnzNadmVRQAH+kzej87jJD0H 1+YU73IWQS4FLMdWzJ7NFBwq54jNkiVylAabY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=tlILxAJ6ffJjPpy2qfEUNlXSLJvbgV9yobkkRLq//a41ypoIN8l0lqxzVpkGjF+Giw j0CJpTWbRhgOQ+nkIYc5P1LshIHQV0SDAtY8R3COl75s5mBZrQxGB1q3RtPv/nMtE5QD SKRzHcCt78Kkw5fAz+1FZYbQHNQaqvyW/P1kE=
Perhaps you access to the Eigen's ArrayXXf in a row major fashion?
Remember that by default Eigen's arrays and matrices are column major.
To check that you can simply try with:
Array<float,Dynamic,Dynamic,Eigen::RowMajor>
and leave the rest of the code unchanged.
I cannot believe that's operator(i,j) itself which is miscompiled.
gael
On Mon, Mar 14, 2011 at 3:00 PM, Hari Sundar <hsundar@xxxxxxxxx> wrote:
> I am working on creating a simple example that I can share. I'll send you
> both the eigen and blitz versions. (if I am able to re-create the slowdown
> with the simple example)
>
> thanks,
> Hari
>
> On Mon, Mar 14, 2011 at 9:57 AM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
> wrote:
>>
>> 2011/3/14 Hari Sundar <hsundar@xxxxxxxxx>:
>> > I do not have any NaN values and I have checked it for my sample
>> > dataset.
>> >
>> > I did some additional tests and it appears that it is not the matrix
>> > multiplication itself that is slow, but it appears to be some really bad
>> > case of cache usage.
>> >
>> > Once projected, I use the points to sample from an Array (512x512). If I
>> > do
>> > not use Eigen for this array (instead using a std. C array), then my
>> > performance is much better.
>> >
>> > I hope that is able to point you in the right direction.
>>
>> As Hauke said, the only useful thing would be a compilable test case.
>>
>> Benoit
>>
>> >
>> > I was using an ArrayXXf (also tried MatrixXf) to store the array.
>> >
>> > best,
>> > Hari
>> >
>> > On Mon, Mar 14, 2011 at 9:18 AM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
>> > wrote:
>> >>
>> >> 2011/3/14 Gael Guennebaud <gael.guennebaud@xxxxxxxxx>:
>> >> > On Mon, Mar 14, 2011 at 12:48 AM, Hari Sundar <hsundar@xxxxxxxxx>
>> >> > wrote:
>> >> >> For example a simple 4x4 * 4*1 multiplication takes around 0.5msec.
>> >> >
>> >> > hm, that's indeed extremely slow... which compiler? flags?
>> >> >
>> >> > for instance here a 4x4 * 4x1 product takes less than 4e-6msec, and
>> >> > even in debug mode (-g2) with a very old gcc 3.4 it takes less than
>> >> > 0.0008 msec...
>> >>
>> >> If his matrix has NaN values, that could explain another 500x factor.
>> >>
>> >> Benoit
>> >>
>> >> >
>> >> > gael
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>> >
>> > --
>> > +1 (215) 501 7752
>> > https://www.rad.upenn.edu/sbia/hsundar/
>> >
>>
>>
>
>
>
> --
> +1 (215) 501 7752
> https://www.rad.upenn.edu/sbia/hsundar/
>