Re: [eigen] Extracting the executed computations |

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

*To*: eigen <eigen@xxxxxxxxxxxxxxxxxxx>*Subject*: Re: [eigen] Extracting the executed computations*From*: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>*Date*: Thu, 7 Feb 2013 09:34:25 +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=s+ZCuVK3bH87SZ9FbD/W8ElnLXfXTuqAOrBeiLpaIAI=; b=v0T3lJekcgFw5SxeB4G9tdoY8bEdt68RZBsNomEman5kP9h6TlUySzgsnLkbLW66SU 6ziumx+oObHEdP/FVUibSRe6yE6ySyDiLanHAZD9u+tVYeTs24YQSgh+6eNgXyuDJMjs g0Mg+Cz5fIhaFbEMMRM2HwoxV29pOyzzbbuF5Af4Oow46cgZ6Hg4hU7SXw5jl1cLLufL wnctrZOdN/+Af3NJdfYDDexP9wTzZtTkEFu2W+4SYkvb38qgrUWTpFWc35/Kwfii47Bs QnAVkl00XRVtTi1+vY1vWwDls904UaBros7+BslA1qyjVHaoq774rxhxSa5KhaxQD+yk skfg==

Hi, what I usually is to generate the assembly (g++ -S -DNDEBUG -O2 file.cpp -o file.s) and examine it. To help finding the starting point I add the following comment just before the expression I'm interested in: EIGEN_ASM_COMMENT("HERE_BEGINS_MY_EXPRESSION") A = 2*A+B; Then you can (quite) easily follow the generated SIMD code, the loops, the function calls.. A more meaningful output could be obtained by putting such EIGEN_ASM_COMMENT() in Eigen's code itself. For instance, we could put ASM comments like: EIGEN_ASM_COMMENT("EIGEN_BEGIN: vectorized inner unrolling") EIGEN_ASM_COMMENT("EIGEN_BEGIN: scalar linear evaluation") EIGEN_ASM_COMMENT("EIGEN: temporary creation") EIGEN_ASM_COMMENT("EIGEN: call GEMM") EIGEN_ASM_COMMENT("EIGEN_BEGIN: vectorized unrolled reduction") .... cheers, Gael On Wed, Feb 6, 2013 at 9:20 PM, Cowing-Zitron, Christopher <ccowingzitron@xxxxxxxx> 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 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

**Follow-Ups**:**Re: [eigen] Extracting the executed computations***From:*Christoph Hertzberg

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

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] banded matrices in Eigen** - Next by Date:
**Re: [eigen] Extracting the executed computations** - 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/ |