Re: [eigen] calculating on ranges

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


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" ;)



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