Re: [eigen] Extracting the executed computations

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


On 06.02.2013 21:20, Cowing-Zitron, Christopher wrote:
Hello,

I'm interested in the internals of Eigen's expression optimizations,
in order to both optimize my usage of Eigen and to improve my overall
programming techniques. Given some matrix expression such as
D=C+(A*B)^-1, I know Eigen doesn't actually execute anything until

Matrix XOR -1 is not implemented, afaik. You can use .inverse(), however (though in general you should not, but that's another story).

the equals sign. Rather, Eigen's expression templates generate an
optimized set of calculations, combining steps to avoid temporaries
and aliasing, for instance. Eigen also rearranges the computations to
make them more amenable to compiler optimizations like loop unrolling
and autovectorization. But while I understand the general ideas, and
the significance of each individual step, the complexity of both
Eigen's and the compiler's optimizations are such that I have a hard
time seeing the whole picture. Is it possible to have an expression
somehow print out or save the final computation sequence chosen by
the compiler? If that's not possible with Eigen on its own, is there
some third-party tool, i.e. a debugger or disassembler, that I can
use in conjunction with Eigen which will record in human-readable
format the executed computations? Thanks for your help,

If you want the typename of the expression tree you can try using
  std::cout << typeid(YOUR_EXPRESSION).name() << std::endl;
I'm afraid this will give you only a small part of the whole picture. Especially, at the moment some sub-expressions are evaluated before they go into the tree (this is supposed to change in the future). You can read the dev-corner in the wiki as a start (no guarantee on the up-to-dateness of the contents). If you really want to understand everything, I guess there is no way around looking deeply into the source and debug through some test-programs (with optimization disabled at first).

Christoph



--
----------------------------------------------
Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252
----------------------------------------------



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