Re: [eigen] Low performance in DEBUG mode |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Low performance in DEBUG mode
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Mon, 25 Oct 2010 07:22:59 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=abktjoqUjSobRVm0ELLwYuZXho8rfomQdr4NBUsO/8Y=; b=eZMHeBSWhhCaQNBCkZS+byMJKZcEPklZ/y5ULzDg3dhkW0ekmZOzlg82NV2q7t2sqW 5dbZ2v/79A1O+xfX3k5gF7rTIk6i2F5DSFsyL81GQCRXYn0sALf0Jkkwep9CVqvwqwnB oc0hWTLDU2Ixxy5k5Ch/eRO60b3sWBOzlvzS0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=fQFFp1Isd8aSsLSB4w8INNy8cNyOwWRCw6Vx5uovs1AmQ6gaVcqpd+gcbkb/N7ixUd P5aoMfX3/G/onl0F45ocT6SYsZVNHHY/GF+0yc7CnkFJDWQ8K9pOIISY/Zkbb8wOmAPb Q1Klpyc7B6YUsIoV1Ovepa0Ry8tdLegHaAEHU=
2010/10/25 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
> 2010/10/25 Mathias Goldau <math@xxxxxxxxxxxxxxxxxxxxxxxxx>:
>> 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?
>
> This is one third of the explanation. Expression templates mean that
> we have lots and lots of trivial functions and objects that must be
> simplified away by the compiler so they have zero cost; but in debug
> mode, all optimization is turned off so the whole thing gets compiled
> so the simplest operation results in dozens of function calls.
>
> A second third is that Eigen is a low-level library doing stuff from
> scratch. In a typical application, even if you compile it in debug
> mode, it still calls libraries that have been compiled with
> optimizations, so in effect it's still benefiting from optimizations
> in these libraries, and that's typically the most performance critical
> part. In Eigen, everything is home-made so when you compile without
> compiler optimizations, you really get no optimization at all.
>
> The last third is specific to Eigen's unit tests. They enable special
> Eigen debugging code that makes them slower than regular debug mode
> (EIGEN_INTERNAL_DEBUGGING). Basically, every coefficient access, even
> internal ones, is checked to be in range (default debug mode skips
> that on eigen-internal coefficient addressing and only checks user
> addressing).
>
>>, 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?
>
> No, -DDEBUG is just enabling regular assertions, that's not too slow.
>
> It's weird that RelWithDebInfo wasn't any faster for you. I checked
> the whole command line with VERBOSE=1 make, and it should really be
> optimized and fast:
>
> -g2 -O2 -g -O2 -g2
>
> (redundancy is no problem)
Please try today's hg development branch with RelWithDebInfo. a Cmake
issue was recently fixed.
Benoit
>
> Benoit
>
>>
>> best regards
>> Mathias
>>
>> --
>> Institut für Informatik
>> Universität Leipzig
>> Johannisgasse 26, 04103 Leipzig
>> Phone: +493419732283
>>
>>
>>
>