Re: [eigen] Low performance in DEBUG mode

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


2010/10/25 Benjamin Schindler <bschindler@xxxxxxxxxxx>:
> I too have the problem of slow debug code, but the reason there is that
> I have to use debug builds because stepping through code is hard on
> RelWithDebInfo code. With Debug code, obviously eigen is extremely slow.
>
> Is there any way to compile Eigen code with optimizations and the rest
> with debug?

No; but I think that GCC 4.4 introduced per-function optimization
flags, feel free to play with it; but obviously Eigen spends its time
in lots and lots of small functions so putting this flag on the right
functions will require a good amount of work. If it weren't too
intrusive I'd accept a patch, i think.

A much simpler approach is to compile those files in your project that
use Eigen with optimization. You could organize your project so that
Eigen-heavy code is isolated in separate files.

 This would be very helpful as I frequently have to wait 5-10
> minutes for calculations until a breakpoint is hit when it takes about
> 10 seconds in release code.
> I checked with gcc but didn't find a meaningful way (except by modifying
> Eigen code itself...), but may be somebody has more experience? With
> non-template libraries it's so easy to use release code, so why not
> doing the same for template libraries is beyond me...

because a template library gets compiled directly into your app, so
the equivalent in this case is to isolate the resulting code in
separate files.

Benoit

>
> Cheers
> Benjamin
>
> On 10/25/2010 12:50 PM, Mathias Goldau wrote:
>> Hi,
>>
>> today I encountered a really strange thing: I compiled my unittest which need
>> in Release mode just about 3 sec, in Debug mode. It uses just some matrix
>> vector multiplication and the inverse computation. However in Debug mode it
>> needs about 3:32 minutes!!
>> A colleague of mine told me this could have to do with expression templates,
>> and as I've seen in the "We need more Gaels"-thread that Eigen uses a lot of
>> expression templates, I want to ask: Is this assumption true?, is there a way
>> around to compile my unit tests also in debug mode, but with a bit more
>> performance in the end?
>> Even setting our cmake build type to: RelWithDebugInfo resulting effective in
>> those CXX flags: "-g -DDEBUG -O2" shows no improvement. I assume this depends
>> on the "-DDEBUG", am I right?
>>
>> best regards
>> Mathias
>>
>
>
>
>



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