Re: [eigen] calculating on ranges |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] calculating on ranges
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Tue, 27 Jan 2009 17:28:29 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=xkn5pXeQPJ/l13cFAO6qt9/Bco5Jc7Wt/qVIlHOunwM=; b=ruelN4moIVQWvg9UBlAdeUBasQe7N/2CEOmG3Hu/Sslj6Nr2sAthzfSe5XPDgVWVpp T48hx+Ft1RM5oaa7L66PA4xK0iF9TkTLdNUQsYtSa5zxfvUDx39V3pFMZZEQUz7kjMbb yavgcekuT6XHCdky/G67GBcr63PnrtI+cLDkc=
- 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=B7wbpcPu9QVg2MehzM6g70kRQkCNW4rqumJNTgceF8mDgOeoo01ANxW7rrtoLF9lFO YXHxB2mWbWf8y3bkuedyGqP8qsv0oNzK6aswBG/lZVG0QxXGUqgOndgkH7zwSyZ3KNDG WaZhJheyxSDVKkRwydZe4gKBd4l1/bivwf3I8=
2009/1/27 Jos van den Oever <jvdoever@xxxxxxxxx>:
> 2009/1/27 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
>> Google found code here:
>> http://gruntthepeon.free.fr/ssemath/
>> http://gruntthepeon.free.fr/ssemath/sse_mathfun.h
>>
>> We could strip a lot of stuff from this file and keep only the SSE2 path.
>>
>> That would be stuff for Eigen 2.1.
>
> I was just about to post that link. A 5-6 fold speedup is no joke!
>
> I meant to ask how to go about implementing the cwise().exp().
> Can I do this via inheritance? Are there any things to mind when
> implementing this function so that it will be vectorized properly?
Well cwise().exp() is implemented, the problem is that it's not
vectorized. This would be implemented by only modifying the
corresponding functor, ei_scalar_exp_op, defined in
eigen2/Eigen/src/Array/Functors.h.
For examples of already vectorized functors, look e.g. at
ei_scalar_sum_op defined in eigen2/Eigen/src/Core/Functors.h.
Basically it is just a matter of implementing the packetOp() method in
the functor. This method would call a portable wrapper (let's call it
ei_pexp) around the SIMD stuff. This wrapper would be declared (and
dummy-implemented for possible non-SIMD usage) in GenericPacketMath.h.
It would then get specialized for each SIMD platform, e.g. in
arch/SSE/PacketMath.h.
Just in case you want to play with that ;)
Cheers,
Benoit
PS. Need to check that the zlib license is OK to relicense to LGPL and
in any case it's good manners to get in touch with the author "Grunt
the peon" ;)