Re: [eigen] Extracting the executed computations |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Extracting the executed computations*From*: Márton Danóczy <marton78@xxxxxxxxx>*Date*: Wed, 6 Feb 2013 23:03:28 +0100*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=Wz4aliJMn4Q6NIVPllbSYQQ2WO19QuJ2Jm5q058GBqE=; b=aTLpNpcGkMdAuplMHak6tbQu8urFzd/ZU4b2kE+fpXfme6MNgdGL8kpj2murtGP1TY vPQ2+mb1nl0d8BlR7/12neMnvug0gQE0kiQieva3/r8IKT+WGzs0bec5OHLlPHCeXYNW iMKa43yHNmrjC5lxPBko3nFhxJAr/CH2IJOpp26qAGAAGKC0HYJC7l9t1Q7aatMPPXLv RkXYjx6Px5aAwtxQgS1KD0pet8S1YPjHyxAoDA/EnLSNKrTpinHqKYMCr/xwKEysilV4 7EVJQ/PwK9343zkqn9fY9jKvxqg8plhjV7Qav63NvKLzULBgag1TMY4UXC63KusO5zGj rK6w==

Hi Christopher,

That shouldn't be too hard. Just define a custom scalar type and override all necessary operations, something along the line of:

template <typename T>

struct Printed

{

Printed(T x, const char* name) : x(x), name(name) {}

// ...

Printed operator+(Printed other)

{

std::cout << name << ": " << x << " + " << other.name << ": " << other.x << " = " << x+y << std::endl;

return x + y;

}

// ...

private:

T x;

std::string name;

};

Then, integrate it into Eigen: http://eigen.tuxfamily.org/dox/TopicCustomizingEigen.html#CustomScalarType

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 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,

-- Chris

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 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,

-- Chris

**References**:**[eigen] Extracting the executed computations***From:*Cowing-Zitron, Christopher

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Extracting the executed computations** - Next by Date:
**Re: [eigen] banded matrices in Eigen** - Previous by thread:
**Re: [eigen] Extracting the executed computations** - Next by thread:
**Re: [eigen] Extracting the executed computations**

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