Re: [eigen] Blas performance on mapped matrices |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
Hi Sameer,
On Monday, January 09, 2012 01:47:14 am Sameer Agarwal wrote:
> We are in the process of a significant code migration from eigen2 to
> eigen3. The code uses Eigen::Map to map chunks of memory into RowMajor
> matrices and operates on them.
> [snip]
> Moving from eigen2 to eigen3 has resulting in a 30% performance
> regression. Has something changed significantly in the way Eigen3
> handles mapped matrices, or about the structure of matrix-matrix
> multiplication in Eigen3 that would cause this?
I'm a newbie when it comes to eigen, and in particular I've never used eigen2,
but I'll nevertheless take a stab at this. Have you looked to see whether
temporaries are being created? This is especially possible if you have to pass
those matrices to a function, and that function was a templated function
originally written with pure matrices in mind: then
template <typename Derived>
void doSomething(MatrixBase<Derived>& input1,MatrixBase<Derived>& input2) {
....
}
will cause your mapped-matrix to be converted into a temporary "real" matrix
so that it is an object of the exact same type as the other argument.
This is described in more detail here:
http://eigen.tuxfamily.org/bz/show_bug.cgi?id=300
which includes some documentation patches. (Which I notice haven't been
applied, and the next release is coming soon. Gael or someone?)
Thanks to some nice contributions by others, you can also learn how to easily
detect whether temporaries are being created here:
http://eigen.tuxfamily.org/index.php?title=FAQ#Where_in_my_program_are_temporary_objects_created.3F
Hope this helps, or at least doesn't distract you too much from finding out
what's _really_ happening :-).
Best,
--Tim